Commit 2039b519 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

main software menu rfc

parent a1213e8b
...@@ -36,8 +36,8 @@ function main(){ ...@@ -36,8 +36,8 @@ function main(){
KERNELID=$(uname -r) KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN="$DISTRO $DISTROID" [[ -z "${ARMBIAN// }" ]] && ARMBIAN="$DISTRO $DISTROID"
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)') DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
local ipadd=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
BACKTITLE="Configuration utility, $ARMBIAN, $ipadd" BACKTITLE="Configuration utility, $ARMBIAN, $LOCALIPADD"
TITLE="$BOARD_NAME " TITLE="$BOARD_NAME "
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo" [[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
OVERLAYDIR="/boot/dtb/overlay"; OVERLAYDIR="/boot/dtb/overlay";
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
# choose_webserver # choose_webserver
# server_conf # server_conf
# install_packet # install_packet
# check_port # alive_port
# alive_process
# install_basic # install_basic
# create_ispconfig_configuration # create_ispconfig_configuration
# install_cups # install_cups
...@@ -78,30 +79,39 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ...@@ -78,30 +79,39 @@ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
function check_status function check_status
{ {
# #
# Check if service is already installed # Check if service is already installed and show it's status
# #
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading install info ... " 5 28 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading install info ... " 5 28
LIST=() LIST=()
LIST_CONST=3 LIST_CONST=3
# Samba # Samba
SAMBA_STATUS="$(check_if_installed samba && echo "on" || echo "off" )" SAMBA_STATUS="$(check_if_installed samba && echo "on" || echo "off" )"
LIST+=( "Samba" "Windows compatible file sharing" "$SAMBA_STATUS" ) alive_port "Windows compatible file sharing" "445" "boolean"
# cups LIST+=( "Samba" "$DESCRIPTION" "$SAMBA_STATUS" )
# CUPS
CUPS_STATUS="$(check_if_installed cups && echo "on" || echo "off" )" CUPS_STATUS="$(check_if_installed cups && echo "on" || echo "off" )"
LIST+=( "CUPS" "Common UNIX Printing System (CUPS)" "$CUPS_STATUS" ) alive_port "Common UNIX Printing System (CUPS)" "631" "boolean"
# tvheadend LIST+=( "CUPS" "$DESCRIPTION" "$CUPS_STATUS" )
if [[ "$family" == "Ubuntu" ]]; then
TVHEADEND_STATUS="$(check_if_installed tvheadend && echo "on" || echo "off" )" # TV headend
LIST+=( "TV headend" "TV streaming / proxy" "$TVHEADEND_STATUS" ) TVHEADEND_STATUS="$(check_if_installed tvheadend && echo "on" || echo "off" )"
fi alive_port "TV streaming server" "9981"
# synthing LIST+=( "TV headend" "$DESCRIPTION" "$TVHEADEND_STATUS" )
# Synthing
SYNCTHING_STATUS="$([[ -d /usr/bin/syncthing ]] && echo "on" || echo "off" )" SYNCTHING_STATUS="$([[ -d /usr/bin/syncthing ]] && echo "on" || echo "off" )"
LIST+=( "Syncthing" "Personal cloud @syncthing.net" "$SYNCTHING_STATUS" ) alive_port "Personal cloud @syncthing.net" "8384" "boolean"
LIST+=( "Syncthing" "$DESCRIPTION" "$SYNCTHING_STATUS" )
# Exagear # Exagear
if [[ "$(check_if_installed xserver-xorg && echo "on")" == "on" && "$family" == "Ubuntu" ]]; then if [[ "$(check_if_installed xserver-xorg && echo "on")" == "on" && "$family" == "Ubuntu" ]]; then
EXAGEAR_STATUS="$(check_if_installed exagear-armbian && echo "on" || echo "off" )" EXAGEAR_STATUS="$(check_if_installed exagear-armbian && echo "on" || echo "off" )"
LIST+=( "ExaGear" "32bit x86 Linux/Windows emulator trial" "$EXAGEAR_STATUS" ) LIST+=( "ExaGear" "32bit x86 Linux/Windows emulator trial" "$EXAGEAR_STATUS" )
fi fi
if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture)" == "amd64" ]]; then if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture)" == "amd64" ]]; then
LIST_CONST=2 LIST_CONST=2
# vpn server # vpn server
...@@ -111,30 +121,48 @@ if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture) ...@@ -111,30 +121,48 @@ if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture)
VPN_CLIENT_STATUS="$([[ -d /usr/local/vpnclient ]] && echo "on" || echo "off" )" VPN_CLIENT_STATUS="$([[ -d /usr/local/vpnclient ]] && echo "on" || echo "off" )"
LIST+=( "VPN client" "Softether VPN client" "$VPN_CLIENT_STATUS" ) LIST+=( "VPN client" "Softether VPN client" "$VPN_CLIENT_STATUS" )
fi fi
# OMV # OMV
OMV_STATUS="$(check_if_installed openmediavault && echo "on" || echo "off" )" OMV_STATUS="$(check_if_installed openmediavault && echo "on" || echo "off" )"
[[ "$family" != "Ubuntu" ]] && LIST+=( "OMV" "OpenMediaVault NAS solution" "$OMV_STATUS" ) && LIST_CONST=3 [[ "$family" != "Ubuntu" ]] && LIST+=( "OMV" "OpenMediaVault NAS solution" "$OMV_STATUS" ) && LIST_CONST=3
# Plex
# Plex media server
PLEX_STATUS="$((check_if_installed plexmediaserver || check_if_installed plexmediaserver-installer) && echo "on" || echo "off" )" PLEX_STATUS="$((check_if_installed plexmediaserver || check_if_installed plexmediaserver-installer) && echo "on" || echo "off" )"
LIST+=( "Plex" "Plex media server" "$PLEX_STATUS" ) alive_port "Plex media server" "32400"
LIST+=( "Plex" "$DESCRIPTION" "$PLEX_STATUS" )
# Radarr # Radarr
RADARR_STATUS="$([[ -d /opt/Radarr ]] && echo "on" || echo "off" )" RADARR_STATUS="$([[ -d /opt/Radarr ]] && echo "on" || echo "off" )"
LIST+=( "Radarr" "Automatically downloading movies" "$RADARR_STATUS" ) alive_port "Movies downloading server" "7878"
LIST+=( "Radarr" "$DESCRIPTION" "$RADARR_STATUS" )
# Sonarr # Sonarr
SONARR_STATUS="$([[ -d /opt/NzbDrone ]] && echo "on" || echo "off" )" SONARR_STATUS="$([[ -d /opt/NzbDrone ]] && echo "on" || echo "off" )"
LIST+=( "Sonarr" "Automatically downloading TV shows" "$SONARR_STATUS" ) alive_port "TV shows downloading server" "8989"
LIST+=( "Sonarr" "$DESCRIPTION" "$SONARR_STATUS" )
# MINIdlna # MINIdlna
MINIDLNA_STATUS="$(check_if_installed minidlna && echo "on" || echo "off" )" MINIDLNA_STATUS="$(check_if_installed minidlna && echo "on" || echo "off" )"
LIST+=( "Minidlna" "Lightweight DLNA/UPnP-AV server" "$MINIDLNA_STATUS" ) alive_port "Lightweight DLNA/UPnP-AV server" "8200" "boolean"
LIST+=( "Minidlna" "$DESCRIPTION" "$MINIDLNA_STATUS" )
# Pi hole # Pi hole
PI_HOLE_STATUS="$([[ -d /etc/pihole ]] && echo "on" || echo "off" )" PI_HOLE_STATUS="$([[ -d /etc/pihole ]] && echo "on" || echo "off" )"
LIST+=( "Pi hole" "Ad blocker" "$PI_HOLE_STATUS" ) alive_process "Ad blocker" "pihole-FTL"
LIST+=( "Pi hole" "$DESCRIPTION" "$PI_HOLE_STATUS" )
# Transmission # Transmission
TRANSMISSION_STATUS="$(check_if_installed transmission-daemon && echo "on" || echo "off" )" TRANSMISSION_STATUS="$(check_if_installed transmission-daemon && echo "on" || echo "off" )"
LIST+=( "Transmission" "Torrent downloading" "$TRANSMISSION_STATUS" ) alive_port "Torrent download server" "9091" "boolean"
LIST+=( "Transmission" "$DESCRIPTION" "$TRANSMISSION_STATUS" )
# UrBackup # UrBackup
URBACKUP_STATUS="$((check_if_installed urbackup-server || check_if_installed urbackup-server-dbg) && echo "on" || echo "off" )" URBACKUP_STATUS="$((check_if_installed urbackup-server || check_if_installed urbackup-server-dbg) && echo "on" || echo "off" )"
LIST+=( "UrBackup" "Open Source client/server backup system" "$URBACKUP_STATUS" ) alive_port "Client/server backup system" "51413" "boolean"
LIST+=( "UrBackup" "$DESCRIPTION" "$URBACKUP_STATUS" )
# ISPconfig # ISPconfig
ISPCONFIG_STATUS="$([[ -d /usr/local/ispconfig ]] && echo "on" || echo "off" )" ISPCONFIG_STATUS="$([[ -d /usr/local/ispconfig ]] && echo "on" || echo "off" )"
LIST+=( "ISPConfig" "SMTP mail, IMAP, POP3 & LAMP/LEMP web server" "$ISPCONFIG_STATUS" ) LIST+=( "ISPConfig" "SMTP mail, IMAP, POP3 & LAMP/LEMP web server" "$ISPCONFIG_STATUS" )
...@@ -231,24 +259,40 @@ echo "" ...@@ -231,24 +259,40 @@ echo ""
} }
alive_port ()
{
#
# Displays URL to the service $1 on port $2 or just that is active if $3 = boolean
#
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
if [[ -n $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'$2'"') ]]; then
if [[ $3 == boolean ]]; then
DESCRIPTION="$1 is \Z1active\Z0";
else
DESCRIPTION="Active on http://${LOCALIPADD}:\Z1$2\Z0";
fi
else
DESCRIPTION="$1";
fi
}
check_port () alive_process ()
{ {
# #
# Display warning with black background if service $2 is not running on a port $1 # check if process name $2 is running. Display it's name $1 or $1 is active if active
# #
temp_rc=$(mktemp) if pgrep -x "$2" > /dev/null 2>&1; then DESCRIPTION="$1 is \Z1active\Z0"; else DESCRIPTION="$1"; fi
cat <<-'EOF' > $temp_rc
screen_color = (BLACK,BLACK,ON)
EOF
[[ -z $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'$1'"') ]] && DIALOGRC=$temp_rc dialog --colors --no-shadow --backtitle \
"$BACKTITLE" --title " \Z1Warning\Z0 " --msgbox "\nThere is no sign of service $2 on port $1" 7 $((41+${#2}+${#1}))
} }
install_basic (){ install_basic (){
# #
# Set hostname, FQDN, add to sources list # Set hostname, FQDN, add to sources list
...@@ -555,7 +599,6 @@ echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ioni ...@@ -555,7 +599,6 @@ echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ioni
chmod 600 /etc/cron.d/make_nas_processes_faster chmod 600 /etc/cron.d/make_nas_processes_faster
/usr/sbin/omv-initsystem /usr/sbin/omv-initsystem
check_port 80 "OMV web"
} }
...@@ -1361,7 +1404,7 @@ while true; do ...@@ -1361,7 +1404,7 @@ while true; do
check_status check_status
LISTLENGHT="$((${#LIST[@]}/2))" LISTLENGHT="$((${#LIST[@]}/2))"
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "Installing to $family $distribution" --clear --cancel-label \ selection=$(dialog --backtitle "$BACKTITLE" --title "Installing to $family $distribution" --colors --clear --cancel-label \
"Exit" --checklist "\nChoose what you want to install:\n " $(($LISTLENGHT+$LIST_CONST)) 70 15 "${LIST[@]}" 2>&1 1>&3) "Exit" --checklist "\nChoose what you want to install:\n " $(($LISTLENGHT+$LIST_CONST)) 70 15 "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -1374,25 +1417,27 @@ while true; do ...@@ -1374,25 +1417,27 @@ while true; do
# cycle trought all install options # cycle trought all install options
i=0 i=0
while [ "$i" -lt "$LISTLENGHT" ]; do while [ "$i" -lt "$LISTLENGHT" ]; do
if [[ "$selection" == *Samba* && "$SAMBA_STATUS" != "on" ]]; then if [[ "$selection" == *Samba* && "$SAMBA_STATUS" != "on" ]]; then
install_samba install_samba
check_port 445 "Samba" selection=${selection//Samba/}
fi fi
if [[ "$selection" == *CUPS* && "$CUPS_STATUS" != "on" ]]; then if [[ "$selection" == *CUPS* && "$CUPS_STATUS" != "on" ]]; then
install_cups install_cups
check_port 631 "CUPS" selection=${selection//CUPS/}
fi fi
if [[ "$selection" == *headend* && "$TVHEADEND_STATUS" != "on" ]]; then if [[ "$selection" == *headend* && "$TVHEADEND_STATUS" != "on" ]]; then
install_tvheadend install_tvheadend
selection=${selection//\"TV headend\"/}
fi fi
if [[ "$selection" == *Minidlna* && "$MINIDLNA_STATUS" != "on" ]]; then if [[ "$selection" == *Minidlna* && "$MINIDLNA_STATUS" != "on" ]]; then
install_packet "minidlna" "Install lightweight DLNA/UPnP-AV server" install_packet "minidlna" "Install lightweight DLNA/UPnP-AV server"
check_port 8200 "minidlna" selection=${selection//Minidlna/}
fi fi
if [[ "$selection" == *ISPConfig* && "$ISPCONFIG_STATUS" != "on" ]]; then if [[ "$selection" == *ISPConfig* && "$ISPCONFIG_STATUS" != "on" ]]; then
...@@ -1412,76 +1457,75 @@ while true; do ...@@ -1412,76 +1457,75 @@ while true; do
install_Jailkit; install_Fail2BanDovecot; install_Fail2BanRulesDovecot; install_Jailkit; install_Fail2BanDovecot; install_Fail2BanRulesDovecot;
install_ISPConfig install_ISPConfig
read -n 1 -s -p "Press any key to continue" read -n 1 -s -p "Press any key to continue"
selection=${selection//ISPConfig/}
fi fi
if [[ "$selection" == *Syncthing* && "$SYNCTHING_STATUS" != "on" ]]; then if [[ "$selection" == *Syncthing* && "$SYNCTHING_STATUS" != "on" ]]; then
install_syncthing install_syncthing
check_port 8384 "Syncthing" selection=${selection//Syncthing/}
read -n 1 -s -p "Press any key to continue"
fi fi
if [[ "$selection" == *ExaGear* && "$EXAGEAR_STATUS" != "on" ]]; then if [[ "$selection" == *ExaGear* && "$EXAGEAR_STATUS" != "on" ]]; then
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y install exagear-armbian exagear-desktop exagear-dsound-server exagear-guest-ubuntu-1604 debconf-apt-progress -- apt-get -y install exagear-armbian exagear-desktop exagear-dsound-server exagear-guest-ubuntu-1604
selection=${selection//ExaGear/}
fi fi
if [[ "$selection" == *server* && "$VPN_SERVER_STATUS" != "on" ]]; then if [[ "$selection" == *server* && "$VPN_SERVER_STATUS" != "on" ]]; then
install_vpn_server install_vpn_server
read -n 1 -s -p "Press any key to continue" selection=${selection//\"VPN server\"/}
fi fi
if [[ "$selection" == *client* && "$VPN_CLIENT_STATUS" != "on" ]]; then if [[ "$selection" == *client* && "$VPN_CLIENT_STATUS" != "on" ]]; then
install_vpn_client install_vpn_client
read -n 1 -s -p "Press any key to continue" selection=${selection//\"VPN client\"/}
fi fi
if [[ "$selection" == *OMV* && "$OMV_STATUS" != "on" ]]; then if [[ "$selection" == *OMV* && "$OMV_STATUS" != "on" ]]; then
install_omv install_omv
read -n 1 -s -p "Press any key to continue" selection=${selection//OMV/}
fi fi
if [[ "$selection" == *Plex* && "$PLEX_STATUS" != "on" ]]; then if [[ "$selection" == *Plex* && "$PLEX_STATUS" != "on" ]]; then
install_plex_media_server install_plex_media_server
sleep 2 selection=${selection//Plex/}
check_port 32400 "Plex Media server"
fi fi
if [[ "$selection" == *Radarr* && "$RADARR_STATUS" != "on" ]]; then if [[ "$selection" == *Radarr* && "$RADARR_STATUS" != "on" ]]; then
install_radarr install_radarr
sleep 2 selection=${selection//Radarr/}
check_port 7878 "Radarr movie downloader"
fi fi
if [[ "$selection" == *Sonarr* && "$SONARR_STATUS" != "on" ]]; then if [[ "$selection" == *Sonarr* && "$SONARR_STATUS" != "on" ]]; then
install_sonarr install_sonarr
sleep 2 selection=${selection//Sonarr/}
check_port 8989 "Sonarr movie downloader"
fi fi
if [[ "$selection" == *hole* && "$PI_HOLE_STATUS" != "on" ]]; then if [[ "$selection" == *hole* && "$PI_HOLE_STATUS" != "on" ]]; then
curl -L "https://install.pi-hole.net" | bash curl -L "https://install.pi-hole.net" | bash
read -n 1 -s -p "Press any key to continue" selection=${selection//\"Pi hole\"/}
fi fi
if [[ "$selection" == *Transmission* && "$TRANSMISSION_STATUS" != "on" ]]; then if [[ "$selection" == *Transmission* && "$TRANSMISSION_STATUS" != "on" ]]; then
install_transmission install_transmission
check_port 9091 transmission selection=${selection//Transmission/}
dialog --title "Seed Armbian torrents" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" --yesno "\n\ dialog --title "Seed Armbian torrents" --backtitle "$BACKTITLE" --yes-label "Yes" --no-label "Cancel" --yesno "\
Do you want to help community and seed armbian torrent files? It will ensure faster download for everyone. We need around 50Gb of your space." 10 44 \nDo you want to help community and seed armbian torrent files? It will ensure faster download for everyone.\
if [[ $? = 0 ]]; then \n\nWe need around 80Gb of your space." 11 44
install_transmission_seed_armbian_torrents if [[ $? = 0 ]]; then
fi install_transmission_seed_armbian_torrents
fi
fi fi
if [[ "$selection" == *UrBackup* && "$URBACKUP_STATUS" != "on" ]]; then if [[ "$selection" == *UrBackup* && "$URBACKUP_STATUS" != "on" ]]; then
install_urbackup install_urbackup
check_port 51413 "UrBackup" selection=${selection//UrBackup/}
fi fi
# reread statuses
check_status
i=$[$i+1] i=$[$i+1]
done done
# reread statuses
check_status
done done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment