From 7cb41f3a72cdaa370b12c65f0d3e916ddacc91de Mon Sep 17 00:00:00 2001 From: "Daniel (Fourdee)" Date: Tue, 2 Aug 2016 18:11:19 +0100 Subject: [PATCH] v127 + DietPi-Software re-code to array: https://github.com/Fourdee/DietPi/issues/453 --- CHANGELOG.txt | 5 +- dietpi.txt | 116 +- dietpi/conf/apache2_wheezy.conf | 77 - dietpi/dietpi-config | 23 +- dietpi/dietpi-launcher | 1 - dietpi/dietpi-obtain_hw_model | 2 +- dietpi/dietpi-services | 3 + dietpi/dietpi-software | 13576 ++++++++++++++++-------------- dietpi/dietpi-uninstall | 756 -- dietpi/func/dietpi-set_hardware | 4 +- dietpi/patch_file | 13 +- 11 files changed, 7141 insertions(+), 7435 deletions(-) delete mode 100644 dietpi/conf/apache2_wheezy.conf delete mode 100644 dietpi/dietpi-uninstall diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cdece6d4f7..f9f22d19bc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,7 +1,10 @@ v127 -(xx/07/16) +(xx/08/16) Changes / Improvements / Optimizations: +Wheezy code has been removed +DietPi-Software | Major (if somewhat long overdue) coding overhaul: https://github.com/Fourdee/DietPi/issues/453 +DietPi-Uninstall | Removed. Software can now be uninstalled from DietPi-Software Bug fixes: diff --git a/dietpi.txt b/dietpi.txt index f62d6a0d80..e474aef034 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -35,110 +35,14 @@ Swapfile_Size=100 # 1=Automated installation with no user inputs. AUTO_Install_Index=0 -#DietPi-Optimized Software to automatically install. | requires AUTO_Install_Index=1 -# 1=install -AUTO_DietpiSoftware_Install_DESKTOP_LXDE=0 -AUTO_DietpiSoftware_Install_DESKTOP_MATE=0 -AUTO_DietpiSoftware_Install_DESKTOP_GNUSTEP=0 -AUTO_DietpiSoftware_Install_DESKTOP_XFCE=0 -AUTO_DietpiSoftware_Install_TIGHTVNCSERVER=0 -AUTO_DietpiSoftware_Install_VNC4SERVER=0 -AUTO_DietpiSoftware_Install_OWNCLOUD=0 -AUTO_DietpiSoftware_Install_TRANSMISSION=0 -AUTO_DietpiSoftware_Install_PHPBB=0 -AUTO_DietpiSoftware_Install_HIFI=0 -AUTO_DietpiSoftware_Install_KODI=0 -AUTO_DietpiSoftware_Install_MINIDLNA=0 -AUTO_DietpiSoftware_Install_OPENTYRIAN=0 -AUTO_DietpiSoftware_Install_DIETPICAM=0 -AUTO_DietpiSoftware_Install_DELUGE=0 -AUTO_DietpiSoftware_Install_RASPCONTROL=0 -AUTO_DietpiSoftware_Install_LINUXDASH=0 -AUTO_DietpiSoftware_Install_NETDATA=0 -AUTO_DietpiSoftware_Install_PIHOLE=0 -AUTO_DietpiSoftware_Install_SUBSONIC5=0 -AUTO_DietpiSoftware_Install_SUBSONIC6=0 -AUTO_DietpiSoftware_Install_WEAVED=0 -AUTO_DietpiSoftware_Install_WEBIOPI=0 -AUTO_DietpiSoftware_Install_DIETPICLOUDSHELL=0 -AUTO_DietpiSoftware_Install_HAPROXY=0 -AUTO_DietpiSoftware_Install_SQUEEZEBOXSERVER=0 -AUTO_DietpiSoftware_Install_WORDPRESS=0 -AUTO_DietpiSoftware_Install_FAIL2BAN=0 -AUTO_DietpiSoftware_Install_PHPSYSINFO=0 -AUTO_DietpiSoftware_Install_PHPIMAGEGALLERY=0 -AUTO_DietpiSoftware_Install_AMPACHE=0 -AUTO_DietpiSoftware_Install_OPENVPNSERVER=0 -AUTO_DietpiSoftware_Install_LETSENCRYPT=0 -AUTO_DietpiSoftware_Install_WIRINGPI=0 -AUTO_DietpiSoftware_Install_RPIGPIO=0 -AUTO_DietpiSoftware_Install_RPII2C=0 - -# - Webserver stacks. -AUTO_DietpiSoftware_Install_WEBSERVER_LAMP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LASP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LAAP=0 - -AUTO_DietpiSoftware_Install_WEBSERVER_LEMP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LESP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LEAP=0 - -AUTO_DietpiSoftware_Install_WEBSERVER_LLMP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LLSP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_LLAP=0 - -AUTO_DietpiSoftware_Install_WEBSERVER_MYADMINPHP=0 -AUTO_DietpiSoftware_Install_WEBSERVER_REDIS=0 - -AUTO_DietpiSoftware_Install_WIFIHOTSPOT=0 -AUTO_DietpiSoftware_Install_TORHOTSPOT=0 -AUTO_DietpiSoftware_Install_SHAIRPORTSYNC=0 -AUTO_DietpiSoftware_Install_BRUTEFIR=0 -AUTO_DietpiSoftware_Install_PYDIO=0 -AUTO_DietpiSoftware_Install_SQUEEZELITE=0 -AUTO_DietpiSoftware_Install_RPIMONITOR=0 -AUTO_DietpiSoftware_Install_EMONHUB=0 -AUTO_DietpiSoftware_Install_MUMBLESERVER=0 -AUTO_DietpiSoftware_Install_EMBYSERVER=0 -AUTO_DietpiSoftware_Install_OPENBAZAAR=0 -AUTO_DietpiSoftware_Install_PLEXMEDIASERVER=0 -AUTO_DietpiSoftware_Install_XRDP=0 -AUTO_DietpiSoftware_Install_NOMACHINE=0 -AUTO_DietpiSoftware_Install_CUBERITE=0 -AUTO_DietpiSoftware_Install_MINEOS=0 -AUTO_DietpiSoftware_Install_GOGS=0 -AUTO_DietpiSoftware_Install_QBITTORRENT=0 -AUTO_DietpiSoftware_Install_SYNCTHING=0 - - -#Linux Additional Software to automatically install | requires AUTO_Install_Index=1 -# 1=install -AUTO_DietpiSoftware_Install_VIMFULL=0 -AUTO_DietpiSoftware_Install_SSHCLIENT=0 -# - This will be automatically mounted to /mnt/samba. Use DietPi-Config settings section in this file to enter your details (SambaClient_*) -AUTO_DietpiSoftware_Install_SMBCLIENT=0 -# - This will be automatically mounted to /mnt/ftp_client. Use DietPi-Config settings section in this file to enter your details (curlftpfs_*) -AUTO_DietpiSoftware_Install_CURLFTPFS=0 -AUTO_DietpiSoftware_Install_GITCLIENT=0 -AUTO_DietpiSoftware_Install_BUILDESSENTIAL=0 -AUTO_DietpiSoftware_Install_ALSABASE=0 -AUTO_DietpiSoftware_Install_XSERVERXORG=0 -AUTO_DietpiSoftware_Install_FFMPEG=0 -AUTO_DietpiSoftware_Install_ORACLEJAVA=0 -AUTO_DietpiSoftware_Install_NODEJS=0 -AUTO_DietpiSoftware_Install_VIFM=0 -AUTO_DietpiSoftware_Install_QUITERSS=0 -AUTO_DietpiSoftware_Install_GNUEMACS=0 -AUTO_DietpiSoftware_Install_JED=0 -AUTO_DietpiSoftware_Install_VIMTINY=0 -AUTO_DietpiSoftware_Install_MIDNIGHTCOMMANDER=0 -AUTO_DietpiSoftware_Install_IFTOP=0 -AUTO_DietpiSoftware_Install_IPTRAF=0 -AUTO_DietpiSoftware_Install_IPERF=0 -AUTO_DietpiSoftware_Install_MTRTINY=0 -AUTO_DietpiSoftware_Install_NLOAD=0 -AUTO_DietpiSoftware_Install_TCPDUMP=0 -AUTO_DietpiSoftware_Install_LOGGING_RSYSLOG=0 +#DietPi-Software to automatically install. | requires AUTO_Install_Index=1 +#For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list' +#No limit on number entires, add as many as you need and uncomment the line. +#DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc) +# Examples: +#AUTO_DietpiSoftware_Install_ID=23 #will install Desktop LXDE +#AUTO_DietpiSoftware_Install_ID=74 #will install LAMP webserver stack +#AUTO_DietpiSoftware_Install_ID=44 #will install Bittorrent transmission #DietPi-Software Choice System #SSH Server Selection: @@ -152,10 +56,6 @@ AUTO_DietpiSoftware_SSHServerIndex=-1 # -1=proftp # -2=samba AUTO_DietpiSoftware_FileServerIndex=0 -# NB: If using any FILESERVER_* below, set AUTO_DietpiSoftware_FileServerIndex=0 -AUTO_DietpiSoftware_Install_FILESERVER_PROFTP=0 -AUTO_DietpiSoftware_Install_FILESERVER_SAMBA=0 -AUTO_DietpiSoftware_Install_FILESERVER_VSFTPD=0 #Logging Mode Selection: # 0=none/manual diff --git a/dietpi/conf/apache2_wheezy.conf b/dietpi/conf/apache2_wheezy.conf deleted file mode 100644 index d2dfdae676..0000000000 --- a/dietpi/conf/apache2_wheezy.conf +++ /dev/null @@ -1,77 +0,0 @@ - - DirectoryIndex index.php index.html - - -ServerName localhost -LockFile ${APACHE_LOCK_DIR}/accept.lock -PidFile ${APACHE_PID_FILE} - -Timeout 30 -KeepAlive On -MaxKeepAliveRequests 10 -KeepAliveTimeout 20 - -# prefork MPM - - StartServers 1 - MinSpareServers 1 - MaxSpareServers 1 - MaxClients 50 - MaxRequestsPerChild 0 - - -# worker MPM - - StartServers 1 - MinSpareThreads 1 - MaxSpareThreads 1 - ThreadLimit 4 - ThreadsPerChild 1 - MaxClients 50 - MaxRequestsPerChild 0 - - -# event MPM - - StartServers 1 - MinSpareThreads 1 - MaxSpareThreads 1 - ThreadLimit 4 - ThreadsPerChild 1 - MaxClients 50 - MaxRequestsPerChild 0 - - -User ${APACHE_RUN_USER} -Group ${APACHE_RUN_GROUP} -AccessFileName .htaccess - - Order allow,deny - Deny from all - Satisfy all - - -DefaultType None -HostnameLookups Off - -ErrorLog ${APACHE_LOG_DIR}/error.log -LogLevel error - -# Include module configuration: -Include mods-enabled/*.load -Include mods-enabled/*.conf - -# Include list of ports to listen on and which to use for name based vhosts -Include ports.conf - -LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined -LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined -LogFormat "%h %l %u %t \"%r\" %>s %O" common -LogFormat "%{Referer}i -> %U" referer -LogFormat "%{User-agent}i" agent - -# Include generic snippets of statements -Include conf.d/ - -# Include the virtual host configurations: -Include sites-enabled/ \ No newline at end of file diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 1b0a343aa6..8a8e1feb1c 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -1646,7 +1646,7 @@ #dhclient -r #Drop Connections - echo -e "\n - Dropping connections.." + /DietPi/dietpi/func/dietpi-notify 2 "Dropping connections, please wait..." ifdown eth$ETH_INDEX &> /dev/null ifdown wlan$WIFI_INDEX &> /dev/null @@ -3226,7 +3226,7 @@ _EOF_ local sambaclient_mounted_size="unknown" local sambaclient_mounted_used="unknown" local sambaclient_mounted_free="unknown" - if (( ${SMBCLIENT:=0} == 2 )); then + if (( ${aSOFTWARE_INSTALL_STATE[1]:=0} == 2 )); then sambaclient_installed=1 sambaclient_status="Unable to connect and/or incorrect details" @@ -3234,19 +3234,22 @@ _EOF_ #Check if mount exists and is valid if (( $(df -h | grep -ci -m1 '/mnt/samba') == 1 )); then + #Get stats sambaclient_mounted_size=$(df -h | grep -m1 '/mnt/samba' | awk '{ print $2 }') sambaclient_mounted_used=$(df -h | grep -m1 '/mnt/samba' | awk '{ print $3 }') sambaclient_mounted_free=$(df -h | grep -m1 '/mnt/samba' | awk '{ print $4 }') sambaclient_status="/mnt/samba | Size $sambaclient_mounted_size | Used $sambaclient_mounted_used | Free $sambaclient_mounted_free" + fi + fi #ftp Client mount, curlftpfs local curlftpfs_installed=0 local curlftpfs_status="Not Installed" local curlftpfs_menutext="Install now to access FTP as filesystem mount" - if (( ${CURLFTPFS:=0} == 2 )); then + if (( ${aSOFTWARE_INSTALL_STATE[2]:=0} == 2 )); then curlftpfs_installed=1 curlftpfs_status="Unable to connect and/or incorrect details" @@ -3254,16 +3257,19 @@ _EOF_ #Check if mount exists and is valid if (( $(df -h | grep -ci -m1 '/mnt/ftp_client') == 1 )); then + #Get stats curlftpfs_status="/mnt/ftp_client | Connected" + fi + fi #NoIp Client local noip_installed=0 local noip_status="Not Installed" local noip_menutext="Install No-Ip now" - if (( ${NOIPDYNDNS:=0} == 2 )); then + if (( ${aSOFTWARE_INSTALL_STATE[67]:=0} == 2 )); then noip_installed=1 noip_status="Offline - Please Enter No-Ip Details" @@ -3271,9 +3277,12 @@ _EOF_ #Check if noip is running (indicates login details are valid) if (( $(ps aux | grep -ci -m1 '/usr/local/bin/[n]oip2') == 1 )); then + noip_status="Online / Active" noip_menutext="Change NoIp Details" + fi + fi WHIP_TITLE='DietPi - Network Options: NAS/Misc' @@ -3295,7 +3304,7 @@ _EOF_ if (( $CHOICE == 0 )); then #install smbclient - /DietPi/dietpi/dietpi-software install SMBCLIENT + /DietPi/dietpi/dietpi-software install 1 fi @@ -3317,7 +3326,7 @@ _EOF_ if (( $CHOICE == 0 )); then #install curlftpfs - /DietPi/dietpi/dietpi-software install CURLFTPFS + /DietPi/dietpi/dietpi-software install 2 fi @@ -3340,7 +3349,7 @@ _EOF_ if (( $CHOICE == 0 )); then #Install - /DietPi/dietpi/dietpi-software install NOIPDYNDNS + /DietPi/dietpi/dietpi-software install 67 fi diff --git a/dietpi/dietpi-launcher b/dietpi/dietpi-launcher index f68d34da4a..bdff6ab8f6 100644 --- a/dietpi/dietpi-launcher +++ b/dietpi/dietpi-launcher @@ -38,7 +38,6 @@ option_name+=("" "────Install Optimized Software───────────────────");((index++)) option_name+=("DietPi-Software" "Install optimized software thats ready to run.");((index++)) - option_name+=("DietPi-Uninstall" "Remove installed software from your system.");((index++)) option_name+=("" "────Configuration────────────────────────────────");((index++)) option_name+=("DietPi-Config" "Feature rich config tool for your device.");((index++)) option_name+=("DietPi-AutoStart" "Choose what software runs after boot.");((index++)) diff --git a/dietpi/dietpi-obtain_hw_model b/dietpi/dietpi-obtain_hw_model index 448124df9f..71cf4e8e14 100644 --- a/dietpi/dietpi-obtain_hw_model +++ b/dietpi/dietpi-obtain_hw_model @@ -30,7 +30,7 @@ # HW_MODEL_DESCRIPTION # - Line3 - # DISTRO 0 unknown - # DISTRO 1 Debian Wheezy + # DISTRO 1 Debian Wheezy (No longer supported, http://dietpi.com/phpbb/viewtopic.php?f=9&t=432#p1898) # DISTRO 2 Ubuntu 14.04 (No longer supported, left in for user message during update) # DISTRO 3 Jessie # - Line4 - diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 403b0dc492..f3c47fdce2 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -82,13 +82,16 @@ do if [ -f /etc/systemd/system/"${aSERVICE_NAME[$i]}".service ]; then + aSERVICE_AVAILABLE[$i]=1 elif [ -f /etc/init.d/"${aSERVICE_NAME[$i]}" ]; then + aSERVICE_AVAILABLE[$i]=1 # - Check dpkg for matching packages. elif (( $(grep -ci -m1 "${aSERVICE_NAME[$i]}$" "$FP_TEMP") == 1 )); then + aSERVICE_AVAILABLE[$i]=1 fi diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index c3dffa7a0d..ec8242284f 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -16,7 +16,9 @@ # # Usage: # - dietpi-software - # - /DietPi/dietpi/dietpi-software install sPROGRAMTOINSTALL=1 (OR) sINDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int + # - /DietPi/dietpi/dietpi-software install iUNIQUEID (OR) sINDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int + # - /DietPi/dietpi/dietpi-software uninstall iUNIQUEID + # - /DietPi/dietpi/dietpi-software list #Lists UNIQUEIDs for software #//////////////////////////////////// #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. @@ -27,7 +29,7 @@ clear echo -e "\n ERROR: You do not have root privileges.\n Please login as root, or, use:\n sudo dietpi-software\n" - exit + Exit_Destroy fi #///////////////////////////////////////////////////////////////////////////////////// @@ -49,13 +51,17 @@ #Overide XU3/4 to 4 cores if (( $HW_MODEL == 11 )); then + CPU_CORES_TOTAL=4 + fi #///////////////////////////////////////////////////////////////////////////////////// #Filepath #///////////////////////////////////////////////////////////////////////////////////// FP_INSTALLED_FILE="/DietPi/dietpi/.installed" + FP_INSTALLED_FILE_TEMP='/tmp/dietpi-software.installed' + FP_DIETPIAUTOMATION_LOG="/root/DietPi-Automation.log" #Used to set user/personal data directories (eg: usbdrive /mnt/usb_1) @@ -71,15 +77,92 @@ FOLDER_VIDEO='Video' FOLDER_DOWNLOADS='downloads' + Write_InstallFileList(){ + + local write_software_in_pending_state=0 + + local fp_target="$FP_INSTALLED_FILE" + + if [ "$1" = "temp" ]; then + + fp_target="$FP_INSTALLED_FILE_TEMP" + write_software_in_pending_state=1 + + fi + + rm "$fp_target" &> /dev/null + + #Save installed states + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + + # - Never save pending state for software (=1). Excluding temp saves. + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 && ! $write_software_in_pending_state )); then + + echo -e "aSOFTWARE_INSTALL_STATE[$i]=0" >> "$fp_target" + + else + + echo -e "aSOFTWARE_INSTALL_STATE[$i]=${aSOFTWARE_INSTALL_STATE[$i]}" >> "$fp_target" + + fi + + done + + #Misc + cat << _EOF_ >> "$fp_target" + +#DietPi External Drive +USBDRIVE=$USBDRIVE + +#DietPi Choice System: SSH Server +INDEX_SSHSERVER_CURRENT=$INDEX_SSHSERVER_CURRENT +INDEX_SSHSERVER_TARGET=$INDEX_SSHSERVER_TARGET + +#DietPi Choice System: File Server +INDEX_FILESERVER_CURRENT=$INDEX_FILESERVER_CURRENT +INDEX_FILESERVER_TARGET=$INDEX_FILESERVER_TARGET + +#DietPi Choice System: Logging +INDEX_LOGGING_CURRENT=$INDEX_LOGGING_CURRENT +INDEX_LOGGING_TARGET=$INDEX_LOGGING_TARGET + +#DietPi Preference System: Webserver base +INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_CURRENT +INDEX_WEBSERVER_TARGET=$INDEX_WEBSERVER_TARGET + +_EOF_ + + } + + Read_InstallFileList(){ + + local fp_target="$FP_INSTALLED_FILE" + + if [ "$1" = "temp" ]; then + + fp_target="$FP_INSTALLED_FILE_TEMP" + + fi + + #Load Software states + /DietPi/dietpi/func/dietpi-notify 2 "Reading database, please wait..." + + #Load + if [ -f "$fp_target" ]; then + + . "$fp_target" + + fi + + } + #///////////////////////////////////////////////////////////////////////////////////// - # Installation System Vars + # Installation System #///////////////////////////////////////////////////////////////////////////////////// #Reboot after installation has finished. DISABLE_REBOOT=0 - #Enable all user inputs (eg: prompts) - USER_INPUTS=1 - #Run Instalation Flag (1 = run installs) GOSTARTINSTALL=0 INSTALL_URL_ADDRESS="" @@ -89,6123 +172,8450 @@ USER_EMONHUB_APIKEY_COMPLETED=0 USER_EMONHUB_APIKEY_CURRENT=0 WIFIHOTSPOT_RTL8188C_DEVICE=0 + USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED=0 - #DietPi Software - INSTALL_DIETPI_CHOICESMADE=0 + # + USBDRIVE=0 - #Linux Software + #Choices Made? + INSTALL_DIETPI_CHOICESMADE=0 INSTALL_LINUX_CHOICESMADE=0 - #SSH Server Choices system + #DietPi Choice System: SSH Server INSTALL_SSHSERVER_CHOICESMADE=0 + INDEX_SSHSERVER_CURRENT=-1 + INDEX_SSHSERVER_TARGET=-1 - #Fileserver Choices system + #DietPi Choice System: Fileserver INSTALL_FILESERVER_CHOICESMADE=0 + INDEX_FILESERVER_CURRENT=0 + INDEX_FILESERVER_TARGET=0 - #Logging Choices system + #DietPi Choice System: Logging INSTALL_LOGGING_CHOICESMADE=0 + INDEX_LOGGING_CURRENT=-1 + INDEX_LOGGING_TARGET=-1 + + #DietPi Preference System: Webserver base + INDEX_WEBSERVER_CURRENT=-2 + INDEX_WEBSERVER_TARGET=-2 + + #Create DietPi-Software Arrays + # - Categories + aSOFTWARE_CATEGORIES_DIETPI=0 #List of cats + MAX_SOFTWARE_CATEGORIES_DIETPI=0 + + aSOFTWARE_CATEGORIES_LINUX=0 + MAX_SOFTWARE_CATEGORIES_LINUX=0 + + # - Software + #NB: All software has a unique index that must not be changed (eg: DESKTOP_LXDE = 23) + TOTAL_SOFTWARE_INDEXS=0 + TOTAL_SOFTWARE_INDEXS_HARDLIMIT=110 #Increase as needed. Must be higher than TOTAL_SOFTWARE_INDEXS once calculated in Software_Arrays_Init + + INSTALLING_INDEX=0 #Which software index is currently being installed? + + aSOFTWARE_CATEGORY_INDEX=0 #Category index + aSOFTWARE_TYPE=0 #0=DietPi 1=Linux | -1=Hidden from install menu + + aSOFTWARE_UNIQUE_NAME=0 #Unique name from pre-array dietpi-software .installed file + aSOFTWARE_INSTALL_STATE=0 #0=not / 1=tobe, or not tobe that is the... / 2=installed + + aSOFTWARE_WHIP_NAME=0 #Item name eg: Kodi + aSOFTWARE_WHIP_DESC=0 #Blah blah + + # - Optional pre req software that needs to be installed + aSOFTWARE_REQUIRES_ALSA=0 + aSOFTWARE_REQUIRES_XSERVERXORG=0 + aSOFTWARE_REQUIRES_MYSQL=0 + aSOFTWARE_REQUIRES_SQLITE=0 + aSOFTWARE_REQUIRES_WEBSERVER=0 + aSOFTWARE_REQUIRES_DESKTOP=0 + aSOFTWARE_REQUIRES_GIT=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL=0 + aSOFTWARE_REQUIRES_RSYSLOG=0 + aSOFTWARE_REQUIRES_FFMPEG=0 + aSOFTWARE_REQUIRES_ORACLEJAVA=0 + aSOFTWARE_REQUIRES_NODEJS=0 + + # - Available for + MAX_HW_MODEL=51 + MAX_HW_ARCH=22 + # 2D array (well, bash style) + declare -A aSOFTWARE_AVAIL_HW_MODEL + declare -A aSOFTWARE_AVAIL_HW_ARCH + + Software_Arrays_Init(){ + + #-------------------------------------------------------------------------------- + #Categories + #NB: Unique Indexs, do not re-arrange or re-order. + #-------------------------------------------------------------------------------- + #DietPi software + aSOFTWARE_CATEGORIES_DIETPI=( + + "────Desktops────────────────────────────────" #0 + "────Remote Desktop Access───────────────────" #1 + "────Media Systems───────────────────────────" #2 + "────BitTorrent──────────────────────────────" #3 + "────Cloud / Backups─────────────────────────" #4 + "────Gaming──────────────────────────────────" #5 + "────Social Media────────────────────────────" #6 + "────Camera / Surveillance───────────────────" #7 + "────WiFi Hotspot────────────────────────────" #8 + "────System Stats / Management───────────────" #9 + "────Remote Access───────────────────────────" #10 + "────Hardware Projects───────────────────────" #11 + "────System Security─────────────────────────" #12 + "────Webserver Stacks────────────────────────" #13 + "────Pi-hole─────────────────────────────────" #14 + "────File Servers────────────────────────────" #15 + "────VPN Servers─────────────────────────────" #16 + "────Advanced Networking─────────────────────" #17 + "────Home Automation─────────────────────────" #18 + + ) + + MAX_SOFTWARE_CATEGORIES_DIETPI=${#aSOFTWARE_CATEGORIES_DIETPI[@]} + + #DietPi software + aSOFTWARE_CATEGORIES_LINUX=( + + "────SSH Clients─────────────────────────────" #0 + "────Fileserver Clients──────────────────────" #1 + "────File Managers───────────────────────────" #2 + "────System──────────────────────────────────" #3 + "────Shared Libraries────────────────────────" #4 + "────Network Tools───────────────────────────" #5 + "────Development / Programming───────────────" #6 + "────Text Editors────────────────────────────" #7 + "────Desktop Utilities───────────────────────" #8 + + ) + + MAX_SOFTWARE_CATEGORIES_LINUX=${#aSOFTWARE_CATEGORIES_LINUX[@]} + + #-------------------------------------------------------------------------------- + #Available For + #-------------------------------------------------------------------------------- + #Set available by default for all devices and arch + + local debug_array_count=0 + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS_HARDLIMIT; i++)) + do - #///////////////////////////////////////////////////////////////////////////////////// - # First Run / Automation functions Vars (eg: on a fresh install) - #///////////////////////////////////////////////////////////////////////////////////// - AUTOINSTALL_INDEX=0 + for ((j=0; j<=$MAX_HW_MODEL; j++)) + do - AUTOINSTALL_SSHINDEX=0 - AUTOINSTALL_FILESERVERINDEX=0 - AUTOINSTALL_LOGGINGINDEX=0 - AUTOINSTALL_WEBSERVERINDEX=0 + aSOFTWARE_AVAIL_HW_MODEL[$i,$j]=1 + # ((debug_array_count++)) + # echo -e "$debug_array_count ${aSOFTWARE_AVAIL_HW_MODEL[$i,$j]}" - AUTOINSTALL_AUTOSTARTTARGET=0 + done - AUTOINSTALL_TIMEZONE=0 - AUTOINSTALL_LANGUAGE=0 - AUTOINSTALL_KEYBOARD=0 + done - AUTOINSTALL_CUSTOMSCRIPTURL=0 + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS_HARDLIMIT; i++)) + do - #///////////////////////////////////////////////////// - # Error Vars - #///////////////////////////////////////////////////// - ERROR_TEXT="" + for ((j=0; j<=$MAX_HW_ARCH; j++)) + do - #///////////////////////////////////////////////////////////////////////////////////// - # WHIPTAIL MENU Vars - #///////////////////////////////////////////////////////////////////////////////////// - WHIP_BACKTITLE='DietPi-Software' - WHIP_TITLE=0 - WHIP_QUESTION=0 - MENU_MAIN_LASTITEM="" - TARGETMENUID=0 + aSOFTWARE_AVAIL_HW_ARCH[$i,$j]=1 + # ((debug_array_count++)) + # echo -e "$debug_array_count ${aSOFTWARE_AVAIL_HW_ARCH[$i,$j]}" - #///////////////////////////////////////////////////////////////////////////////////// - # Internet Connection Test Vars - #///////////////////////////////////////////////////////////////////////////////////// - INTERNET_CONNECTED=0 - #Use /etc/apt/sources.list for connection test - INTERNET_URL_TEST=$(cat /etc/apt/sources.list | grep -m1 "deb http" | awk '{print $2}') + done - #Global funcs - Check_Internet_Connection(){ + done - #Max loops for USER_INPUTS=0 - local max_loops=10 - local current_loop=0 + #-------------------------------------------------------------------------------- + #Requires software to be installed + #-------------------------------------------------------------------------------- + #As we don't define this for all software, init the arrays to 0 + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS_HARDLIMIT; i++)) + do - INTERNET_CONNECTED=0 - while (( $INTERNET_CONNECTED == 0 )); do + aSOFTWARE_REQUIRES_ALSA[$i]=0 + aSOFTWARE_REQUIRES_XSERVERXORG[$i]=0 + aSOFTWARE_REQUIRES_MYSQL[$i]=0 + aSOFTWARE_REQUIRES_SQLITE[$i]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$i]=0 + aSOFTWARE_REQUIRES_DESKTOP[$i]=0 + aSOFTWARE_REQUIRES_GIT[$i]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]=0 + aSOFTWARE_REQUIRES_RSYSLOG[$i]=0 + aSOFTWARE_REQUIRES_FFMPEG[$i]=0 + aSOFTWARE_REQUIRES_ORACLEJAVA[$i]=0 + aSOFTWARE_REQUIRES_NODEJS[$i]=0 - /DietPi/dietpi/func/check_connection "$INTERNET_URL_TEST" - if (( $? == 0 )); then + done - INTERNET_CONNECTED=1 - elif (( $USER_INPUTS )); then + #-------------------------------------------------------------------------------- + #DietPi software items + #-------------------------------------------------------------------------------- + #Assign UNIQUE index to each item + local index_current=0 + + #Desktops + #-------------------------------------------------------------------------------- + index_current=23 + + aSOFTWARE_UNIQUE_NAME[$index_current]='DESKTOP_LXDE' + aSOFTWARE_WHIP_NAME[$index_current]='LXDE: Desktop' + aSOFTWARE_WHIP_DESC[$index_current]='Ultra lightweight desktop' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + #------------------ + index_current=24 + aSOFTWARE_UNIQUE_NAME[$index_current]='DESKTOP_MATE' + aSOFTWARE_WHIP_NAME[$index_current]='MATE: Desktop' + aSOFTWARE_WHIP_DESC[$index_current]='MATE Desktop Enviroment' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + #------------------ + index_current=25 + + aSOFTWARE_UNIQUE_NAME[$index_current]='DESKTOP_XFCE' + aSOFTWARE_WHIP_NAME[$index_current]='XFCE: Desktop' + aSOFTWARE_WHIP_DESC[$index_current]='lightweight desktop environment' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + #------------------ + index_current=26 + + aSOFTWARE_UNIQUE_NAME[$index_current]='DESKTOP_GNUSTEP' + aSOFTWARE_WHIP_NAME[$index_current]='GNUStep: Desktop' + aSOFTWARE_WHIP_DESC[$index_current]='Lightweight Desktop based on OpenStep' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + #Remote Desktops + #-------------------------------------------------------------------------------- + index_current=27 + + aSOFTWARE_UNIQUE_NAME[$index_current]='TIGHTVNCSERVER' + aSOFTWARE_WHIP_NAME[$index_current]='TightVNC Server' + aSOFTWARE_WHIP_DESC[$index_current]='Desktop for remote connection' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + #------------------ + index_current=28 + + aSOFTWARE_UNIQUE_NAME[$index_current]='VNC4SERVER' + aSOFTWARE_WHIP_NAME[$index_current]='VNC4 Server' + aSOFTWARE_WHIP_DESC[$index_current]='Desktop for remote connection' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1 + + #------------------ + index_current=29 + + aSOFTWARE_UNIQUE_NAME[$index_current]='XRDP' + aSOFTWARE_WHIP_NAME[$index_current]='XRDP' + aSOFTWARE_WHIP_DESC[$index_current]='Remote Desktop Protocol (RDP) server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1 + + #------------------ + index_current=30 + + aSOFTWARE_UNIQUE_NAME[$index_current]='NOMACHINE' + aSOFTWARE_WHIP_NAME[$index_current]='NoMachine' + aSOFTWARE_WHIP_DESC[$index_current]='Multi-Platform Server and Client Access' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + + #Media Systems + #-------------------------------------------------------------------------------- + index_current=31 + + aSOFTWARE_UNIQUE_NAME[$index_current]='KODI' + aSOFTWARE_WHIP_NAME[$index_current]='Kodi' + aSOFTWARE_WHIP_DESC[$index_current]='Media centre & player' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 + + # - Disabled for HW_MODEL + aSOFTWARE_AVAIL_HW_MODEL[$index_current,30]=0 + aSOFTWARE_AVAIL_HW_MODEL[$index_current,50]=0 + aSOFTWARE_AVAIL_HW_MODEL[$index_current,51]=0 + + # - Disabled for All Pine64 + for ((i=40; i<50; i++)) + do - Menu_No_Internet + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - else + done - if (( $current_loop >= $max_loops )); then + #------------------ + index_current=32 + + aSOFTWARE_UNIQUE_NAME[$index_current]='HIFI' + aSOFTWARE_WHIP_NAME[$index_current]='HiFi' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface music & radio player' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 + + #------------------ + index_current=33 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SUBSONIC5' + aSOFTWARE_WHIP_NAME[$index_current]='SubSonic 5' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1 + aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1 + + #------------------ + index_current=34 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SUBSONIC6' + aSOFTWARE_WHIP_NAME[$index_current]='SubSonic 6' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1 + aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1 + + #------------------ + index_current=35 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SQUEEZEBOXSERVER' + aSOFTWARE_WHIP_NAME[$index_current]='SqueezeBox' + aSOFTWARE_WHIP_DESC[$index_current]='Logitech Media Server (LMS)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - /DietPi/dietpi/func/dietpi-notify 1 "Connection test failed. $INTERNET_URL_TEST" - exit + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - else + done - ((current_loop++)) - /DietPi/dietpi/func/dietpi-notify 2 "Testing connection to $INTERNET_URL_TEST" - /DietPi/dietpi/func/dietpi-notify 2 "Attempt ($current_loop / $max_loops), please wait..." - sleep 1 + #------------------ + index_current=36 - fi + aSOFTWARE_UNIQUE_NAME[$index_current]='SQUEEZELITE' + aSOFTWARE_WHIP_NAME[$index_current]='SqueezeLite' + aSOFTWARE_WHIP_DESC[$index_current]='Audio player for LMS/SqueezeBox' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 - fi + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 done - } + #------------------ + index_current=37 - Create_Desktop_DietPi_Applications(){ + aSOFTWARE_UNIQUE_NAME[$index_current]='SHAIRPORTSYNC' + aSOFTWARE_WHIP_NAME[$index_current]='Shairport Sync' + aSOFTWARE_WHIP_DESC[$index_current]='AirPlay audio player with multiroom sync' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 - #Copy DietPi favourite links - cp /DietPi/dietpi/conf/desktop/.gtk-bookmarks "$HOME"/.gtk-bookmarks + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 - #Create Desktop SymLinks - mkdir -p "$HOME"/Desktop - ln -sf /usr/share/applications/htop.desktop "$HOME"/Desktop/htop.desktop + #------------------ + index_current=38 - #DietPi Desktop symlinks - ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop "$HOME"/Desktop/dietpi-software.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop "$HOME"/Desktop/dietpi-config.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop "$HOME"/Desktop/dietpi-launcher.desktop + aSOFTWARE_UNIQUE_NAME[$index_current]='BRUTEFIR' + aSOFTWARE_WHIP_NAME[$index_current]='BruteFIR' + aSOFTWARE_WHIP_DESC[$index_current]='EQ and Digital Room Correction via ALSA' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 - #DietPi Menu symlinks - mkdir -p /usr/share/applications - ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop /usr/share/applications/dietpi-software.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-update.desktop /usr/share/applications/dietpi-update.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop /usr/share/applications/dietpi-config.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-uninstall.desktop /usr/share/applications/dietpi-uninstall.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-backup.desktop /usr/share/applications/dietpi-backup.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-sync.desktop /usr/share/applications/dietpi-sync.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-bugreport.desktop /usr/share/applications/dietpi-bugreport.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-process_tool.desktop /usr/share/applications/dietpi-process_tool.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-cleaner.desktop /usr/share/applications/dietpi-cleaner.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-cron.desktop /usr/share/applications/dietpi-cron.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop /usr/share/applications/dietpi-launcher.desktop + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - # - Set execute to prevent "untrusted" prompt in Mate, and possibily other desktops. - chmod +x /usr/share/applications/* + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - } + done - Create_UserContent_Folders(){ + #------------------ + index_current=39 + + aSOFTWARE_UNIQUE_NAME[$index_current]='MINIDLNA' + aSOFTWARE_WHIP_NAME[$index_current]='MiniDLNA' + aSOFTWARE_WHIP_DESC[$index_current]='Media streaming server (DLNA, UPnP)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + + #------------------ + index_current=40 + + aSOFTWARE_UNIQUE_NAME[$index_current]='AMPACHE' + aSOFTWARE_WHIP_NAME[$index_current]='Ampache' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_GIT[$index_current]=1 + aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=41 + + aSOFTWARE_UNIQUE_NAME[$index_current]='EMBYSERVER' + aSOFTWARE_WHIP_NAME[$index_current]='Emby Server' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + # - Disabled for HW_MODEL + aSOFTWARE_AVAIL_HW_MODEL[$index_current,30]=0 + aSOFTWARE_AVAIL_HW_MODEL[$index_current,50]=0 + aSOFTWARE_AVAIL_HW_MODEL[$index_current,51]=0 + + #------------------ + index_current=42 + + aSOFTWARE_UNIQUE_NAME[$index_current]='PLEXMEDIASERVER' + aSOFTWARE_WHIP_NAME[$index_current]='Plex Server' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface media streaming server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + #------------------ + index_current=43 + + aSOFTWARE_UNIQUE_NAME[$index_current]='MUMBLESERVER' + aSOFTWARE_WHIP_NAME[$index_current]='Murmur' + aSOFTWARE_WHIP_DESC[$index_current]='Mumble VoIP server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=0 + + #BitTorrent + #-------------------------------------------------------------------------------- + index_current=44 + + aSOFTWARE_UNIQUE_NAME[$index_current]='TRANSMISSION' + aSOFTWARE_WHIP_NAME[$index_current]='Transmission' + aSOFTWARE_WHIP_DESC[$index_current]='BitTorrent server with web interface (C)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=3 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=45 + + aSOFTWARE_UNIQUE_NAME[$index_current]='DELUGE' + aSOFTWARE_WHIP_NAME[$index_current]='Deluge' + aSOFTWARE_WHIP_DESC[$index_current]='BitTorrent server with web interface (Python)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=3 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=46 + + aSOFTWARE_UNIQUE_NAME[$index_current]='QBITTORRENT' + aSOFTWARE_WHIP_NAME[$index_current]='qBitTorrent' + aSOFTWARE_WHIP_DESC[$index_current]='BitTorrent server with web interface (C++)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=3 + aSOFTWARE_TYPE[$index_current]=0 + + + #Cloud / Backups + #-------------------------------------------------------------------------------- + index_current=47 + + aSOFTWARE_UNIQUE_NAME[$index_current]='OWNCLOUD' + aSOFTWARE_WHIP_NAME[$index_current]='OwnCloud' + aSOFTWARE_WHIP_DESC[$index_current]='Your very own cloud (eg: dropbox)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=48 + + aSOFTWARE_UNIQUE_NAME[$index_current]='PYDIO' + aSOFTWARE_WHIP_NAME[$index_current]='Pydio' + aSOFTWARE_WHIP_DESC[$index_current]='Feature-rich backup and sync server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=49 + + aSOFTWARE_UNIQUE_NAME[$index_current]='GOGS' + aSOFTWARE_WHIP_NAME[$index_current]='Gogs' + aSOFTWARE_WHIP_DESC[$index_current]='Personal GitHub server with web interface' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_GIT[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + #------------------ + index_current=50 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SYNCTHING' + aSOFTWARE_WHIP_NAME[$index_current]='Syncthing' + aSOFTWARE_WHIP_DESC[$index_current]='Backup and sync server with web interface' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + + #Gaming + #-------------------------------------------------------------------------------- + index_current=51 + + aSOFTWARE_UNIQUE_NAME[$index_current]='OPENTYRIAN' + aSOFTWARE_WHIP_NAME[$index_current]='OpenTyrian' + aSOFTWARE_WHIP_DESC[$index_current]='A classic retro game, addictive' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_ALSA[$index_current]=1 + aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1 + + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" &> /dev/null - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" &> /dev/null - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" &> /dev/null - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" &> /dev/null + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" - chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" - chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" - chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" + done - } + #------------------ + index_current=52 + + aSOFTWARE_UNIQUE_NAME[$index_current]='CUBERITE' + aSOFTWARE_WHIP_NAME[$index_current]='Cuberite' + aSOFTWARE_WHIP_DESC[$index_current]='Minecraft Server with web interface (C++)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=0 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + #------------------ + index_current=53 + + aSOFTWARE_UNIQUE_NAME[$index_current]='MINEOS' + aSOFTWARE_WHIP_NAME[$index_current]='MineOS' + aSOFTWARE_WHIP_DESC[$index_current]='Minecraft Servers with web interface (Java)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1 + aSOFTWARE_REQUIRES_GIT[$index_current]=1 + aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1 + aSOFTWARE_REQUIRES_NODEJS[$index_current]=1 + + #------------------ + + #Social Media + #-------------------------------------------------------------------------------- + index_current=54 + + aSOFTWARE_UNIQUE_NAME[$index_current]='PHPBB' + aSOFTWARE_WHIP_NAME[$index_current]='Forums' + aSOFTWARE_WHIP_DESC[$index_current]='PhpBB forums' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=55 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WORDPRESS' + aSOFTWARE_WHIP_NAME[$index_current]='Wordpress' + aSOFTWARE_WHIP_DESC[$index_current]='Website Blog and Publishing platform' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=56 + + aSOFTWARE_UNIQUE_NAME[$index_current]='PHPIMAGEGALLERY' + aSOFTWARE_WHIP_NAME[$index_current]='Image Gallery' + aSOFTWARE_WHIP_DESC[$index_current]='Website to host / browse your images' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + + #------------------ + index_current=57 + + aSOFTWARE_UNIQUE_NAME[$index_current]='BAIKAL' + aSOFTWARE_WHIP_NAME[$index_current]='BaiKal' + aSOFTWARE_WHIP_DESC[$index_current]='Lightweight CalDAV + CardDAV server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=58 + + aSOFTWARE_UNIQUE_NAME[$index_current]='OPENBAZAAR' + aSOFTWARE_WHIP_NAME[$index_current]='OpenBazaar' + aSOFTWARE_WHIP_DESC[$index_current]='Decentralized peer to peer Bitcoin market' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1 + aSOFTWARE_REQUIRES_GIT[$index_current]=1 + + #------------------ + + #Camera + #-------------------------------------------------------------------------------- + index_current=59 + + aSOFTWARE_UNIQUE_NAME[$index_current]='DIETPICAM' + aSOFTWARE_WHIP_NAME[$index_current]='DietPi Cam' + aSOFTWARE_WHIP_DESC[$index_current]='RPi Cam Control / Web Interface Surveillance' + aSOFTWARE_CATEGORY_INDEX[$index_current]=7 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - Download_Test_Media(){ + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - if [ ! -f "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg ]; then + done - #Grab My test music - wget http://dietpi.com/downloads/audio/fourdee_tech.ogg -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg + #------------------ - #Grab Absolute Radio Streams - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-80s.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a9bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-90s.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a0bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-00s.pls + #WiFi Hotspot + #-------------------------------------------------------------------------------- + index_current=60 - fi + aSOFTWARE_UNIQUE_NAME[$index_current]='WIFIHOTSPOT' + aSOFTWARE_WHIP_NAME[$index_current]='WiFi Hotspot' + aSOFTWARE_WHIP_DESC[$index_current]='Turn your device into a WiFi hotspot' + aSOFTWARE_CATEGORY_INDEX[$index_current]=8 + aSOFTWARE_TYPE[$index_current]=0 - } + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 - #apt-get install - AGI(){ - local string="$@" - DEBIAN_FRONTEND=noninteractive apt-get install -y $string + #------------------ + index_current=61 - local result=$? - if (( $result != 0 )); then - Error_AptGet_Failed - fi - } + aSOFTWARE_UNIQUE_NAME[$index_current]='TORHOTSPOT' + aSOFTWARE_WHIP_NAME[$index_current]='Tor Hotspot' + aSOFTWARE_WHIP_DESC[$index_current]='Optional: Route HotSpot traffic through Tor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=8 + aSOFTWARE_TYPE[$index_current]=0 - #Return optimization values for BitTorrent servers based on device and hardware capabilities. - Optimize_BitTorrent(){ + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 - local output=0 + #------------------ - local gigabit_device=1 - # - Lets hope the next RPi device is finally gigabit capable. I'll cry if it is not. - if (( $HW_MODEL <= 3 || $HW_MODEL == 30 || $HW_MODEL == 40 )); then + #System stats + #-------------------------------------------------------------------------------- + index_current=62 - gigabit_device=0 + aSOFTWARE_UNIQUE_NAME[$index_current]='DIETPICLOUDSHELL' + aSOFTWARE_WHIP_NAME[$index_current]='DietPi-Cloudshell' + aSOFTWARE_WHIP_DESC[$index_current]='System stats for your LCD display or monitor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 - fi + #------------------ + index_current=63 - #Cache size 1/7th of total mem - if (( $1 == 0 )); then + aSOFTWARE_UNIQUE_NAME[$index_current]='LINUXDASH' + aSOFTWARE_WHIP_NAME[$index_current]='LinuxDash' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 - output=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 7 )) - #Max active downloads - elif (( $1 == 1 )); then + #------------------ + index_current=64 - output=2 + aSOFTWARE_UNIQUE_NAME[$index_current]='PHPSYSINFO' + aSOFTWARE_WHIP_NAME[$index_current]='PhpSysInfo' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 - # - Bump up for VM's - if (( $HW_MODEL == 20 )); then + #------------------ + index_current=65 - output=3 + aSOFTWARE_UNIQUE_NAME[$index_current]='NETDATA' + aSOFTWARE_WHIP_NAME[$index_current]='netdata' + aSOFTWARE_WHIP_DESC[$index_current]='Real-time performance monitoring' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_NODEJS[$index_current]=1 - fi + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,21]=0 - #Max global connections - elif (( $1 == 2 )); then + #------------------ + index_current=66 - output=20 + aSOFTWARE_UNIQUE_NAME[$index_current]='RPIMONITOR' + aSOFTWARE_WHIP_NAME[$index_current]='RPi-Monitor' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 - # - Bump up for VM's - if (( $HW_MODEL == 20 )); then + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - output=40 + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - # - 1Gbit SBC's - elif (( $gigabit_device )); then + done - output=30 + #------------------ + index_current=106 - # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. - # - RPi v3 - elif (( $HW_MODEL == 3 )); then + aSOFTWARE_UNIQUE_NAME[$index_current]='RASPCONTROL' + aSOFTWARE_WHIP_NAME[$index_current]='Raspcontrol' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface system stats' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 - output=15 + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - # - RPi v2 - elif (( $HW_MODEL == 2 )); then + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - output=13 + done - # - RPi v1 256/512 - elif (( $HW_MODEL <= 1 )); then + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 - output=7 + #------------------ - fi + #Remote Access + #-------------------------------------------------------------------------------- + index_current=67 - #Max upload slots - elif (( $1 == 3 )); then + aSOFTWARE_UNIQUE_NAME[$index_current]='NOIPDYNDNS' + aSOFTWARE_WHIP_NAME[$index_current]='NoIp' + aSOFTWARE_WHIP_DESC[$index_current]='URL website address for your device' + aSOFTWARE_CATEGORY_INDEX[$index_current]=10 + aSOFTWARE_TYPE[$index_current]=0 - output=3 + #------------------ + index_current=68 - # - Bump up for VM's - if (( $HW_MODEL == 20 )); then + aSOFTWARE_UNIQUE_NAME[$index_current]='WEAVED' + aSOFTWARE_WHIP_NAME[$index_current]='Weaved' + aSOFTWARE_WHIP_DESC[$index_current]='Access your device over the internet' + aSOFTWARE_CATEGORY_INDEX[$index_current]=10 + aSOFTWARE_TYPE[$index_current]=0 - output=5 + #------------------ - # - 1Gbit devices - elif (( $gigabit_device )); then + #Hardware projects + #-------------------------------------------------------------------------------- + index_current=69 - output=4 + aSOFTWARE_UNIQUE_NAME[$index_current]='RPIGPIO' + aSOFTWARE_WHIP_NAME[$index_current]='RPi.GPIO' + aSOFTWARE_WHIP_DESC[$index_current]='GPIO Interface library for RPi (python)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=11 + aSOFTWARE_TYPE[$index_current]=0 - # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. - elif (( $HW_MODEL <= 3 )); then - output=2 + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - fi + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - fi + done - echo $output + #------------------ + index_current=70 - } + aSOFTWARE_UNIQUE_NAME[$index_current]='WIRINGPI' + aSOFTWARE_WHIP_NAME[$index_current]='WiringPi' + aSOFTWARE_WHIP_DESC[$index_current]='GPIO Interface library for RPi (c)' + aSOFTWARE_CATEGORY_INDEX[$index_current]=11 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1 + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - Write_InstallFileList(){ + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - ##Write_InstallFileList = write to /DietPi/dietpi/.installed - ##Write_InstallFileList 1 = write to /tmp/dietpi-software_selected (used to obtain list of selected software to prompt user before startring) + done - #FP_INSTALLED_FILE="/DietPi/dietpi/.installed" - #if [[ $1 =~ ^-?[0-9]+$ ]]; then - # if (( $1 == 1 )); then - # FP_INSTALLED_FILE="/tmp/dietpi-software_selected" - # fi - #fi + #------------------ + index_current=71 - #Leave this until we have a SQL database to read from. + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBIOPI' + aSOFTWARE_WHIP_NAME[$index_current]='WebIOPi' + aSOFTWARE_WHIP_DESC[$index_current]='Web interface to control RPi.GPIO' + aSOFTWARE_CATEGORY_INDEX[$index_current]=11 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1 - local output=" -#DietPi External Drive -USBDRIVE=${USBDRIVE:=0} - -#DietPi Software -GRASSHOPPER=${GRASSHOPPER:=0} -DESKTOP_LXDE=${DESKTOP_LXDE:=0} -DESKTOP_MATE=${DESKTOP_MATE:=0} -DESKTOP_GNUSTEP=${DESKTOP_GNUSTEP:=0} -DESKTOP_XFCE=${DESKTOP_XFCE:=0} - -WEBSERVER_LAMP=${WEBSERVER_LAMP:=0} -WEBSERVER_LASP=${WEBSERVER_LASP:=0} -WEBSERVER_LAAP=${WEBSERVER_LAAP:=0} - -WEBSERVER_LEMP=${WEBSERVER_LEMP:=0} -WEBSERVER_LESP=${WEBSERVER_LESP:=0} -WEBSERVER_LEAP=${WEBSERVER_LEAP:=0} - -WEBSERVER_LLMP=${WEBSERVER_LLMP:=0} -WEBSERVER_LLSP=${WEBSERVER_LLSP:=0} -WEBSERVER_LLAP=${WEBSERVER_LLAP:=0} - -WEBSERVER_APACHE=${WEBSERVER_APACHE:=0} -WEBSERVER_NGINX=${WEBSERVER_NGINX:=0} -WEBSERVER_LIGHTTPD=${WEBSERVER_LIGHTTPD:=0} -WEBSERVER_MYSQL=${WEBSERVER_MYSQL:=0} -WEBSERVER_MARIADB=${WEBSERVER_MARIADB:=0} -WEBSERVER_SQLITE=${WEBSERVER_SQLITE:=0} -WEBSERVER_PHP=${WEBSERVER_PHP:=0} -WEBSERVER_MYADMINPHP=${WEBSERVER_MYADMINPHP:=0} -WEBSERVER_REDIS=${WEBSERVER_REDIS:=0} - -NOMACHINE=${NOMACHINE:=0} -XRDP=${XRDP:=0} -TIGHTVNCSERVER=${TIGHTVNCSERVER:=0} -VNC4SERVER=${VNC4SERVER:=0} - -OWNCLOUD=${OWNCLOUD:=0} -TRANSMISSION=${TRANSMISSION:=0} -PHPBB=${PHPBB:=0} -HIFI=${HIFI:=0} -KODI=${KODI:=0} -MINIDLNA=${MINIDLNA:=0} -NOIPDYNDNS=${NOIPDYNDNS:=0} -OPENTYRIAN=${OPENTYRIAN:=0} -DIETPICAM=${DIETPICAM:=0} -DELUGE=${DELUGE:=0} -FILESERVER_SAMBA=${FILESERVER_SAMBA:=0} -FILESERVER_PROFTP=${FILESERVER_PROFTP:=0} -FILESERVER_VSFTPD=${FILESERVER_VSFTPD:=0} -RASPCONTROL=${RASPCONTROL:=0} -LINUXDASH=${LINUXDASH:=0} -PIHOLE=${PIHOLE:=0} -SUBSONIC5=${SUBSONIC5:=0} -SUBSONIC6=${SUBSONIC6:=0} -WEAVED=${WEAVED:=0} -WEBIOPI=${WEBIOPI:=0} -DIETPICLOUDSHELL=${DIETPICLOUDSHELL:=0} -HAPROXY=${HAPROXY:=0} -SQUEEZEBOXSERVER=${SQUEEZEBOXSERVER:=0} -WORDPRESS=${WORDPRESS:=0} -FAIL2BAN=${FAIL2BAN:=0} -PHPSYSINFO=${PHPSYSINFO:=0} -PHPIMAGEGALLERY=${PHPIMAGEGALLERY:=0} -AMPACHE=${AMPACHE:=0} -OPENVPNSERVER=${OPENVPNSERVER:=0} -LETSENCRYPT=${LETSENCRYPT:=0} -WIRINGPI=${WIRINGPI:=0} -RPIGPIO=${RPIGPIO:=0} -RPII2C=${RPII2C:=0} -WIFIHOTSPOT=${WIFIHOTSPOT:=0} -TORHOTSPOT=${TORHOTSPOT:=0} -SHAIRPORTSYNC=${SHAIRPORTSYNC:=0} -BRUTEFIR=${BRUTEFIR:=0} -PYDIO=${PYDIO:=0} -SQUEEZELITE=${SQUEEZELITE:=0} -EMONHUB=${EMONHUB:=0} -RPIMONITOR=${RPIMONITOR:=0} -NETDATA=${NETDATA:=0} -BAIKAL=${BAIKAL:=0} -MUMBLESERVER=${MUMBLESERVER:=0} -EMBYSERVER=${EMBYSERVER:=0} -OPENBAZAAR=${OPENBAZAAR:=0} -PLEXMEDIASERVER=${PLEXMEDIASERVER:=0} -CUBERITE=${CUBERITE:=0} -MINEOS=${MINEOS:=0} -GOGS=${GOGS:=0} -QBITTORRENT=${QBITTORRENT:=0} -SYNCTHING=${SYNCTHING:=0} - -#Additional Linux Software -VIMFULL=${VIMFULL:=0} -VIMTINY=${VIMTINY:=0} -QUITERSS=${QUITERSS:=0} -GNUEMACS=${GNUEMACS:=0} -SSHCLIENT=${SSHCLIENT:=0} -SMBCLIENT=${SMBCLIENT:=0} -MIDNIGHTCOMMANDER=${MIDNIGHTCOMMANDER:=0} -VIFM=${VIFM:=0} -JED=${JED:=0} -IFTOP=${IFTOP:=0} -IPTRAF=${IPTRAF:=0} -IPERF=${IPERF:=0} -MTRTINY=${MTRTINY:=0} -NLOAD=${NLOAD:=0} -TCPDUMP=${TCPDUMP:=0} - -GITCLIENT=${GITCLIENT:=0} -BUILDESSENTIAL=${BUILDESSENTIAL:=0} -ALSABASE=${ALSABASE:=0} -XSERVERXORG=${XSERVERXORG:=0} -CURLFTPFS=${CURLFTPFS:=0} -FFMPEG=${FFMPEG:=0} -ORACLEJAVA=${ORACLEJAVA:=0} -NODEJS=${NODEJS:=0} - -SSHSERVER_DROPBEAR=${SSHSERVER_DROPBEAR:=2} -SSHSERVER_OPENSSH=${SSHSERVER_OPENSSH:=0} -LOGGING_LOGROTATE=${LOGGING_LOGROTATE:=0} -LOGGING_RAMLOG=${LOGGING_RAMLOG:=2} -LOGGING_RSYSLOG=${LOGGING_RSYSLOG:=0} + # - Disabled for All non-rpi and RPi3 + for ((i=3; i<=$MAX_HW_MODEL; i++)) + do + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 -#DietPi Choice System: SSH Server -INDEX_SSHSERVER_CURRENT=${INDEX_SSHSERVER_CURRENT:=-1} -INDEX_SSHSERVER_TARGET=${INDEX_SSHSERVER_TARGET:=-1} + done -#DietPi Choice System: File Server -INDEX_FILESERVER_CURRENT=${INDEX_FILESERVER_CURRENT:=0} -INDEX_FILESERVER_TARGET=${INDEX_FILESERVER_TARGET:=0} + #------------------ + index_current=72 -#DietPi Choice System: Logging -INDEX_LOGGING_CURRENT=${INDEX_LOGGING_CURRENT:=-1} -INDEX_LOGGING_TARGET=${INDEX_LOGGING_TARGET:=-1} + aSOFTWARE_UNIQUE_NAME[$index_current]='RPII2C' + aSOFTWARE_WHIP_NAME[$index_current]='I2c' + aSOFTWARE_WHIP_DESC[$index_current]='Enables support for I2c based hardware' + aSOFTWARE_CATEGORY_INDEX[$index_current]=11 + aSOFTWARE_TYPE[$index_current]=0 -#DietPi Preference System: Webserver base -INDEX_WEBSERVER_CURRENT=${INDEX_WEBSERVER_CURRENT:=-2} -INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do -" + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - echo "$output" > "$FP_INSTALLED_FILE" - } + done - Read_InstallFileList(){ + #------------------ + + #System security + #-------------------------------------------------------------------------------- + index_current=73 + + aSOFTWARE_UNIQUE_NAME[$index_current]='FAIL2BAN' + aSOFTWARE_WHIP_NAME[$index_current]='Fail2Ban' + aSOFTWARE_WHIP_DESC[$index_current]='Prevents brute-force attacks with IP ban' + aSOFTWARE_CATEGORY_INDEX[$index_current]=12 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1 + #------------------ + + #Webserver stacks + #-------------------------------------------------------------------------------- + index_current=74 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LAMP' + aSOFTWARE_WHIP_NAME[$index_current]='LAMP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Apache2 | MySql | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=75 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LASP' + aSOFTWARE_WHIP_NAME[$index_current]='LASP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Apache2 | SQLite | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=76 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LAAP' + aSOFTWARE_WHIP_NAME[$index_current]='LAAP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Apache2 | MariaDB | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=77 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LEMP' + aSOFTWARE_WHIP_NAME[$index_current]='LEMP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Nginx | MySql | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=78 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LESP' + aSOFTWARE_WHIP_NAME[$index_current]='LESP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Nginx | SQLite | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=79 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LEAP' + aSOFTWARE_WHIP_NAME[$index_current]='LEAP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Nginx | MariaDB | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=80 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LLMP' + aSOFTWARE_WHIP_NAME[$index_current]='LLMP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Lighttpd | MySql | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=81 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LLSP' + aSOFTWARE_WHIP_NAME[$index_current]='LLSP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Lighttpd | SQLite | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=82 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LLAP' + aSOFTWARE_WHIP_NAME[$index_current]='LLAP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver: Lighttpd | MariaDB | Php' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=83 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_APACHE' + aSOFTWARE_WHIP_NAME[$index_current]='Apache2' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=84 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_LIGHTTPD' + aSOFTWARE_WHIP_NAME[$index_current]='Lighttpd' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=85 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_NGINX' + aSOFTWARE_WHIP_NAME[$index_current]='Nginx' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=86 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_MYSQL' + aSOFTWARE_WHIP_NAME[$index_current]='MySQL' + aSOFTWARE_WHIP_DESC[$index_current]='database' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=87 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_SQLITE' + aSOFTWARE_WHIP_NAME[$index_current]='SQlite' + aSOFTWARE_WHIP_DESC[$index_current]='database' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=88 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_MARIADB' + aSOFTWARE_WHIP_NAME[$index_current]='MariaDB' + aSOFTWARE_WHIP_DESC[$index_current]='database' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=89 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_PHP' + aSOFTWARE_WHIP_NAME[$index_current]='PHP' + aSOFTWARE_WHIP_DESC[$index_current]='Webserver' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=-1 + + #------------------ + index_current=90 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_MYADMINPHP' + aSOFTWARE_WHIP_NAME[$index_current]='phpMyAdmin' + aSOFTWARE_WHIP_DESC[$index_current]='Optional MySql admin tools' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 + + #------------------ + index_current=91 + + aSOFTWARE_UNIQUE_NAME[$index_current]='WEBSERVER_REDIS' + aSOFTWARE_WHIP_NAME[$index_current]='Redis' + aSOFTWARE_WHIP_DESC[$index_current]='Optional non-SQL database store' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + # - Disabled for HW_ARCH + aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + + #------------------ + index_current=92 + + aSOFTWARE_UNIQUE_NAME[$index_current]='LETSENCRYPT' + aSOFTWARE_WHIP_NAME[$index_current]='CertBot' + aSOFTWARE_WHIP_DESC[$index_current]='Free, auto SSL cert install allowing https://' + aSOFTWARE_CATEGORY_INDEX[$index_current]=13 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + + #PiHole + #-------------------------------------------------------------------------------- + index_current=93 + + aSOFTWARE_UNIQUE_NAME[$index_current]='PIHOLE' + aSOFTWARE_WHIP_NAME[$index_current]='Pi-hole' + aSOFTWARE_WHIP_DESC[$index_current]='Block adverts for any device on your network' + aSOFTWARE_CATEGORY_INDEX[$index_current]=14 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + + #------------------ + + #File servers + #-------------------------------------------------------------------------------- + index_current=94 + + aSOFTWARE_UNIQUE_NAME[$index_current]='FILESERVER_PROFTP' + aSOFTWARE_WHIP_NAME[$index_current]='ProFTP' + aSOFTWARE_WHIP_DESC[$index_current]='Lightweight FTP / file server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=15 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=95 + + aSOFTWARE_UNIQUE_NAME[$index_current]='FILESERVER_VSFTPD' + aSOFTWARE_WHIP_NAME[$index_current]='vsFTPD' + aSOFTWARE_WHIP_DESC[$index_current]='Alternative FTP / file server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=15 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + index_current=96 + + aSOFTWARE_UNIQUE_NAME[$index_current]='FILESERVER_SAMBA' + aSOFTWARE_WHIP_NAME[$index_current]='Samba' + aSOFTWARE_WHIP_DESC[$index_current]='Feature-rich file server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=15 + aSOFTWARE_TYPE[$index_current]=0 + + #------------------ + + #VPN servers + #-------------------------------------------------------------------------------- + index_current=97 + + aSOFTWARE_UNIQUE_NAME[$index_current]='OPENVPNSERVER' + aSOFTWARE_WHIP_NAME[$index_current]='OpenVPN' + aSOFTWARE_WHIP_DESC[$index_current]='VPN server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=16 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1 + + #------------------ + + + #Advanced Networking + #-------------------------------------------------------------------------------- + index_current=98 + + aSOFTWARE_UNIQUE_NAME[$index_current]='HAPROXY' + aSOFTWARE_WHIP_NAME[$index_current]='HaProxy' + aSOFTWARE_WHIP_DESC[$index_current]='High performance TCP/HTTP load balancer' + aSOFTWARE_CATEGORY_INDEX[$index_current]=17 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1 + + #Home automation + #-------------------------------------------------------------------------------- + index_current=99 + + aSOFTWARE_UNIQUE_NAME[$index_current]='EMONHUB' + aSOFTWARE_WHIP_NAME[$index_current]='EmonPi' + aSOFTWARE_WHIP_DESC[$index_current]='Energy usage addon board with web interface' + aSOFTWARE_CATEGORY_INDEX[$index_current]=18 + aSOFTWARE_TYPE[$index_current]=0 + + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - if [[ -f "$FP_INSTALLED_FILE" ]]; then - . "$FP_INSTALLED_FILE" - fi + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - } + done - Install_Dietpi_Software(){ + #------------------ + index_current=100 - #-------------------------------------------------------------- - # Stop Services - /DietPi/dietpi/dietpi-services stop - #-------------------------------------------------------------- - #Text install info vars (for Webserver stacks) - local info_1="LAMP" - local info_2="Apache2" - local info_3="MySql" - local info_4="PHP" - - # Apply all "combo" installs that require webserver stack - # - Installs that require any WEBSERVER_L??P - if (( $DIETPICAM || $LINUXDASH || $PIHOLE || $PHPSYSINFO || $PHPIMAGEGALLERY )); then - - # - Check for existing installations - if (( ! $WEBSERVER_LAMP && ! $WEBSERVER_LASP && ! $WEBSERVER_LAAP && \ - ! $WEBSERVER_LLMP && ! $WEBSERVER_LLSP && ! $WEBSERVER_LLAP && \ - ! $WEBSERVER_LEMP && ! $WEBSERVER_LESP && ! $WEBSERVER_LEAP )); then - - # - None found, Select one for Install, based on user preference - if (( $INDEX_WEBSERVER_TARGET == 0 )); then - WEBSERVER_LASP=1 - elif (( $INDEX_WEBSERVER_TARGET == -1 )); then - WEBSERVER_LESP=1 - elif (( $INDEX_WEBSERVER_TARGET == -2 )); then - WEBSERVER_LLSP=1 - fi + aSOFTWARE_UNIQUE_NAME[$index_current]='GRASSHOPPER' + aSOFTWARE_WHIP_NAME[$index_current]='Grasshopper' + aSOFTWARE_WHIP_DESC[$index_current]='Web App to control Bticino MyHome' + aSOFTWARE_CATEGORY_INDEX[$index_current]=18 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 + aSOFTWARE_REQUIRES_SQLITE[$index_current]=1 - fi - fi + # - Disabled for All non-rpi + for ((i=10; i<=$MAX_HW_MODEL; i++)) + do - # - Installs that require a SQLite stack: WEBSERVER_L?SP - if (( $GRASSHOPPER )); then + aSOFTWARE_AVAIL_HW_MODEL[$index_current,$i]=0 - # - Check for existing installations - if (( ! $WEBSERVER_LASP && ! $WEBSERVER_LLSP && ! $WEBSERVER_LESP )); then + done - if (( $WEBSERVER_LAMP || $WEBSERVER_LAAP )); then - WEBSERVER_LASP=1 - elif (( $WEBSERVER_LLMP || $WEBSERVER_LLAP )); then - WEBSERVER_LLSP=1 - elif (( $WEBSERVER_LEMP || $WEBSERVER_LEAP )); then - WEBSERVER_LESP=1 + #------------------ + + + #-------------------------------------------------------------------------------- + #Additional linux software items + #-------------------------------------------------------------------------------- + + #SSH clients + #-------------------------------------------------------------------------------- + index_current=0 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SSHCLIENT' + aSOFTWARE_WHIP_NAME[$index_current]='OpenSSH' + aSOFTWARE_WHIP_DESC[$index_current]='SSH Client: OpenSSH' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #File server clients + #-------------------------------------------------------------------------------- + index_current=1 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SMBCLIENT' + aSOFTWARE_WHIP_NAME[$index_current]='Samba' + aSOFTWARE_WHIP_DESC[$index_current]='Samba Client: Access Network Shares' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=2 + + aSOFTWARE_UNIQUE_NAME[$index_current]='CURLFTPFS' + aSOFTWARE_WHIP_NAME[$index_current]='Curlftpfs' + aSOFTWARE_WHIP_DESC[$index_current]='FTP Client: Allows filesystem mount' + aSOFTWARE_CATEGORY_INDEX[$index_current]=1 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #File managers + #-------------------------------------------------------------------------------- + index_current=3 + + aSOFTWARE_UNIQUE_NAME[$index_current]='MIDNIGHTCOMMANDER' + aSOFTWARE_WHIP_NAME[$index_current]='MC' + aSOFTWARE_WHIP_DESC[$index_current]='Midnight Commander, powerful file manager' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=4 + + aSOFTWARE_UNIQUE_NAME[$index_current]='VIFM' + aSOFTWARE_WHIP_NAME[$index_current]='ViFM' + aSOFTWARE_WHIP_DESC[$index_current]='File Manager with Vi bindings' + aSOFTWARE_CATEGORY_INDEX[$index_current]=2 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #System + #-------------------------------------------------------------------------------- + index_current=5 + + aSOFTWARE_UNIQUE_NAME[$index_current]='ALSABASE' + aSOFTWARE_WHIP_NAME[$index_current]='ALSA' + aSOFTWARE_WHIP_DESC[$index_current]='Linux Sound System' + aSOFTWARE_CATEGORY_INDEX[$index_current]=3 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=6 + + aSOFTWARE_UNIQUE_NAME[$index_current]='XSERVERXORG' + aSOFTWARE_WHIP_NAME[$index_current]='Xserver' + aSOFTWARE_WHIP_DESC[$index_current]='Linux Display System' + aSOFTWARE_CATEGORY_INDEX[$index_current]=3 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #Shared Libs + #-------------------------------------------------------------------------------- + index_current=7 + + aSOFTWARE_UNIQUE_NAME[$index_current]='FFMPEG' + aSOFTWARE_WHIP_NAME[$index_current]='FFmpeg' + aSOFTWARE_WHIP_DESC[$index_current]='Audio & Visual Libary' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=8 + + aSOFTWARE_UNIQUE_NAME[$index_current]='ORACLEJAVA' + aSOFTWARE_WHIP_NAME[$index_current]='Java' + aSOFTWARE_WHIP_DESC[$index_current]='Oracle Java 8 JDK/JRE libary' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=9 + + aSOFTWARE_UNIQUE_NAME[$index_current]='NODEJS' + aSOFTWARE_WHIP_NAME[$index_current]='Node.js' + aSOFTWARE_WHIP_DESC[$index_current]='Javascript Runtime' + aSOFTWARE_CATEGORY_INDEX[$index_current]=4 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #Network tools + #-------------------------------------------------------------------------------- + index_current=10 + + aSOFTWARE_UNIQUE_NAME[$index_current]='IFTOP' + aSOFTWARE_WHIP_NAME[$index_current]='iftop' + aSOFTWARE_WHIP_DESC[$index_current]='Displays bandwidth usage information' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=11 + + aSOFTWARE_UNIQUE_NAME[$index_current]='IPTRAF' + aSOFTWARE_WHIP_NAME[$index_current]='IPTraf' + aSOFTWARE_WHIP_DESC[$index_current]='Interactive Colorful IP LAN Monitor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=12 + + aSOFTWARE_UNIQUE_NAME[$index_current]='IPERF' + aSOFTWARE_WHIP_NAME[$index_current]='Iperf' + aSOFTWARE_WHIP_DESC[$index_current]='Internet Protocol bandwidth measuring tool' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=13 + + aSOFTWARE_UNIQUE_NAME[$index_current]='MTRTINY' + aSOFTWARE_WHIP_NAME[$index_current]='MTR-Tiny' + aSOFTWARE_WHIP_DESC[$index_current]='Full screen ncurses traceroute tool' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=14 + + aSOFTWARE_UNIQUE_NAME[$index_current]='NLOAD' + aSOFTWARE_WHIP_NAME[$index_current]='nLoad' + aSOFTWARE_WHIP_DESC[$index_current]='Realtime console network usage monitor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=15 + + aSOFTWARE_UNIQUE_NAME[$index_current]='TCPDUMP' + aSOFTWARE_WHIP_NAME[$index_current]='tcpdump' + aSOFTWARE_WHIP_DESC[$index_current]='Command-line network traffic analyzer' + aSOFTWARE_CATEGORY_INDEX[$index_current]=5 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #Development / Programming + #-------------------------------------------------------------------------------- + index_current=16 + + aSOFTWARE_UNIQUE_NAME[$index_current]='BUILDESSENTIAL' + aSOFTWARE_WHIP_NAME[$index_current]='Build tools' + aSOFTWARE_WHIP_DESC[$index_current]='Build-Essentials' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=17 + + aSOFTWARE_UNIQUE_NAME[$index_current]='GITCLIENT' + aSOFTWARE_WHIP_NAME[$index_current]='Git' + aSOFTWARE_WHIP_DESC[$index_current]='Git Client' + aSOFTWARE_CATEGORY_INDEX[$index_current]=6 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #Text Editors + #-------------------------------------------------------------------------------- + index_current=18 + + aSOFTWARE_UNIQUE_NAME[$index_current]='GNUEMACS' + aSOFTWARE_WHIP_NAME[$index_current]='Emacs' + aSOFTWARE_WHIP_DESC[$index_current]='GNU Emacs editor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=7 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=19 + + aSOFTWARE_UNIQUE_NAME[$index_current]='JED' + aSOFTWARE_WHIP_NAME[$index_current]='Jed' + aSOFTWARE_WHIP_DESC[$index_current]='Editor for programmers' + aSOFTWARE_CATEGORY_INDEX[$index_current]=7 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=20 + + aSOFTWARE_UNIQUE_NAME[$index_current]='VIMFULL' + aSOFTWARE_WHIP_NAME[$index_current]='Vim' + aSOFTWARE_WHIP_DESC[$index_current]='Vi Enhanced Text Editor' + aSOFTWARE_CATEGORY_INDEX[$index_current]=7 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + index_current=21 + + aSOFTWARE_UNIQUE_NAME[$index_current]='VIMTINY' + aSOFTWARE_WHIP_NAME[$index_current]='Vim-Tiny' + aSOFTWARE_WHIP_DESC[$index_current]='Compact release of Vim' + aSOFTWARE_CATEGORY_INDEX[$index_current]=7 + aSOFTWARE_TYPE[$index_current]=1 + #------------------ + + #Desktop Utilities + #-------------------------------------------------------------------------------- + index_current=22 + + aSOFTWARE_UNIQUE_NAME[$index_current]='QUITERSS' + aSOFTWARE_WHIP_NAME[$index_current]='QuiteRSS' + aSOFTWARE_WHIP_DESC[$index_current]='Cross-Platform, Free RSS Reader' + aSOFTWARE_CATEGORY_INDEX[$index_current]=8 + aSOFTWARE_TYPE[$index_current]=1 + aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1 + + #------------------ + + #-------------------------------------------------------------------------------- + #Logging (hidden) + #-------------------------------------------------------------------------------- + index_current=101 + + aSOFTWARE_UNIQUE_NAME[$index_current]='LOGGING_LOGROTATE' + aSOFTWARE_WHIP_NAME[$index_current]='Log Rotate' + aSOFTWARE_WHIP_DESC[$index_current]='Rotates log files' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=-1 + #------------------ + index_current=102 + + aSOFTWARE_UNIQUE_NAME[$index_current]='LOGGING_RSYSLOG' + aSOFTWARE_WHIP_NAME[$index_current]='Rsyslog' + aSOFTWARE_WHIP_DESC[$index_current]='System logging' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=-1 + #------------------ + index_current=103 + + aSOFTWARE_UNIQUE_NAME[$index_current]='LOGGING_RAMLOG' + aSOFTWARE_WHIP_NAME[$index_current]='DietPi-Ramlog' + aSOFTWARE_WHIP_DESC[$index_current]='Minimal Logging' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=-1 + #------------------ + + #-------------------------------------------------------------------------------- + #SSH servers (hidden) + #-------------------------------------------------------------------------------- + index_current=104 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SSHSERVER_DROPBEAR' + aSOFTWARE_WHIP_NAME[$index_current]='Dropbear' + aSOFTWARE_WHIP_DESC[$index_current]='SSH server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=-1 + #------------------ + index_current=105 + + aSOFTWARE_UNIQUE_NAME[$index_current]='SSHSERVER_OPENSSH' + aSOFTWARE_WHIP_NAME[$index_current]='OpenSSH' + aSOFTWARE_WHIP_DESC[$index_current]='SSH server' + aSOFTWARE_CATEGORY_INDEX[$index_current]=0 + aSOFTWARE_TYPE[$index_current]=-1 + #------------------ + + #-------------------------------------------------------------------------------- + #Total software installations + TOTAL_SOFTWARE_INDEXS=${#aSOFTWARE_UNIQUE_NAME[@]} + #-------------------------------------------------------------------------------- + #Init Installed state - 0=not 1=to be 2=installed + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - # - None found, Select one for Install, based on user preference - else - if (( $INDEX_WEBSERVER_TARGET == 0 )); then - WEBSERVER_LASP=1 - elif (( $INDEX_WEBSERVER_TARGET == -1 )); then - WEBSERVER_LESP=1 - elif (( $INDEX_WEBSERVER_TARGET == -2 )); then - WEBSERVER_LLSP=1 - fi - fi - fi - fi + aSOFTWARE_INSTALL_STATE[$i]=0 - # - Installs that require a MySQL stack: WEBSERVER_L?[MA]P - if (( $OWNCLOUD || $PHPBB || $WORDPRESS || $AMPACHE || $PYDIO || $BAIKAL || $WEBSERVER_MYADMINPHP )); then + done - # - Check for existing installations - if (( ! $WEBSERVER_LAMP && ! $WEBSERVER_LAAP && \ - ! $WEBSERVER_LLMP && ! $WEBSERVER_LLAP && \ - ! $WEBSERVER_LEMP && ! $WEBSERVER_LEAP )); then + #Set installed for software on DietPi image by default. + aSOFTWARE_INSTALL_STATE[103]=2 + aSOFTWARE_INSTALL_STATE[104]=2 + #-------------------------------------------------------------------------------- - if (( $WEBSERVER_LASP )); then - WEBSERVER_LAMP=1 - elif (( $WEBSERVER_LLSP )); then - WEBSERVER_LLMP=1 - elif (( $WEBSERVER_LESP )); then - WEBSERVER_LEMP=1 + } - # - None found, Select one for Install, based on user preference - else - if (( $INDEX_WEBSERVER_TARGET == 0 )); then - WEBSERVER_LAMP=1 - elif (( $INDEX_WEBSERVER_TARGET == -1 )); then - WEBSERVER_LEMP=1 - elif (( $INDEX_WEBSERVER_TARGET == -2 )); then - WEBSERVER_LLMP=1 - fi - fi - fi - fi + Software_Arrays_Destroy(){ + + unset aSOFTWARE_CATEGORIES_DIETPI + unset aSOFTWARE_CATEGORIES_LINUX + + unset aSOFTWARE_CATEGORY_INDEX + unset aSOFTWARE_TYPE + unset aSOFTWARE_WHIP_NAME + unset aSOFTWARE_WHIP_DESC + unset aSOFTWARE_UNIQUE_NAME + unset aSOFTWARE_INSTALL_STATE + + unset aSOFTWARE_REQUIRES_ALSA + unset aSOFTWARE_REQUIRES_XSERVERXORG + unset aSOFTWARE_REQUIRES_MYSQL + unset aSOFTWARE_REQUIRES_SQLITE + unset aSOFTWARE_REQUIRES_WEBSERVER + unset aSOFTWARE_REQUIRES_DESKTOP + unset aSOFTWARE_REQUIRES_GIT + unset aSOFTWARE_REQUIRES_BUILDESSENTIAL + unset aSOFTWARE_REQUIRES_RSYSLOG + unset aSOFTWARE_REQUIRES_FFMPEG + unset aSOFTWARE_REQUIRES_ORACLEJAVA + unset aSOFTWARE_REQUIRES_NODEJS + + unset aSOFTWARE_AVAIL_HW_MODEL + unset aSOFTWARE_AVAIL_HW_ARCH - #Define extra DietPi install flags for WEBSERVER_STACKS - if (( $WEBSERVER_LLAP == 1 )); then - WEBSERVER_LIGHTTPD=1 - WEBSERVER_MARIADB=1 - WEBSERVER_PHP=1 - info_1="LLAP" - info_2="Lighttpd" - info_3="MariaDB" - info_4="PHP" - fi - - if (( $WEBSERVER_LLSP == 1 )); then - WEBSERVER_LIGHTTPD=1 - WEBSERVER_SQLITE=1 - WEBSERVER_PHP=1 - info_1="LLSP" - info_2="Lighttpd" - info_3="SQLite" - info_4="PHP" - fi - - if (( $WEBSERVER_LLMP == 1 )); then - WEBSERVER_LIGHTTPD=1 - WEBSERVER_MYSQL=1 - WEBSERVER_PHP=1 - info_1="LLMP" - info_2="Lighttpd" - info_3="MySql" - info_4="PHP" - fi - - if (( $WEBSERVER_LEAP == 1 )); then - WEBSERVER_NGINX=1 - WEBSERVER_MARIADB=1 - WEBSERVER_PHP=1 - info_1="LEAP" - info_2="Nginx" - info_3="MariaDB" - info_4="PHP" - fi - - if (( $WEBSERVER_LESP == 1 )); then - WEBSERVER_NGINX=1 - WEBSERVER_SQLITE=1 - WEBSERVER_PHP=1 - info_1="LESP" - info_2="Nginx" - info_3="SQLite" - info_4="PHP" - fi - - if (( $WEBSERVER_LEMP == 1 )); then - WEBSERVER_NGINX=1 - WEBSERVER_MYSQL=1 - WEBSERVER_PHP=1 - info_1="LEMP" - info_2="Nginx" - info_3="MySql" - info_4="PHP" - fi - - if (( $WEBSERVER_LAAP == 1 )); then - WEBSERVER_APACHE=1 - WEBSERVER_MARIADB=1 - WEBSERVER_PHP=1 - info_1="LAAP" - info_2="Apache2" - info_3="MariaDB" - info_4="PHP" - fi - - if (( $WEBSERVER_LASP == 1 )); then - WEBSERVER_APACHE=1 - WEBSERVER_SQLITE=1 - WEBSERVER_PHP=1 - info_1="LASP" - info_2="Apache2" - info_3="SQLite" - info_4="PHP" - fi - - if (( $WEBSERVER_LAMP == 1 )); then - WEBSERVER_APACHE=1 - WEBSERVER_MYSQL=1 - WEBSERVER_PHP=1 - info_1="LAMP" - info_2="Apache2" - info_3="MySql" - info_4="PHP" - fi + } - #-------------------------------------------------------------- - #Install Software + #Work out which additional software we need to install + Install_Flag_Prereq_Software(){ - #Installs that require a DESKTOP - if (( $TIGHTVNCSERVER == 1 || $VNC4SERVER == 1 || $XRDP == 1 || $NOMACHINE == 1 || $QUITERSS == 1 )); then + #WEBSERVER - Manual stack install + # - Define extra DietPi install flags for WEBSERVER_STACKS + #LLAP + if (( ${aSOFTWARE_INSTALL_STATE[82]} == 1 )); then + aSOFTWARE_INSTALL_STATE[84]=1 + aSOFTWARE_INSTALL_STATE[88]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi - # - If no desktop is selected or installed (0), default to LXDE - if (( ! $DESKTOP_LXDE && ! $DESKTOP_MATE && ! $DESKTOP_GNUSTEP && ! $DESKTOP_XFCE )); then + #LLSP + if (( ${aSOFTWARE_INSTALL_STATE[81]} == 1 )); then + aSOFTWARE_INSTALL_STATE[84]=1 + aSOFTWARE_INSTALL_STATE[87]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi - DESKTOP_LXDE=1 + #LLMP + if (( ${aSOFTWARE_INSTALL_STATE[80]} == 1 )); then + aSOFTWARE_INSTALL_STATE[84]=1 + aSOFTWARE_INSTALL_STATE[86]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi - fi + #LEAP + if (( ${aSOFTWARE_INSTALL_STATE[79]} == 1 )); then + aSOFTWARE_INSTALL_STATE[85]=1 + aSOFTWARE_INSTALL_STATE[88]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi + #LESP + if (( ${aSOFTWARE_INSTALL_STATE[78]} == 1 )); then + aSOFTWARE_INSTALL_STATE[85]=1 + aSOFTWARE_INSTALL_STATE[87]=1 + aSOFTWARE_INSTALL_STATE[89]=1 fi - #Desktop LXDE - if (( $DESKTOP_LXDE == 1 )); then - INSTALL_DESCRIPTION='Desktop (LXDE)' - Banner_Installing + #LEMP + if (( ${aSOFTWARE_INSTALL_STATE[77]} == 1 )); then + aSOFTWARE_INSTALL_STATE[85]=1 + aSOFTWARE_INSTALL_STATE[86]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi - AGI lxde upower policykit-1 iceweasel p7zip-full --no-install-recommends - #upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ...... + #LAAP + if (( ${aSOFTWARE_INSTALL_STATE[76]} == 1 )); then + aSOFTWARE_INSTALL_STATE[83]=1 + aSOFTWARE_INSTALL_STATE[88]=1 + aSOFTWARE_INSTALL_STATE[89]=1 fi - #Desktop MATE - if (( $DESKTOP_MATE == 1 )); then - INSTALL_DESCRIPTION="Desktop (MATE)" - Banner_Installing + #LASP + if (( ${aSOFTWARE_INSTALL_STATE[75]} == 1 )); then + aSOFTWARE_INSTALL_STATE[83]=1 + aSOFTWARE_INSTALL_STATE[87]=1 + aSOFTWARE_INSTALL_STATE[89]=1 + fi - AGI mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full --no-install-recommends + #LAMP + if (( ${aSOFTWARE_INSTALL_STATE[74]} == 1 )); then + aSOFTWARE_INSTALL_STATE[83]=1 + aSOFTWARE_INSTALL_STATE[86]=1 + aSOFTWARE_INSTALL_STATE[89]=1 fi - #Desktop GNUStep - if (( $DESKTOP_GNUSTEP == 1 )); then - INSTALL_DESCRIPTION="Desktop (GNUStep)" - Banner_Installing + #WEBSERVER - Auto install via choice system + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - AGI x-window-system-core wmaker gnustep gnustep-devel gnustep-games libc-dbg upower policykit-1 iceweasel p7zip-full --no-install-recommends - fi + if (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #DESKTOP_XFCE - if (( $DESKTOP_XFCE == 1 )); then - INSTALL_DESCRIPTION='Desktop (XFCE)' - Banner_Installing + # - Check for existing webserver base (eg: apache2/nginx) installation + #FOURDEE: We may want to check dpkg for installed packages also? + if (( ! ${aSOFTWARE_INSTALL_STATE[83]} && + ! ${aSOFTWARE_INSTALL_STATE[84]} && + ! ${aSOFTWARE_INSTALL_STATE[85]} )); then - AGI xfce4 gnome-icon-theme tango-icon-theme iceweasel p7zip-full --no-install-recommends + # - None found, Select one for Install, based on user preference + if (( $INDEX_WEBSERVER_TARGET == 0 )); then - fi + #WEBSERVER_APACHE + aSOFTWARE_INSTALL_STATE[83]=1 + /DietPi/dietpi/func/dietpi-notify 2 "Apache2 will be installed" - #XRDP - if (( $XRDP == 1 )); then - INSTALL_DESCRIPTION="XRDP (Remote Desktop Server)" - Banner_Installing + elif (( $INDEX_WEBSERVER_TARGET == -1 )); then - AGI xrdp - fi + #WEBSERVER_NGINX + aSOFTWARE_INSTALL_STATE[85]=1 + /DietPi/dietpi/func/dietpi-notify 2 "Nginx will be installed" - #NOMACHINE - if (( $NOMACHINE == 1 )); then - # NoMachine Supports many, many architectures and operating systems - # The following link can be used as a reference: - # https://www.nomachine.com/download/linux&id=1 - INSTALL_DESCRIPTION="NoMachine (Secure RDP Server & Client)" - Banner_Installing + elif (( $INDEX_WEBSERVER_TARGET == -2 )); then - #x86_32 - As was said (you never know) - if (( $HW_ARCH == 20 )); then - INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_i386.deb" - #x86_64 - elif (( $HW_ARCH == 21 )); then - INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_amd64.deb" - #arm6 (RPi1) - elif (( $HW_ARCH == 1 )); then - INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_6_armv6hf.deb" - #arm7+ (RPi 2/3) - elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_5_armhf.deb" - fi + #WEBSERVER_LIGHTTPD + aSOFTWARE_INSTALL_STATE[84]=1 + /DietPi/dietpi/func/dietpi-notify 2 "Lighttpd will be installed" - # Now, check that the links are legitimate - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + fi - if (( $? == 0 )); then + # - Always install WEBSERVER_PHP + aSOFTWARE_INSTALL_STATE[89]=1 + /DietPi/dietpi/func/dietpi-notify 2 "PHP will be installed" - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + fi - else - Error_NoConnection_NoInstall + break - # ABORT INSTALLATION - NOMACHINE=0 fi - fi - - #BitTorrent Transmission - if (( $TRANSMISSION == 1 )); then - INSTALL_DESCRIPTION='BitTorrent (Transmission)' - Banner_Installing - AGI transmission-daemon - fi + done - #ProFTPd - if (( $FILESERVER_PROFTP == 1 )); then - INSTALL_DESCRIPTION='FTP Server (Proftp)' - Banner_Installing + #WEBSERVER_MYSQL + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - echo -e "proftpd-basic shared/proftpd/inetd_or_standalone select standalone" | debconf-set-selections - AGI proftpd-basic - fi + if (( ${aSOFTWARE_REQUIRES_MYSQL[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #Samba Server - if (( $FILESERVER_SAMBA == 1 )); then - INSTALL_DESCRIPTION='Samba File Server' - Banner_Installing - AGI samba samba-common-bin --no-install-recommends + # - Check for existing mysql/mariaDB installations + if (( ! ${aSOFTWARE_INSTALL_STATE[86]} && + ! ${aSOFTWARE_INSTALL_STATE[88]} )); then - fi + #WEBSERVER_MYSQL + aSOFTWARE_INSTALL_STATE[86]=1 - #vsFTPD - if (( $FILESERVER_VSFTPD == 1 )); then - INSTALL_DESCRIPTION='FTP Server (vsFTPD)' - Banner_Installing + /DietPi/dietpi/func/dietpi-notify 2 "MySQL will be installed" - AGI vsftpd --no-install-recommends + fi - fi + break - #WEBSERVER_APACHE - if (( $WEBSERVER_APACHE == 1 )); then + fi - INSTALL_DESCRIPTION="$info_1: ($info_2) / $info_3 / $info_4" - Banner_Installing - AGI apache2 - fi + done - #WEBSERVER_NGINX - if (( $WEBSERVER_NGINX == 1 )); then + #WEBSERVER_SQLITE + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - INSTALL_DESCRIPTION="$info_1: ($info_2) / $info_3 / $info_4" - Banner_Installing - AGI nginx xml-core --no-install-recommends - fi + if (( ${aSOFTWARE_REQUIRES_SQLITE[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #WEBSERVER_LIGHTTPD - if (( $WEBSERVER_LIGHTTPD == 1 )); then + #WEBSERVER_SQLITE + aSOFTWARE_INSTALL_STATE[87]=1 - INSTALL_DESCRIPTION="$info_1: ($info_2) / $info_3 / $info_4" - Banner_Installing - AGI lighttpd - fi + /DietPi/dietpi/func/dietpi-notify 2 "SQlite will be installed" - #Programs that require just MYSQL or MARIADB - if (( ! $WEBSERVER_MYSQL && ! $WEBSERVER_MARIADB )); then + break - if (( $GOGS == 1 )); then - WEBSERVER_MYSQL=1 fi - fi + done - #WEBSERVER_MYSQL - if (( $WEBSERVER_MYSQL == 1 )); then - INSTALL_DESCRIPTION="$info_1: $info_2 / ($info_3) / $info_4" - Banner_Installing + #WEBSERVER - Check for stacks and flag as installing + #WEBSERVER_APACHE + if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then - echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections - echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections + #MySQL + if (( ${aSOFTWARE_INSTALL_STATE[86]} >= 1 )); then - AGI mysql-server mysql-client + #WEBSERVER_LAMP + aSOFTWARE_INSTALL_STATE[74]=1 - # Fix depricated key_buffer -> key_buffer_size per MySQL 5.x notification - sed -i 's/key_buffer/key_buffer_size/g' /etc/mysql/my.cnf + fi - # Restart the service and install the client - service mysql restart + #SQLite + if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )); then - fi + #WEBSERVER_LASP + aSOFTWARE_INSTALL_STATE[75]=1 - #WEBSERVER_MARIADB - if (( $WEBSERVER_MARIADB == 1 )); then - INSTALL_DESCRIPTION="$info_1: $info_2 / ($info_3) / $info_4" - Banner_Installing + fi - echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections - echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections + #MariaDB + if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )); then - AGI mariadb-server mariadb-client - fi + #WEBSERVER_LAAP + aSOFTWARE_INSTALL_STATE[76]=1 - #WEBSERVER_SQLITE - if (( $WEBSERVER_SQLITE == 1 )); then - INSTALL_DESCRIPTION="$info_1: $info_2 / ($info_3) / $info_4" - Banner_Installing - AGI sqlite3 - fi + fi - #WEBSERVER_REDIS - if (( $WEBSERVER_REDIS == 1 )); then - INSTALL_DESCRIPTION="Redis Server" - Banner_Installing - AGI redis-server - fi + #WEBSERVER_NGINX + elif (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then - #WEBSERVER_PHP - if (( $WEBSERVER_PHP == 1 )); then - INSTALL_DESCRIPTION="$info_1: $info_2 / $info_3 / ($info_4)" - Banner_Installing + #MySQL + if (( ${aSOFTWARE_INSTALL_STATE[86]} >= 1 )); then - #Install base PHP packages/modules. - if (( $WEBSERVER_APACHE == 1 )); then - AGI php5 libapache2-mod-php5 - else - AGI php5-fpm php5-cgi php5-xsl - fi + #WEBSERVER_LEMP + aSOFTWARE_INSTALL_STATE[77]=1 - #php-SQL modules - if (( $WEBSERVER_MYSQL == 1 )); then - AGI php5-mysql - elif (( $WEBSERVER_MARIADB == 1 )); then - AGI php5-mysqlnd fi - if (( $WEBSERVER_SQLITE == 1 )); then - AGI php5-sqlite - fi + #SQLite + if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )); then + + #WEBSERVER_LESP + aSOFTWARE_INSTALL_STATE[78]=1 - #Redis php5 module | >= 1 to check for existing installs (2) - if (( $WEBSERVER_REDIS >= 1 )); then - AGI php5-redis fi + #MariaDB + if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )); then + + #WEBSERVER_LEAP + aSOFTWARE_INSTALL_STATE[79]=1 - #Wheezy - APC - if (( $DISTRO == 1 )); then - AGI php-apc - #Jessie - APCu - else - AGI php5-apcu fi - fi - #WEBSERVER_MYADMINPHP - if (( $WEBSERVER_MYADMINPHP == 1 )); then - INSTALL_DESCRIPTION='phpMyAdmin' - Banner_Installing + #WEBSERVER_LIGHTTPD + elif (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 )); then - #Mysql must be running during install to allow debconf setup. - service mysql restart + #MySQL + if (( ${aSOFTWARE_INSTALL_STATE[86]} >= 1 )); then - # Set password parameters before installing - echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections - echo "phpmyadmin phpmyadmin/app-password-confirm password dietpi" | debconf-set-selections - echo "phpmyadmin phpmyadmin/mysql/admin-pass password dietpi" | debconf-set-selections - echo "phpmyadmin phpmyadmin/mysql/app-pass password dietpi" | debconf-set-selections + #WEBSERVER_LLMP + aSOFTWARE_INSTALL_STATE[80]=1 - if (( $WEBSERVER_APACHE == 1 )); then - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections - elif (( $WEBSERVER_LIGHTTPD == 1 )); then - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd" | debconf-set-selections - else - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections fi - AGI phpmyadmin - fi + #SQLite + if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )); then - #Forums PHPBB - if (( $PHPBB == 1 )); then - INSTALL_DESCRIPTION='phpBB3 Forums' - Banner_Installing + #WEBSERVER_LLSP + aSOFTWARE_INSTALL_STATE[81]=1 - INSTALL_URL_ADDRESS='https://www.phpbb.com/files/release/phpBB-3.1.6.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Install - if (( $? == 0 )); then + fi - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www - rm package.zip + #MariaDB + if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )); then - else - Error_NoConnection_NoInstall + #WEBSERVER_LLAP + aSOFTWARE_INSTALL_STATE[82]=1 - #Abort failed install - PHPBB=0 fi + fi - #OPENBAZAAR - if (( $OPENBAZAAR == 1 )); then + #DESKTOP + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - INSTALL_DESCRIPTION='OpenBazaar' - Banner_Installing + if (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - INSTALL_URL_ADDRESS='https://github.com/OpenBazaar/OpenBazaar-Server.git' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Install + # - If no desktop is selected or installed (0), default to LXDE + if (( ! ${aSOFTWARE_INSTALL_STATE[23]} && + ! ${aSOFTWARE_INSTALL_STATE[24]} && + ! ${aSOFTWARE_INSTALL_STATE[25]} && + ! ${aSOFTWARE_INSTALL_STATE[26]} )); then - if (( $? == 0 )); then + aSOFTWARE_INSTALL_STATE[23]=1 + /DietPi/dietpi/func/dietpi-notify 2 "LXDE desktop will be installed" - AGI libsodium-dev automake autoconf pkg-config libtool libssl-dev libffi-dev python-dev openssl python-pip libzmq3-dev + fi - #Not required. - #AGI software-properties-common - #add-apt-repository -y ppa:chris-lea/libsodium - #apt-get update + break - pip install cryptography + fi + done - cd "$HOME" - git clone --depth 1 https://github.com/zeromq/libzmq - git clone --depth 1 https://github.com/pyca/pynacl/ - git clone --depth 1 "$INSTALL_URL_ADDRESS" + #GIT + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - # - compile - cd "$HOME"/libzmq - ./autogen.sh && ./configure && make -j "$(nproc --all)" - make check && make install && ldconfig + if (( ${aSOFTWARE_REQUIRES_GIT[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - cd "$HOME"/pynacl - python setup.py build && python setup.py install + # - Flag for install + aSOFTWARE_INSTALL_STATE[17]=1 - cd "$HOME" + /DietPi/dietpi/func/dietpi-notify 2 "Git will be installed" - # - Move OpenBazaar to a 'better' location - mkdir -p /etc/openbazaar-server - mv "$HOME"/OpenBazaar-Server/* /etc/openbazaar-server/ - rm -R "$HOME"/OpenBazaar-Server + break - # - install OpenBazaar - cd /etc/openbazaar-server - pip install -r requirements.txt + fi - cd "$HOME" + done - # - Clean up, remove source libaries - rm -R "$HOME"/libzmq - rm -R "$HOME"/pynacl + #BUILDESSENTIAL + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + if (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - else + # - Flag for install + aSOFTWARE_INSTALL_STATE[16]=1 - Error_NoConnection_NoInstall - OPENBAZAAR=0 + /DietPi/dietpi/func/dietpi-notify 2 "Build-Essential will be installed" + + break fi + done - fi + #RSYSLOG + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + if (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #OwnCloud - if (( $OWNCLOUD == 1 )); then - INSTALL_DESCRIPTION='OwnCloud' - Banner_Installing + # - Flag for install + aSOFTWARE_INSTALL_STATE[102]=1 + + /DietPi/dietpi/func/dietpi-notify 2 "Rsyslog will be installed" + + break - #Wheezy - if (( $DISTRO == 1 )); then - INSTALL_URL_ADDRESS='http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/' - #Jessie - elif (( $DISTRO == 3 )); then - INSTALL_URL_ADDRESS='http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_8.0/' fi - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Install - if (( $? == 0 )); then + done - if [ ! -f /etc/apt/sources.list.d/owncloud.list ]; then - echo "deb $INSTALL_URL_ADDRESS /" > /etc/apt/sources.list.d/owncloud.list - wget "$INSTALL_URL_ADDRESS"Release.key - apt-key add - < Release.key + #FFMPEG + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - apt-get update - fi + if (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - AGI owncloud --force-yes + # - Flag for install + aSOFTWARE_INSTALL_STATE[7]=1 - else - Error_NoConnection_NoInstall + /DietPi/dietpi/func/dietpi-notify 2 "FFmpeg will be installed" + + break - #Abort failed install - OWNCLOUD=0 fi - fi + done - #Hifi - if (( $HIFI == 1 )); then - INSTALL_DESCRIPTION='Hifi / Web Interface Music Player (Mpd Ympd)' - Banner_Installing + #ORACLEJAVA + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - #ympd - # - armhf - if (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then + if (( ${aSOFTWARE_REQUIRES_ORACLEJAVA[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - INSTALL_URL_ADDRESS='http://www.ympd.org/downloads/ympd-1.2.3-armhf.tar.bz2' + # - Flag for install + aSOFTWARE_INSTALL_STATE[8]=1 - # - arm64 - elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + /DietPi/dietpi/func/dietpi-notify 2 "Oracle Java will be installed" - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/ympd-1.2.3-arm64.tar.bz2' + break fi - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Install - if (( $? == 0 )); then + done - #Install ympd - wget "$INSTALL_URL_ADDRESS" - tar -xvf ympd-* - rm ympd-* - mv ympd /usr/bin/ympd + #NODEJS + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - #Install MPD - AGI libmpdclient2 + if (( ${aSOFTWARE_REQUIRES_NODEJS[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - # - arm64 - if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + # - Flag for install + aSOFTWARE_INSTALL_STATE[9]=1 - # - additional preqs - #AGI libsmbclient libcurl4-gnutls-dev libmodplug1 libfaad2 libmpcdec6 libavformat56 libupnp6 libnfs4 libflac8 libyajl2 libvorbisfile3 libsndfile1 libaudiofile1 libgme0 libsidplay2 libresid-builder0c2a libsidutils0 libfluidsynth1 libWildMidi1 libwavpack1 libmad0 libmpg123-0 + /DietPi/dietpi/func/dietpi-notify 2 "NodeJS will be installed" - # - Install same dev packages as per a compile to ensure libary's are available. - AGI libmad0-dev libmpg123-dev libid3tag0-dev libflac-dev libvorbis-dev libopus-dev libaudiofile-dev libsndfile1-dev libfaad-dev libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev libmpcdec-dev libwavpack-dev libwildmidi-dev libsidplay2-dev libsidutils-dev libresid-builder-dev libavcodec-dev libavformat-dev libmp3lame-dev libsamplerate0-dev libsoxr-dev libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev libzzip-dev libcurl4-gnutls-dev libyajl-dev libexpat-dev libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev libpulse-dev libroar-dev libshout3-dev libnfs-dev libsmbclient-dev libupnp-dev libavahi-client-dev libsqlite3-dev libsystemd-daemon-dev libwrap0-dev libcppunit-dev xmlto libboost-dev libicu-dev + break - wget http://dietpi.com/downloads/binaries/all/mpd_0.19.16_arm64.deb -O package.deb - dpkg -i package.deb - rm package.deb + fi - # - everything else - else + done - AGI mpd + #ALSA + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - fi + if (( ${aSOFTWARE_REQUIRES_ALSA[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then + # - Flag for install + aSOFTWARE_INSTALL_STATE[5]=1 - else - Error_NoConnection_NoInstall + /DietPi/dietpi/func/dietpi-notify 2 "Alsa will be installed" - #Abort failed install - HIFI=0 - fi - fi + break - #Kodi - if (( $KODI == 1 )); then - INSTALL_DESCRIPTION='Kodi' - Banner_Installing + fi - #Wheezy - if (( $DISTRO == 1 )); then + done - if (( $HW_MODEL < 10 )); then + #XSERVERXORG + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - #check source is online - INSTALL_URL_ADDRESS='http://archive.mene.za.net/raspbian' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + if (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]} && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #Install - if (( $? == 0 )); then - #Check if apt address and key needs adding - if (( $(cat /etc/apt/sources.list.d/mene.list | grep -ci -m1 'http://archive.mene.za.net/raspbian') == 0 )); then - echo -e 'deb http://archive.mene.za.net/raspbian wheezy contrib' >> /etc/apt/sources.list.d/mene.list - apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED - fi + # - Flag for install + aSOFTWARE_INSTALL_STATE[6]=1 - apt-get update + /DietPi/dietpi/func/dietpi-notify 2 "Xserver will be installed" - INSTALL_DESCRIPTION='Kodi (Michael Gorven Repo)' - Banner_Installing + break - AGI kodi + fi - else - Error_NoConnection_NoInstall + done - #Abort failed install - KODI=0 - fi - fi + } - #Jessie - elif (( $DISTRO == 3 )); then + Create_Desktop_DietPi_Applications(){ - #Odroids - if (( $HW_MODEL >= 10 )) && (( $HW_MODEL < 20 )); then - AGI kodi-odroid + #Copy DietPi favourite links + cp /DietPi/dietpi/conf/desktop/.gtk-bookmarks "$HOME"/.gtk-bookmarks - #XU4 - requires pulse audio (fixes corrupt sound) - if (( $HW_MODEL == 11 )); then - AGI pulseaudio --no-install-recommends - fi + #Create Desktop SymLinks + mkdir -p "$HOME"/Desktop + ln -sf /usr/share/applications/htop.desktop "$HOME"/Desktop/htop.desktop - #Everything else - else - AGI kodi - fi + #DietPi Desktop symlinks + ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop "$HOME"/Desktop/dietpi-software.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop "$HOME"/Desktop/dietpi-config.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop "$HOME"/Desktop/dietpi-launcher.desktop - #libcurl3-gnutls required for C2. But lets apply to all: https://github.com/Fourdee/DietPi/issues/446 - AGI libcurl3-gnutls + #DietPi Menu symlinks + mkdir -p /usr/share/applications + ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop /usr/share/applications/dietpi-software.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-update.desktop /usr/share/applications/dietpi-update.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop /usr/share/applications/dietpi-config.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-uninstall.desktop /usr/share/applications/dietpi-uninstall.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-backup.desktop /usr/share/applications/dietpi-backup.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-sync.desktop /usr/share/applications/dietpi-sync.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-bugreport.desktop /usr/share/applications/dietpi-bugreport.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-process_tool.desktop /usr/share/applications/dietpi-process_tool.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-cleaner.desktop /usr/share/applications/dietpi-cleaner.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-cron.desktop /usr/share/applications/dietpi-cron.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop /usr/share/applications/dietpi-launcher.desktop - fi + # - Set execute to prevent "untrusted" prompt in Mate, and possibily other desktops. + chmod +x /usr/share/applications/* - # - Add NFS support for kodi - AGI libnfs4 + } - fi + Create_UserContent_Folders(){ - #MINIDLNA - if (( $MINIDLNA == 1 )); then - INSTALL_DESCRIPTION='DLNA/UPnP Media Server (MiniDLNA)' - Banner_Installing - AGI minidlna - fi + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" &> /dev/null - #NoIp - if (( $NOIPDYNDNS == 1 )); then - INSTALL_DESCRIPTION='Website URL Address (No-Ip)' - Banner_Installing + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" - #x32 x64 - if (( $HW_MODEL == 20 )); then - INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_x32_x64.zip" - #arm64 - elif (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >=40 && $HW_MODEL < 50 ) )); then - INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_arm64.zip" - #armv6+ - else - INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_armhf.zip" - fi - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + } - #Install - if (( $? == 0 )); then + Download_Test_Media(){ - #NoIp Binary install - wget "$INSTALL_URL_ADDRESS" -O dietpi-noip.zip - unzip dietpi-noip.zip - rm dietpi-noip.zip - mv noip_binary /usr/local/bin/noip2 - chmod +x /usr/local/bin/noip2 + if [ ! -f "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg ]; then - #noip2 service file - cp /DietPi/dietpi/conf/noip_init /etc/init.d/noip2 - chmod +x /etc/init.d/noip2 - update-rc.d noip2 defaults + #Grab My test music + wget http://dietpi.com/downloads/audio/fourdee_tech.ogg -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg - else - Error_NoConnection_NoInstall + #Grab Absolute Radio Streams + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-80s.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a9bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-90s.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a0bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-00s.pls - #Abort failed install - NOIPDYNDNS=0 - fi fi - #OpenTyrian - if (( $OPENTYRIAN == 1 )); then - INSTALL_DESCRIPTION='Gaming (OpenTyrian Game)' - Banner_Installing + } - INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip" - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #apt-get install + AGI(){ - #Install - if (( $? == 0 )); then - AGI ibsdl1.2debian libsdl-net1.2 --no-install-recommends + local string="$@" + DEBIAN_FRONTEND=noninteractive apt-get install -y $string - #Download binaries - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d / - rm package.zip - chmod +x /usr/local/games/opentyrian/opentyrian + local result=$? + if (( $result != 0 )); then - else - Error_NoConnection_NoInstall + Error_AptGet_Failed - #Abort failed install - OPENTYRIAN=0 - fi fi - #DietPi Cam - if (( $DIETPICAM == 1 )); then - INSTALL_DESCRIPTION='RPi Camera / Web Interface Surveillance (DietPi-Cam)' - Banner_Installing + } - #check source is online - INSTALL_URL_ADDRESS='https://github.com/Fourdee/RPi_Cam_Web_Interface/archive/6.1.6.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #apt-get purge + AGP(){ - #Install - if (( $? == 0 )); then + local string="$@" + apt-get purge -y $string - #Install pre-reqs - AGI gpac motion + } - #Get source/binaries and extract - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip - rm package.zip + #Return optimization values for BitTorrent servers based on device and hardware capabilities. + Optimize_BitTorrent(){ - #work form inside RPi_Cam folder - cd RPi_Cam* + local output=0 - #Config /etc/motion - mkdir -p /etc/motion - cp etc/motion/motion.conf.1 /etc/motion/motion.conf + local gigabit_device=1 + # - Lets hope the next RPi device is finally gigabit capable. I'll cry if it is not. + if (( $HW_MODEL <= 3 || $HW_MODEL == 30 || $HW_MODEL == 40 )); then - #Config /etc/raspimjpeg - cp etc/raspimjpeg/raspimjpeg.1 /etc/raspimjpeg + gigabit_device=0 - #Setup /var/www/dietpicam - mkdir -p /var/www/dietpicam/media - cp -R www/* /var/www/dietpicam/ - chmod +x /var/www/dietpicam/raspizip.sh - mknod /var/www/dietpicam/FIFO p - mknod /var/www/dietpicam/FIFO1 p + fi - #Temp cam.jpg file symlink - ln -sf /run/shm/mjpeg/cam.jpg /var/www/dietpicam/cam.jpg + #Cache size 1/7th of total mem + if (( $1 == 0 )); then - #Setup Raspimjpeg binary - cp bin/raspimjpeg /opt/vc/bin/raspimjpeg - chmod +x /opt/vc/bin/raspimjpeg - ln -s /opt/vc/bin/raspimjpeg /usr/bin/raspimjpeg + output=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 7 )) - #Cleanup / remove extracted source - cd "$HOME"/ - rm -R "$HOME"/RPi_Cam* + #Max active downloads + elif (( $1 == 1 )); then - else - Error_NoConnection_NoInstall + output=2 - #Abort failed install - DIETPICAM=0 - fi + # - Bump up for VM's + if (( $HW_MODEL == 20 )); then - fi + output=3 - #DELUGE - if (( $DELUGE == 1 )); then - INSTALL_DESCRIPTION='Deluge (BitTorrent Server, Web Interface)' - Banner_Installing - AGI deluged deluge-web deluge-webui deluge-console - fi + fi - #GRASSHOPPER - if (( $GRASSHOPPER == 1 )); then - INSTALL_DESCRIPTION='Grasshopper' - Banner_Installing + #Max global connections + elif (( $1 == 2 )); then - AGI python + output=20 - #Download Grasshopper - local grasshopper_directory='/var/www' - INSTALL_URL_ADDRESS='http://sourceforge.net/projects/grasshopperwebapp/files/grasshopper_v5_application.zip/download' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O grasshopper.zip - unzip grasshopper.zip -d "$grasshopper_directory" - rm grasshopper.zip + # - Bump up for VM's + if (( $HW_MODEL == 20 )); then - #Install - chmod +x "$grasshopper_directory"/install/install.sh - "$grasshopper_directory"/install/install.sh - else - Error_NoConnection_NoInstall - GRASSHOPPER=0 - fi + output=40 - fi + # - 1Gbit SBC's + elif (( $gigabit_device )); then - #RASPCONTROL - if (( $RASPCONTROL == 1 )); then - INSTALL_DESCRIPTION='Raspcontrol (Web interface system stats)' - Banner_Installing + output=30 - INSTALL_URL_ADDRESS='https://github.com/harmon25/raspcontrol/archive/master.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.zip + # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. + # - RPi v3 + elif (( $HW_MODEL == 3 )); then - unzip package.zip - rm package.zip - mkdir -p /var/www/raspcontrol - mv raspcontrol-master/* /var/www/raspcontrol - rm -R raspcontrol-master + output=15 + + # - RPi v2 + elif (( $HW_MODEL == 2 )); then + + output=13 + + # - RPi v1 256/512 + elif (( $HW_MODEL <= 1 )); then + + output=7 - else - Error_NoConnection_NoInstall - RASPCONTROL=0 fi - fi + #Max upload slots + elif (( $1 == 3 )); then - #LINUXDASH - if (( $LINUXDASH == 1 )); then - INSTALL_DESCRIPTION='Linux Dash (Web interface system stats)' - Banner_Installing + output=3 - INSTALL_URL_ADDRESS='https://github.com/afaqurk/linux-dash/archive/master.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.zip + # - Bump up for VM's + if (( $HW_MODEL == 20 )); then - unzip package.zip - rm package.zip - mkdir -p /var/www/linuxdash - mv linux-dash-master/* /var/www/linuxdash - rm -R linux-dash-master + output=5 - else - Error_NoConnection_NoInstall - LINUXDASH=0 - fi + # - 1Gbit devices + elif (( $gigabit_device )); then - fi + output=4 - #PIHOLE - if (( $PIHOLE == 1 )); then - INSTALL_DESCRIPTION='Pi-hole (Block adverts on your network)' - Banner_Installing + # - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency. + elif (( $HW_MODEL <= 3 )); then - # local git_version='master' - # local git_owner='pi-hole' - local git_version='04_07_2016' - local git_owner='Fourdee' + output=2 - # - Web stats - INSTALL_URL_ADDRESS="https://github.com/$git_owner/AdminLTE/archive/$git_version.zip" - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then + fi - #Install + fi - AGI dnsmasq bc - service dnsmasq stop + echo $output - #Generate PiHole Dirs - mkdir -p /etc/pihole - mkdir -p /etc/.pihole #gravity always wants to read from the "temp" installation folder used by their install script. - mkdir -p /var/www/pihole - mkdir -p /opt/pihole + } - #Grab/Setup Web interface panel - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip - mv AdminLTE-*/* /var/www/pihole/ - rm -R AdminLTE-* - rm package.zip + Install_Dietpi_Software(){ - # - Grab chronometer (this script is run to parse logfiles for PiHole webpage stats) - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/chronometer.sh -O /usr/local/bin/chronometer.sh - chmod +x /usr/local/bin/chronometer.sh + #-------------------------------------------------------------- + # Stop Services + /DietPi/dietpi/dietpi-services stop + #-------------------------------------------------------------- - # - Blacklist/whitelist scripts - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/blacklist.sh -O /opt/pihole/blacklist.sh - chmod +x /opt/pihole/blacklist.sh + #-------------------------------------------------------------- + #Install Software - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/whitelist.sh -O /opt/pihole/whitelist.sh - chmod +x /opt/pihole/whitelist.sh + #Desktop LXDE + INSTALLING_INDEX=23 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - update dashboard - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/updateDashboard.sh -O /opt/pihole/updateDashboard.sh - #chmod +x /opt/pihole/updateDashboard.sh #Disabled as it wants to install Git and expects official installation method. + Banner_Installing - # - Default ads list - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/adlists.default -O /etc/pihole/adlists.default - cp /etc/pihole/adlists.default /etc/.pihole/adlists.default + AGI lxde upower policykit-1 iceweasel p7zip-full --no-install-recommends + #upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ...... - #Check free available memory. Increase swapfile size to prevent gravity running out of mem. - if (( $(free -m -o | grep -m1 'Mem:' | awk '{print $4}') < 512 )); then - if [ -f /etc/dphys-swapfile ] && - (( $(cat /etc/dphys-swapfile | grep 'CONF_SWAPSIZE=' | sed 's/.*=//') < 512 )); then - /DietPi/dietpi/func/dietpi-notify 2 "Increasing swapfile size to 512MB before running gravity.sh, please wait...\n" - /DietPi/dietpi/func/dietpi-set_dphys-swapfile 512 - fi - fi + fi - #Run and update adblocking databases (gravity) - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/gravity.sh -O /usr/local/bin/gravity.sh - chmod 755 /usr/local/bin/gravity.sh - /usr/local/bin/gravity.sh - killall -w dnsmasq # gravity.sh restarts dnsmasq and creates a brief temp loss of connection. So lets kill the process and wait for it to terminate. - ln -sf /usr/local/bin/gravity.sh /opt/pihole/gravity.sh #symlink to new location of script. We still use the old location for docs and cron + #Desktop MATE + INSTALLING_INDEX=24 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #bash completion for pihole bin - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/bash-completion/pihole -O /etc/bash_completion.d/pihole - . /etc/bash_completion.d/pihole + Banner_Installing - #Pihole bin - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/pihole -O /usr/local/bin/pihole - chmod +x /usr/local/bin/pihole + AGI mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full --no-install-recommends - #Pihole sudoers (to allow web interface access to pihole bin and add/remove white/black lists) - mkdir -p /etc/sudoers.d - wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/pihole.sudo -O /etc/sudoers.d/pihole - chmod 0440 /etc/sudoers.d/pihole + fi - else - Error_NoConnection_NoInstall - PIHOLE=0 - fi + #Desktop GNUStep + INSTALLING_INDEX=26 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + + AGI x-window-system-core wmaker gnustep gnustep-devel gnustep-games libc-dbg upower policykit-1 iceweasel p7zip-full --no-install-recommends fi - #SUBSONIC 5 - if (( $SUBSONIC5 == 1 )); then - INSTALL_DESCRIPTION='SubSonic 5 (Web interface media streamer)' + #DESKTOP_XFCE + INSTALLING_INDEX=25 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - INSTALL_URL_ADDRESS='http://sourceforge.net/projects/subsonic/files/subsonic/5.3/subsonic-5.3.deb/download' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then + AGI xfce4 gnome-icon-theme tango-icon-theme iceweasel p7zip-full --no-install-recommends - AGI lame + fi - #Install SubSonic 5.3 - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + #XRDP + INSTALLING_INDEX=29 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + + AGI xrdp - else - Error_NoConnection_NoInstall - SUBSONIC5=0 - fi fi - #SUBSONIC 6 - if (( $SUBSONIC6 == 1 )); then - INSTALL_DESCRIPTION='SubSonic 6 (Web interface media streamer)' + #NOMACHINE + INSTALLING_INDEX=30 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing + INSTALL_DESCRIPTION="NoMachine (Secure RDP Server & Client)" - INSTALL_URL_ADDRESS='https://sourceforge.net/projects/subsonic/files/subsonic/6.0/subsonic-6.0.deb/download' + #x86_32 - As was said (you never know) + if (( $HW_ARCH == 20 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_i386.deb" + #x86_64 + elif (( $HW_ARCH == 21 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_amd64.deb" + #arm6 (RPi1) + elif (( $HW_ARCH == 1 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_6_armv6hf.deb" + #arm7+ (RPi 2/3) + elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_5_armhf.deb" + fi + + # Now, check that the links are legitimate /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then - AGI lame + if (( $? == 0 )); then - #Install SubSonic 6.0 wget "$INSTALL_URL_ADDRESS" -O package.deb dpkg -i package.deb rm package.deb else + Error_NoConnection_NoInstall - SUBSONIC6=0 + fi + fi - #WEAVED - if (( $WEAVED == 1 )); then - INSTALL_DESCRIPTION='Weaved (Access your device over the internet)' + #BitTorrent Transmission + INSTALLING_INDEX=44 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing + AGI transmission-daemon - INSTALL_URL_ADDRESS='https://github.com/weaved/installer/raw/master/binaries/weaved-nixinstaller_1.2.13.bin' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then + fi - #Install WEAVED - wget "$INSTALL_URL_ADDRESS" -O weaved_setup.bin - chmod +x weaved_setup.bin + #ProFTPd + INSTALLING_INDEX=94 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - ##Dont run this, let the user run it for "1st time setup" - #./weaved_setup.bin + Banner_Installing - else - Error_NoConnection_NoInstall - WEAVED=0 - fi + echo -e "proftpd-basic shared/proftpd/inetd_or_standalone select standalone" | debconf-set-selections + AGI proftpd-basic fi - #DietPi software that requires RPI GPIO - if (( $WEBIOPI == 1 )); then - RPIGPIO=1 - fi + #Samba Server + INSTALLING_INDEX=96 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - if (( $RPIGPIO == 1 )); then - INSTALL_DESCRIPTION='RPi.GPIO' Banner_Installing + AGI samba samba-common-bin --no-install-recommends - #Wheezy - if (( $DISTRO == 1 )); then - AGI python-rpi.gpio python3-rpi.gpio + fi - #Jessie - elif (( $DISTRO == 3 )); then + #vsFTPD + INSTALLING_INDEX=95 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # >= v111 image - if [ -f /etc/.dietpi_image_version ]; then - AGI python-rpi.gpio python3-rpi.gpio + Banner_Installing - # - < v111 Bug in older DietPi images with sources.list | Use pip, as offical repo = python3-rpi.gpio: Depends: python3 (< 3.3) but 3.4.2-2 is to be installed - else - AGI python3-pip - pip3 install RPi.GPIO - - fi - fi + AGI vsftpd --no-install-recommends fi - #WIRINGPI - if (( $WIRINGPI == 1 )); then - INSTALL_DESCRIPTION='Wiring Pi' - Banner_Installing + #WEBSERVER_APACHE + INSTALLING_INDEX=83 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #check source is online | http://git.drogon.net/?p=wiringPi;a=shortlog;h=refs/heads/master snapshot - INSTALL_URL_ADDRESS='http://git.drogon.net/?p=wiringPi;a=snapshot;h=HEAD;sf=tgz' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + Banner_Installing + AGI apache2 - #Install - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.tar - tar xfz package.tar - rm package.tar - cd wiringPi* - ./build - cd .. - #rm -R /root/wiringPi* #Also Contains example code for users. + fi - else - Error_NoConnection_NoInstall + #WEBSERVER_NGINX + INSTALLING_INDEX=85 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Abort Install - WIRINGPI=0 - fi + Banner_Installing + AGI nginx xml-core --no-install-recommends fi - #RPII2C - if (( $RPII2C == 1 )); then - INSTALL_DESCRIPTION='RPi I2C' - Banner_Installing + #WEBSERVER_LIGHTTPD + INSTALLING_INDEX=84 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - /DietPi/dietpi/func/dietpi-set_hardware i2c enable + Banner_Installing + AGI lighttpd fi - #WEBIOPI - if (( $WEBIOPI == 1 )); then - INSTALL_DESCRIPTION='WebIOPi (Control RPi.GPIO from web interface)' + + #WEBSERVER_MYSQL + INSTALLING_INDEX=86 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - INSTALL_URL_ADDRESS='http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz/download' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then + echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections + echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections - #Python dev, pre-reqs - AGI python-dev python-setuptools --no-install-recommends + AGI mysql-server mysql-client - #Install WEBIOPI - wget "$INSTALL_URL_ADDRESS" -O package.tar - tar xvzf package.tar - rm package.tar + # Fix depricated key_buffer -> key_buffer_size per MySQL 5.x notification + sed -i 's/key_buffer/key_buffer_size/g' /etc/mysql/my.cnf - cd WebIOPi* + # Restart the service and install the client + service mysql restart - #Automate Weaved prompt - sed -i '/read response/c\response="n"' setup.sh + fi - #Run setup script - ./setup.sh - clear + #WEBSERVER_MARIADB + INSTALLING_INDEX=88 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - cd .. + Banner_Installing - #Cleanup - rm -R WebIOPi* + echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections + echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections - else - Error_NoConnection_NoInstall - WEBIOPI=0 - fi + AGI mariadb-server mariadb-client fi - #DIETPICLOUDSHELL - if (( $DIETPICLOUDSHELL == 1 )); then - INSTALL_DESCRIPTION='DietPi-Cloudshell (System stats)' + #WEBSERVER_SQLITE + INSTALLING_INDEX=87 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing + AGI sqlite3 - AGI net-tools + fi - #LCD panels can be enabled in Dietpi-config > display options + #WEBSERVER_REDIS + INSTALLING_INDEX=91 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + AGI redis-server fi - #HAPROXY - if (( $HAPROXY == 1 )); then - INSTALL_DESCRIPTION='HaProxy - High Performance TCP/HTTP Load Balancer' + #WEBSERVER_PHP + INSTALLING_INDEX=89 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #check source is online - INSTALL_URL_ADDRESS='http://www.haproxy.org/download/1.6/src/haproxy-1.6.2.tar.gz' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #Install base PHP packages/modules. + if (( ${aSOFTWARE_INSTALL_STATE[83]} == 1 )); then - #Install - if (( $? == 0 )); then + AGI php5 libapache2-mod-php5 - #Download HAPROXY - wget "$INSTALL_URL_ADDRESS" -O package.tar - tar -xvf package.tar - rm package.tar + else - cd haproxy-* + AGI php5-fpm php5-cgi php5-xsl - #Pre-reqs - AGI libpcre3-dev libssl-dev - #Compile and install - make -j "$(nproc --all)" TARGET=linux2628 CPU=generic USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_SPLICE=1 - make install + fi - mkdir /etc/haproxy + #php-SQL modules + if (( ${aSOFTWARE_INSTALL_STATE[86]} == 1 )); then - #Exit directory - cd .. + AGI php5-mysql - #Clean up - rm -R haproxy-* + elif (( ${aSOFTWARE_INSTALL_STATE[88]} == 1 )); then - #Install init script as service - cp /DietPi/dietpi/conf/haproxy_init /etc/init.d/haproxy - chmod +x /etc/init.d/haproxy - update-rc.d haproxy defaults + AGI php5-mysqlnd - else - Error_NoConnection_NoInstall + fi + + if (( ${aSOFTWARE_INSTALL_STATE[87]} == 1 )); then + + AGI php5-sqlite + + fi + + #Redis php5 module | >= 1 to check for existing installs (2) + if (( ${aSOFTWARE_INSTALL_STATE[91]} >= 1 )); then + + AGI php5-redis - #Abort failed install - HAPROXY=0 fi + #Jessie - APCu + AGI php5-apcu + fi - #SQUEEZEBOXSERVER - if (( $SQUEEZEBOXSERVER == 1 )); then - INSTALL_DESCRIPTION='SqueezeBox (Logitech Media Server)' + #WEBSERVER_MYADMINPHP + INSTALLING_INDEX=90 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_all.deb' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #Mysql must be running during install to allow debconf setup. + service mysql restart - #Install - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + # Set password parameters before installing + echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections + echo "phpmyadmin phpmyadmin/app-password-confirm password dietpi" | debconf-set-selections + echo "phpmyadmin phpmyadmin/mysql/admin-pass password dietpi" | debconf-set-selections + echo "phpmyadmin phpmyadmin/mysql/app-pass password dietpi" | debconf-set-selections - #Stop service - service logitechmediaserver stop + if (( ${aSOFTWARE_INSTALL_STATE[83]} == 1 )); then - # + ARMv6 cpan - if (( $HW_MODEL <= 1 )); then - wget http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_CPAN_5.20_armv6hf.tar.gz -O package.tar - tar xvzf package.tar -C / - rm package.tar - fi + echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections + + elif (( ${aSOFTWARE_INSTALL_STATE[84]} == 1 )); then + + echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd" | debconf-set-selections else - Error_NoConnection_NoInstall - #Abort failed install - SQUEEZEBOXSERVER=0 + echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections + fi + AGI phpmyadmin fi - #WORDPRESS - if (( $WORDPRESS == 1 )); then - INSTALL_DESCRIPTION='Wordpress' + #Forums PHPBB + INSTALLING_INDEX=54 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #check source is online - INSTALL_URL_ADDRESS='https://wordpress.org/latest.zip' + INSTALL_URL_ADDRESS='https://www.phpbb.com/files/release/phpBB-3.1.6.zip' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then + wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www/ + unzip package.zip -d /var/www rm package.zip - chown -R www-data:www-data /var/www/wordpress - chmod -R 775 /var/www/wordpress + else + Error_NoConnection_NoInstall - #Abort failed install - WORDPRESS=0 fi fi - #TIGHTVNCSERVER - if (( $TIGHTVNCSERVER == 1 )); then - INSTALL_DESCRIPTION='TightVNC Server' - Banner_Installing + #OPENBAZAAR + INSTALLING_INDEX=58 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - AGI tightvncserver --no-install-recommends + Banner_Installing - fi + INSTALL_URL_ADDRESS='https://github.com/OpenBazaar/OpenBazaar-Server.git' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #Install - #VNC4SERVER - if (( $VNC4SERVER == 1 )); then - INSTALL_DESCRIPTION='VNC4 Server' - Banner_Installing + if (( $? == 0 )); then - AGI vnc4server --no-install-recommends + AGI libsodium-dev automake autoconf pkg-config libtool libssl-dev libffi-dev python-dev openssl python-pip libzmq3-dev - fi + #Not required. + #AGI software-properties-common + #add-apt-repository -y ppa:chris-lea/libsodium + #apt-get update - #FAIL2BAN - if (( $FAIL2BAN == 1 )); then - INSTALL_DESCRIPTION='Fail2Ban' - Banner_Installing + pip install cryptography - AGI fail2ban --no-install-recommends - fi + cd "$HOME" + git clone --depth 1 https://github.com/zeromq/libzmq + git clone --depth 1 https://github.com/pyca/pynacl/ + git clone --depth 1 "$INSTALL_URL_ADDRESS" - #PHPSYSINFO - if (( $PHPSYSINFO == 1 )); then - INSTALL_DESCRIPTION='PhpSysInfo (Stats)' - Banner_Installing + # - compile + cd "$HOME"/libzmq + ./autogen.sh && ./configure && make -j "$(nproc --all)" + make check && make install && ldconfig - #check source is online - INSTALL_URL_ADDRESS='https://github.com/phpsysinfo/phpsysinfo/archive/master.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + cd "$HOME"/pynacl + python setup.py build && python setup.py install - #Install - if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www/ - rm package.zip - mv /var/www/phpsysinfo-* /var/www/phpsysinfo - else - Error_NoConnection_NoInstall + cd "$HOME" - #Abort failed install - PHPSYSINFO=0 - fi + # - Move OpenBazaar to a 'better' location + mkdir -p /etc/openbazaar-server + mv "$HOME"/OpenBazaar-Server/* /etc/openbazaar-server/ + rm -R "$HOME"/OpenBazaar-Server - fi + # - install OpenBazaar + cd /etc/openbazaar-server + pip install -r requirements.txt - #PHPIMAGEGALLERY - if (( $PHPIMAGEGALLERY == 1 )); then - INSTALL_DESCRIPTION='Php Image Gallery' - Banner_Installing + cd "$HOME" - #check source is online - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/Single_File_PHP_Gallery_4.6.1.zip' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + # - Clean up, remove source libaries + rm -R "$HOME"/libzmq + rm -R "$HOME"/pynacl - #Install - if (( $? == 0 )); then - AGI php5-gd - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www/gallery - rm package.zip else + Error_NoConnection_NoInstall - #Abort failed install - PHPIMAGEGALLERY=0 fi fi - #AMPACHE - if (( $AMPACHE == 1 )); then - INSTALL_DESCRIPTION='Ampache' + + #OwnCloud + INSTALLING_INDEX=47 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #check source is online - INSTALL_URL_ADDRESS='https://github.com/ampache/ampache/archive/master.zip' + INSTALL_URL_ADDRESS='http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_8.0/' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Install if (( $? == 0 )); then - AGI php5-curl + if [ ! -f /etc/apt/sources.list.d/owncloud.list ]; then - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip - rm package.zip - mv ampache-* /var/www/ampache + echo "deb $INSTALL_URL_ADDRESS /" > /etc/apt/sources.list.d/owncloud.list + wget "$INSTALL_URL_ADDRESS"Release.key + apt-key add - < Release.key - #composer install required for 3.8.2 - php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php - php composer-setup.php - php -r "unlink('composer-setup.php');" + apt-get update - mv composer.phar /usr/local/bin/composer + fi - cd /var/www/ampache - composer install --prefer-source --no-interaction - cd ~/ + AGI owncloud --force-yes else + Error_NoConnection_NoInstall - #Abort failed install - AMPACHE=0 fi fi - #OPENVPNSERVER - if (( $OPENVPNSERVER == 1 )); then - INSTALL_DESCRIPTION='OpenVPN Server' + #Hifi + INSTALLING_INDEX=32 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI openvpn easy-rsa iptables + #ympd + # - armhf + if (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - fi + INSTALL_URL_ADDRESS='http://www.ympd.org/downloads/ympd-1.2.3-armhf.tar.bz2' - #LETSENCRYPT - if (( $LETSENCRYPT == 1 )); then - INSTALL_DESCRIPTION='Certbot / Lets Encrypt' - Banner_Installing + # - arm64 + elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - #check source is online - INSTALL_URL_ADDRESS='https://github.com/certbot/certbot/archive/master.zip' + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/ympd-1.2.3-arm64.tar.bz2' + + fi /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /root - rm package.zip - mv certbot* /etc/letsencrypt_scripts - - # - Install packages - cd /etc/letsencrypt_scripts - ./certbot-auto --os-packages-only - cd ~/ - else - Error_NoConnection_NoInstall + #Install ympd + wget "$INSTALL_URL_ADDRESS" + tar -xvf ympd-* + rm ympd-* + mv ympd /usr/bin/ympd - #Abort failed install - LETSENCRYPT=0 - fi + #Install MPD + AGI libmpdclient2 - fi + # - arm64 + if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - #Software that requires WiFihotspot: - if (( $TORHOTSPOT == 1 )); then - WIFIHOTSPOT=1 - fi + # - additional preqs + #AGI libsmbclient libcurl4-gnutls-dev libmodplug1 libfaad2 libmpcdec6 libavformat56 libupnp6 libnfs4 libflac8 libyajl2 libvorbisfile3 libsndfile1 libaudiofile1 libgme0 libsidplay2 libresid-builder0c2a libsidutils0 libfluidsynth1 libWildMidi1 libwavpack1 libmad0 libmpg123-0 - #WIFIHOTSPOT - if (( $WIFIHOTSPOT == 1 )); then - INSTALL_DESCRIPTION='Wifi Hotspot' - Banner_Installing + # - Install same dev packages as per a compile to ensure libary's are available. + AGI libmad0-dev libmpg123-dev libid3tag0-dev libflac-dev libvorbis-dev libopus-dev libaudiofile-dev libsndfile1-dev libfaad-dev libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev libmpcdec-dev libwavpack-dev libwildmidi-dev libsidplay2-dev libsidutils-dev libresid-builder-dev libavcodec-dev libavformat-dev libmp3lame-dev libsamplerate0-dev libsoxr-dev libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev libzzip-dev libcurl4-gnutls-dev libyajl-dev libexpat-dev libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev libpulse-dev libroar-dev libshout3-dev libnfs-dev libsmbclient-dev libupnp-dev libavahi-client-dev libsqlite3-dev libsystemd-daemon-dev libwrap0-dev libcppunit-dev xmlto libboost-dev libicu-dev - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/hostapd_2.5_all.zip' + wget http://dietpi.com/downloads/binaries/all/mpd_0.19.16_arm64.deb -O package.deb + dpkg -i package.deb + rm package.deb - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + # - everything else + else - #Install - if (( $? == 0 )); then + AGI mpd - # - Prereqs - AGI hostapd isc-dhcp-server iptables libnl-3-200 + fi - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip - rm package.zip - # - Check for RTL8188C* device, use the patched binary I compiled: https://github.com/pritambaral/hostapd-rtl871xdrv#why - if (( $(lsusb | grep -ci -m1 'RTL8188C') )); then + else - WIFIHOTSPOT_RTL8188C_DEVICE=1 + Error_NoConnection_NoInstall - fi + fi - #Which binary to install - local filename_hostapd='' - local filename_hostapd_cli='' + fi - # - armv6 - if (( $HW_ARCH == 1 )); then + #Kodi + INSTALLING_INDEX=31 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - filename_hostapd='hostapd-nl80211-armv6' - filename_hostapd_cli='hostapd_cli-armv6' - if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - filename_hostapd='hostapd-rtl8188c-armv6' - fi + Banner_Installing - # - armv7+ - elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then + #Odroids + if (( $HW_MODEL >= 10 )) && (( $HW_MODEL < 20 )); then - filename_hostapd='hostapd-nl80211-armv7' - filename_hostapd_cli='hostapd_cli-armv7' - if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - filename_hostapd='hostapd-rtl8188c-armv7' - fi + AGI kodi-odroid - # - arm64 - elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + #XU4 - requires pulse audio (fixes corrupt sound) + if (( $HW_MODEL == 11 )); then - filename_hostapd='hostapd-nl80211-arm64' - filename_hostapd_cli='hostapd_cli-arm64' - if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - filename_hostapd='hostapd-rtl8188c-arm64' - fi + AGI pulseaudio --no-install-recommends fi - mv "$filename_hostapd" /usr/sbin/hostapd - mv "$filename_hostapd_cli" /usr/sbin/hostapd_cli - - chmod +x /usr/sbin/hostapd - chmod +x /usr/sbin/hostapd_cli - - rm hostapd-* + #Everything else + else + AGI kodi - #Enable wifi modules - /DietPi/dietpi/func/dietpi-set_hardware wifi enable + fi - else - Error_NoConnection_NoInstall + #libcurl3-gnutls required for C2. But lets apply to all: https://github.com/Fourdee/DietPi/issues/446 + AGI libcurl3-gnutls - #Abort failed install - WIFIHOTSPOT=0 - fi + # - Add NFS support for kodi + AGI libnfs4 fi + #MINIDLNA + INSTALLING_INDEX=39 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #TORHOTSPOT - if (( $TORHOTSPOT == 1 )); then - INSTALL_DESCRIPTION='Tor Hotspot' Banner_Installing - - # - Prereqs - AGI tor + AGI minidlna fi + #NoIp + INSTALLING_INDEX=67 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #SHAIRPORTSYNC - if (( $SHAIRPORTSYNC == 1 )); then - INSTALL_DESCRIPTION='Shairport Sync' Banner_Installing - #check source is online - # - ARMv6 - if (( $HW_ARCH == 1 )); then - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_armv6.deb' - # - ARMv7 - elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_armv7.deb' - # - ARM64 - elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_arm64.deb' - fi - - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install - if (( $? == 0 )); then + #x32 x64 + if (( $HW_MODEL == 20 )); then - # - Prereqs - AGI openssl avahi-daemon libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 --no-install-recommends + INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_x32_x64.zip" - # This occured on C2: shairport-sync : Depends: libpopt-dev but it is not installed - AGI libpopt-dev + #arm64 + elif (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >=40 && $HW_MODEL < 50 ) )); then - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_arm64.zip" + #armv6+ else - Error_NoConnection_NoInstall - - #Abort failed install - SHAIRPORTSYNC=0 - fi - - fi - #BRUTEFIR - if (( $BRUTEFIR == 1 )); then - INSTALL_DESCRIPTION='BruteFIR / ALSA Loopback' - Banner_Installing + INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/all/noip_armhf.zip" - #check folder is online - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/conf/BruteFIR/' + fi /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then - # - Prereqs - AGI brutefir + #NoIp Binary install + wget "$INSTALL_URL_ADDRESS" -O dietpi-noip.zip + unzip dietpi-noip.zip + rm dietpi-noip.zip + mv noip_binary /usr/local/bin/noip2 + chmod +x /usr/local/bin/noip2 - wget -r -nH --cut-dirs=2 --no-parent --reject="index.htm*" -e robots=off "$INSTALL_URL_ADDRESS" - mv BruteFIR /etc/ + #noip2 service file + cp /DietPi/dietpi/conf/noip_init /etc/init.d/noip2 + chmod +x /etc/init.d/noip2 + update-rc.d noip2 defaults else + Error_NoConnection_NoInstall - #Abort failed install - BRUTEFIR=0 fi fi - #PYDIO - if (( $PYDIO == 1 )); then - INSTALL_DESCRIPTION='Pydio' + #OpenTyrian + INSTALLING_INDEX=51 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #check folder is online - INSTALL_URL_ADDRESS='http://sourceforge.net/projects/ajaxplorer/files/pydio/stable-channel/6.2.2/pydio-core-6.2.2.zip/download' + INSTALL_URL_ADDRESS="http://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip" /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then - # - Prereqs - AGI php5-mcrypt php5-gd + AGI ibsdl1.2debian libsdl-net1.2 --no-install-recommends + #Download binaries wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www - mv /var/www/pydio-core-* /var/www/pydio + unzip package.zip -d / rm package.zip + chmod +x /usr/local/games/opentyrian/opentyrian else + Error_NoConnection_NoInstall - #Abort failed install - PYDIO=0 fi fi - #SQUEEZELITE - if (( $SQUEEZELITE == 1 )); then - INSTALL_DESCRIPTION='SqueezeLite' - Banner_Installing - - # - Prereqs - AGI squeezelite - - fi + #DietPi Cam + INSTALLING_INDEX=59 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #EMONHUB - if (( $EMONHUB == 1 )); then - INSTALL_DESCRIPTION='EmonPi / EmonHub' Banner_Installing - #check, is online - INSTALL_URL_ADDRESS='https://github.com/Fourdee/emonhub/archive/emon-pi.zip' + #check source is online + INSTALL_URL_ADDRESS='https://github.com/Fourdee/RPi_Cam_Web_Interface/archive/6.1.6.zip' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then - # - Prereqs - AGI minicom python-pip python-serial python-configobj --no-install-recommends - pip install paho-mqtt pydispatcher + #Install pre-reqs + AGI gpac motion + #Get source/binaries and extract wget "$INSTALL_URL_ADDRESS" -O package.zip unzip package.zip rm package.zip - # - move everything to /etc/emonhub - rm -R /etc/emonhub - mkdir -p /etc/emonhub - mv emonhub-*/* /etc/emonhub/ - rm -R emonhub-* + #work form inside RPi_Cam folder + cd RPi_Cam* - else - Error_NoConnection_NoInstall + #Config /etc/motion + mkdir -p /etc/motion + cp etc/motion/motion.conf.1 /etc/motion/motion.conf - #Abort failed install - EMONHUB=0 - fi + #Config /etc/raspimjpeg + cp etc/raspimjpeg/raspimjpeg.1 /etc/raspimjpeg - fi + #Setup /var/www/dietpicam + mkdir -p /var/www/dietpicam/media + cp -R www/* /var/www/dietpicam/ + chmod +x /var/www/dietpicam/raspizip.sh + mknod /var/www/dietpicam/FIFO p + mknod /var/www/dietpicam/FIFO1 p - #RPIMONITOR - if (( $RPIMONITOR == 1 )); then - INSTALL_DESCRIPTION='Rpi-Monitor' - Banner_Installing - - #check, is online - INSTALL_URL_ADDRESS='https://github.com/XavierBerger/RPi-Monitor-deb/raw/master/packages/rpimonitor_2.10-1_all.deb' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install - if (( $? == 0 )); then + #Temp cam.jpg file symlink + ln -sf /run/shm/mjpeg/cam.jpg /var/www/dietpicam/cam.jpg - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + #Setup Raspimjpeg binary + cp bin/raspimjpeg /opt/vc/bin/raspimjpeg + chmod +x /opt/vc/bin/raspimjpeg + ln -s /opt/vc/bin/raspimjpeg /usr/bin/raspimjpeg - # - Prereqs - apt-get -f -y install + #Cleanup / remove extracted source + cd "$HOME"/ + rm -R "$HOME"/RPi_Cam* else + Error_NoConnection_NoInstall - #Abort failed install - RPIMONITOR=0 fi fi - #NETDATA - if (( $NETDATA == 1 )); then - INSTALL_DESCRIPTION='netdata' + #DELUGE + INSTALLING_INDEX=45 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing + AGI deluged deluge-web deluge-webui deluge-console - #Rpi 1 - if (( $HW_MODEL < 2 )); then - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_armv6.deb' - #arm64 - elif (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >= 40 && $HW_MODEL < 50 ) )); then - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_arm64.deb' - #all others - else - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_armv7.deb' - fi + fi - #check, is online - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #GRASSHOPPER + INSTALLING_INDEX=100 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Install + Banner_Installing + + AGI python + + #Download Grasshopper + local grasshopper_directory='/var/www' + INSTALL_URL_ADDRESS='http://sourceforge.net/projects/grasshopperwebapp/files/grasshopper_v5_application.zip/download' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" if (( $? == 0 )); then - # - For compression - AGI --no-install-recommends zlib1g-dev + wget "$INSTALL_URL_ADDRESS" -O grasshopper.zip + unzip grasshopper.zip -d "$grasshopper_directory" + rm grasshopper.zip - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + #Install + chmod +x "$grasshopper_directory"/install/install.sh + "$grasshopper_directory"/install/install.sh else + Error_NoConnection_NoInstall - #Abort failed install - NETDATA=0 fi fi - #BAIKAL - if (( $BAIKAL == 1 )); then - INSTALL_DESCRIPTION='BaiKal' + #RASPCONTROL + INSTALLING_INDEX=106 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #check folder is online - INSTALL_URL_ADDRESS='https://github.com/fruux/Baikal/archive/master.zip' + INSTALL_URL_ADDRESS='https://github.com/harmon25/raspcontrol/archive/master.zip' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install if (( $? == 0 )); then wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip -d /var/www + + unzip package.zip rm package.zip - mv /var/www/Baikal* /var/www/baikal + mkdir -p /var/www/raspcontrol + mv raspcontrol-master/* /var/www/raspcontrol + rm -R raspcontrol-master else + Error_NoConnection_NoInstall - #Abort failed install - BAIKAL=0 fi fi - #MUMBLESERVER - if (( $MUMBLESERVER == 1 )); then - INSTALL_DESCRIPTION='Murmur - Mumble VoIP Server' - Banner_Installing - - AGI mumble-server - - fi + #LINUXDASH + INSTALLING_INDEX=63 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #EMBYSERVER - if (( $EMBYSERVER == 1 )); then - INSTALL_DESCRIPTION='Emby Server' Banner_Installing - local url_tests=0 - - #check is online - INSTALL_URL_ADDRESS='http://download.opensuse.org/repositories/home:/emby/Debian_8.0' + INSTALL_URL_ADDRESS='https://github.com/afaqurk/linux-dash/archive/master.zip' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $? == 0 )); then - INSTALL_URL_ADDRESS='http://download.mono-project.com/repo/debian' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + wget "$INSTALL_URL_ADDRESS" -O package.zip - if (( $? == 0 )); then + unzip package.zip + rm package.zip + mkdir -p /var/www/linuxdash + mv linux-dash-master/* /var/www/linuxdash + rm -R linux-dash-master - url_tests=1 + else - fi + Error_NoConnection_NoInstall fi - #install - if (( $url_tests == 1 )); then + fi - # - Alternative mono repo: https://github.com/Fourdee/DietPi/issues/310#issuecomment-216247879 - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo -e "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list - echo -e "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" >> /etc/apt/sources.list.d/mono-xamarin.list + #PIHOLE + INSTALLING_INDEX=93 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - # - Emby repo - wget http://download.opensuse.org/repositories/home:emby/Debian_8.0/Release.key - apt-key add - < Release.key - echo -e "deb http://download.opensuse.org/repositories/home:/emby/Debian_8.0/ /" > /etc/apt/sources.list.d/emby-server.list - apt-get update + # local git_version='master' + # local git_owner='pi-hole' + local git_version='04_07_2016' + local git_owner='Fourdee' - AGI emby-server + # - Web stats + INSTALL_URL_ADDRESS="https://github.com/$git_owner/AdminLTE/archive/$git_version.zip" + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + if (( $? == 0 )); then - else - Error_NoConnection_NoInstall + #Install - #Abort failed install - EMBYSERVER=0 - fi + AGI dnsmasq bc + service dnsmasq stop - fi + #Generate PiHole Dirs + mkdir -p /etc/pihole + mkdir -p /etc/.pihole #gravity always wants to read from the "temp" installation folder used by their install script. + mkdir -p /var/www/pihole + mkdir -p /opt/pihole - #PLEXMEDIASERVER - if (( $PLEXMEDIASERVER == 1 )); then - INSTALL_DESCRIPTION='Plex Media Server' - Banner_Installing + #Grab/Setup Web interface panel + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip + mv AdminLTE-*/* /var/www/pihole/ + rm -R AdminLTE-* + rm package.zip - #check folder is online + # - Grab chronometer (this script is run to parse logfiles for PiHole webpage stats) + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/chronometer.sh -O /usr/local/bin/chronometer.sh + chmod +x /usr/local/bin/chronometer.sh - #x86_64 - if (( $HW_ARCH == 21 )); then - INSTALL_URL_ADDRESS='https://downloads.plex.tv/plex-media-server/1.0.0.2261-a17e99e/plexmediaserver_1.0.0.2261-a17e99e_amd64.deb' - #32bit ARM - elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - INSTALL_URL_ADDRESS='http://dev2day.de/pms/' - fi - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + # - Blacklist/whitelist scripts + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/blacklist.sh -O /opt/pihole/blacklist.sh + chmod +x /opt/pihole/blacklist.sh - #Install - if (( $? == 0 )); then + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/whitelist.sh -O /opt/pihole/whitelist.sh + chmod +x /opt/pihole/whitelist.sh - #x86_64 - if (( $HW_ARCH == 21 )); then + # - update dashboard + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/Scripts/updateDashboard.sh -O /opt/pihole/updateDashboard.sh + #chmod +x /opt/pihole/updateDashboard.sh #Disabled as it wants to install Git and expects official installation method. - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + # - Default ads list + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/adlists.default -O /etc/pihole/adlists.default + cp /etc/pihole/adlists.default /etc/.pihole/adlists.default - #32bit ARM - elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then + #Check free available memory. Increase swapfile size to prevent gravity running out of mem. + if (( $(free -m -o | grep -m1 'Mem:' | awk '{print $4}') < 512 )); then - echo -e "deb $INSTALL_URL_ADDRESS jessie main" > /etc/apt/sources.list.d/plex.list - wget -O - "$INSTALL_URL_ADDRESS"dev2day-pms.gpg.key | apt-key add - - #AGI apt-transport-https - apt-get update + if [ -f /etc/dphys-swapfile ] && + (( $(cat /etc/dphys-swapfile | grep 'CONF_SWAPSIZE=' | sed 's/.*=//') < 512 )); then - AGI plexmediaserver + /DietPi/dietpi/func/dietpi-notify 2 "Increasing swapfile size to 512MB before running gravity.sh, please wait...\n" + /DietPi/dietpi/func/dietpi-set_dphys-swapfile 512 + + fi fi + #Run and update adblocking databases (gravity) + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/gravity.sh -O /usr/local/bin/gravity.sh + chmod 755 /usr/local/bin/gravity.sh + /usr/local/bin/gravity.sh + killall -w dnsmasq # gravity.sh restarts dnsmasq and creates a brief temp loss of connection. So lets kill the process and wait for it to terminate. + ln -sf /usr/local/bin/gravity.sh /opt/pihole/gravity.sh #symlink to new location of script. We still use the old location for docs and cron + + #bash completion for pihole bin + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/bash-completion/pihole -O /etc/bash_completion.d/pihole + . /etc/bash_completion.d/pihole + + #Pihole bin + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/pihole -O /usr/local/bin/pihole + chmod +x /usr/local/bin/pihole + + #Pihole sudoers (to allow web interface access to pihole bin and add/remove white/black lists) + mkdir -p /etc/sudoers.d + wget https://raw.githubusercontent.com/"$git_owner"/pi-hole/"$git_version"/advanced/pihole.sudo -O /etc/sudoers.d/pihole + chmod 0440 /etc/sudoers.d/pihole + else + Error_NoConnection_NoInstall - #Abort failed install - PLEXMEDIASERVER=0 fi fi - #CUBERITE - if (( $CUBERITE == 1 )); then - INSTALL_DESCRIPTION='Cuberite (Minecraft Server)' - Banner_Installing + #SUBSONIC 5 + INSTALLING_INDEX=33 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #check folder is online + Banner_Installing - #x86_64 - if (( $HW_ARCH == 21 )); then - INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' - #32bit ARM - elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' - fi + INSTALL_URL_ADDRESS='http://sourceforge.net/projects/subsonic/files/subsonic/5.3/subsonic-5.3.deb/download' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.tar - mkdir -p /etc/cubrite - tar xzvf package.tar -C /etc/cubrite - rm package.tar + AGI lame - # - Move everything into base directory (cuberite) - mv /etc/cubrite/Server/* /etc/cubrite/ - rm -R /etc/cuberite/Server + #Install SubSonic 5.3 + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb else + Error_NoConnection_NoInstall - #Abort failed install - CUBERITE=0 fi fi - #MINEOS - if (( $MINEOS == 1 )); then - INSTALL_DESCRIPTION='MineOS (Minecraft Servers)' - Banner_Installing + #SUBSONIC 6 + INSTALLING_INDEX=34 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #check folder is online + Banner_Installing - INSTALL_URL_ADDRESS='http://github.com/hexparrot/mineos-node.git' + INSTALL_URL_ADDRESS='https://sourceforge.net/projects/subsonic/files/subsonic/6.0/subsonic-6.0.deb/download' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install if (( $? == 0 )); then - #prereqs - apt-get install -y python python3 supervisor rdiff-backup screen rsync - - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos - cd "$DIETPI_USERDATA_DIRECTORY"/mineos - git clone https://github.com/hexparrot/mineos-node.git minecraft + AGI lame - cd minecraft - git config core.filemode false - chmod +x service.js mineos_console.js generate-sslcert.sh webui.js - - npm install - - cd "$HOME" + #Install SubSonic 6.0 + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb else + Error_NoConnection_NoInstall - #Abort failed install - MINEOS=0 fi fi - #GOGS - if (( $GOGS == 1 )); then - INSTALL_DESCRIPTION='Gogs (Personal GitHub)' - Banner_Installing - - #armv6 - if (( $HW_ARCH == 1 )); then - - INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_linux_arm.zip' - - #armv7+ - elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - - INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_raspi2.zip' - - #x86_64 - elif (( $HW_ARCH == 21 )); then + #WEAVED + INSTALLING_INDEX=68 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_linux_amd64.zip' - fi + Banner_Installing + INSTALL_URL_ADDRESS='https://github.com/weaved/installer/raw/master/binaries/weaved-nixinstaller_1.2.13.bin' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install if (( $? == 0 )); then - wget "$INSTALL_URL_ADDRESS" -O package.zip - unzip package.zip - rm package.zip + #Install WEAVED + wget "$INSTALL_URL_ADDRESS" -O weaved_setup.bin + chmod +x weaved_setup.bin - mv gogs* /etc/gogs + ##Dont run this, let the user run it for "1st time setup" + #./weaved_setup.bin else + Error_NoConnection_NoInstall - #Abort failed install - GOGS=0 fi fi - if (( $QBITTORRENT == 1 )); then + #WEBIOPI requires RPIGPIO + if (( ${aSOFTWARE_INSTALL_STATE[$71]} == 1 )); then - AGI qbittorrent-nox + aSOFTWARE_INSTALL_STATE[69]=1 fi - #SYNCTHING - if (( $SYNCTHING == 1 )); then + #RPIGPIO + INSTALLING_INDEX=69 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_DESCRIPTION='Syncthing' Banner_Installing - #armv6+ - if (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - - INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-arm-v0.14.0.tar.gz' + # >= v111 image + if [ -f /etc/.dietpi_image_version ]; then - #arm64 - elif (( $HW_ARCH == 10 )); then + AGI python-rpi.gpio python3-rpi.gpio - INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-arm64-v0.14.0.tar.gz' + # - < v111 Bug in older DietPi images with sources.list | Use pip, as offical repo = python3-rpi.gpio: Depends: python3 (< 3.3) but 3.4.2-2 is to be installed + else - #x86_64 - elif (( $HW_ARCH == 21 )); then + AGI python3-pip + pip3 install RPi.GPIO - INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-amd64-v0.14.0.tar.gz' fi - #?? - #For some reason checking connection (spider) against the files above fails. + fi - #/DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - /DietPi/dietpi/func/check_connection http://github.com/syncthing/syncthing + #WIRINGPI + INSTALLING_INDEX=70 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + + #check source is online | http://git.drogon.net/?p=wiringPi;a=shortlog;h=refs/heads/master snapshot + INSTALL_URL_ADDRESS='http://git.drogon.net/?p=wiringPi;a=snapshot;h=HEAD;sf=tgz' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then wget "$INSTALL_URL_ADDRESS" -O package.tar - tar xzvf package.tar + tar xfz package.tar rm package.tar - - mv syncthing-*/syncthing /usr/bin/ - rm -R syncthing-* + cd wiringPi* + ./build + cd .. + #rm -R /root/wiringPi* #Also Contains example code for users. else + Error_NoConnection_NoInstall - #Abort failed install - SYNCTHING=0 fi - fi - } - - Install_Linux_Software(){ - - # Stop Services - /DietPi/dietpi/dietpi-services stop + #RPII2C + INSTALLING_INDEX=72 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #DietPi software that requires Alsa-base - if (( $DESKTOP_LXDE == 1 )); then - ALSABASE=1 - elif (( $DESKTOP_MATE == 1 )); then - ALSABASE=1 - elif (( $DESKTOP_GNUSTEP == 1 )); then - ALSABASE=1 - elif (( $DESKTOP_XFCE == 1 )); then - ALSABASE=1 - elif (( $HIFI == 1 )); then - ALSABASE=1 - elif (( $KODI == 1 )); then - ALSABASE=1 - elif (( $MINIDLNA == 1 )); then - ALSABASE=1 - elif (( $OPENTYRIAN == 1 )); then - ALSABASE=1 - elif (( $SUBSONIC5 == 1 )); then - ALSABASE=1 - elif (( $SUBSONIC6 == 1 )); then - ALSABASE=1 - elif (( $TIGHTVNCSERVER == 1 )); then - ALSABASE=1 - elif (( $VNC4SERVER == 1 )); then - ALSABASE=1 - elif (( $NOMACHINE == 1 )); then - ALSABASE=1 - elif (( $XRDP == 1 )); then - ALSABASE=1 - elif (( $SQUEEZEBOXSERVER == 1 )); then - ALSABASE=1 - elif (( $AMPACHE == 1 )); then - ALSABASE=1 - elif (( $SHAIRPORTSYNC == 1 )); then - ALSABASE=1 - elif (( $BRUTEFIR == 1 )); then - ALSABASE=1 - elif (( $SQUEEZELITE == 1 )); then - ALSABASE=1 - fi - - if (( $ALSABASE == 1 )); then - INSTALL_DESCRIPTION='ALSA (Linux Sound System)' Banner_Installing - AGI alsa-base alsa-utils - - #Apply soundcard - local soundcard=$(cat /DietPi/dietpi.txt | grep -m1 'soundcard=' | sed 's/.*=//') - # - RPi enable internal HDMI+Analogue if currently set to 'none' - if (( $HW_MODEL < 10 )) && - [ "$soundcard" = "none" ]; then - soundcard='rpi-bcm2835' - fi + /DietPi/dietpi/func/dietpi-set_hardware i2c enable - # - Apply - /DietPi/dietpi/func/dietpi-set_hardware soundcard "$soundcard" + fi - ALSABASE=2 - fi - - #DietPi software that requires Xserver - Xorg - if (( $DESKTOP_LXDE == 1 )); then - XSERVERXORG=1 - elif (( $DESKTOP_MATE == 1 )); then - XSERVERXORG=1 - elif (( $DESKTOP_GNUSTEP == 1 )); then - XSERVERXORG=1 - elif (( $DESKTOP_XFCE == 1 )); then - XSERVERXORG=1 - elif (( $KODI == 1 )); then - XSERVERXORG=1 - elif (( $OPENTYRIAN == 1 )); then - XSERVERXORG=1 - elif (( $TIGHTVNCSERVER == 1 )); then - XSERVERXORG=1 - elif (( $VNC4SERVER == 1 )); then - XSERVERXORG=1 - elif (( $NOMACHINE == 1 )); then - XSERVERXORG=1 - elif (( $XRDP == 1 )); then - XSERVERXORG=1 - elif (( $QUITERSS == 1 )); then - XSERVERXORG=1 - fi - - if (( $XSERVERXORG == 1 )); then - - XSERVERXORG=2 + #WEBIOPI + INSTALLING_INDEX=71 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Xserver Prereqs (ALL) - INSTALL_DESCRIPTION='Xserver (Xinit / Xauth)' Banner_Installing - AGI xterm xinit xauth xserver-xorg dbus-x11 xfonts-base x11-xserver-utils x11-common x11-utils --no-install-recommends - #RPI - if (( $HW_MODEL < 10 )); then - INSTALL_DESCRIPTION='Xserver (FBTurbo)' - Banner_Installing + INSTALL_URL_ADDRESS='http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz/download' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + if (( $? == 0 )); then - #Wheezy - if (( $DISTRO == 1 )); then - AGI xserver-xorg-video-fbturbo xserver-xorg-video-fbdev --no-install-recommends + #Python dev, pre-reqs + AGI python-dev python-setuptools --no-install-recommends - #Jessie - elif (( $DISTRO == 3 )); then - sleep 1 - # - Install OpenGL driver? - #AGI xcompmgr libgl1-mesa-dri raspi-gpio mesa-utils - # - Requires 256mb GPU? + #Install WEBIOPI + wget "$INSTALL_URL_ADDRESS" -O package.tar + tar xvzf package.tar + rm package.tar - # - status: still software driver being used on rpi 3. - fi + cd WebIOPi* - #Odroid C2 - elif (( $HW_MODEL == 12 )); then - INSTALL_DESCRIPTION='Xserver (AMLogic VPU / Mali GPU)' - Banner_Installing + #Automate Weaved prompt + sed -i '/read response/c\response="n"' setup.sh - AGI xcompmgr aml-libs-odroid mali450-odroid xf86-video-mali-odroid libump-odroid --no-install-recommends - # xcompmgr is fix for broken transparency with lxdesession and improve performance + #Run setup script + ./setup.sh + clear - cp /DietPi/dietpi/conf/xorg_c2.conf /etc/X11/xorg.conf + cd .. - #Odroid XU4 - elif (( $HW_MODEL == 11 )); then - INSTALL_DESCRIPTION='Xserver (Exynos 5422)' - Banner_Installing + #Cleanup + rm -R WebIOPi* - AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid --no-install-recommends + else - cp /DietPi/dietpi/conf/xorg_xu4.conf /etc/X11/xorg.conf + Error_NoConnection_NoInstall - #Odroid C1 - elif (( $HW_MODEL == 10 )); then - INSTALL_DESCRIPTION='Xserver (AMLogic VPU / Mali GPU)' - Banner_Installing + fi - AGI xcompmgr aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid --no-install-recommends - # xcompmgr is fix for broken transparency with lxdesession and improve performance + fi - cp /DietPi/dietpi/conf/xorg_c1.conf /etc/X11/xorg.conf + #DIETPICLOUDSHELL + INSTALLING_INDEX=62 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Pine64 - elif (( $HW_MODEL >= 40 && $HW_MODEL < 50 )); then + Banner_Installing - #check source is online - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + AGI net-tools - #Install - if (( $? == 0 )); then + #LCD panels can be enabled in Dietpi-config > display options - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + fi - wget http://dietpi.com/downloads/binaries/all/xf86-video-fbturbo_1-1_arm64.deb -O package.deb - dpkg -i package.deb - rm package.deb + #HAPROXY + INSTALLING_INDEX=98 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - cat << _EOF_ > /etc/X11/xorg.conf -Section "Device" - Identifier "Allwinner A10/A13 FBDEV" - Driver "fbturbo" - Option "fbdev" "/dev/fb0" - Option "SwapbuffersWait" "true" -EndSection -_EOF_ + Banner_Installing - else - Error_NoConnection_NoInstall + #check source is online + INSTALL_URL_ADDRESS='http://www.haproxy.org/download/1.6/src/haproxy-1.6.2.tar.gz' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Abort failed install - XSERVERXORG=0 - fi + #Install + if (( $? == 0 )); then - fi + #Download HAPROXY + wget "$INSTALL_URL_ADDRESS" -O package.tar + tar -xvf package.tar + rm package.tar - fi + cd haproxy-* - #DietPi software that requires Build-Essential - if (( $HAPROXY == 1 )); then - BUILDESSENTIAL=1 - elif (( $WEBIOPI == 1 )); then - BUILDESSENTIAL=1 - elif (( $WIRINGPI == 1 )); then - BUILDESSENTIAL=1 - elif (( $OPENBAZAAR == 1 )); then - BUILDESSENTIAL=1 - elif (( $MINEOS == 1 )); then - BUILDESSENTIAL=1 - fi + #Pre-reqs + AGI libpcre3-dev libssl-dev + #Compile and install + make -j "$(nproc --all)" TARGET=linux2628 CPU=generic USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_SPLICE=1 + make install - if (( $BUILDESSENTIAL == 1 )); then - INSTALL_DESCRIPTION='Build Essential' - Banner_Installing - AGI build-essential --no-install-recommends + mkdir /etc/haproxy - BUILDESSENTIAL=2 - fi + #Exit directory + cd .. - #DietPi software that requires GITCLIENT - if (( $AMPACHE == 1 )); then - GITCLIENT=1 - elif (( $OPENBAZAAR == 1 )); then - GITCLIENT=1 - elif (( $MINEOS == 1 )); then - GITCLIENT=1 - elif (( $GOGS == 1 )); then - GITCLIENT=1 - fi + #Clean up + rm -R haproxy-* - if (( $GITCLIENT == 1 )); then - INSTALL_DESCRIPTION='Git' - Banner_Installing - AGI git --no-install-recommends + #Install init script as service + cp /DietPi/dietpi/conf/haproxy_init /etc/init.d/haproxy + chmod +x /etc/init.d/haproxy + update-rc.d haproxy defaults - GITCLIENT=2 - fi + else - if (( $QUITERSS == 1 )); then - INSTALL_DESCRIPTION="QuiteRSS" - Banner_Installing - AGI quiterss + Error_NoConnection_NoInstall - QUITERSS=2 + fi fi - if (( $VIFM == 1 )); then - INSTALL_DESCRIPTION='ViFM (File Manager with Vi Bindings)' + #SQUEEZEBOXSERVER + INSTALLING_INDEX=35 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI vifm - VIFM=2 - fi + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_all.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $VIMFULL == 1 )); then - INSTALL_DESCRIPTION='Vim' - Banner_Installing - AGI vim + #Install + if (( $? == 0 )); then - VIMFULL=2 - fi + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - if (( $VIMTINY == 1 )); then - INSTALL_DESCRIPTION='Vim Tiny' - Banner_Installing - AGI vim-tiny + #Stop service + service logitechmediaserver stop - VIMTINY=2 - fi + # + ARMv6 cpan + if (( $HW_MODEL <= 1 )); then - if (( $GNUEMACS == 1 )); then - INSTALL_DESCRIPTION='Emacs' - Banner_Installing - AGI emacs + wget http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_CPAN_5.20_armv6hf.tar.gz -O package.tar + tar xvzf package.tar -C / + rm package.tar - GNUEMACS=2 - fi + fi - if (( $IPERF == 1 )); then - INSTALL_DESCRIPTION='Iperf' - Banner_Installing - AGI iperf + else - IPERF=2 - fi + Error_NoConnection_NoInstall - if (( $MIDNIGHTCOMMANDER == 1 )); then - INSTALL_DESCRIPTION='Midnight Commander' - Banner_Installing - AGI mc + fi - MIDNIGHTCOMMANDER=2 fi - if (( $JED == 1 )); then - INSTALL_DESCRIPTION='Jed Text Editor' + #WORDPRESS + INSTALLING_INDEX=55 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI jed - JED=2 - fi + #check source is online + INSTALL_URL_ADDRESS='https://wordpress.org/latest.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $IFTOP == 1 )); then - INSTALL_DESCRIPTION='iftop' - Banner_Installing - AGI iftop + #Install + if (( $? == 0 )); then - IFTOP=2 - fi + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /var/www/ + rm package.zip + chown -R www-data:www-data /var/www/wordpress + chmod -R 775 /var/www/wordpress - if (( $IPTRAF == 1 )); then - INSTALL_DESCRIPTION='IPTraf' - Banner_Installing - AGI iptraf + else - IPTRAF=2 - fi + Error_NoConnection_NoInstall - if (( $MTRTINY == 1 )); then - INSTALL_DESCRIPTION='MTR-Tiny' - Banner_Installing - AGI mtr-tiny + fi - MTRTINY=2 fi - if (( $NLOAD == 1 )); then - INSTALL_DESCRIPTION='nLoad' + #TIGHTVNCSERVER + INSTALLING_INDEX=27 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI nload - NLOAD=2 + AGI tightvncserver --no-install-recommends + fi - if (( $TCPDUMP == 1 )); then - INSTALL_DESCRIPTION='TCPDUMP' + #VNC4SERVER + INSTALLING_INDEX=28 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI tcpdump - TCPDUMP=2 + AGI vnc4server --no-install-recommends + fi - if (( $SSHCLIENT == 1 )); then - INSTALL_DESCRIPTION='OpenSSH Client' + #FAIL2BAN + INSTALLING_INDEX=73 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - AGI openssh-client - SSHCLIENT=2 + AGI fail2ban --no-install-recommends + fi - if (( $SMBCLIENT == 1 )); then - INSTALL_DESCRIPTION='Samba Client' + #PHPSYSINFO + INSTALLING_INDEX=64 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing - #Remove Information file - rm /mnt/samba/readme.txt &> /dev/null + #check source is online + INSTALL_URL_ADDRESS='https://github.com/phpsysinfo/phpsysinfo/archive/master.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - AGI smbclient cifs-utils --no-install-recommends + #Install + if (( $? == 0 )); then - SMBCLIENT=2 - fi + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /var/www/ + rm package.zip + mv /var/www/phpsysinfo-* /var/www/phpsysinfo - if (( $CURLFTPFS == 1 )); then - INSTALL_DESCRIPTION='CurlFtpFs (FTP client as filesystem mount)' - Banner_Installing + else - #Remove information file - rm /mnt/ftp_client/readme.txt &> /dev/null + Error_NoConnection_NoInstall - AGI curlftpfs + fi - CURLFTPFS=2 fi - #Install Choice based SSH Server - if (( $SSHSERVER_DROPBEAR == 1 )); then + #PHPIMAGEGALLERY + INSTALLING_INDEX=56 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_DESCRIPTION='Dropbear SSH Server' Banner_Installing - AGI dropbear - #set to start on next boot - sed -i '/NO_START=1/c\NO_START=0' /etc/default/dropbear + #check source is online + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/Single_File_PHP_Gallery_4.6.1.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + + #Install + if (( $? == 0 )); then + + AGI php5-gd + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /var/www/gallery + rm package.zip + + else + + Error_NoConnection_NoInstall - SSHSERVER_DROPBEAR=2 + fi fi - if (( $SSHSERVER_OPENSSH == 1 )); then + #AMPACHE + INSTALLING_INDEX=40 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_DESCRIPTION='OpenSSH Server' Banner_Installing - AGI openssh-server --no-install-recommends - - #Jessie, must enable root login - if (( $DISTRO == 3 )); then - sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config - #Restart ssh server now so root users can login during setup. - systemctl restart ssh - fi + #check source is online + INSTALL_URL_ADDRESS='https://github.com/ampache/ampache/archive/master.zip' - SSHSERVER_OPENSSH=2 + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #SSH server package also installs client. - SSHCLIENT=2 + #Install + if (( $? == 0 )); then - fi + AGI php5-curl - #Install Choices Logging - if (( $LOGGING_RAMLOG == 1 )); then + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip + rm package.zip + mv ampache-* /var/www/ampache - INSTALL_DESCRIPTION='DietPi-Ramlog' - Banner_Installing + #composer install required for 3.8.2 + php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php + php composer-setup.php + php -r "unlink('composer-setup.php');" - #Install (add tmpfs mount to fstab) - sed -i '/\/var\/log/c\tmpfs \/var\/log tmpfs defaults,size=20m,noatime,nodev,nosuid,mode=1777 0 0' /etc/fstab - LOGGING_RAMLOG=2 + mv composer.phar /usr/local/bin/composer - fi + cd /var/www/ampache + composer install --prefer-source --no-interaction + cd ~/ - if (( $LOGGING_LOGROTATE == 1 )); then + else - INSTALL_DESCRIPTION='Logrotate' - Banner_Installing - AGI logrotate --no-install-recommends + Error_NoConnection_NoInstall - LOGGING_LOGROTATE=2 - fi + fi - #Software that requires rsyslog - if (( $FAIL2BAN == 1 )); then - LOGGING_RSYSLOG=1 - elif (( $OPENVPNSERVER == 1 )); then - LOGGING_RSYSLOG=1 fi - if (( $LOGGING_RSYSLOG == 1 )); then + #OPENVPNSERVER + INSTALLING_INDEX=97 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_DESCRIPTION='Rsyslog' Banner_Installing - AGI rsyslog --no-install-recommends - - LOGGING_RSYSLOG=2 - fi + AGI openvpn easy-rsa iptables - #Software that requires ffmpeg - if (( $SUBSONIC5 == 1 )); then - FFMPEG=1 - elif (( $SUBSONIC6 == 1 )); then - FFMPEG=1 - elif (( $AMPACHE == 1 )); then - FFMPEG=1 - elif (( $EMBYSERVER == 1 )); then - FFMPEG=1 fi - if (( $FFMPEG == 1 )); then + #LETSENCRYPT + INSTALLING_INDEX=92 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - INSTALL_DESCRIPTION='FFmpeg' Banner_Installing - if (( $DISTRO == 1 )); then + #check source is online + INSTALL_URL_ADDRESS='https://github.com/certbot/certbot/archive/master.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - AGI ffmpeg + #Install + if (( $? == 0 )); then - elif (( $DISTRO == 3 )); then + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /root + rm package.zip + mv certbot* /etc/letsencrypt_scripts - #RPi v1 armv6, broken packages in multimedia repo. https://github.com/Fourdee/DietPi/issues/84#issuecomment-151201361 - if (( $HW_MODEL < 2 )); then + # - Install packages + cd /etc/letsencrypt_scripts + ./certbot-auto --os-packages-only + cd ~/ - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/ffmpeg_2.7.2-1_armhf-v6.deb' - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + else - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/fdk-aac_0.1.4_armhf-v6.deb' - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + Error_NoConnection_NoInstall - #Install pre-reqs - AGI libogg0 libvorbisenc2 libtheora0 libspeex1 libopencore-amrwb0 libopencore-amrnb0 libass5 + fi - #rpi 2/3 - elif (( $HW_MODEL == 2 )) || (( $HW_MODEL == 3 )); then + fi - #Add Deb Multimedia repo for ffmpeg - if [ ! -f /etc/apt/sources.list.d/debmultimedia.list ]; then + #TORHOTSPOT requires WIFIHOTSPOT: + if (( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )); then - echo -e "deb http://www.deb-multimedia.org jessie main non-free" > /etc/apt/sources.list.d/debmultimedia.list - apt-get update - AGI deb-multimedia-keyring --force-yes - apt-get update + aSOFTWARE_INSTALL_STATE[60]=1 - AGI ffmpeg + fi - #Done. Remove deb http://www.deb-multimedia.org from apt sources - # - When installing Kodi, apt uses the packages from deb http://www.deb-multimedia.org, rather than Raspbian. - rm /etc/apt/sources.list.d/debmultimedia.list - /DietPi/dietpi/dietpi-apt-get_update 2 - fi + #WIFIHOTSPOT + INSTALLING_INDEX=60 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Jessie (now available from backports). - else - AGI ffmpeg + Banner_Installing - fi - fi + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/hostapd_2.5_all.zip' - FFMPEG=2 + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - fi + #Install + if (( $? == 0 )); then - #ORACLEJAVA - # - Software that requires JRE/JDK - if (( $SUBSONIC5 == 1 )); then - ORACLEJAVA=1 - elif (( $SUBSONIC6 == 1 )); then - ORACLEJAVA=1 - elif (( $MINEOS == 1 )); then - ORACLEJAVA=1 - fi + # - Prereqs + AGI hostapd isc-dhcp-server iptables libnl-3-200 - if (( $ORACLEJAVA == 1 )); then + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip + rm package.zip - INSTALL_DESCRIPTION='Oracle Java 8 jdk' - Banner_Installing + # - Check for RTL8188C* device, use the patched binary I compiled: https://github.com/pritambaral/hostapd-rtl871xdrv#why + if (( $(lsusb | grep -ci -m1 'RTL8188C') )); then - # - Raspbian - if (( $HW_MODEL < 10 )); then + WIFIHOTSPOT_RTL8188C_DEVICE=1 - AGI oracle-java8-jdk + fi - # - Debian. Add repo - else + #Which binary to install + local filename_hostapd='' + local filename_hostapd_cli='' - cat << _EOF_ > /etc/apt/sources.list.d/webupd8team-java.list -deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main -deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main -_EOF_ + # - armv6 + if (( $HW_ARCH == 1 )); then - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 - apt-get update + filename_hostapd='hostapd-nl80211-armv6' + filename_hostapd_cli='hostapd_cli-armv6' - # - Accept the license: https://github.com/Fourdee/DietPi/issues/298 - debconf-set-selections <<< "oracle-java8-installer shared/accepted-oracle-license-v1-1 boolean true" + if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - AGI oracle-java8-installer + filename_hostapd='hostapd-rtl8188c-armv6' - fi + fi - ORACLEJAVA=2 + # - armv7+ + elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - fi + filename_hostapd='hostapd-nl80211-armv7' + filename_hostapd_cli='hostapd_cli-armv7' - #Programs that require NODEJS - if (( $NETDATA == 1 )); then - NODEJS=1 - elif (( $MINEOS == 1 )); then - NODEJS=1 - fi + if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - #NODEJS - if (( $NODEJS == 1 )); then - INSTALL_DESCRIPTION='NodeJS - Javascript Runtime' - Banner_Installing + filename_hostapd='hostapd-rtl8188c-armv7' - #arm64 - Not currently available via nodesource.com or https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh - if (( $HW_ARCH == 10 )); then + fi - #check, is online - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/c2/nodejs_5-1_arm64.deb' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + # - arm64 + elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - #Install - if (( $? == 0 )); then + filename_hostapd='hostapd-nl80211-arm64' + filename_hostapd_cli='hostapd_cli-arm64' - # - Preqs - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then - NODEJS=2 + filename_hostapd='hostapd-rtl8188c-arm64' - else - Error_NoConnection_NoInstall + fi - #Abort failed install - NODEJS=0 fi - #Everything else - else - - #check, is online - INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install - if (( $? == 0 )); then + mv "$filename_hostapd" /usr/sbin/hostapd + mv "$filename_hostapd_cli" /usr/sbin/hostapd_cli - # - Preqs - wget "$INSTALL_URL_ADDRESS" -O node_install.sh - chmod +x node_install.sh - ./node_install.sh + chmod +x /usr/sbin/hostapd + chmod +x /usr/sbin/hostapd_cli - rm node_install.sh + rm hostapd-* - NODEJS=2 + #Enable wifi modules + /DietPi/dietpi/func/dietpi-set_hardware wifi enable - else - Error_NoConnection_NoInstall + else - #Abort failed install - NODEJS=0 - fi + Error_NoConnection_NoInstall fi fi - } - - Uninstall_NonSelected_Choices(){ - - #Uninstall software using our temp uninstall file script - if [ -f "$UNINSTALL_FILE" ]; then - - #Write .Install File - Write_InstallFileList - #Run the temp uninstall script - while read -r line - do - /DietPi/dietpi/dietpi-uninstall "$line" + #TORHOTSPOT + INSTALLING_INDEX=61 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - done < $UNINSTALL_FILE - rm $UNINSTALL_FILE + Banner_Installing - #Reload installed file (dietpi-uninstall sets flags back to 0) - Read_InstallFileList + # - Prereqs + AGI tor fi - } + #SHAIRPORTSYNC + INSTALLING_INDEX=37 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - Apply_SSHServer_Choices(){ + Banner_Installing - #Work out which SSH Server needs installing from Indexs (if any) - #Work out which SSH server needs removing (if any), and, create a temp script file - if (( $INDEX_SSHSERVER_TARGET != $INDEX_SSHSERVER_CURRENT )); then + #check source is online + # - ARMv6 + if (( $HW_ARCH == 1 )); then - # - No SSH server - if (( $INDEX_SSHSERVER_TARGET == 0 )); then - echo -e "SSHSERVER_DROPBEAR" >> "$UNINSTALL_FILE" - echo -e "SSHSERVER_OPENSSH" >> "$UNINSTALL_FILE" + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_armv6.deb' - # - Dropbear - elif (( $INDEX_SSHSERVER_TARGET == -1 )); then + # - ARMv7 + elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - SSHSERVER_DROPBEAR=1 - echo -e "SSHSERVER_OPENSSH" >> "$UNINSTALL_FILE" + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_armv7.deb' - # - Openssh - elif (( $INDEX_SSHSERVER_TARGET == -2 )); then + # - ARM64 + elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - SSHSERVER_OPENSSH=1 - echo -e "SSHSERVER_DROPBEAR" >> "$UNINSTALL_FILE" + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/shairport-sync-dietpi_arm64.deb' fi - #Inform user (From testing, stopping SSH server services does not disconnect user, however, just incase it does in the future) - /DietPi/dietpi/dietpi-banner 0 - echo -e "\n Stopping SSH Servers, please wait.....\n\n - If you are connected via SSH, you may be disconnected.\n - Your system will reboot once your DietPi-Software installation is completed.\n - Go make a coffee :) \n" + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #stop all SSH server services - service ssh stop &> /dev/null - service dropbear stop &> /dev/null + #Install + if (( $? == 0 )); then - #Update Current SSHSERVER index - INDEX_SSHSERVER_CURRENT=$INDEX_SSHSERVER_TARGET + # - Prereqs + AGI openssl avahi-daemon libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 --no-install-recommends - fi + # This occured on C2: shairport-sync : Depends: libpopt-dev but it is not installed + AGI libpopt-dev - } + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - Apply_FileServer_Choices(){ + else - #Work out which File Server needs installing from Indexs (if any) - #Work out which File server needs removing (if any), and, create a temp script file - if (( $INDEX_FILESERVER_TARGET != $INDEX_FILESERVER_CURRENT )); then + Error_NoConnection_NoInstall - #No File server - if (( $INDEX_FILESERVER_TARGET == 0 )); then - echo -e "FILESERVER_SAMBA" >> "$UNINSTALL_FILE" - echo -e "FILESERVER_PROFTP" >> "$UNINSTALL_FILE" - #echo -e "FILESERVER_VSFTPD" >> "$UNINSTALL_FILE" + fi - #ProFTP - elif (( $INDEX_FILESERVER_TARGET == -1 )); then + fi - FILESERVER_PROFTP=1 - echo -e "FILESERVER_SAMBA" >> "$UNINSTALL_FILE" + #BRUTEFIR + INSTALLING_INDEX=38 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Samba - elif (( $INDEX_FILESERVER_TARGET == -2 )); then + Banner_Installing - FILESERVER_SAMBA=1 - echo -e "FILESERVER_PROFTP" >> "$UNINSTALL_FILE" + #check folder is online + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/conf/BruteFIR/' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - fi + #Install + if (( $? == 0 )); then - #Update Current SSHSERVER index - INDEX_FILESERVER_CURRENT=$INDEX_FILESERVER_TARGET + # - Prereqs + AGI brutefir - fi + wget -r -nH --cut-dirs=2 --no-parent --reject="index.htm*" -e robots=off "$INSTALL_URL_ADDRESS" + mv BruteFIR /etc/ - } + else - Apply_Logging_Choices(){ + Error_NoConnection_NoInstall - #Work out which Logging system needs installing from Indexs (if any) - #Work out which Logging system needs removing (if any), and, create a temp script file - if (( $INDEX_LOGGING_TARGET != $INDEX_LOGGING_CURRENT )); then + fi - #None - if (( $INDEX_LOGGING_TARGET == 0 )); then - echo -e "LOGGING_LOGROTATE" >> "$UNINSTALL_FILE" - echo -e "LOGGING_RAMLOG" >> "$UNINSTALL_FILE" - echo -e "LOGGING_RSYSLOG" >> "$UNINSTALL_FILE" + fi - #Ramlog - clear every 24H - elif (( $INDEX_LOGGING_TARGET == -1 )); then + #PYDIO + INSTALLING_INDEX=48 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - LOGGING_RAMLOG=1 - echo -e "LOGGING_LOGROTATE" >> "$UNINSTALL_FILE" - echo -e "LOGGING_RSYSLOG" >> "$UNINSTALL_FILE" + Banner_Installing - #Ramlog - backup every 1H to $HOME/logfile_storage, then clear. - elif (( $INDEX_LOGGING_TARGET == -2 )); then + #check folder is online + INSTALL_URL_ADDRESS='http://sourceforge.net/projects/ajaxplorer/files/pydio/stable-channel/6.2.2/pydio-core-6.2.2.zip/download' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - LOGGING_RAMLOG=1 - echo -e "LOGGING_LOGROTATE" >> "$UNINSTALL_FILE" - echo -e "LOGGING_RSYSLOG" >> "$UNINSTALL_FILE" + #Install + if (( $? == 0 )); then - #Logrotate + rsyslog - logs to disk - elif (( $INDEX_LOGGING_TARGET == -3 )); then + # - Prereqs + AGI php5-mcrypt php5-gd - LOGGING_LOGROTATE=1 - LOGGING_RSYSLOG=1 - echo -e "LOGGING_RAMLOG" >> "$UNINSTALL_FILE" + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /var/www + mv /var/www/pydio-core-* /var/www/pydio + rm package.zip - fi + else - #Requires Rsyslog. Override and remove from uninstall file. - if (( $FAIL2BAN > 0 )) || - (( $OPENVPNSERVER > 0 )); then - sed -i '/LOGGING_RSYSLOG/d' "$UNINSTALL_FILE" - fi + Error_NoConnection_NoInstall - #Update Current Logging index - INDEX_LOGGING_CURRENT=$INDEX_LOGGING_TARGET + fi fi - } - - Apply_Webserver_Preference(){ + #SQUEEZELITE + INSTALLING_INDEX=36 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )); then + Banner_Installing - #Update Current to Target - INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET + # - Prereqs + AGI squeezelite fi - } + #EMONHUB + INSTALLING_INDEX=99 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - Install_Apply_Configs(){ + Banner_Installing - # Stop Services - /DietPi/dietpi/dietpi-services stop + #check, is online + INSTALL_URL_ADDRESS='https://github.com/Fourdee/emonhub/archive/emon-pi.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - # Copy/Set optimised Software settings. - # Set install states to 2 (installed). + #Install + if (( $? == 0 )); then - #Destop LXDE - if (( $DESKTOP_LXDE == 1 )); then + # - Prereqs + AGI minicom python-pip python-serial python-configobj --no-install-recommends + pip install paho-mqtt pydispatcher - #C1 - Fix for broken/laggy transparency - # - xcompmgr -a seems faster, but causes display corruption vertically on right side of screen for C1 - if (( $HW_MODEL == 10 )); then - cat << _EOF_ > /etc/xdg/lxsession/LXDE/autostart -xcompmgr -n -@lxpanel --profile LXDE -@pcmanfm --desktop --profile LXDE -@xscreensaver -no-splash -_EOF_ + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip + rm package.zip - #C2 - Same as C1 but use -a to prevent kodi video playback displaying desktop. - elif (( $HW_MODEL == 12 )); then - cat << _EOF_ > /etc/xdg/lxsession/LXDE/autostart -xcompmgr -a -@lxpanel --profile LXDE -@pcmanfm --desktop --profile LXDE -@xscreensaver -no-splash -_EOF_ + # - move everything to /etc/emonhub + rm -R /etc/emonhub + mkdir -p /etc/emonhub + mv emonhub-*/* /etc/emonhub/ + rm -R emonhub-* - fi + else - #Remove Lxrandr Menu item (monitor configuration tool as we set res in dietpi-config) - rm /usr/share/applications/lxrandr.desktop &> /dev/null + Error_NoConnection_NoInstall - #Copy PCmanFM configs - mkdir -p "$HOME"/.config/pcmanfm/LXDE - cp /DietPi/dietpi/conf/desktop/pcmanfm.conf "$HOME"/.config/pcmanfm/LXDE/pcmanfm.conf - cp /DietPi/dietpi/conf/desktop/pcmanfm-desktopitems.conf "$HOME"/.config/pcmanfm/LXDE/desktop-items-0.conf + fi - #Disable Trash - sed -i '/use_trash=/c\use_trash=0' /etc/xdg/libfm/libfm.conf + fi - #Copy DietPi Panel config - mkdir -p "$HOME"/.config/lxpanel/LXDE/panels - cp /DietPi/dietpi/conf/desktop/panel "$HOME"/.config/lxpanel/LXDE/panels/panel + #RPIMONITOR + INSTALLING_INDEX=66 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Openbox config - mkdir -p "$HOME"/.config/openbox - cp /DietPi/dietpi/conf/desktop/lxde-rc.xml "$HOME"/.config/openbox/lxde-rc.xml + Banner_Installing - # - file manager desktop icon - ln -sf /usr/share/applications/pcmanfm.desktop "$HOME"/Desktop/pcmanfm.desktop + #check, is online + INSTALL_URL_ADDRESS='https://github.com/XavierBerger/RPi-Monitor-deb/raw/master/packages/rpimonitor_2.10-1_all.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - Create_Desktop_DietPi_Applications + #Install + if (( $? == 0 )); then + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - DESKTOP_LXDE=2 + # - Prereqs + apt-get -f -y install - fi + else - #Desktop MATE - if (( $DESKTOP_MATE == 1 )); then + Error_NoConnection_NoInstall - # - file manager desktop icon - ln -sf /usr/share/applications/caja.desktop "$HOME"/Desktop/caja.desktop + fi - Create_Desktop_DietPi_Applications + fi - #Odroid C2, define default pulseaudio sink: https://github.com/Fourdee/DietPi/issues/415 - if (( $HW_MODEL == 12 && - ! $(cat /etc/pulse/default.pa | grep -ci -m1 '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo') )); then + #NETDATA + INSTALLING_INDEX=65 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - echo -e "set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo" >> /etc/pulse/default.pa + Banner_Installing - fi + #Rpi 1 + if (( $HW_MODEL < 2 )); then + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_armv6.deb' - DESKTOP_MATE=2 + #arm64 + elif (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >= 40 && $HW_MODEL < 50 ) )); then - fi + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_arm64.deb' - #Desktop GNUStep - if (( $DESKTOP_GNUSTEP == 1 )); then + #all others + else - Create_Desktop_DietPi_Applications + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/netdata_1.2.0_armv7.deb' - DESKTOP_GNUSTEP=2 + fi - fi + #check, is online + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #DESKTOP_XFCE - if (( $DESKTOP_XFCE == 1 )); then + #Install + if (( $? == 0 )); then - Create_Desktop_DietPi_Applications + # - For compression + AGI --no-install-recommends zlib1g-dev - DESKTOP_XFCE=2 + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - fi + else + + Error_NoConnection_NoInstall - #WEBSERVER_LAMP - if (( $WEBSERVER_LAMP == 1 )); then + fi - WEBSERVER_LAMP=2 fi - #WEBSERVER_LASP - if (( $WEBSERVER_LASP == 1 )); then + #BAIKAL + INSTALLING_INDEX=57 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WEBSERVER_LASP=2 - fi + Banner_Installing - #WEBSERVER_LAAP - if (( $WEBSERVER_LAAP == 1 )); then + #check folder is online + INSTALL_URL_ADDRESS='https://github.com/fruux/Baikal/archive/master.zip' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - WEBSERVER_LAAP=2 - fi + #Install + if (( $? == 0 )); then + + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip -d /var/www + rm package.zip + mv /var/www/Baikal* /var/www/baikal - #WEBSERVER_LEMP - if (( $WEBSERVER_LEMP == 1 )); then + else - WEBSERVER_LEMP=2 - fi + Error_NoConnection_NoInstall - #WEBSERVER_LESP - if (( $WEBSERVER_LESP == 1 )); then + fi - WEBSERVER_LESP=2 fi - #WEBSERVER_LEAP - if (( $WEBSERVER_LEAP == 1 )); then + #MUMBLESERVER + INSTALLING_INDEX=43 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WEBSERVER_LEAP=2 - fi + Banner_Installing - #WEBSERVER_LLMP - if (( $WEBSERVER_LLMP == 1 )); then + AGI mumble-server - WEBSERVER_LLMP=2 fi - #WEBSERVER_LLSP - if (( $WEBSERVER_LLSP == 1 )); then + #EMBYSERVER + INSTALLING_INDEX=41 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WEBSERVER_LLSP=2 - fi + Banner_Installing - #WEBSERVER_LLAP - if (( $WEBSERVER_LLAP == 1 )); then + local url_tests=0 - WEBSERVER_LLAP=2 - fi + #check is online + INSTALL_URL_ADDRESS='http://download.opensuse.org/repositories/home:/emby/Debian_8.0' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #WEBSERVER_APACHE - if (( $WEBSERVER_APACHE == 1 )); then + if (( $? == 0 )); then - #create www directory - mkdir -p /var/www + INSTALL_URL_ADDRESS='http://download.mono-project.com/repo/debian' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Jessie - if (( $DISTRO == 3 )); then + if (( $? == 0 )); then - #Apache2 confs - cp /DietPi/dietpi/conf/apache2_jessie.conf /etc/apache2/apache2.conf - cat << _EOF_ > /etc/apache2/sites-available/000-default.conf - - ServerAdmin webmaster@localhost - DocumentRoot /var/www + url_tests=1 - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - -_EOF_ + fi - cat << _EOF_ > /etc/apache2/mods-available/mpm_event.conf - - StartServers $CPU_CORES_TOTAL - MinSpareThreads 1 - MaxSpareThreads 8 - ThreadLimit 16 - ThreadsPerChild 4 - MaxRequestWorkers 50 - MaxConnectionsPerChild 0 - -_EOF_ + fi - cat << _EOF_ > /etc/apache2/mods-available/mpm_prefork.conf - - StartServers $CPU_CORES_TOTAL - MinSpareServers 1 - MaxSpareServers $CPU_CORES_TOTAL - MaxRequestWorkers 50 - MaxConnectionsPerChild 0 - -_EOF_ + #install + if (( $url_tests == 1 )); then - cat << _EOF_ > /etc/apache2/mods-available/mpm_worker.conf - - StartServers $CPU_CORES_TOTAL - MinSpareThreads 1 - MaxSpareThreads 8 - ThreadLimit 16 - ThreadsPerChild 4 - MaxRequestWorkers 50 - MaxConnectionsPerChild 0 - -_EOF_ + # - Alternative mono repo: https://github.com/Fourdee/DietPi/issues/310#issuecomment-216247879 + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo -e "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list + echo -e "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" >> /etc/apt/sources.list.d/mono-xamarin.list - #Use /var/www as default webfolder - mv /var/www/html/index.html /var/www/index.html &> /dev/null - rm -R /var/www/html &> /dev/null + # - Emby repo + wget http://download.opensuse.org/repositories/home:emby/Debian_8.0/Release.key + apt-key add - < Release.key + echo -e "deb http://download.opensuse.org/repositories/home:/emby/Debian_8.0/ /" > /etc/apt/sources.list.d/emby-server.list + apt-get update - #Wheezy - elif (( $DISTRO == 1 )); then + AGI emby-server - #Rpi apache2 confs - cp /DietPi/dietpi/conf/apache2_wheezy.conf /etc/apache2/apache2.conf + else - sed -i "/StartServers /c\StartServers $CPU_CORES_TOTAL" /etc/apache2/apache2.conf - sed -i "/MinSpareServers /c\MinSpareServers 1" /etc/apache2/apache2.conf - sed -i "/MaxSpareServers /c\MaxSpareServers $CPU_CORES_TOTAL" /etc/apache2/apache2.conf - sed -i "/MinSpareThreads /c\MinSpareThreads 1" /etc/apache2/apache2.conf - sed -i "/MaxSpareThreads /c\MaxSpareThreads 8" /etc/apache2/apache2.conf - sed -i "/MaxClients /c\MaxClients 50" /etc/apache2/apache2.conf - sed -i "/MaxRequestsPerChild /c\MaxRequestsPerChild 0" /etc/apache2/apache2.conf - sed -i "/ThreadLimit /c\ThreadLimit 16" /etc/apache2/apache2.conf - sed -i "/ThreadsPerChild /c\ThreadsPerChild 8" /etc/apache2/apache2.conf - sed -i "/MaxKeepAliveRequests /c\MaxKeepAliveRequests 10" /etc/apache2/apache2.conf + Error_NoConnection_NoInstall fi - #Sites-Available settings. Disable access log, set error log level - sed -i "/CustomLog /c\ #CustomLog "'${APACHE_LOG_DIR}'"/access.log combined" /etc/apache2/sites-available/* - sed -i "/LogLevel /c\ LogLevel error" /etc/apache2/sites-available/* + fi - #Apply permissions - chown -R www-data:www-data /var/www + #PLEXMEDIASERVER + INSTALLING_INDEX=42 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WEBSERVER_APACHE=2 - fi + Banner_Installing - #WEBSERVER_NGINX - if (( $WEBSERVER_NGINX == 1 )); then + #check folder is online - #create www directory - mkdir -p /var/www + #x86_64 + if (( $HW_ARCH == 21 )); then - #Nginx confs - mkdir /etc/nginx/sites-dietpi - cp /DietPi/dietpi/conf/nginx.conf /etc/nginx/nginx.conf - cp /DietPi/dietpi/conf/nginx.site-available-default /etc/nginx/sites-available/default + INSTALL_URL_ADDRESS='https://downloads.plex.tv/plex-media-server/1.0.0.2261-a17e99e/plexmediaserver_1.0.0.2261-a17e99e_amd64.deb' - #Nginx index page - if (( $DISTRO == 1 )); then - cp /usr/share/nginx/www/index.html /var/www/index.html - elif (( $DISTRO == 3 )); then - cp /usr/share/nginx/html/index.html /var/www/index.html - fi + #32bit ARM + elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - #CPU core count - sed -i "/worker_processes/c\worker_processes $CPU_CORES_TOTAL;" /etc/nginx/nginx.conf + INSTALL_URL_ADDRESS='http://dev2day.de/pms/' - #Apply permissions - chown -R www-data:www-data /var/www + fi + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - WEBSERVER_NGINX=2 - fi + #Install + if (( $? == 0 )); then - #WEBSERVER_LIGHTTPD - if (( $WEBSERVER_LIGHTTPD == 1 )); then + #x86_64 + if (( $HW_ARCH == 21 )); then - #create www directory - mkdir -p /var/www + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - #www path - sed -i '/^server.document-root/c\server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf + #32bit ARM + elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - #Configure fastcgi for PHP-FPM - cat << _EOF_ > /etc/lighttpd/conf-available/15-fastcgi-php.conf -# -*- depends: fastcgi -*- -# /usr/share/doc/lighttpd/fastcgi.txt.gz -# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi + echo -e "deb $INSTALL_URL_ADDRESS jessie main" > /etc/apt/sources.list.d/plex.list + wget -O - "$INSTALL_URL_ADDRESS"dev2day-pms.gpg.key | apt-key add - + #AGI apt-transport-https + apt-get update -## Start an FastCGI server using php-fpm -fastcgi.server += ( ".php" => - (( - "socket" => "/var/run/php5-fpm.sock", - "broken-scriptfilename" => "enable" - )) -) -_EOF_ + AGI plexmediaserver - #enable cgi/php - lighttpd-enable-mod fastcgi - lighttpd-enable-mod fastcgi-php + fi - #Move default page - mv /var/www/html/index.lighttpd.html /var/www/ + else - #Apply permissions - chown -R www-data:www-data /var/www + Error_NoConnection_NoInstall - service lighttpd force-reload + fi - WEBSERVER_LIGHTTPD=2 fi - #NB: Webserver_name now = 2 - - #WEBSERVER_MYSQL - if (( $WEBSERVER_MYSQL == 1 )); then + #CUBERITE + INSTALLING_INDEX=52 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WEBSERVER_MYSQL=2 - fi + Banner_Installing - #WEBSERVER_MARIADB - if (( $WEBSERVER_MARIADB == 1 )); then + #x86_64 + if (( $HW_ARCH == 21 )); then - WEBSERVER_MARIADB=2 - fi + INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' - #WEBSERVER_SQLITE - if (( $WEBSERVER_SQLITE == 1 )); then + #32bit ARM + elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - WEBSERVER_SQLITE=2 - fi + INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' - #WEBSERVER_PHP - if (( $WEBSERVER_PHP == 1 )); then + fi + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #PHP-FPM - # - Apache2 has uses its own PHP module - if (( $WEBSERVER_APACHE == 2 )); then - echo -e "nothing here" &> /dev/null + #Install + if (( $? == 0 )); then - # - All other webservers (eg: Nginx/Lighttpd) use PHP-FPM - else + wget "$INSTALL_URL_ADDRESS" -O package.tar + mkdir -p /etc/cubrite + tar xzvf package.tar -C /etc/cubrite + rm package.tar - # - Php-FPM confs - cp /DietPi/dietpi/conf/php-fpm.conf /etc/php5/fpm/php-fpm.conf - cp /DietPi/dietpi/conf/php-fpm_pool.conf /etc/php5/fpm/pool.d/www.conf - sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=1' /etc/php5/fpm/php.ini + # - Move everything into base directory (cuberite) + mv /etc/cubrite/Server/* /etc/cubrite/ + rm -R /etc/cuberite/Server - # - PHP5-fpm optimizations based on total cores - sed -i "/pm.max_children = /c\pm.max_children = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf - sed -i "/pm.start_servers = /c\pm.start_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf - sed -i "/pm.min_spare_servers = /c\pm.min_spare_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf - sed -i "/pm.max_spare_servers = /c\pm.max_spare_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf + else - fi + Error_NoConnection_NoInstall - #php APC/u settings - local target_php_ini=0 - local target_php_cachesize=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 30 )) - if (( $target_php_cachesize < 10 )); then - target_php_cachesize=10 fi - # - 3days TTL - local target_apc_ttl='259200' - #Wheezy APC - if (( $DISTRO == 1 )); then + fi - # - apc ini locations - if (( $WEBSERVER_APACHE == 2 )); then - target_php_ini='/etc/php5/apache2/conf.d/20-apc.ini' - elif (( $WEBSERVER_NGINX == 2 )); then - target_php_ini='/etc/php5/fpm/conf.d/20-apc.ini' - fi + #MINEOS + INSTALLING_INDEX=53 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - echo -e "extension=apc.so" > "$target_php_ini" - echo -e "apc.enabled=1" >> "$target_php_ini" - echo -e "apc.shm_size=$target_php_cachesize" >> "$target_php_ini" - echo -e "apc.ttl=$target_apc_ttl" >> "$target_php_ini" - cp /usr/share/doc/php-apc/apc.php /var/www/apc.php + Banner_Installing + #check folder is online - #Jessie. Opcache + APCu - else + INSTALL_URL_ADDRESS='http://github.com/hexparrot/mineos-node.git' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #PHP OPcache - php5enmod opcache + #Install + if (( $? == 0 )); then - if (( $WEBSERVER_APACHE == 2 )); then - target_php_ini='/etc/php5/apache2/php.ini' - else - target_php_ini='/etc/php5/fpm/php.ini' - fi + #prereqs + AGI python python3 supervisor rdiff-backup screen rsync - sed -i "/opcache.enable=/c\opcache.enable=1" $target_php_ini - sed -i "/opcache.memory_consumption=/c\opcache.memory_consumption=$target_php_cachesize" $target_php_ini - sed -i "/opcache.revalidate_freq=/c\opcache.revalidate_freq=60" $target_php_ini + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos + cd "$DIETPI_USERDATA_DIRECTORY"/mineos + git clone https://github.com/hexparrot/mineos-node.git minecraft - wget https://raw.githubusercontent.com/rlerdorf/opcache-status/master/opcache.php -O /var/www/opcache.php + cd minecraft + git config core.filemode false + chmod +x service.js mineos_console.js generate-sslcert.sh webui.js - #APCu - php5enmod apcu + npm install - # - apc.shm_size= requires M at end to prevent warning: https://github.com/Fourdee/DietPi/issues/218 - target_php_cachesize+="M" - target_php_ini='/etc/php5/mods-available/apcu.ini' + cd "$HOME" - cat << _EOF_ > "$target_php_ini" -extension=apcu.so -apc.shm_size=$target_php_cachesize -apc.ttl=$target_apc_ttl -_EOF_ + else - cp /usr/share/doc/php5-apcu/apc.php /var/www/apc.php + Error_NoConnection_NoInstall fi - #Apply permissions - chown -R www-data:www-data /var/www/apc.php - chown -R www-data:www-data /var/www/opcache.php + fi - #Set all PHP.INI's to UTF-8 - sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/apache2/php.ini &> /dev/null - sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/cli/php.ini &> /dev/null - sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/fpm/php.ini &> /dev/null + #GOGS + INSTALLING_INDEX=49 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Set all PHP.ini tmp_upload_dir to sd (cant be /tmp as its ramdisk and limited size. Also used by Owncloud uploads) - local tmp_upload_dir="/var/tmp/php_upload_tmp" - mkdir -p "$tmp_upload_dir" - chown -R www-data:www-data "$tmp_upload_dir" + Banner_Installing - sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/apache2/php.ini &> /dev/null - sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/cli/php.ini &> /dev/null - sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/fpm/php.ini &> /dev/null + #armv6 + if (( $HW_ARCH == 1 )); then - #Set all PHP.ini max upload sizes. - local php_max_post_size='2G' - local php_max_upload_size='2G' - sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/apache2/php.ini &> /dev/null - sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/apache2/php.ini &> /dev/null - sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/cli/php.ini &> /dev/null - sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/cli/php.ini &> /dev/null - sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/fpm/php.ini &> /dev/null - sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/fpm/php.ini &> /dev/null + INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_linux_arm.zip' - #PHP info web file - cat << _EOF_ > /var/www/phpinfo.php - -_EOF_ + #armv7+ + elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then - WEBSERVER_PHP=2 - fi + INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_raspi2.zip' - #WEBSERVER_MYADMINPHP - if (( $WEBSERVER_MYADMINPHP == 1 )); then + #x86_64 + elif (( $HW_ARCH == 21 )); then - if (( $WEBSERVER_NGINX == 2 || $WEBSERVER_LIGHTTPD == 2 )); then - ln -sf /usr/share/phpmyadmin /var/www + INSTALL_URL_ADDRESS='https://dl.gogs.io/gogs_latest_linux_amd64.zip' fi - WEBSERVER_MYADMINPHP=2 - fi - - #WEBSERVER_REDIS - if (( $WEBSERVER_REDIS == 1 )); then + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Enable resdis extensions for all webstacks: - echo -e "extension=redis.so" > /etc/php5/cli/conf.d/20-redis.ini &> /dev/null - echo -e "extension=redis.so" > /etc/php5/apache2/conf.d/20-redis.ini &> /dev/null + #Install + if (( $? == 0 )); then + wget "$INSTALL_URL_ADDRESS" -O package.zip + unzip package.zip + rm package.zip - WEBSERVER_REDIS=2 - fi + mv gogs* /etc/gogs - #OPENBAZAAR - if (( $OPENBAZAAR == 1 )); then + else - # - service - cp /DietPi/dietpi/conf/openbazaar-server.service /etc/dietpi/dietpi-software/services/openbazaar-server.service - chmod +x /etc/dietpi/dietpi-software/services/openbazaar-server.service + Error_NoConnection_NoInstall - OPENBAZAAR=2 + fi fi + #QBITTORRENT + INSTALLING_INDEX=46 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #OwnCloud - if (( $OWNCLOUD == 1 )); then - + Banner_Installing - #Setup Data directory - local target_data_dir="$DIETPI_USERDATA_DIRECTORY/owncloud_data" - mkdir -p "$target_data_dir" + AGI qbittorrent-nox - #Create symlink from default /var/www/owncloud/data to DIETPI_USERDATA_DIRECTORY - local target_data_symlink="/var/www/owncloud/data" - mkdir -p "$target_data_symlink" &> /dev/null + fi - # - Copy existing data to our data location - cp -R "$target_data_symlink" "$target_data_dir" + #SYNCTHING + INSTALLING_INDEX=50 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Create symlink - rm -R "$target_data_symlink" &> /dev/null - ln -fs "$target_data_dir" "$target_data_symlink" + Banner_Installing - #Set permissions to both directory and symlink. - chown -R www-data:www-data "$target_data_dir" - chown -R www-data:www-data "$target_data_symlink" + #armv6+ + if (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - chmod -R 770 "$target_data_dir" - chmod -R 770 "$target_data_symlink" + INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-arm-v0.14.0.tar.gz' - #Set max upload size - sed -i "/php_value upload_max_filesize/c\php_value upload_max_filesize 2G" /var/www/owncloud/.htaccess - sed -i "/php_value post_max_size/c\php_value post_max_size 2G" /var/www/owncloud/.htaccess - #Set max allowed memory total/4 - local memory_limit_max="$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 4 ))M" - sed -i "/php_value memory_limit/c\php_value memory_limit $memory_limit_max" /var/www/owncloud/.htaccess + #arm64 + elif (( $HW_ARCH == 10 )); then - if (( $WEBSERVER_NGINX == 2 )); then - cp /DietPi/dietpi/conf/nginx.sites-dietpi.owncloud.conf /etc/nginx/sites-dietpi/owncloud.conf - fi + INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-arm64-v0.14.0.tar.gz' - OWNCLOUD=2 - fi + #x86_64 + elif (( $HW_ARCH == 21 )); then - # Transmission - if (( $TRANSMISSION == 1 )); then + INSTALL_URL_ADDRESS='http://github.com/syncthing/syncthing/releases/download/v0.14.0/syncthing-linux-amd64-v0.14.0.tar.gz' - sed -i '/USER=/c\USER=root' /etc/init.d/transmission-daemon + fi - #Jessie, Transmission uses my systemd service: https://github.com/Fourdee/DietPi/issues/350#issuecomment-220828884 - if (( $DISTRO == 3 )); then + #?? + #For some reason checking connection (spider) against the files above fails. - rm /etc/init.d/transmission-daemon - rm /etc/systemd/system/transmission-daemon.service - cat << _EOF_ > /etc/systemd/system/transmission-daemon.service -[Unit] -Description=Barebones transmission-daemon service -DefaultDependencies=no + #/DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + /DietPi/dietpi/func/check_connection http://github.com/syncthing/syncthing -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/transmission-daemon --config-dir /var/lib/transmission-daemon/info -ExecStop=/usr/bin/killall -w transmission-daemon -StandardOutput=tty + #Install + if (( $? == 0 )); then -[Install] -WantedBy=multi-user.target -_EOF_ - systemctl enable transmission-daemon.service + wget "$INSTALL_URL_ADDRESS" -O package.tar + tar xzvf package.tar + rm package.tar - fi + mv syncthing-*/syncthing /usr/bin/ + rm -R syncthing-* - cp /DietPi/dietpi/conf/transmission_settings /etc/transmission-daemon/settings.json + else - Create_UserContent_Folders + Error_NoConnection_NoInstall - #Apply optimized settings - sed -i '/cache-size-mb/c\ "cache-size-mb": '$(Optimize_BitTorrent 0)',' /etc/transmission-daemon/settings.json - sed -i '/download-queue-size/c\ "download-queue-size": '$(Optimize_BitTorrent 1)',' /etc/transmission-daemon/settings.json - sed -i '/peer-limit-global/c\ "peer-limit-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json - sed -i '/max-peers-global/c\ "max-peers-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json - sed -i '/peer-limit-per-torrent/c\ "peer-limit-per-torrent": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json - sed -i '/upload-slots-per-torrent/c\ "upload-slots-per-torrent": '$(Optimize_BitTorrent 3)',' /etc/transmission-daemon/settings.json + fi - TRANSMISSION=2 fi - #PHPBB - if (( $PHPBB == 1 )); then - chown -R www-data:www-data /var/www/phpBB3 - /DietPi/dietpi/func/create_mysql_db phpbb3 dietpi root dietpi + } - PHPBB=2 - fi + Install_Linux_Software(){ - # Proftpd - if (( $FILESERVER_PROFTP == 1 )); then - sed -i "/root/c\#root" /etc/ftpusers - cp /DietPi/dietpi/conf/proftpd.conf /etc/proftpd/proftpd.conf - sed -i "/DefaultRoot /c\DefaultRoot $DIETPI_USERDATA_DIRECTORY" /etc/proftpd/proftpd.conf + # Stop Services + /DietPi/dietpi/dietpi-services stop - FILESERVER_PROFTP=2 - fi + INSTALLING_INDEX=5 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Samba Server - if (( $FILESERVER_SAMBA == 1 )); then - echo -e "dietpi\ndietpi" | smbpasswd -s -a root - cp /DietPi/dietpi/conf/smb.conf /etc/samba/smb.conf + Banner_Installing - sed -i "/path = /c\path = $DIETPI_USERDATA_DIRECTORY" /etc/samba/smb.conf + AGI alsa-base alsa-utils - FILESERVER_SAMBA=2 - fi + #Apply soundcard + local soundcard=$(cat /DietPi/dietpi.txt | grep -m1 'soundcard=' | sed 's/.*=//') - # vsFTPD - if (( $FILESERVER_VSFTPD == 1 )); then - cp /DietPi/dietpi/conf/vsftpd.conf /etc/vsftpd.conf - sed -i '/root/c\#root' /etc/ftpusers + # - RPi enable internal HDMI+Analogue if currently set to 'none' + if (( $HW_MODEL < 10 )) && + [ "$soundcard" = "none" ]; then + soundcard='rpi-bcm2835' + fi - sed -i "/local_root=/c\local_root=$DIETPI_USERDATA_DIRECTORY" /etc/vsftpd.conf + # - Apply + /DietPi/dietpi/func/dietpi-set_hardware soundcard "$soundcard" - FILESERVER_VSFTPD=2 fi - #Ympd MPD - if (( $HIFI == 1 )); then - #Start at boot - cp /DietPi/dietpi/conf/ympd_init /etc/init.d/ympd - chmod +x /etc/init.d/ympd - update-rc.d ympd defaults + INSTALLING_INDEX=6 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # + arm64 MPD using our compiled mpd binary. - if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + Banner_Installing - cat << _EOF_ > /etc/default/mpd -#Even though we declare the conf location in our service, MPD will fail to start if this file does not exist. + #Xserver Prereqs (ALL) + AGI xterm xinit xauth xserver-xorg dbus-x11 xfonts-base x11-xserver-utils x11-common x11-utils --no-install-recommends -## The configuration file location for mpd: -MPDCONF=/etc/mpd.conf -_EOF_ + #RPI + if (( $HW_MODEL < 10 )); then + #Wheezy + #AGI xserver-xorg-video-fbturbo xserver-xorg-video-fbdev --no-install-recommends - cat << _EOF_ > /lib/systemd/system/mpd.service -[Unit] -Description=Music Player Daemon -After=network.target sound.target + #Jessie + sleep 1 + # - Install OpenGL driver? + #AGI xcompmgr libgl1-mesa-dri raspi-gpio mesa-utils + # - Requires 256mb GPU? -[Service] -User=root -EnvironmentFile=/etc/default/mpd -ExecStartPre=/bin/mkdir -p /var/lib/mpd -ExecStartPre=/bin/mkdir -p /var/log/mpd -ExecStartPre=/bin/mkdir -p /var/run/mpd -ExecStartPre=/bin/mkdir -p /var/lib/mpd -ExecStart=/usr/local/bin/mpd --no-daemon /etc/mpd.conf + # - status: still software driver being used on rpi 3. -# allow MPD to use real-time priority 50 -LimitRTPRIO=50 -LimitRTTIME=-1 + #Odroid C2 + elif (( $HW_MODEL == 12 )); then -[Install] -WantedBy=multi-user.target + AGI xcompmgr aml-libs-odroid mali450-odroid xf86-video-mali-odroid libump-odroid --no-install-recommends + # xcompmgr is fix for broken transparency with lxdesession and improve performance -_EOF_ + cp /DietPi/dietpi/conf/xorg_c2.conf /etc/X11/xorg.conf - systemctl daemon-reload + #Odroid XU4 + elif (( $HW_MODEL == 11 )); then - fi + AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid --no-install-recommends - #Copy default config - cp /DietPi/dietpi/conf/mpd.conf /etc/mpd.conf + cp /DietPi/dietpi/conf/xorg_xu4.conf /etc/X11/xorg.conf - #Add audio output options to mpd config - cat << _EOF_ >> /etc/mpd.conf -audio_output { - type "alsa" - name "DietPi Alsa" -# device "hw:0,0" - format "44100:16:2" - mixer_type "software" -# mixer_control "PCM" -# mixer_index "0" -} -#HDMI - Set format and audio_output_format to 48000hz -#audio_output_format "48000:16:2" -#samplerate_converter "soxr" -_EOF_ + #Odroid C1 + elif (( $HW_MODEL == 10 )); then - #Setup data locations - Create_UserContent_Folders - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.mpd_cache + AGI xcompmgr aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid --no-install-recommends + # xcompmgr is fix for broken transparency with lxdesession and improve performance - #Grab our test music for the user. - Download_Test_Media + cp /DietPi/dietpi/conf/xorg_c1.conf /etc/X11/xorg.conf - HIFI=2 - fi + #Pine64 + elif (( $HW_MODEL >= 40 && $HW_MODEL < 50 )); then - #Kodi - if (( $KODI == 1 )); then + #check source is online + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - #Remove Kodi user (Whilst waving) - userdel -r kodi &> /dev/null + #Install + if (( $? == 0 )); then - #Run Kodi as root - sed -i '/USER=/c\USER=root' /etc/default/kodi &> /dev/null + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - #Copy udev rules, probably not needed for root, but we'll do it anyway - cp /DietPi/dietpi/conf/kodi_udev /etc/udev/rules.d/99-input.rules - chmod +x /etc/udev/rules.d/99-input.rules + wget http://dietpi.com/downloads/binaries/all/xf86-video-fbturbo_1-1_arm64.deb -O package.deb + dpkg -i package.deb + rm package.deb - #Create .desktop SymLinks - mkdir -p "$HOME"/Desktop - rm /usr/share/applications/kodi.desktop &> /dev/null - ln -sf /DietPi/dietpi/conf/desktop/kodi.desktop /usr/share/applications/kodi.desktop - ln -sf /DietPi/dietpi/conf/desktop/kodi.desktop "$HOME"/Desktop/kodi.desktop + cat << _EOF_ > /etc/X11/xorg.conf +Section "Device" + Identifier "Allwinner A10/A13 FBDEV" + Driver "fbturbo" + Option "fbdev" "/dev/fb0" + Option "SwapbuffersWait" "true" +EndSection +_EOF_ - #startkodi alias. - if (( $(cat /etc/bash.bashrc | grep -ci -m1 'startkodi') == 0 )); then - echo -e "alias startkodi='/DietPi/dietpi/misc/start_kodi'" >> /etc/bash.bashrc - fi + else + Error_NoConnection_NoInstall - KODI=2 + fi - fi + fi - #MINIDLNA - if (( $MINIDLNA == 1 )); then + fi - #Run as root - sed -i '/USER=m/c\USER=root' /etc/init.d/minidlna - # + SystemD - sed -i '/User=m/c\User=root' /lib/systemd/system/minidlna.service &> /dev/null - sed -i '/Group=m/c\Group=root' /lib/systemd/system/minidlna.service &> /dev/null + INSTALLING_INDEX=16 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Copy Config - cp /DietPi/dietpi/conf/minidlna.conf /etc/minidlna.conf + Banner_Installing + AGI build-essential --no-install-recommends - #Setup data directories - Create_UserContent_Folders - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.MiniDLNA_Cache + fi + INSTALLING_INDEX=17 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - MINIDLNA=2 + Banner_Installing + AGI git --no-install-recommends fi - #NoIp - if (( $NOIPDYNDNS == 1 )); then + # if (( $QUITERSS == 1 )); then + # INSTALL_DESCRIPTION="QuiteRSS" + # Banner_Installing + # AGI quiterss - NOIPDYNDNS=2 - fi + # QUITERSS=2 - #OpenTyrian - if (( $OPENTYRIAN == 1 )); then + # fi - #Copy the DietPi run file for OpenTyrian - cp /DietPi/dietpi/conf/opentyrian_run /usr/local/games/opentyrian/run - chmod +x /usr/local/games/opentyrian/run + INSTALLING_INDEX=4 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Create .Desktop SymLinks - mkdir -p "$HOME"/Desktop - rm /usr/share/applications/opentyrian.desktop &> /dev/null - ln -s /DietPi/dietpi/conf/desktop/opentyrian.desktop /usr/share/applications/opentyrian.desktop - ln -s /DietPi/dietpi/conf/desktop/opentyrian.desktop "$HOME"/Desktop/opentyrian.desktop + Banner_Installing + AGI vifm - OPENTYRIAN=2 fi - #DietPi-Cam - if (( $DIETPICAM == 1 )); then + INSTALLING_INDEX=20 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - raspimjpeg conf - chmod +x /etc/raspimjpeg - ln -s /etc/raspimjpeg /var/www/dietpicam/raspimjpeg + Banner_Installing + AGI vim - # - Motion conf - chgrp www-data /etc/motion/motion.conf - chmod 777 /etc/motion/motion.conf - usermod -a -G video www-data + fi - # - raspimjpeg/php schedule startup and control script - cp /DietPi/dietpi/conf/raspimjpeg.service /etc/dietpi/dietpi-software/services/raspimjpeg.service + INSTALLING_INDEX=21 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Set web permissions for local dietpicam web directory - chown -R www-data:www-data /var/www/dietpicam + Banner_Installing + AGI vim-tiny - # - Setup Data directory - local dietpicam_media_directory=$DIETPI_USERDATA_DIRECTORY + fi - mkdir -p "$dietpicam_media_directory"/dietpicam - rm -R /var/www/dietpicam/media - ln -s "$dietpicam_media_directory"/dietpicam /var/www/dietpicam/media - chown -R www-data:www-data "$dietpicam_media_directory"/dietpicam - chmod -R 777 "$dietpicam_media_directory"/dietpicam + INSTALLING_INDEX=18 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Enable RPi Camera module - sed -i '/start_x=/c\start_x=1' /DietPi/config.txt + Banner_Installing + AGI emacs - DIETPICAM=2 fi - #Deluge - if (( $DELUGE == 1 )); then - - #copy init - cp /DietPi/dietpi/conf/deluge.service /etc/dietpi/dietpi-software/services/deluge.service + INSTALLING_INDEX=12 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Generate deluge default config - deluged - killall -w deluged + Banner_Installing + AGI iperf - #Copy DietPi configs - cp /DietPi/dietpi/conf/deluge.conf "$HOME"/.config/deluge/core.conf - cp /DietPi/dietpi/conf/deluge_web.conf "$HOME"/.config/deluge/web.conf + fi - #Set remote access login details - echo -e "localclient:dietpi:10" > "$HOME"/.config/deluge/auth + INSTALLING_INDEX=3 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Setup data directory - Create_UserContent_Folders + Banner_Installing + AGI mc - #Apply Optimized settings - # - Cache size is in steps of 16 KiB. (Cachesize * 16 = total KiB) - local deluge_cache_size=$(( $(echo -e "scale=0; $(Optimize_BitTorrent 0) * 1024 / 16" | bc -l ) )) - sed -i '/"cache_size": /c\ "cache_size": '"$deluge_cache_size"',' "$HOME"/.config/deluge/core.conf + fi - sed -i '/"max_active_limit": /c\ "max_active_limit": '"$(Optimize_BitTorrent 1)"',' "$HOME"/.config/deluge/core.conf - sed -i '/"max_active_downloading": /c\ "max_active_downloading": '"$(Optimize_BitTorrent 1)"',' "$HOME"/.config/deluge/core.conf - sed -i '/"max_connections_global": /c\ "max_connections_global": '"$(Optimize_BitTorrent 2)"',' "$HOME"/.config/deluge/core.conf - sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '"$(Optimize_BitTorrent 3)"',' "$HOME"/.config/deluge/core.conf + INSTALLING_INDEX=19 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + Banner_Installing + AGI jed - DELUGE=2 fi - #GRASSHOPPER - if (( $GRASSHOPPER == 1 )); then + INSTALLING_INDEX=10 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + AGI iftop - GRASSHOPPER=2 fi - #RaspControl - if (( $RASPCONTROL == 1 )); then + INSTALLING_INDEX=11 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - chown -R www-data:www-data /var/www/raspcontrol - chmod -R 750 /var/www/raspcontrol + Banner_Installing + AGI iptraf - #Setup login file - mkdir -p /etc/raspcontrol + fi -cat << _EOF_ > /etc/raspcontrol/database.aptmnt -{ - "user": "root", - "password": "dietpi" -} -_EOF_ + INSTALLING_INDEX=13 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - chown -R www-data:www-data /etc/raspcontrol - chmod -R 750 /etc/raspcontrol + Banner_Installing + AGI mtr-tiny - RASPCONTROL=2 fi - #Linux Dash - if (( $LINUXDASH == 1 )); then + INSTALLING_INDEX=14 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - chown -R www-data:www-data /var/www/linuxdash - chmod -R 750 /var/www/linuxdash + Banner_Installing + AGI nload - LINUXDASH=2 fi - #PIHOLE - if (( $PIHOLE == 1 )); then + INSTALLING_INDEX=15 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Generate index page that replaces adverts - cat << _EOF_ > /var/www/index.html - -Blocked by Pi-hole. - -_EOF_ + Banner_Installing + AGI tcpdump - #Set /var/www/pihole permisions - chown -R www-data:www-data /var/www/pihole - chmod -R 775 /var/www/pihole + fi - #Generate pihole.log , set permissions to www-data - echo -e "" > /var/log/pihole.log - chown www-data:www-data /var/log/pihole.log &> /dev/null - chmod 775 /var/log/pihole.log + INSTALLING_INDEX=0 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Apply dnsmasq.conf - cp /DietPi/dietpi/conf/dnsmasq.conf /etc/dnsmasq.conf + Banner_Installing + AGI openssh-client - #Add active network adapter - local active_network_adapter=$(sed -n 3p /DietPi/dietpi/.network) - sed -i "/interface=/c\interface=$active_network_adapter" /etc/dnsmasq.conf + fi - #Set dnsmasq service to user www-data. - sed -i '/DNSMASQ_USER=/c\DNSMASQ_USER="www-data"' /etc/init.d/dnsmasq + INSTALLING_INDEX=1 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Add weekly cronjob to update adlist - cat << _EOF_ > /etc/cron.weekly/pihole_adlist_update -#!/bin/bash -{ - service dnsmasq stop + Banner_Installing - echo -e "--------------------------------------------------------------------\n\n\$(date)\nDietPi - Running weekly adlist update" >> /var/log/pihole.log - /usr/local/bin/gravity.sh &>> /var/log/pihole.log - echo -e "--------------------------------------------------------------------\n" >> /var/log/pihole.log + #Remove Information file + rm /mnt/samba/readme.txt &> /dev/null - service dnsmasq start + AGI smbclient cifs-utils --no-install-recommends - exit 0 -} + fi -_EOF_ + INSTALLING_INDEX=2 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - chmod +x /etc/cron.weekly/pihole_adlist_update + Banner_Installing - # - Prevent warning of missing file during gravity.sh: https://github.com/Fourdee/DietPi/issues/311#issuecomment-230276175 - # NB: The contents of this file is not "currently" required for our installation. - echo -e "#nothing here" > /etc/dnsmasq.d/01-pihole.conf + #Remove information file + rm /mnt/ftp_client/readme.txt &> /dev/null + AGI curlftpfs - PIHOLE=2 fi - #SUBSONIC 5 - if (( $SUBSONIC5 == 1 )); then + INSTALLING_INDEX=104 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Generate user dir - Create_UserContent_Folders + Banner_Installing + AGI dropbear - #Optimize memory limit - local subsonic_memory_max=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 5 )) - #Minimum cap 150mb - if (( $subsonic_memory_max < 150 )); then - subsonic_memory_max=150 - fi + #set to start on next boot + sed -i '/NO_START=1/c\NO_START=0' /etc/default/dropbear - cat << _EOF_ > /etc/default/subsonic -SUBSONIC_USER=root -SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" -_EOF_ + fi - #Grab our test media for user - Download_Test_Media + INSTALLING_INDEX=105 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Symlink ffmpeg to subsonic transcoder - #rpi armv6 jessie (using compiled ffmpeg) - if (( $HW_MODEL < 2 )) && - (( $DISTRO == 3 )); then - ln -fs /usr/local/bin/ffmpeg /var/subsonic/transcode + Banner_Installing + AGI openssh-server --no-install-recommends - #ARMv7 - else - ln -fs /usr/bin/ffmpeg /var/subsonic/transcode - fi - SUBSONIC5=2 - fi + #Jessie, must enable root login + if (( $DISTRO == 3 )); then - #SUBSONIC - if (( $SUBSONIC6 == 1 )); then + sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config - #Generate user dir - Create_UserContent_Folders + #Restart ssh server now so root users can login during setup. + systemctl restart ssh - #Optimize memory limit - local subsonic_memory_max=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 5 )) - #Minimum cap 150mb - if (( $subsonic_memory_max < 150 )); then - subsonic_memory_max=150 fi - cat << _EOF_ > /etc/default/subsonic -SUBSONIC_USER=root -SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" -_EOF_ + #SSH server package also installs client. + aSOFTWARE_INSTALL_STATE[0]=2 - #Grab our test media for user - Download_Test_Media + fi - #Symlink ffmpeg to subsonic transcoder - #rpi armv6 jessie (using compiled ffmpeg) - if (( $HW_MODEL < 2 )) && - (( $DISTRO == 3 )); then - ln -fs /usr/local/bin/ffmpeg /var/subsonic/transcode + INSTALLING_INDEX=103 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #ARMv7 - else - ln -fs /usr/bin/ffmpeg /var/subsonic/transcode - fi + Banner_Installing + + #Install (add tmpfs mount to fstab) + sed -i '/\/var\/log/c\tmpfs \/var\/log tmpfs defaults,size=20m,noatime,nodev,nosuid,mode=1777 0 0' /etc/fstab - SUBSONIC6=2 fi - #RPIGPIO - if (( $RPIGPIO == 1 )); then + INSTALLING_INDEX=101 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - RPIGPIO=2 + Banner_Installing + AGI logrotate --no-install-recommends fi - #WIRINGPI - if (( $WIRINGPI == 1 )); then + INSTALLING_INDEX=102 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - WIRINGPI=2 + Banner_Installing + AGI rsyslog --no-install-recommends fi - #RPII2C - if (( $RPII2C == 1 )); then + INSTALLING_INDEX=7 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - RPII2C=2 + Banner_Installing - fi + if (( $DISTRO == 1 )); then - #WEBIOPI - if (( $WEBIOPI == 1 )); then - #auto start - update-rc.d webiopi defaults + AGI ffmpeg - WEBIOPI=2 - fi + elif (( $DISTRO == 3 )); then - #WEAVED - if (( $WEAVED == 1 )); then + #RPi v1 armv6, broken packages in multimedia repo. https://github.com/Fourdee/DietPi/issues/84#issuecomment-151201361 + if (( $HW_MODEL < 2 )); then - WEAVED=2 - fi + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/ffmpeg_2.7.2-1_armhf-v6.deb' + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - #DIETPICLOUDSHELL - if (( $DIETPICLOUDSHELL == 1 )); then + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/fdk-aac_0.1.4_armhf-v6.deb' + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - #Enable DietPi-Cloudshell autostart - /DietPi/dietpi/dietpi-autostart 5 + #Install pre-reqs + AGI libogg0 libvorbisenc2 libtheora0 libspeex1 libopencore-amrwb0 libopencore-amrnb0 libass5 - #add alias - if (( $(cat /etc/bash.bashrc | grep -ci -m1 'dietpi-cloudshell=' ) == 0 )); then - sed -i "/#DietPi Additions/a alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell'" /etc/bash.bashrc - fi + #rpi 2/3 + elif (( $HW_MODEL == 2 )) || (( $HW_MODEL == 3 )); then + #Add Deb Multimedia repo for ffmpeg + if [ ! -f /etc/apt/sources.list.d/debmultimedia.list ]; then - DIETPICLOUDSHELL=2 - fi + echo -e "deb http://www.deb-multimedia.org jessie main non-free" > /etc/apt/sources.list.d/debmultimedia.list + apt-get update + AGI deb-multimedia-keyring --force-yes + apt-get update - #XRDP - if (( $XRDP == 1 )); then + AGI ffmpeg - XRDP=2 + #Done. Remove deb http://www.deb-multimedia.org from apt sources + # - When installing Kodi, apt uses the packages from deb http://www.deb-multimedia.org, rather than Raspbian. + rm /etc/apt/sources.list.d/debmultimedia.list + /DietPi/dietpi/dietpi-apt-get_update 2 - fi + fi - #NOMACHINE - if (( $NOMACHINE == 1 )); then + #Jessie (now available from backports). + else + + AGI ffmpeg - NOMACHINE=2 + fi + fi fi - #HAPROXY - if (( $HAPROXY == 1 )); then + INSTALLING_INDEX=8 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Create jail directory - mkdir -p /var/lib/haproxy + Banner_Installing - cat << _EOF_ > /etc/haproxy/haproxy.cfg -global + # - Raspbian + if (( $HW_MODEL < 10 )); then - #rsyslog is required for logging - #log /var/log local0 - #log /var/log local1 notice - maxconn 64 - #Jail directory - chroot /var/lib/haproxy - stats socket /run/haproxy.sock mode 660 level admin - stats timeout 30s - user root - group root - daemon + AGI oracle-java8-jdk - # Default SSL material locations - ca-base /etc/ssl/certs - crt-base /etc/ssl/private + # - Debian. Add repo + else - # Default ciphers to use on SSL-enabled listening sockets. - # For more information, see ciphers(1SSL). - ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL + cat << _EOF_ > /etc/apt/sources.list.d/webupd8team-java.list +deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main +deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main +_EOF_ -defaults + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 + apt-get update - log global - mode http - option httplog - option dontlognull - timeout connect 5000 - timeout client 50000 - timeout server 50000 - errorfile 400 /etc/haproxy/errors/400.http - errorfile 403 /etc/haproxy/errors/403.http - errorfile 408 /etc/haproxy/errors/408.http - errorfile 500 /etc/haproxy/errors/500.http - errorfile 502 /etc/haproxy/errors/502.http - errorfile 503 /etc/haproxy/errors/503.http - errorfile 504 /etc/haproxy/errors/504.http + # - Accept the license: https://github.com/Fourdee/DietPi/issues/298 + debconf-set-selections <<< "oracle-java8-installer shared/accepted-oracle-license-v1-1 boolean true" -frontend localnodes + AGI oracle-java8-installer - bind *:80 - mode http - default_backend nodes + fi -backend nodes + fi - mode http - balance roundrobin - option forwardfor - http-request set-header X-Forwarded-Port %[dst_port] - http-request add-header X-Forwarded-Proto https if { ssl_fc } - option httpchk HEAD / HTTP/1.1\r\nHost:localhost - server web01 127.0.0.1:9000 check - server web02 127.0.0.1:9001 check - server web03 127.0.0.1:9002 check + INSTALLING_INDEX=9 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then -#Admin web page + Banner_Installing - listen stats *:1338 - stats enable - stats uri / - stats hide-version - stats auth admin:dietpi -_EOF_ + #arm64 - Not currently available via nodesource.com or https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh + if (( $HW_ARCH == 10 )); then - #Add html error pages - mkdir -p /etc/haproxy/errors - local errorcode=0 + #check, is online + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/c2/nodejs_5-1_arm64.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - errorcode=400; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=403; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=408; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=500; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=502; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=503; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http - errorcode=504; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + #Install + if (( $? == 0 )); then - HAPROXY=2 - fi + # - Preqs + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb - #SQUEEZEBOXSERVER - if (( $SQUEEZEBOXSERVER == 1 )); then + else - #Remove service - update-rc.d logitechmediaserver remove - rm /etc/init.d/logitechmediaserver + Error_NoConnection_NoInstall - #DietPi-Services init - cp /DietPi/dietpi/conf/squeezeboxserver.service /etc/dietpi/dietpi-software/services/squeezeboxserver.service + fi - #Generate user dir - Create_UserContent_Folders + #Everything else + else - #Grab our test media for user - Download_Test_Media + #check, is online + INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - SQUEEZEBOXSERVER=2 + #Install + if (( $? == 0 )); then - fi + # - Preqs + wget "$INSTALL_URL_ADDRESS" -O node_install.sh + chmod +x node_install.sh + ./node_install.sh - #WORDPRESS - if (( $WORDPRESS == 1 )); then + rm node_install.sh - #Create mysql DB - /DietPi/dietpi/func/create_mysql_db wordpress dietpi root dietpi - service mysql stop - WORDPRESS=2 + else + + Error_NoConnection_NoInstall + + fi + + fi fi + #------------------------------------------------------------------- + #Install finished, set all installed software to state 2 (installed) + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - #TIGHTVNCSERVER & VNC4SERVER - Shared setup - if (( $TIGHTVNCSERVER == 1 || $VNC4SERVER == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )) && + (( ${aSOFTWARE_TYPE[$i]} == 1 || ${aSOFTWARE_TYPE[$i]} == -1 )); then # Also flag hidden items as installed, so they are available in uninstall. - #User, enter PW - WHIP_QUESTION='A password is required for your VNC Server.\n\nThe next screen will allow you to set your password, this password will be used when connecting from a VNC client/viewer.\n\nPress Ok/Enter when ready.' - whiptail --title "VNC Server Password" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 13 70 - local entering_pw=1 - local loop_count=0 - while (( $entering_pw == 1 )); do - vncpasswd - ((loop_count++)) - - #Password file created - if [ -f "$HOME"/.vnc/passwd ]; then - entering_pw=0 - #Endless loop - elif (( $loop_count >= 30 )); then - entering_pw=0 - fi - done + aSOFTWARE_INSTALL_STATE[$i]=2 + fi - #Wheezy - if (( $DISTRO == 1 )); then + done + #------------------------------------------------------------------- - cat << _EOF_ > /etc/init.d/vncserver -#!/bin/bash -e -### BEGIN INIT INFO -# Provides: VNC server -# Required-Start: \$all -# Should-Start: -# Required-Stop: \$local_fs \$network -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: DietPi VNC server control -### END INIT INFO + } -#Wheezy, to prevent "vncserver: The HOME/USER environment variable is not set" -export USER='root' -export HOME='/root' + Uninstall_NonSelected_Choices(){ -start(){ + #Uninstall software using our temp uninstall list + if [ -f "$UNINSTALL_FILE" ]; then - /usr/local/bin/vncserver start + #Run the temp uninstall script + while read -r line + do + Uninstall_Software "$line" -} + done < $UNINSTALL_FILE + rm $UNINSTALL_FILE -stop(){ + fi - /usr/local/bin/vncserver stop + } -} + Apply_SSHServer_Choices(){ -case "\$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "Usage: \$0 {start|stop|restart}" - ;; -esac -_EOF_ + #Work out which SSH Server needs installing from Indexs (if any) + #Work out which SSH server needs removing (if any), and, create a temp script file + if (( $INDEX_SSHSERVER_TARGET != $INDEX_SSHSERVER_CURRENT )); then - chmod +x /etc/init.d/vncserver - update-rc.d vncserver defaults 00 80 + # - No SSH server + if (( $INDEX_SSHSERVER_TARGET == 0 )); then - #Jessie - elif (( $DISTRO == 3 )); then + echo -e "104" >> "$UNINSTALL_FILE" + echo -e "105" >> "$UNINSTALL_FILE" - cat << _EOF_ > /etc/systemd/system/vncserver.service -[Unit] -Description=Manage VNC Server -After=dietpi-service.service -After=rc.local.service + # - Dropbear + elif (( $INDEX_SSHSERVER_TARGET == -1 )); then -[Service] -Type=idle -RemainAfterExit=yes -ExecStart=/bin/bash /usr/local/bin/vncserver start -ExecStop=/bin/bash /usr/local/bin/vncserver stop -User=root + aSOFTWARE_INSTALL_STATE[104]=1 + echo -e "105" >> "$UNINSTALL_FILE" -[Install] -WantedBy=multi-user.target -_EOF_ + # - Openssh + elif (( $INDEX_SSHSERVER_TARGET == -2 )); then - systemctl enable vncserver.service - systemctl daemon-reload + aSOFTWARE_INSTALL_STATE[105]=1 + echo -e "104" >> "$UNINSTALL_FILE" fi - cat << _EOF_ > /usr/local/bin/vncserver -#!/bin/bash + #Inform user (From testing, stopping SSH server services does not disconnect user, however, just incase it does in the future) + /DietPi/dietpi/dietpi-banner 0 + echo -e "\n Stopping SSH Servers, please wait.....\n\n - If you are connected via SSH, you may be disconnected.\n - Your system will reboot once your DietPi-Software installation is completed.\n - Go make a coffee :) \n" -#Globals -VNC_INSTALLED=0 -BINARY_FP=0 + #stop all SSH server services + service ssh stop &> /dev/null + service dropbear stop &> /dev/null -WIDTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_width=' | sed 's/.*=//') -HEIGHT=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_height=' | sed 's/.*=//') -DEPTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_depth=' | sed 's/.*=//') -DISPLAY=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_display=' | sed 's/.*=//') + #Update Current SSHSERVER index + INDEX_SSHSERVER_CURRENT=$INDEX_SSHSERVER_TARGET -#TightVNC or VNC4server? -if [ -f /usr/bin/vnc4server ]; then - BINARY_FP='/usr/bin/vnc4server' - VNC_INSTALLED=1 -elif [ -f /usr/bin/vncserver ]; then - BINARY_FP='/usr/bin/vncserver' - VNC_INSTALLED=1 -fi + fi -#Exit if no VNC binary found -if (( ! \$VNC_INSTALLED )); then - exit 1 -fi + } -case "\$1" in - start) - \$BINARY_FP :\$DISPLAY -geometry \$WIDTH'x'\$HEIGHT -depth \$DEPTH - ;; + Apply_FileServer_Choices(){ - stop) - \$BINARY_FP -kill :\$DISPLAY - ;; + #Work out which File Server needs installing from Indexs (if any) + #Work out which File server needs removing (if any), and, create a temp script file + if (( $INDEX_FILESERVER_TARGET != $INDEX_FILESERVER_CURRENT )); then -esac + #No File server + if (( $INDEX_FILESERVER_TARGET == 0 )); then + echo -e "96" >> "$UNINSTALL_FILE" + echo -e "94" >> "$UNINSTALL_FILE" + #echo -e "95" >> "$UNINSTALL_FILE" -exit 0 -_EOF_ - chmod +x /usr/local/bin/vncserver + #ProFTP + elif (( $INDEX_FILESERVER_TARGET == -1 )); then - fi + aSOFTWARE_INSTALL_STATE[94]=1 + echo -e "96" >> "$UNINSTALL_FILE" + #Samba + elif (( $INDEX_FILESERVER_TARGET == -2 )); then - #TIGHTVNCSERVER - if (( $TIGHTVNCSERVER == 1 )); then + aSOFTWARE_INSTALL_STATE[96]=1 + echo -e "94" >> "$UNINSTALL_FILE" + + fi - TIGHTVNCSERVER=2 + #Update Current SSHSERVER index + INDEX_FILESERVER_CURRENT=$INDEX_FILESERVER_TARGET fi - #VNC4SERVER - if (( $VNC4SERVER == 1 )); then + } + Apply_Logging_Choices(){ - local cmd_launch_desktop='' - if (( $DESKTOP_LXDE > 0 )); then + #Work out which Logging system needs installing from Indexs (if any) + #Work out which Logging system needs removing (if any), and, create a temp script file + if (( $INDEX_LOGGING_TARGET != $INDEX_LOGGING_CURRENT )); then - cmd_launch_desktop='/usr/bin/lxsession -s LXDE &' + #None + if (( $INDEX_LOGGING_TARGET == 0 )); then - elif (( $DESKTOP_MATE > 0 )); then + echo -e "101" >> "$UNINSTALL_FILE" + echo -e "103" >> "$UNINSTALL_FILE" + echo -e "102" >> "$UNINSTALL_FILE" - cmd_launch_desktop='x-window-manager &' + #Ramlog - clear every 24H + elif (( $INDEX_LOGGING_TARGET == -1 )); then - elif (( $DESKTOP_GNUSTEP > 0 )); then + aSOFTWARE_INSTALL_STATE[103]=1 + echo -e "101" >> "$UNINSTALL_FILE" + echo -e "102" >> "$UNINSTALL_FILE" - cmd_launch_desktop='x-window-manager &' + #Ramlog - backup every 1H to $HOME/logfile_storage, then clear. + elif (( $INDEX_LOGGING_TARGET == -2 )); then - elif (( $DESKTOP_XFCE > 0 )); then + aSOFTWARE_INSTALL_STATE[103]=1 + echo -e "101" >> "$UNINSTALL_FILE" + echo -e "102" >> "$UNINSTALL_FILE" - cmd_launch_desktop='/usr/bin/xfce4-session &' + #Logrotate + rsyslog - logs to disk + elif (( $INDEX_LOGGING_TARGET == -3 )); then + + aSOFTWARE_INSTALL_STATE[101]=1 + aSOFTWARE_INSTALL_STATE[102]=1 + echo -e "103" >> "$UNINSTALL_FILE" fi - cat << _EOF_ > "$HOME"/.vnc/xstartup -[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup -[ -r /root/.Xresources ] && xrdb /root/.Xresources -xsetroot -solid grey -vncconfig -iconic & -$cmd_launch_desktop -_EOF_ + #Update Current Logging index + INDEX_LOGGING_CURRENT=$INDEX_LOGGING_TARGET - chmod +x "$HOME"/.vnc/xstartup + fi + + } + Apply_Webserver_Preference(){ + + if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )); then - VNC4SERVER=2 + #Update Current to Target + INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET fi + } - #FAIL2BAN - if (( $FAIL2BAN == 1 )); then + Install_Apply_Configs(){ - cat << _EOF_ > /etc/fail2ban/fail2ban.conf -[Definition] -# loglevel #1=error #2=warn #3=info -loglevel = 3 -logtarget = /var/log/fail2ban.log -socket = /var/run/fail2ban/fail2ban.sock -pidfile = /var/run/fail2ban/fail2ban.pid -_EOF_ + # Stop Services + /DietPi/dietpi/dietpi-services stop - cp /DietPi/dietpi/conf/fail2ban_jail.conf /etc/fail2ban/jail.conf + # Copy/Set optimised Software settings. + # Set install states to 2 (installed). - FAIL2BAN=2 + #DESKTOP_LXDE + INSTALLING_INDEX=23 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - fi + #C1 - Fix for broken/laggy transparency + # - xcompmgr -a seems faster, but causes display corruption vertically on right side of screen for C1 + if (( $HW_MODEL == 10 )); then - #PHPSYSINFO - if (( $PHPSYSINFO == 1 )); then + cat << _EOF_ > /etc/xdg/lxsession/LXDE/autostart +xcompmgr -n +@lxpanel --profile LXDE +@pcmanfm --desktop --profile LXDE +@xscreensaver -no-splash +_EOF_ - #conf - cp /DietPi/dietpi/conf/phpsysinfo.ini /var/www/phpsysinfo/phpsysinfo.ini + #C2 - Same as C1 but use -a to prevent kodi video playback displaying desktop. + elif (( $HW_MODEL == 12 )); then - #Set permissions - chown -R www-data:www-data /var/www/phpsysinfo - chmod -R 775 /var/www/phpsysinfo + cat << _EOF_ > /etc/xdg/lxsession/LXDE/autostart +xcompmgr -a +@lxpanel --profile LXDE +@pcmanfm --desktop --profile LXDE +@xscreensaver -no-splash +_EOF_ - PHPSYSINFO=2 + fi - fi + #Remove Lxrandr Menu item (monitor configuration tool as we set res in dietpi-config) + rm /usr/share/applications/lxrandr.desktop &> /dev/null - #PHPIMAGEGALLERY - if (( $PHPIMAGEGALLERY == 1 )); then + #Copy PCmanFM configs + mkdir -p "$HOME"/.config/pcmanfm/LXDE + cp /DietPi/dietpi/conf/desktop/pcmanfm.conf "$HOME"/.config/pcmanfm/LXDE/pcmanfm.conf + cp /DietPi/dietpi/conf/desktop/pcmanfm-desktopitems.conf "$HOME"/.config/pcmanfm/LXDE/desktop-items-0.conf - #Get test images - mkdir -p /var/www/gallery/DietPi - wget http://dietpi.com/images/dietpi-logo_256.png -O /var/www/gallery/DietPi/logo_256.png + #Disable Trash + sed -i '/use_trash=/c\use_trash=0' /etc/xdg/libfm/libfm.conf - mkdir -p /var/www/gallery/Tr-Zero - wget http://media.indiedb.com/images/games/1/25/24673/SS_0.jpg -O /var/www/gallery/Tr-Zero/SS_0.jpg - wget http://media.indiedb.com/images/games/1/25/24673/SS_44.jpg -O /var/www/gallery/Tr-Zero/SS_1.jpg - wget http://media.indiedb.com/images/games/1/25/24673/3.png -O /var/www/gallery/Tr-Zero/SS_2.jpg + #Copy DietPi Panel config + mkdir -p "$HOME"/.config/lxpanel/LXDE/panels + cp /DietPi/dietpi/conf/desktop/panel "$HOME"/.config/lxpanel/LXDE/panels/panel - #permissions for cache/thumbnail/database - mkdir -p /var/www/gallery/_sfpg_data - chown -R www-data:www-data /var/www/gallery/_sfpg_data - chmod -R 775 /var/www/gallery/_sfpg_data + #Openbox config + mkdir -p "$HOME"/.config/openbox + cp /DietPi/dietpi/conf/desktop/lxde-rc.xml "$HOME"/.config/openbox/lxde-rc.xml - #enable (Some type of security trigger) - sed -i "/define('SECURITY_PHRASE'/c\define('SECURITY_PHRASE', 'true');" /var/www/gallery/index.php + # - file manager desktop icon + ln -sf /usr/share/applications/pcmanfm.desktop "$HOME"/Desktop/pcmanfm.desktop - PHPIMAGEGALLERY=2 + Create_Desktop_DietPi_Applications fi - #AMPACHE - if (( $AMPACHE == 1 )); then - - Create_UserContent_Folders - Download_Test_Media + #Desktop MATE + INSTALLING_INDEX=24 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #create/insert our pre-made ampache sql db - wget http://dietpi.com/downloads/mysql_databases/ampache_mysql_3.8.2-v113.zip -O sql.zip - unzip sql.zip - rm sql.zip + # - file manager desktop icon + ln -sf /usr/share/applications/caja.desktop "$HOME"/Desktop/caja.desktop - /DietPi/dietpi/func/create_mysql_db ampache dietpi root dietpi - mysql -u root -pdietpi ampache < ampache.sql - rm ampache.sql + Create_Desktop_DietPi_Applications - #Grab config - wget http://dietpi.com/downloads/conf/ampache.cfg.php_3.8.2-v113 -O /var/www/ampache/config/ampache.cfg.php + #Odroid C2, define default pulseaudio sink: https://github.com/Fourdee/DietPi/issues/415 + if (( $HW_MODEL == 12 && + ! $(cat /etc/pulse/default.pa | grep -ci -m1 '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo') )); then - #Set Permisions - chown -R www-data:www-data /var/www/ampache - chmod -R 775 /var/www/ampache + echo -e "set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo" >> /etc/pulse/default.pa - AMPACHE=2 + fi fi - #OPENVPNSERVER - if (( $OPENVPNSERVER == 1 )); then + #Desktop GNUStep + INSTALLING_INDEX=26 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - local key_size=1024 + Create_Desktop_DietPi_Applications - #Start Cert/Key generation. - cp -R /usr/share/easy-rsa/ /etc/openvpn - mkdir -p /etc/openvpn/easy-rsa/keys - cat << _EOF_ >> /etc/openvpn/easy-rsa/vars -export KEY_SIZE=$key_size -export KEY_COUNTRY="UK" -export KEY_PROVINCE="DietPi" -export KEY_CITY="DietPi" -export KEY_ORG="DietPi" -export KEY_EMAIL="noreply@DietPi.com" -export KEY_OU="DietPi" -export KEY_NAME="DietPi_OpenVPN_Server" -_EOF_ + fi - #Create Server Cert Auth - /DietPi/dietpi/func/dietpi-notify 2 "Generating unique OpenVPN certificates and keys. Please wait....\n" - openssl dhparam -out /etc/openvpn/dh"$key_size".pem "$key_size" + #DESKTOP_XFCE + INSTALLING_INDEX=25 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Build Server certs/keys - chmod -R +x /etc/openvpn/easy-rsa - cd /etc/openvpn/easy-rsa - . ./vars - ./clean-all - ./build-ca --batch DietPi_OpenVPN_Server - ./build-key-server --batch DietPi_OpenVPN_Server + Create_Desktop_DietPi_Applications - #Copy Server cert/keys - cp /etc/openvpn/easy-rsa/keys/{DietPi_OpenVPN_Server.crt,DietPi_OpenVPN_Server.key,ca.crt} /etc/openvpn/ + fi - #Build client cert/keys - ./build-key --batch DietPi_OpenVPN_Client + #WEBSERVER_APACHE + INSTALLING_INDEX=83 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - cd .. - #End Cert/Key generation. + #create www directory + mkdir -p /var/www - #Server config - cat << _EOF_ > /etc/openvpn/server.conf -port 1194 -proto udp -dev tun + #Apache2 confs + cp /DietPi/dietpi/conf/apache2_jessie.conf /etc/apache2/apache2.conf + cat << _EOF_ > /etc/apache2/sites-available/000-default.conf + +ServerAdmin webmaster@localhost +DocumentRoot /var/www -ca ca.crt -cert DietPi_OpenVPN_Server.crt -key DietPi_OpenVPN_Server.key -dh dh$key_size.pem +ErrorLog ${APACHE_LOG_DIR}/error.log +CustomLog ${APACHE_LOG_DIR}/access.log combined + +_EOF_ -server 10.8.0.0 255.255.255.0 + cat << _EOF_ > /etc/apache2/mods-available/mpm_event.conf + +StartServers $CPU_CORES_TOTAL +MinSpareThreads 1 +MaxSpareThreads 8 +ThreadLimit 16 +ThreadsPerChild 4 +MaxRequestWorkers 50 +MaxConnectionsPerChild 0 + +_EOF_ -client-to-client -keepalive 10 60 -comp-lzo -max-clients 10 - -user nobody -group nogroup - -persist-key -persist-tun -verb 3 - -#Web Forwarding (uncomment to enable) -#push "redirect-gateway" -#push "dhcp-option DNS 10.8.0.1" + cat << _EOF_ > /etc/apache2/mods-available/mpm_prefork.conf + +StartServers $CPU_CORES_TOTAL +MinSpareServers 1 +MaxSpareServers $CPU_CORES_TOTAL +MaxRequestWorkers 50 +MaxConnectionsPerChild 0 + +_EOF_ + cat << _EOF_ > /etc/apache2/mods-available/mpm_worker.conf + +StartServers $CPU_CORES_TOTAL +MinSpareThreads 1 +MaxSpareThreads 8 +ThreadLimit 16 +ThreadsPerChild 4 +MaxRequestWorkers 50 +MaxConnectionsPerChild 0 + _EOF_ - #Client config - cat << _EOF_ > /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn -client -proto udp -dev tun - -#Ip/Domain name of DietPi system, running OpenVPN server. -remote mywebsite.com 1194 - -resolv-retry infinite -nobind + #Use /var/www as default webfolder + mv /var/www/html/index.html /var/www/index.html &> /dev/null + rm -R /var/www/html &> /dev/null -user nobody -group nogroup + #Sites-Available settings. Disable access log, set error log level + sed -i "/CustomLog /c\ #CustomLog "'${APACHE_LOG_DIR}'"/access.log combined" /etc/apache2/sites-available/* + sed -i "/LogLevel /c\ LogLevel error" /etc/apache2/sites-available/* -persist-key -persist-tun + #Apply permissions + chown -R www-data:www-data /var/www -ns-cert-type server -comp-lzo -verb 3 + fi -_EOF_ + #WEBSERVER_NGINX + INSTALLING_INDEX=85 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Unified client file. Add DietPi generated certs/keys. - # - Add Server Cert auth - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - cat /etc/openvpn/ca.crt >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - # - Add Client Cert - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - cat /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.crt >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - # - Add Client Key - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - cat /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.key >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn - echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + #create www directory + mkdir -p /var/www - #Copy client file to DietPi fileserver locations (/root or /mnt/usb_1) - cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn "$DIETPI_USERDATA_DIRECTORY"/ - # - and /boot partition - cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn /boot/ + #Nginx confs + mkdir /etc/nginx/sites-dietpi + cp /DietPi/dietpi/conf/nginx.conf /etc/nginx/nginx.conf + cp /DietPi/dietpi/conf/nginx.site-available-default /etc/nginx/sites-available/default - #enable ipv4 forwarding - sed -i '/net.ipv4.ip_forward=/c\net.ipv4.ip_forward=1' /etc/sysctl.conf + #Nginx index page + if (( $DISTRO == 1 )); then - #Web Fowarding (Setup IPtables, must also be run during boot) - #iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$(sed -n 3p /DietPi/dietpi/.network)" -j MASQUERADE + cp /usr/share/nginx/www/index.html /var/www/index.html + elif (( $DISTRO == 3 )); then - OPENVPNSERVER=2 + cp /usr/share/nginx/html/index.html /var/www/index.html - fi + fi - #LETSENCRYPT - if (( $LETSENCRYPT == 1 )); then + #CPU core count + sed -i "/worker_processes/c\worker_processes $CPU_CORES_TOTAL;" /etc/nginx/nginx.conf - LETSENCRYPT=2 + #Apply permissions + chown -R www-data:www-data /var/www fi - #WIFIHOTSPOT - if (( $WIFIHOTSPOT == 1 )); then + #WEBSERVER_LIGHTTPD + INSTALLING_INDEX=84 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - local eth_index=$(sed -n 1p /DietPi/dietpi/.network) - local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) + #create www directory + mkdir -p /var/www - # - DHCPD Config - cat << _EOF_ > /etc/dhcp/dhcpd.conf -ddns-update-style none; -default-lease-time 600; -max-lease-time 7200; -authoritative; -log-facility local7; + #www path + sed -i '/^server.document-root/c\server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf -subnet 192.168.42.0 netmask 255.255.255.0 { - range 192.168.42.10 192.168.42.50; - option broadcast-address 192.168.42.255; - option routers 192.168.42.1; - option domain-name "local"; - option domain-name-servers 8.8.8.8, 8.8.4.4; -} -_EOF_ + #Configure fastcgi for PHP-FPM + cat << _EOF_ > /etc/lighttpd/conf-available/15-fastcgi-php.conf +# -*- depends: fastcgi -*- +# /usr/share/doc/lighttpd/fastcgi.txt.gz +# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi - # - Assign wlan as interface for dhcp server. - cat << _EOF_ > /etc/default/isc-dhcp-server -INTERFACES="wlan$wifi_index" +## Start an FastCGI server using php-fpm +fastcgi.server += ( ".php" => + (( + "socket" => "/var/run/php5-fpm.sock", + "broken-scriptfilename" => "enable" + )) +) _EOF_ - # - Remove all entries below wlan, so we can recreate them. - sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces - - # - enable up wlan - sed -i "/allow-hotplug wlan/c\allow-hotplug wlan$wifi_index" /etc/network/interfaces + #enable cgi/php + lighttpd-enable-mod fastcgi + lighttpd-enable-mod fastcgi-php - # - Add wifi settings to network interfaces config - cat << _EOF_ >> /etc/network/interfaces -iface wlan$wifi_index inet static -address 192.168.42.1 -netmask 255.255.255.0 -#gateway 192.168.0.1 -#wireless-essid FuzonWifi -#wireless-key abcde12345 -#wireless-mode Managed -wireless-power off -#wpa-ssid FuzonWifi -#wpa-psk abcde12345 -#dns-nameservers 8.8.8.8 8.8.4.4 + #Move default page + mv /var/www/html/index.lighttpd.html /var/www/ -# IP tables -up iptables-restore < /etc/iptables.ipv4.nat -_EOF_ + #Apply permissions + chown -R www-data:www-data /var/www - # - Assign static IP for wlan now - ifconfig wlan$wifi_index 192.168.42.1 + service lighttpd force-reload - # - Create access point config - cat << _EOF_ > /etc/hostapd/hostapd.conf -interface=wlan$wifi_index -driver=nl80211 -ssid=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_ssid=' | sed 's/.*=//') -hw_mode=g -channel=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_channel=' | sed 's/.*=//') -macaddr_acl=0 -auth_algs=1 -ignore_broadcast_ssid=0 -wpa=2 -wpa_passphrase=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_key=' | sed 's/.*=//') -wpa_key_mgmt=WPA-PSK -wpa_pairwise=TKIP -rsn_pairwise=CCMP -_EOF_ + fi - # - Check for RTL8188C* device, use the patched driver with compiled binary: https://github.com/pritambaral/hostapd-rtl871xdrv#why - if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then + #WEBSERVER_PHP + INSTALLING_INDEX=89 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - sed -i "/^driver=/c\driver=rtl871xdrv" /etc/hostapd/hostapd.conf + #PHP-FPM + # - Apache2 has uses its own PHP module + if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then - fi + echo -e "nothing here" &> /dev/null - # - Enable access point config - cat << _EOF_ > /etc/default/hostapd -DAEMON_CONF="/etc/hostapd/hostapd.conf" -_EOF_ + # - All other webservers (eg: Nginx/Lighttpd) use PHP-FPM + else - # - Enable IPv4 forwarding - sed -i "/net.ipv4.ip_forward=/c\net.ipv4.ip_forward=1" /etc/sysctl.conf - echo 1 > /proc/sys/net/ipv4/ip_forward + # - Php-FPM confs + cp /DietPi/dietpi/conf/php-fpm.conf /etc/php5/fpm/php-fpm.conf + cp /DietPi/dietpi/conf/php-fpm_pool.conf /etc/php5/fpm/pool.d/www.conf + sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=1' /etc/php5/fpm/php.ini - # - Apply iptables - iptables -t nat -A POSTROUTING -o eth$eth_index -j MASQUERADE - iptables -A FORWARD -i eth$eth_index -o wlan$wifi_index -m state --state RELATED,ESTABLISHED -j ACCEPT - iptables -A FORWARD -i wlan$wifi_index -o eth$eth_index -j ACCEPT + # - PHP5-fpm optimizations based on total cores + sed -i "/pm.max_children = /c\pm.max_children = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf + sed -i "/pm.start_servers = /c\pm.start_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf + sed -i "/pm.min_spare_servers = /c\pm.min_spare_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf + sed -i "/pm.max_spare_servers = /c\pm.max_spare_servers = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf - # - Save IP tables, applied during ifup in /etc/network/interfaces. - iptables-save > /etc/iptables.ipv4.nat + fi - # - RPi 3 - onboard wifi, enable N - if (( $HW_MODEL == 3 && ! $WIFIHOTSPOT_RTL8188C_DEVICE )); then + #php APC/u settings + local target_php_ini=0 + local target_php_cachesize=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 30 )) + if (( $target_php_cachesize < 10 )); then - # - Add Wireless N support - echo -e "ieee80211n=1" >> /etc/hostapd/hostapd.conf + target_php_cachesize=10 fi + # - 3days TTL + local target_apc_ttl='259200' - WIFIHOTSPOT=2 - - fi + #PHP OPcache + php5enmod opcache - #TORHOTSPOT - if (( $TORHOTSPOT == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then -# - Tor config - cat << _EOF_ > /etc/tor/torrc -Log notice file /var/log/tor/notices.log -VirtualAddrNetwork 10.192.0.0/10 -AutomapHostsSuffixes .onion,.exit -AutomapHostsOnResolve 1 -TransPort 9040 -TransListenAddress 192.168.42.1 -DNSPort 53 -DNSListenAddress 192.168.42.1 -_EOF_ + target_php_ini='/etc/php5/apache2/php.ini' - # - Flush IP tables - iptables -F - iptables -t nat -F + else - # - Generate tor prerouting tables - local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) - iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --dport 22 -j REDIRECT --to-ports 22 - iptables -t nat -A PREROUTING -i wlan$wifi_index -p udp --dport 53 -j REDIRECT --to-ports 53 - iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --syn -j REDIRECT --to-ports 9040 + target_php_ini='/etc/php5/fpm/php.ini' - # - Save - iptables-save > /etc/iptables.ipv4.nat + fi - # - Generate Logfile - mkdir -p /var/log/tor - echo 0 > /var/log/tor/notices.log - chown -R debian-tor:nogroup /var/log/tor/notices.log + sed -i "/opcache.enable=/c\opcache.enable=1" $target_php_ini + sed -i "/opcache.memory_consumption=/c\opcache.memory_consumption=$target_php_cachesize" $target_php_ini + sed -i "/opcache.revalidate_freq=/c\opcache.revalidate_freq=60" $target_php_ini - # - User: Test tor is functional. - #https://check.torproject.org + wget https://raw.githubusercontent.com/rlerdorf/opcache-status/master/opcache.php -O /var/www/opcache.php + #APCu + php5enmod apcu - TORHOTSPOT=2 + # - apc.shm_size= requires M at end to prevent warning: https://github.com/Fourdee/DietPi/issues/218 + target_php_cachesize+="M" + target_php_ini='/etc/php5/mods-available/apcu.ini' - fi + cat << _EOF_ > "$target_php_ini" +extension=apcu.so +apc.shm_size=$target_php_cachesize +apc.ttl=$target_apc_ttl +_EOF_ - #SHAIRPORTSYNC - if (( $SHAIRPORTSYNC == 1 )); then + cp /usr/share/doc/php5-apcu/apc.php /var/www/apc.php - #Reduce min volume scale threshold (prevents hissing on low end soundcards eg:rpi) - sed -i '/volume_range_db = /c\volume_range_db = 40;' /etc/shairport-sync.conf + #Apply permissions + chown -R www-data:www-data /var/www/apc.php + chown -R www-data:www-data /var/www/opcache.php - #set service user to root (mainly for for arm64, but no harm in doing it for all installs) - sed -i '/^User=/d' /lib/systemd/system/shairport-sync.service &> /dev/null - sed -i '/^Group=/d' /lib/systemd/system/shairport-sync.service &> /dev/null + #Set all PHP.INI's to UTF-8 + sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/apache2/php.ini &> /dev/null + sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/cli/php.ini &> /dev/null + sed -i '/default_charset/c\default_charset = "UTF-8"' /etc/php5/fpm/php.ini &> /dev/null + #Set all PHP.ini tmp_upload_dir to sd (cant be /tmp as its ramdisk and limited size. Also used by Owncloud uploads) + local tmp_upload_dir="/var/tmp/php_upload_tmp" + mkdir -p "$tmp_upload_dir" + chown -R www-data:www-data "$tmp_upload_dir" - SHAIRPORTSYNC=2 - - fi - - #BRUTEFIR - if (( $BRUTEFIR == 1 )); then + sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/apache2/php.ini &> /dev/null + sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/cli/php.ini &> /dev/null + sed -i "/upload_tmp_dir =/c\upload_tmp_dir = $tmp_upload_dir" /etc/php5/fpm/php.ini &> /dev/null - #Copy configs and services - cp /DietPi/dietpi/conf/brutefir_config /etc/BruteFIR/ - cp /DietPi/dietpi/conf/brutefir.service /etc/dietpi/dietpi-software/services/brutefir.service + #Set all PHP.ini max upload sizes. + local php_max_post_size='2G' + local php_max_upload_size='2G' + sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/apache2/php.ini &> /dev/null + sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/apache2/php.ini &> /dev/null + sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/cli/php.ini &> /dev/null + sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/cli/php.ini &> /dev/null + sed -i "/upload_max_filesize =/c\upload_max_filesize = $php_max_upload_size" /etc/php5/fpm/php.ini &> /dev/null + sed -i "/post_max_size =/c\post_max_size = $php_max_post_size" /etc/php5/fpm/php.ini &> /dev/null - #Modules - echo -e "snd-aloop" > /etc/modules-load.d/brutefir-alsa-loopback.conf - echo -e "options snd-aloop id=BruteFIR enable=1 pcm_substreams=1 pcm_notify=1" > /etc/modprobe.d/brutefir-alsa-loopback.conf + #PHP info web file + cat << _EOF_ > /var/www/phpinfo.php + +_EOF_ - #Asound.conf RPI - cat << _EOF_ > /etc/asound.conf -pcm.!default { + fi - type plug + #WEBSERVER_MYADMINPHP + INSTALLING_INDEX=90 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - slave { - pcm { + #NGINX LIGHTTPD symlink to var www + if (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 || + ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then - type hw - card "BruteFIR" - device 0 - channels 2 - format "S16_LE" - rate 44100 - } - } -} + ln -sf /usr/share/phpmyadmin /var/www -ctl.!default { + fi - type hw - card "BruteFIR" -} -_EOF_ + fi + #WEBSERVER_REDIS + INSTALLING_INDEX=91 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - BRUTEFIR=2 + #Enable resdis extensions for all webstacks: + echo -e "extension=redis.so" > /etc/php5/cli/conf.d/20-redis.ini &> /dev/null + echo -e "extension=redis.so" > /etc/php5/apache2/conf.d/20-redis.ini &> /dev/null fi + #OPENBAZAAR + INSTALLING_INDEX=58 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #PYDIO - if (( $PYDIO == 1 )); then - - #Configure apache2 - # - Disable php output_buffering = - sed -i '/output_buffering = /c\output_buffering = Off/' /etc/php5/apache2/php.ini - # - Allow overrides and redirects - sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/sites-enabled/000-default* - # - +Jessie - sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/apache2.conf - - # - Enable apache2 rewrite engine - a2enmod rewrite + # - service + cp /DietPi/dietpi/conf/openbazaar-server.service /etc/dietpi/dietpi-software/services/openbazaar-server.service + chmod +x /etc/dietpi/dietpi-software/services/openbazaar-server.service - # - Enable PHP mods - php5enmod mcrypt - php5enmod gd + fi - #Create Mysql DB - /DietPi/dietpi/func/create_mysql_db pydio dietpi root dietpi + #OWNCLOUD + INSTALLING_INDEX=47 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then #Setup Data directory - local target_data_dir="$DIETPI_USERDATA_DIRECTORY/pydio_data" - - # - Generate user data dir + local target_data_dir="$DIETPI_USERDATA_DIRECTORY/owncloud_data" mkdir -p "$target_data_dir" - # - move data structure - mv /var/www/pydio/data/* "$target_data_dir"/ - rm -R /var/www/pydio/data - ln -sf "$target_data_dir" /var/www/pydio/data - - #Set permissions - chown -R www-data:www-data /var/www/pydio - chown -R www-data:www-data "$target_data_dir" - + #Create symlink from default /var/www/owncloud/data to DIETPI_USERDATA_DIRECTORY + local target_data_symlink="/var/www/owncloud/data" + mkdir -p "$target_data_symlink" &> /dev/null - PYDIO=2 + # - Copy existing data to our data location + cp -R "$target_data_symlink" "$target_data_dir" - fi + # - Create symlink + rm -R "$target_data_symlink" &> /dev/null + ln -fs "$target_data_dir" "$target_data_symlink" + #Set permissions to both directory and symlink. + chown -R www-data:www-data "$target_data_dir" + chown -R www-data:www-data "$target_data_symlink" - #SQUEEZELITE - if (( $SQUEEZELITE == 1 )); then + chmod -R 770 "$target_data_dir" + chmod -R 770 "$target_data_symlink" + #Set max upload size + sed -i "/php_value upload_max_filesize/c\php_value upload_max_filesize 2G" /var/www/owncloud/.htaccess + sed -i "/php_value post_max_size/c\php_value post_max_size 2G" /var/www/owncloud/.htaccess + #Set max allowed memory total/4 + local memory_limit_max="$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 4 ))M" + sed -i "/php_value memory_limit/c\php_value memory_limit $memory_limit_max" /var/www/owncloud/.htaccess - #Specify buffers for RPi (prevents buffer underruns on default settings) - # - Miliseconds + #NGINX setup default site + if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then - # -- Nice big buffer for single cores - if (( $CPU_CORES_TOTAL == 1 )); then - sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 180"' /etc/default/squeezelite + cp /DietPi/dietpi/conf/nginx.sites-dietpi.owncloud.conf /etc/nginx/sites-dietpi/owncloud.conf - # -- lapse buffer for >=2 cores - else - sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 75"' /etc/default/squeezelite fi - # - Buffer/period/bit - #sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 4096:8:16:0"' /etc/default/squeezelite - + fi - SQUEEZELITE=2 + # Transmission + INSTALLING_INDEX=44 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - fi + sed -i '/USER=/c\USER=root' /etc/init.d/transmission-daemon - #EMONHUB - if (( $EMONHUB == 1 )); then + #Jessie, Transmission uses my systemd service: https://github.com/Fourdee/DietPi/issues/350#issuecomment-220828884 + rm /etc/init.d/transmission-daemon + rm /etc/systemd/system/transmission-daemon.service + cat << _EOF_ > /etc/systemd/system/transmission-daemon.service +[Unit] +Description=Barebones transmission-daemon service +DefaultDependencies=no - # - Copy configs - cp /etc/emonhub/conf/default/emonhub /etc/default/emonhub +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/transmission-daemon --config-dir /var/lib/transmission-daemon/info +ExecStop=/usr/bin/killall -w transmission-daemon +StandardOutput=tty - # - Setup service - cp /etc/emonhub/service/emonhub /etc/init.d/emonhub - chmod +x /etc/init.d/emonhub - update-rc.d emonhub defaults +[Install] +WantedBy=multi-user.target +_EOF_ + systemctl enable transmission-daemon.service - chmod +x -R /etc/emonhub + cp /DietPi/dietpi/conf/transmission_settings /etc/transmission-daemon/settings.json - #RPI 3 - Must disable BCM BT to recover UART 0 - if (( $HW_MODEL == 3 )); then + Create_UserContent_Folders - # - Add DToverlay to disable bluetooth - if (( $(cat /DietPi/config.txt | grep -ci -m1 '=pi3-disable-bt') == 0 )); then - echo -e "\ndtoverlay=pi3-disable-bt" >> /DietPi/config.txt - # - Enable - else - sed -i '/pi3-disable-bt/c\dtoverlay=pi3-disable-bt' /DietPi/config.txt - fi + #Apply optimized settings + sed -i '/cache-size-mb/c\ "cache-size-mb": '$(Optimize_BitTorrent 0)',' /etc/transmission-daemon/settings.json + sed -i '/download-queue-size/c\ "download-queue-size": '$(Optimize_BitTorrent 1)',' /etc/transmission-daemon/settings.json + sed -i '/peer-limit-global/c\ "peer-limit-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json + sed -i '/max-peers-global/c\ "max-peers-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json + sed -i '/peer-limit-per-torrent/c\ "peer-limit-per-torrent": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json + sed -i '/upload-slots-per-torrent/c\ "upload-slots-per-torrent": '$(Optimize_BitTorrent 3)',' /etc/transmission-daemon/settings.json - # - Disable bluetooth service - systemctl stop hciuart - systemctl disable hciuart + fi - fi + #PHPBB + INSTALLING_INDEX=54 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #RPi - Disable serial tty that emonPi uses. - /DietPi/dietpi/func/dietpi-set_hardware serialconsole disable + chown -R www-data:www-data /var/www/phpBB3 + /DietPi/dietpi/func/create_mysql_db phpbb3 dietpi root dietpi - # - Apply user API KEY - USER_EMONHUB_APIKEY_CURRENT=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_emonhub_apikey=' | sed 's/.*=//') - sed -i "/apikey/c\ apikey = $USER_EMONHUB_APIKEY_CURRENT" /etc/emonhub/conf/emonhub.conf + fi + # Proftpd + INSTALLING_INDEX=94 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - EMONHUB=2 + sed -i "/root/c\#root" /etc/ftpusers + cp /DietPi/dietpi/conf/proftpd.conf /etc/proftpd/proftpd.conf + sed -i "/DefaultRoot /c\DefaultRoot $DIETPI_USERDATA_DIRECTORY" /etc/proftpd/proftpd.conf fi - #RPIMONITOR - if (( $RPIMONITOR == 1 )); then + #Samba Server + INSTALLING_INDEX=96 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Update apt package stats - /usr/share/rpimonitor/scripts/updatePackagesStatus.pl + echo -e "dietpi\ndietpi" | smbpasswd -s -a root + cp /DietPi/dietpi/conf/smb.conf /etc/samba/smb.conf - # - USBdrive stats implimentation by Rich - if (( $USBDRIVE == 2 )); then + sed -i "/path = /c\path = $DIETPI_USERDATA_DIRECTORY" /etc/samba/smb.conf - sed -i '\/include=\/etc\/rpimonitor\/template\/sdcard.conf/a include=\/etc\/rpimonitor\/template\/usb_hdd.conf' /etc/rpimonitor/data.conf + fi - cat << _EOF_ > /etc/rpimonitor/template/usb_hdd.conf -######################################################################## -# Extract USB HDD (sda1) information -# Page: 1 -# Information Status Statistics -# - USBHDD1 total - yes - yes -# - USBHDD1 used - yes - yes -######################################################################## -static.10.name=usbhdd_total -static.10.source=df -t ext4 -static.10.regexp=sda1\s+(\d+) -static.10.postprocess=\$1/1024 + # vsFTPD + INSTALLING_INDEX=95 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then -dynamic.14.name=usbhdd_used -dynamic.14.source=df -t ext4 -dynamic.14.regexp=sda1\s+\d+\s+(\d+) -dynamic.14.postprocess=\$1/1024 -dynamic.14.rrd=GAUGE + cp /DietPi/dietpi/conf/vsftpd.conf /etc/vsftpd.conf + sed -i '/root/c\#root' /etc/ftpusers -web.status.1.content.9.name=USB HDD -web.status.1.content.9.icon=usb_hdd.png -web.status.1.content.9.line.1="/sda1 Used: "+KMG(data.usbhdd_used,'M')+" ("+Percent(data.udbhdd_used,data.usbhdd_total,'M')+") Free: "+KMG(data.usbhdd_total-data.usbhdd_used,'M')+ " Total: "+ KMG(data.usbhdd_total,'M') +"" -web.status.1.content.9.line.2=ProgressBar(data.usbhdd_used,data.usbhdd_total) + sed -i "/local_root=/c\local_root=$DIETPI_USERDATA_DIRECTORY" /etc/vsftpd.conf -web.statistics.1.content.9.name=USB HDD -web.statistics.1.content.9.graph.1=usbhdd_total -web.statistics.1.content.9.graph.2=usbhdd_used -web.statistics.1.content.9.ds_graph_options.usbhdd_total.label=USB HDD total space (MB) -web.statistics.1.content.9.ds_graph_options.usbhdd_total.color="#FF7777" -web.statistics.1.content.9.ds_graph_options.usbhdd_used.label=USB HDD used space (MB) -web.statistics.1.content.9.ds_graph_options.usbhdd_used.lines={ fill: true } -web.statistics.1.content.9.ds_graph_options.usbhdd_used.color="#7777FF" -_EOF_ + fi - fi + #HIFI + INSTALLING_INDEX=32 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + #Start at boot + cp /DietPi/dietpi/conf/ympd_init /etc/init.d/ympd + chmod +x /etc/init.d/ympd + update-rc.d ympd defaults - RPIMONITOR=2 + # + arm64 MPD using our compiled mpd binary. + if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - fi + cat << _EOF_ > /etc/default/mpd +#Even though we declare the conf location in our service, MPD will fail to start if this file does not exist. - #NETDATA - if (( $NETDATA == 1 )); then +## The configuration file location for mpd: +MPDCONF=/etc/mpd.conf +_EOF_ - # - service - cat << _EOF_ > /etc/systemd/system/netdata.service -[Unit] -Description=netdata -After=network.target httpd.service squid.service nfs-server.service mysqld.service named.service postfix.service -[Service] -Type=forking -WorkingDirectory=/tmp + cat << _EOF_ > /lib/systemd/system/mpd.service +[Unit] +Description=Music Player Daemon +After=network.target sound.target + +[Service] User=root -Group=root -PIDFile=/var/run/netdata.pid -ExecStart=/usr/sbin/netdata -pidfile /var/run/netdata.pid -ExecStop=/bin/kill -SIGTERM \$MAINPID +EnvironmentFile=/etc/default/mpd +ExecStartPre=/bin/mkdir -p /var/lib/mpd +ExecStartPre=/bin/mkdir -p /var/log/mpd +ExecStartPre=/bin/mkdir -p /var/run/mpd +ExecStartPre=/bin/mkdir -p /var/lib/mpd +ExecStart=/usr/local/bin/mpd --no-daemon /etc/mpd.conf -TimeoutStopSec=30 +# allow MPD to use real-time priority 50 +LimitRTPRIO=50 +LimitRTTIME=-1 [Install] WantedBy=multi-user.target + _EOF_ - systemctl daemon-reload + systemctl daemon-reload - # - Create netdata user/group - getent group netdata > /dev/null || groupadd -r netdata - getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata + fi - for x in /var/cache/netdata /usr/share/netdata/web /etc/netdata /var/log/netdata; do - chown -R netdata.netdata $x - chmod 0775 -R $x - done + #Copy default config + cp /DietPi/dietpi/conf/mpd.conf /etc/mpd.conf - # - Workaround to prevent update checks and the "distracting update flashing button": https://github.com/firehol/netdata/issues/233#issuecomment-210468649 - #echo 0 > /usr/share/netdata/web/version.txt + #Add audio output options to mpd config + cat << _EOF_ >> /etc/mpd.conf +audio_output { + type "alsa" + name "DietPi Alsa" +# device "hw:0,0" + format "44100:16:2" + mixer_type "software" +# mixer_control "PCM" +# mixer_index "0" +} +#HDMI - Set format and audio_output_format to 48000hz +#audio_output_format "48000:16:2" +#samplerate_converter "soxr" +_EOF_ + #Setup data locations + Create_UserContent_Folders + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.mpd_cache - NETDATA=2 + #Grab our test music for the user. + Download_Test_Media fi - #BAIKAL - if (( $BAIKAL == 1 )); then + #Kodi + INSTALLING_INDEX=31 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Permissions - chown -R www-data:www-data /var/www/baikal + #Remove Kodi user (Whilst waving) + userdel -r kodi &> /dev/null - # - install/run composer | Also run for ampache. Move this to a global function.... - php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php - php composer-setup.php - php -r "unlink('composer-setup.php');" + #Run Kodi as root + sed -i '/USER=/c\USER=root' /etc/default/kodi &> /dev/null - mv composer.phar /usr/local/bin/composer + #Copy udev rules, probably not needed for root, but we'll do it anyway + cp /DietPi/dietpi/conf/kodi_udev /etc/udev/rules.d/99-input.rules + chmod +x /etc/udev/rules.d/99-input.rules - cd /var/www/baikal - composer install --no-interaction - cd ~/ + #Create .desktop SymLinks + mkdir -p "$HOME"/Desktop + rm /usr/share/applications/kodi.desktop &> /dev/null + ln -sf /DietPi/dietpi/conf/desktop/kodi.desktop /usr/share/applications/kodi.desktop + ln -sf /DietPi/dietpi/conf/desktop/kodi.desktop "$HOME"/Desktop/kodi.desktop - # - Mysql DB - /DietPi/dietpi/func/create_mysql_db baikal dietpi root dietpi + #startkodi alias. + if (( $(cat /etc/bash.bashrc | grep -ci -m1 'startkodi') == 0 )); then - BAIKAL=2 + echo -e "alias startkodi='/DietPi/dietpi/misc/start_kodi'" >> /etc/bash.bashrc - fi + fi - #MUMBLESERVER - if (( $MUMBLESERVER == 1 )); then + fi - #Cap total connections - sed -i '/users=/c\users=40' /etc/mumble-server.ini - # - RPI 1 - if (( $HW_MODEL <= 1 )); then - sed -i '/users=/c\users=8' /etc/mumble-server.ini - fi + #MINIDLNA + INSTALLING_INDEX=39 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Name the root channel - sed -i '/registerName=/c\registerName=DietPi Mumble Server' /etc/mumble-server.ini + #Run as root + sed -i '/USER=m/c\USER=root' /etc/init.d/minidlna + # + SystemD + sed -i '/User=m/c\User=root' /lib/systemd/system/minidlna.service &> /dev/null + sed -i '/Group=m/c\Group=root' /lib/systemd/system/minidlna.service &> /dev/null - #Disable DB logging - sed -i '/logdays=/c\logdays=-1' /etc/mumble-server.ini + #Copy Config + cp /DietPi/dietpi/conf/minidlna.conf /etc/minidlna.conf - MUMBLESERVER=2 + #Setup data directories + Create_UserContent_Folders + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.MiniDLNA_Cache fi - #EMBYSERVER - if (( $EMBYSERVER == 1 )); then - - Create_UserContent_Folders - Download_Test_Media + #OpenTyrian + INSTALLING_INDEX=51 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + #Copy the DietPi run file for OpenTyrian + cp /DietPi/dietpi/conf/opentyrian_run /usr/local/games/opentyrian/run + chmod +x /usr/local/games/opentyrian/run - EMBYSERVER=2 + #Create .Desktop SymLinks + mkdir -p "$HOME"/Desktop + rm /usr/share/applications/opentyrian.desktop &> /dev/null + ln -s /DietPi/dietpi/conf/desktop/opentyrian.desktop /usr/share/applications/opentyrian.desktop + ln -s /DietPi/dietpi/conf/desktop/opentyrian.desktop "$HOME"/Desktop/opentyrian.desktop fi - #PLEXMEDIASERVER - if (( $PLEXMEDIASERVER == 1 )); then + #DIETPICAM + INSTALLING_INDEX=59 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - Create_UserContent_Folders - Download_Test_Media + # - raspimjpeg conf + chmod +x /etc/raspimjpeg + ln -s /etc/raspimjpeg /var/www/dietpicam/raspimjpeg - #For all ARM devices: - # - en_US.UTF8 must be installed and the default locale on system. This is for SBC installs using dev2day repo: https://github.com/Fourdee/DietPi/issues/116#issuecomment-222195911 - if (( $HW_ARCH < 20 )) && - (( ! $(locale | grep -ci -m1 'en_US.UTF-8') )); then + # - Motion conf + chgrp www-data /etc/motion/motion.conf + chmod 777 /etc/motion/motion.conf + usermod -a -G video www-data - sed -i '/en_US.UTF-8 UTF-8/c\en_US.UTF-8 UTF-8' /etc/locale.gen - locale-gen + # - raspimjpeg/php schedule startup and control script + cp /DietPi/dietpi/conf/raspimjpeg.service /etc/dietpi/dietpi-software/services/raspimjpeg.service - WHIP_QUESTION='Plex Media Server requires en_US.UTF8 locale to be installed and set to default, else, Plex will not start.\n\nOn the next screen:\n - Press enter (Do not make any changes to the selections, we have already selected en_US.UTF8 for you).\n\nOn the screen after:\n - Select en_US.UTF8 and press enter.' - whiptail --title "Plex en_US.UTF8" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 16 70 + # - Set web permissions for local dietpicam web directory + chown -R www-data:www-data /var/www/dietpicam - dpkg-reconfigure locales + # - Setup Data directory + local dietpicam_media_directory=$DIETPI_USERDATA_DIRECTORY - #en_US.UTF8 must be installed and the default locale for Plex Media Server to function correctly. If en_US.UTF8 is not the default locale on your system, DietPi will prompt you, with instructions, to set this up during installation. - fi + mkdir -p "$dietpicam_media_directory"/dietpicam + rm -R /var/www/dietpicam/media + ln -s "$dietpicam_media_directory"/dietpicam /var/www/dietpicam/media + chown -R www-data:www-data "$dietpicam_media_directory"/dietpicam + chmod -R 777 "$dietpicam_media_directory"/dietpicam - PLEXMEDIASERVER=2 + # - Enable RPi Camera module + sed -i '/start_x=/c\start_x=1' /DietPi/config.txt fi - #CUBERITE - if (( $CUBERITE == 1 )); then + #Deluge + INSTALLING_INDEX=45 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - cat << _EOF_ > /etc/systemd/system/cuberite.service -[Unit] -Description=Cuberite Server + #copy init + cp /DietPi/dietpi/conf/deluge.service /etc/dietpi/dietpi-software/services/deluge.service -[Service] -Type=oneshot -WorkingDirectory=/etc/cubrite -ExecStart=/etc/cubrite/Cuberite --service -ExecStop=/usr/bin/killall -w Cuberite -RemainAfterExit=yes -User=root + #Generate deluge default config + deluged + killall -w deluged -[Install] -WantedBy=multi-user.target -_EOF_ -systemctl enable cuberite.service -systemctl daemon-reload + #Copy DietPi configs + cp /DietPi/dietpi/conf/deluge.conf "$HOME"/.config/deluge/core.conf + cp /DietPi/dietpi/conf/deluge_web.conf "$HOME"/.config/deluge/web.conf - #WebUI settings - cat << _EOF_ > /etc/cubrite/webadmin.ini -[User:root] -Password=dietpi + #Set remote access login details + echo -e "localclient:dietpi:10" > "$HOME"/.config/deluge/auth -[WebAdmin] -Ports=1339 -Enabled=1 -_EOF_ + #Setup data directory + Create_UserContent_Folders + #Apply Optimized settings + # - Cache size is in steps of 16 KiB. (Cachesize * 16 = total KiB) + local deluge_cache_size=$(( $(echo -e "scale=0; $(Optimize_BitTorrent 0) * 1024 / 16" | bc -l ) )) + sed -i '/"cache_size": /c\ "cache_size": '"$deluge_cache_size"',' "$HOME"/.config/deluge/core.conf - CUBERITE=2 + sed -i '/"max_active_limit": /c\ "max_active_limit": '"$(Optimize_BitTorrent 1)"',' "$HOME"/.config/deluge/core.conf + sed -i '/"max_active_downloading": /c\ "max_active_downloading": '"$(Optimize_BitTorrent 1)"',' "$HOME"/.config/deluge/core.conf + sed -i '/"max_connections_global": /c\ "max_connections_global": '"$(Optimize_BitTorrent 2)"',' "$HOME"/.config/deluge/core.conf + sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '"$(Optimize_BitTorrent 3)"',' "$HOME"/.config/deluge/core.conf fi - #MINEOS - if (( $MINEOS == 1 )); then + #RaspControl + INSTALLING_INDEX=106 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - #Stop mineos from running while we config it. When we didnt do this, the program would constantly overwrite our symlink from (/var/games/minecraft). - /DietPi/dietpi/dietpi-services stop - killall -w supervisord &> /dev/null - killall -w node &> /dev/null - killall -w nodejs &> /dev/null + chown -R www-data:www-data /var/www/raspcontrol + chmod -R 750 /var/www/raspcontrol - ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos_console.js /usr/local/bin/mineos + #Setup login file + mkdir -p /etc/raspcontrol - cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos.conf /etc/mineos.conf +cat << _EOF_ > /etc/raspcontrol/database.aptmnt +{ + "user": "root", + "password": "dietpi" +} +_EOF_ - # - setup SSL cert - cd "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft - ./generate-sslcert.sh + chown -R www-data:www-data /etc/raspcontrol + chmod -R 750 /etc/raspcontrol - # - Supervisor service - cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/init/supervisor_conf /etc/supervisor/conf.d/mineos.conf + fi - cd "$HOME" + #Linux Dash + INSTALLING_INDEX=63 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Add underprivilged user for web access - useradd mineos - echo -e "dietpi\ndietpi\n" | passwd mineos + chown -R www-data:www-data /var/www/linuxdash + chmod -R 750 /var/www/linuxdash - # - Move server data storage to userdata dir (High disk writes) - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata - mkdir -p /var/games #sometimes this is not created by mineos after installation... Ensures symlink creation does not fail. - cp -R /var/games/minecraft/* "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata/ - rm -R /var/games/minecraft + fi - ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata /var/games/minecraft + #PIHOLE + INSTALLING_INDEX=93 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - chown -R mineos:mineos /var/games/minecraft - chown -R mineos:mineos "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata + #Generate index page that replaces adverts + cat << _EOF_ > /var/www/index.html + +Blocked by Pi-hole. + +_EOF_ - # - correct the node filepath for supervisor mineos - sed -i '/^command=/c\command=/usr/local/bin/node webui.js' /etc/supervisor/conf.d/mineos.conf + #Set /var/www/pihole permisions + chown -R www-data:www-data /var/www/pihole + chmod -R 775 /var/www/pihole - # - Set directory to DIETPI_USERDATA_DIRECTORY - sed -i "/^directory=/c\directory=$DIETPI_USERDATA_DIRECTORY/mineos/minecraft" /etc/supervisor/conf.d/mineos.conf + #Generate pihole.log , set permissions to www-data + echo -e "" > /var/log/pihole.log + chown www-data:www-data /var/log/pihole.log &> /dev/null + chmod 775 /var/log/pihole.log - supervisorctl reload + #Apply dnsmasq.conf + cp /DietPi/dietpi/conf/dnsmasq.conf /etc/dnsmasq.conf + + #Add active network adapter + local active_network_adapter=$(sed -n 3p /DietPi/dietpi/.network) + sed -i "/interface=/c\interface=$active_network_adapter" /etc/dnsmasq.conf + + #Set dnsmasq service to user www-data. + sed -i '/DNSMASQ_USER=/c\DNSMASQ_USER="www-data"' /etc/init.d/dnsmasq + + #Add weekly cronjob to update adlist + cat << _EOF_ > /etc/cron.weekly/pihole_adlist_update +#!/bin/bash +{ + service dnsmasq stop + + echo -e "--------------------------------------------------------------------\n\n\$(date)\nDietPi - Running weekly adlist update" >> /var/log/pihole.log + /usr/local/bin/gravity.sh &>> /var/log/pihole.log + echo -e "--------------------------------------------------------------------\n" >> /var/log/pihole.log + + service dnsmasq start + + exit 0 +} + +_EOF_ + chmod +x /etc/cron.weekly/pihole_adlist_update - MINEOS=2 + # - Prevent warning of missing file during gravity.sh: https://github.com/Fourdee/DietPi/issues/311#issuecomment-230276175 + # NB: The contents of this file is not "currently" required for our installation. + echo -e "#nothing here" > /etc/dnsmasq.d/01-pihole.conf fi - #GOGS - if (( $GOGS == 1 )); then + #SUBSONIC 5/6 + #INSTALLING_INDEX=33/34 + if (( ${aSOFTWARE_INSTALL_STATE[33]} == 1 || + ${aSOFTWARE_INSTALL_STATE[34]} == 1 )); then - # - Data storage / user data - mkdir -p "$DIETPI_USERDATA_DIRECTORY"/gogs-repo + #Generate user dir + Create_UserContent_Folders - # - sqldb - /DietPi/dietpi/func/create_mysql_db gogs dietpi root dietpi + #Optimize memory limit + local subsonic_memory_max=$(( $(free -m -o | grep -m1 'Mem:' | awk '{print $2}') / 5 )) + #Minimum cap 150mb + if (( $subsonic_memory_max < 150 )); then - # - service (couldnt get this to run as a new thread with systemD (&). so bash script ftw. - cat << _EOF_ > /etc/gogs/start.sh -#!/bin/bash -#Simple script to start gogs for DietPi systems -/etc/gogs/gogs web &> /var/log/gogs_daemon.log & -exit + subsonic_memory_max=150 + + fi + + cat << _EOF_ > /etc/default/subsonic +SUBSONIC_USER=root +SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" _EOF_ - chmod +x /etc/gogs/start.sh + #Grab our test media for user + Download_Test_Media - cat << _EOF_ > /etc/systemd/system/gogs.service + #Symlink ffmpeg to subsonic transcoder + #rpi armv6 jessie (using compiled ffmpeg) + if (( $HW_MODEL < 2 )); then + + ln -fs /usr/local/bin/ffmpeg /var/subsonic/transcode + + #ARMv7 + else + + ln -fs /usr/bin/ffmpeg /var/subsonic/transcode + + fi + + fi + + #WEBIOPI + INSTALLING_INDEX=71 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #auto start + update-rc.d webiopi defaults + + WEBIOPI=2 + fi + + #DIETPICLOUDSHELL + INSTALLING_INDEX=62 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Enable DietPi-Cloudshell autostart + /DietPi/dietpi/dietpi-autostart 5 + + #add alias + if (( $(cat /etc/bash.bashrc | grep -ci -m1 'dietpi-cloudshell=' ) == 0 )); then + + sed -i "/#DietPi Additions/a alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell'" /etc/bash.bashrc + + fi + + fi + + #HAPROXY + INSTALLING_INDEX=98 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Create jail directory + mkdir -p /var/lib/haproxy + + cat << _EOF_ > /etc/haproxy/haproxy.cfg +global + + #rsyslog is required for logging + #log /var/log local0 + #log /var/log local1 notice + maxconn 64 + #Jail directory + chroot /var/lib/haproxy + stats socket /run/haproxy.sock mode 660 level admin + stats timeout 30s + user root + group root + daemon + + # Default SSL material locations + ca-base /etc/ssl/certs + crt-base /etc/ssl/private + + # Default ciphers to use on SSL-enabled listening sockets. + # For more information, see ciphers(1SSL). + ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL + +defaults + + log global + mode http + option httplog + option dontlognull + timeout connect 5000 + timeout client 50000 + timeout server 50000 + errorfile 400 /etc/haproxy/errors/400.http + errorfile 403 /etc/haproxy/errors/403.http + errorfile 408 /etc/haproxy/errors/408.http + errorfile 500 /etc/haproxy/errors/500.http + errorfile 502 /etc/haproxy/errors/502.http + errorfile 503 /etc/haproxy/errors/503.http + errorfile 504 /etc/haproxy/errors/504.http + +frontend localnodes + + bind *:80 + mode http + default_backend nodes + +backend nodes + + mode http + balance roundrobin + option forwardfor + http-request set-header X-Forwarded-Port %[dst_port] + http-request add-header X-Forwarded-Proto https if { ssl_fc } + option httpchk HEAD / HTTP/1.1\r\nHost:localhost + server web01 127.0.0.1:9000 check + server web02 127.0.0.1:9001 check + server web03 127.0.0.1:9002 check + +#Admin web page + + listen stats *:1338 + stats enable + stats uri / + stats hide-version + stats auth admin:dietpi +_EOF_ + + #Add html error pages + mkdir -p /etc/haproxy/errors + local errorcode=0 + + errorcode=400; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=403; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=408; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=500; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=502; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=503; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + errorcode=504; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http + + fi + + #SQUEEZEBOXSERVER + INSTALLING_INDEX=35 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Remove service + update-rc.d logitechmediaserver remove + rm /etc/init.d/logitechmediaserver + + #DietPi-Services init + cp /DietPi/dietpi/conf/squeezeboxserver.service /etc/dietpi/dietpi-software/services/squeezeboxserver.service + + #Generate user dir + Create_UserContent_Folders + + #Grab our test media for user + Download_Test_Media + + fi + + #WORDPRESS + INSTALLING_INDEX=55 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Create mysql DB + /DietPi/dietpi/func/create_mysql_db wordpress dietpi root dietpi + service mysql stop + + fi + + #TIGHTVNCSERVER & VNC4SERVER - Shared setup + #INSTALLING_INDEX=27/28 + if (( ${aSOFTWARE_INSTALL_STATE[27]} == 1 || + ${aSOFTWARE_INSTALL_STATE[28]} == 1 )); then + + #User, enter PW + if (( $USER_INPUTS )); then + + local entering_pw=1 + local loop_count=0 + + WHIP_QUESTION='A password is required for your VNC Server.\n\nThe next screen will allow you to set your password, this password will be used when connecting from a VNC client/viewer.\n\nPress Ok/Enter when ready.' + whiptail --title "VNC Server Password" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 13 70 + + + while (( $entering_pw == 1 )); do + + vncpasswd + ((loop_count++)) + + # - Password file created + if [ -f "$HOME"/.vnc/passwd ]; then + + entering_pw=0 + + # - Endless loop + elif (( $loop_count >= 30 )); then + + entering_pw=0 + + fi + + done + + fi + + cat << _EOF_ > /etc/systemd/system/vncserver.service [Unit] -Description=DietPi Gogs service -DefaultDependencies=no +Description=Manage VNC Server +After=dietpi-service.service +After=rc.local.service [Service] -Type=oneshot +Type=idle RemainAfterExit=yes +ExecStart=/bin/bash /usr/local/bin/vncserver start +ExecStop=/bin/bash /usr/local/bin/vncserver stop User=root -ExecStart=/bin/bash /etc/gogs/start.sh -ExecStop=/usr/bin/killall -w gogs -StandardOutput=tty [Install] WantedBy=multi-user.target _EOF_ + systemctl enable vncserver.service + systemctl daemon-reload - GOGS=2 + cat << _EOF_ > /usr/local/bin/vncserver +#!/bin/bash - fi +#Globals +VNC_INSTALLED=0 +BINARY_FP=0 - #QBITTORRENT - if (( $QBITTORRENT == 1 )); then +WIDTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_width=' | sed 's/.*=//') +HEIGHT=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_height=' | sed 's/.*=//') +DEPTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_depth=' | sed 's/.*=//') +DISPLAY=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_display=' | sed 's/.*=//') + +#TightVNC or VNC4server? +if [ -f /usr/bin/vnc4server ]; then + BINARY_FP='/usr/bin/vnc4server' + VNC_INSTALLED=1 +elif [ -f /usr/bin/vncserver ]; then + BINARY_FP='/usr/bin/vncserver' + VNC_INSTALLED=1 +fi + +#Exit if no VNC binary found +if (( ! \$VNC_INSTALLED )); then + exit 1 +fi + +case "\$1" in + start) + \$BINARY_FP :\$DISPLAY -geometry \$WIDTH'x'\$HEIGHT -depth \$DEPTH + ;; + + stop) + \$BINARY_FP -kill :\$DISPLAY + ;; + +esac + +exit 0 +_EOF_ + chmod +x /usr/local/bin/vncserver + + fi + + #VNC4SERVER + INSTALLING_INDEX=28 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + local cmd_launch_desktop='' + #DESKTOP_LXDE + if (( ${aSOFTWARE_INSTALL_STATE[23]} == 1 )); then + + cmd_launch_desktop='/usr/bin/lxsession -s LXDE &' + + #DESKTOP_MATE + elif (( ${aSOFTWARE_INSTALL_STATE[24]} == 1 )); then + + cmd_launch_desktop='x-window-manager &' + + #DESKTOP_GNUSTEP + elif (( ${aSOFTWARE_INSTALL_STATE[26]} == 1 )); then + + cmd_launch_desktop='x-window-manager &' + + #DESKTOP_XFCE + elif (( ${aSOFTWARE_INSTALL_STATE[25]} == 1 )); then + + cmd_launch_desktop='/usr/bin/xfce4-session &' + + fi + + cat << _EOF_ > "$HOME"/.vnc/xstartup +[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup +[ -r /root/.Xresources ] && xrdb /root/.Xresources +xsetroot -solid grey +vncconfig -iconic & +$cmd_launch_desktop +_EOF_ + + chmod +x "$HOME"/.vnc/xstartup + + fi + + + #FAIL2BAN + INSTALLING_INDEX=73 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + cat << _EOF_ > /etc/fail2ban/fail2ban.conf +[Definition] +# loglevel #1=error #2=warn #3=info +loglevel = 3 +logtarget = /var/log/fail2ban.log +socket = /var/run/fail2ban/fail2ban.sock +pidfile = /var/run/fail2ban/fail2ban.pid +_EOF_ + + cp /DietPi/dietpi/conf/fail2ban_jail.conf /etc/fail2ban/jail.conf + + fi + + #PHPSYSINFO + INSTALLING_INDEX=64 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #conf + cp /DietPi/dietpi/conf/phpsysinfo.ini /var/www/phpsysinfo/phpsysinfo.ini + + #Set permissions + chown -R www-data:www-data /var/www/phpsysinfo + chmod -R 775 /var/www/phpsysinfo + + fi + + #PHPIMAGEGALLERY + INSTALLING_INDEX=56 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Get test images + mkdir -p /var/www/gallery/DietPi + wget http://dietpi.com/images/dietpi-logo_256.png -O /var/www/gallery/DietPi/logo_256.png + + mkdir -p /var/www/gallery/Tr-Zero + wget http://media.indiedb.com/images/games/1/25/24673/SS_0.jpg -O /var/www/gallery/Tr-Zero/SS_0.jpg + wget http://media.indiedb.com/images/games/1/25/24673/SS_44.jpg -O /var/www/gallery/Tr-Zero/SS_1.jpg + wget http://media.indiedb.com/images/games/1/25/24673/3.png -O /var/www/gallery/Tr-Zero/SS_2.jpg + + #permissions for cache/thumbnail/database + mkdir -p /var/www/gallery/_sfpg_data + chown -R www-data:www-data /var/www/gallery/_sfpg_data + chmod -R 775 /var/www/gallery/_sfpg_data + + #enable (Some type of security trigger) + sed -i "/define('SECURITY_PHRASE'/c\define('SECURITY_PHRASE', 'true');" /var/www/gallery/index.php + + fi + + #AMPACHE + INSTALLING_INDEX=40 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then Create_UserContent_Folders + Download_Test_Media - # - conf. - mkdir -p "$HOME"/.config/qBittorrent - cat << _EOF_ > "$HOME"/.config/qBittorrent/qBittorrent.conf -[General] -ported_to_new_savepath_system=true + #create/insert our pre-made ampache sql db + wget http://dietpi.com/downloads/mysql_databases/ampache_mysql_3.8.2-v113.zip -O sql.zip + unzip sql.zip + rm sql.zip -[Preferences] -Downloads\DiskWriteCacheSize=$(Optimize_BitTorrent 0) -Downloads\DiskWriteCacheTTL=60 -Queueing\MaxActiveDownloads=$(Optimize_BitTorrent 1) -Queueing\MaxActiveTorrents=$(Optimize_BitTorrent 1) -Queueing\MaxActiveUploads=1 -Queueing\IgnoreSlowTorrents=false -Bittorrent\MaxConnecs=$(Optimize_BitTorrent 2) -Bittorrent\MaxConnecsPerTorrent=$(Optimize_BitTorrent 2) -Bittorrent\MaxUploads=$(Optimize_BitTorrent 3) -Bittorrent\MaxUploadsPerTorrent=$(Optimize_BitTorrent 3) -WebUI\Port=1340 -WebUI\Enabled=true -General\Locale=en_GB -Downloads\SavePath=/mnt/dietpi_userdata/downloads -Downloads\TempPathEnabled=false -Downloads\TempPath=/mnt/dietpi_userdata/downloads -Downloads\ScanDirs=@Invalid() -Downloads\DownloadInScanDirs=@Invalid() -Downloads\TorrentExportDir= -MailNotification\enabled=false -MailNotification\email= -MailNotification\smtp_server=smtp.changeme.com -MailNotification\req_ssl=false -MailNotification\req_auth=false -MailNotification\username= -MailNotification\password= -Downloads\PreAllocation=false -Queueing\QueueingEnabled=false -Downloads\UseIncompleteExtension=false -Connection\PortRangeMin=6881 -Connection\UPnP=true -Connection\GlobalDLLimit=-1 -Connection\GlobalUPLimit=-1 -Bittorrent\uTP=true -Bittorrent\uTP_rate_limited=false -Advanced\IncludeOverhead=false -Connection\GlobalDLLimitAlt=10 -Connection\GlobalUPLimitAlt=10 -Scheduler\Enabled=false -Bittorrent\DHT=true -Bittorrent\sameDHTPortAsBT=true -Bittorrent\DHTPort=6881 -Bittorrent\PeX=true -Bittorrent\LSD=true -Bittorrent\Encryption=1 -Advanced\AnonymousMode=false -Connection\ProxyType=-1 -Connection\Proxy\IP=0.0.0.0 -Connection\Proxy\Port=8080 -Connection\ProxyPeerConnections=false -Connection\Proxy\Authentication=false -Connection\Proxy\Username= -Connection\Proxy\Password= -IPFilter\Enabled=false -IPFilter\File= -WebUI\Username=root -WebUI\LocalHostAuth=true -WebUI\HTTPS\Enabled=false -DynDNS\Enabled=false -DynDNS\Service=0 -DynDNS\Username= -DynDNS\Password= -DynDNS\DomainName=changeme.dyndns.org -WebUI\Password_ha1=@ByteArray(5e434b0004be6970cf8878fcf929baba) + /DietPi/dietpi/func/create_mysql_db ampache dietpi root dietpi + mysql -u root -pdietpi ampache < ampache.sql + rm ampache.sql -[LegalNotice] -Accepted=true + #Grab config + wget http://dietpi.com/downloads/conf/ampache.cfg.php_3.8.2-v113 -O /var/www/ampache/config/ampache.cfg.php -[AutoRun] -enabled=false -program= + #Set Permisions + chown -R www-data:www-data /var/www/ampache + chmod -R 775 /var/www/ampache + + fi + + #OPENVPNSERVER + INSTALLING_INDEX=97 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + local key_size=1024 + + #Start Cert/Key generation. + cp -R /usr/share/easy-rsa/ /etc/openvpn + mkdir -p /etc/openvpn/easy-rsa/keys + cat << _EOF_ >> /etc/openvpn/easy-rsa/vars +export KEY_SIZE=$key_size +export KEY_COUNTRY="UK" +export KEY_PROVINCE="DietPi" +export KEY_CITY="DietPi" +export KEY_ORG="DietPi" +export KEY_EMAIL="noreply@DietPi.com" +export KEY_OU="DietPi" +export KEY_NAME="DietPi_OpenVPN_Server" _EOF_ - # - service - cat << _EOF_ > /etc/systemd/system/qbittorrent.service -[Unit] -Description=qBittorrent Daemon Service -After=network.target + #Create Server Cert Auth + /DietPi/dietpi/func/dietpi-notify 2 "Generating unique OpenVPN certificates and keys. Please wait....\n" + openssl dhparam -out /etc/openvpn/dh"$key_size".pem "$key_size" + + #Build Server certs/keys + chmod -R +x /etc/openvpn/easy-rsa + cd /etc/openvpn/easy-rsa + . ./vars + ./clean-all + ./build-ca --batch DietPi_OpenVPN_Server + ./build-key-server --batch DietPi_OpenVPN_Server + + #Copy Server cert/keys + cp /etc/openvpn/easy-rsa/keys/{DietPi_OpenVPN_Server.crt,DietPi_OpenVPN_Server.key,ca.crt} /etc/openvpn/ + + #Build client cert/keys + ./build-key --batch DietPi_OpenVPN_Client + + cd .. + #End Cert/Key generation. + + #Server config + cat << _EOF_ > /etc/openvpn/server.conf +port 1194 +proto udp +dev tun + +ca ca.crt +cert DietPi_OpenVPN_Server.crt +key DietPi_OpenVPN_Server.key +dh dh$key_size.pem + +server 10.8.0.0 255.255.255.0 + +client-to-client +keepalive 10 60 +comp-lzo +max-clients 10 + +user nobody +group nogroup + +persist-key +persist-tun +verb 3 + +#Web Forwarding (uncomment to enable) +#push "redirect-gateway" +#push "dhcp-option DNS 10.8.0.1" + +_EOF_ + + #Client config + cat << _EOF_ > /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn +client +proto udp +dev tun + +#Ip/Domain name of DietPi system, running OpenVPN server. +remote mywebsite.com 1194 + +resolv-retry infinite +nobind + +user nobody +group nogroup + +persist-key +persist-tun + +ns-cert-type server +comp-lzo +verb 3 + +_EOF_ + + #Unified client file. Add DietPi generated certs/keys. + # - Add Server Cert auth + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + cat /etc/openvpn/ca.crt >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + # - Add Client Cert + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + cat /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.crt >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + # - Add Client Key + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + cat /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.key >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn + + #Copy client file to DietPi fileserver locations (/root or /mnt/usb_1) + cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn "$DIETPI_USERDATA_DIRECTORY"/ + # - and /boot partition + cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn /boot/ + + #enable ipv4 forwarding + sed -i '/net.ipv4.ip_forward=/c\net.ipv4.ip_forward=1' /etc/sysctl.conf + + #Web Fowarding (Setup IPtables, must also be run during boot) + #iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$(sed -n 3p /DietPi/dietpi/.network)" -j MASQUERADE + + fi + + #WIFIHOTSPOT + INSTALLING_INDEX=60 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + local eth_index=$(sed -n 1p /DietPi/dietpi/.network) + local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) + + # - DHCPD Config + cat << _EOF_ > /etc/dhcp/dhcpd.conf +ddns-update-style none; +default-lease-time 600; +max-lease-time 7200; +authoritative; +log-facility local7; + +subnet 192.168.42.0 netmask 255.255.255.0 { + range 192.168.42.10 192.168.42.50; + option broadcast-address 192.168.42.255; + option routers 192.168.42.1; + option domain-name "local"; + option domain-name-servers 8.8.8.8, 8.8.4.4; +} +_EOF_ + + # - Assign wlan as interface for dhcp server. + cat << _EOF_ > /etc/default/isc-dhcp-server +INTERFACES="wlan$wifi_index" +_EOF_ + + # - Remove all entries below wlan, so we can recreate them. + sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces + + # - enable up wlan + sed -i "/allow-hotplug wlan/c\allow-hotplug wlan$wifi_index" /etc/network/interfaces + + # - Add wifi settings to network interfaces config + cat << _EOF_ >> /etc/network/interfaces +iface wlan$wifi_index inet static +address 192.168.42.1 +netmask 255.255.255.0 +#gateway 192.168.0.1 +#wireless-essid FuzonWifi +#wireless-key abcde12345 +#wireless-mode Managed +wireless-power off +#wpa-ssid FuzonWifi +#wpa-psk abcde12345 +#dns-nameservers 8.8.8.8 8.8.4.4 + +# IP tables +up iptables-restore < /etc/iptables.ipv4.nat +_EOF_ + + # - Assign static IP for wlan now + ifconfig wlan$wifi_index 192.168.42.1 + + # - Create access point config + cat << _EOF_ > /etc/hostapd/hostapd.conf +interface=wlan$wifi_index +driver=nl80211 +ssid=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_ssid=' | sed 's/.*=//') +hw_mode=g +channel=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_channel=' | sed 's/.*=//') +macaddr_acl=0 +auth_algs=1 +ignore_broadcast_ssid=0 +wpa=2 +wpa_passphrase=$(cat /DietPi/dietpi.txt | grep -m1 '^wifi_hotspot_key=' | sed 's/.*=//') +wpa_key_mgmt=WPA-PSK +wpa_pairwise=TKIP +rsn_pairwise=CCMP +_EOF_ + + # - Check for RTL8188C* device, use the patched driver with compiled binary: https://github.com/pritambaral/hostapd-rtl871xdrv#why + if (( $WIFIHOTSPOT_RTL8188C_DEVICE )); then + + sed -i "/^driver=/c\driver=rtl871xdrv" /etc/hostapd/hostapd.conf + + fi + + # - Enable access point config + cat << _EOF_ > /etc/default/hostapd +DAEMON_CONF="/etc/hostapd/hostapd.conf" +_EOF_ + + # - Enable IPv4 forwarding + sed -i "/net.ipv4.ip_forward=/c\net.ipv4.ip_forward=1" /etc/sysctl.conf + echo 1 > /proc/sys/net/ipv4/ip_forward + + # - Apply iptables + iptables -t nat -A POSTROUTING -o eth$eth_index -j MASQUERADE + iptables -A FORWARD -i eth$eth_index -o wlan$wifi_index -m state --state RELATED,ESTABLISHED -j ACCEPT + iptables -A FORWARD -i wlan$wifi_index -o eth$eth_index -j ACCEPT + + # - Save IP tables, applied during ifup in /etc/network/interfaces. + iptables-save > /etc/iptables.ipv4.nat + + # - RPi 3 - onboard wifi, enable N + if (( $HW_MODEL == 3 && ! $WIFIHOTSPOT_RTL8188C_DEVICE )); then + + # - Add Wireless N support + echo -e "ieee80211n=1" >> /etc/hostapd/hostapd.conf + + fi + + fi + + #TORHOTSPOT + INSTALLING_INDEX=61 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + +# - Tor config + cat << _EOF_ > /etc/tor/torrc +Log notice file /var/log/tor/notices.log +VirtualAddrNetwork 10.192.0.0/10 +AutomapHostsSuffixes .onion,.exit +AutomapHostsOnResolve 1 +TransPort 9040 +TransListenAddress 192.168.42.1 +DNSPort 53 +DNSListenAddress 192.168.42.1 +_EOF_ + + # - Flush IP tables + iptables -F + iptables -t nat -F + + # - Generate tor prerouting tables + local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) + iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --dport 22 -j REDIRECT --to-ports 22 + iptables -t nat -A PREROUTING -i wlan$wifi_index -p udp --dport 53 -j REDIRECT --to-ports 53 + iptables -t nat -A PREROUTING -i wlan$wifi_index -p tcp --syn -j REDIRECT --to-ports 9040 + + # - Save + iptables-save > /etc/iptables.ipv4.nat + + # - Generate Logfile + mkdir -p /var/log/tor + echo 0 > /var/log/tor/notices.log + chown -R debian-tor:nogroup /var/log/tor/notices.log + + # - User: Test tor is functional. + #https://check.torproject.org + + fi + + #SHAIRPORTSYNC + INSTALLING_INDEX=37 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Reduce min volume scale threshold (prevents hissing on low end soundcards eg:rpi) + sed -i '/volume_range_db = /c\volume_range_db = 40;' /etc/shairport-sync.conf + + #set service user to root (mainly for for arm64, but no harm in doing it for all installs) + sed -i '/^User=/d' /lib/systemd/system/shairport-sync.service &> /dev/null + sed -i '/^Group=/d' /lib/systemd/system/shairport-sync.service &> /dev/null + + fi + + #BRUTEFIR + INSTALLING_INDEX=38 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Copy configs and services + cp /DietPi/dietpi/conf/brutefir_config /etc/BruteFIR/ + cp /DietPi/dietpi/conf/brutefir.service /etc/dietpi/dietpi-software/services/brutefir.service + + #Modules + echo -e "snd-aloop" > /etc/modules-load.d/brutefir-alsa-loopback.conf + echo -e "options snd-aloop id=BruteFIR enable=1 pcm_substreams=1 pcm_notify=1" > /etc/modprobe.d/brutefir-alsa-loopback.conf + + #Asound.conf RPI + cat << _EOF_ > /etc/asound.conf +pcm.!default { + + type plug + + slave { + pcm { + + type hw + card "BruteFIR" + device 0 + channels 2 + format "S16_LE" + rate 44100 + } + } +} + +ctl.!default { + + type hw + card "BruteFIR" +} +_EOF_ + + fi + + + #PYDIO + INSTALLING_INDEX=48 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Configure apache2 + # - Disable php output_buffering = + sed -i '/output_buffering = /c\output_buffering = Off/' /etc/php5/apache2/php.ini + # - Allow overrides and redirects + sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/sites-enabled/000-default* + # - +Jessie + sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/apache2.conf + + # - Enable apache2 rewrite engine + a2enmod rewrite + + # - Enable PHP mods + php5enmod mcrypt + php5enmod gd + + #Create Mysql DB + /DietPi/dietpi/func/create_mysql_db pydio dietpi root dietpi + + #Setup Data directory + local target_data_dir="$DIETPI_USERDATA_DIRECTORY/pydio_data" + + # - Generate user data dir + mkdir -p "$target_data_dir" + + # - move data structure + mv /var/www/pydio/data/* "$target_data_dir"/ + rm -R /var/www/pydio/data + ln -sf "$target_data_dir" /var/www/pydio/data + + #Set permissions + chown -R www-data:www-data /var/www/pydio + chown -R www-data:www-data "$target_data_dir" + + fi + + + #SQUEEZELITE + INSTALLING_INDEX=36 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Specify buffers for RPi (prevents buffer underruns on default settings) + # - Miliseconds + + # -- Nice big buffer for single cores + if (( $CPU_CORES_TOTAL == 1 )); then + + sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 180"' /etc/default/squeezelite + + # -- lapse buffer for >=2 cores + else + + sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 75"' /etc/default/squeezelite + + fi + + # - Buffer/period/bit + #sed -i '/SB_EXTRA_ARGS=/c\SB_EXTRA_ARGS="-a 4096:8:16:0"' /etc/default/squeezelite + + fi + + #EMONHUB + INSTALLING_INDEX=99 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - Copy configs + cp /etc/emonhub/conf/default/emonhub /etc/default/emonhub + + # - Setup service + cp /etc/emonhub/service/emonhub /etc/init.d/emonhub + chmod +x /etc/init.d/emonhub + update-rc.d emonhub defaults + + chmod +x -R /etc/emonhub + + #RPI 3 - Must disable BCM BT to recover UART 0 + if (( $HW_MODEL == 3 )); then + + # - Add DToverlay to disable bluetooth + if (( $(cat /DietPi/config.txt | grep -ci -m1 '=pi3-disable-bt') == 0 )); then + + echo -e "\ndtoverlay=pi3-disable-bt" >> /DietPi/config.txt + + # - Enable + else + + sed -i '/pi3-disable-bt/c\dtoverlay=pi3-disable-bt' /DietPi/config.txt + + fi + + # - Disable bluetooth service + systemctl stop hciuart + systemctl disable hciuart + + fi + + #RPi - Disable serial tty that emonPi uses. + /DietPi/dietpi/func/dietpi-set_hardware serialconsole disable + + # - Apply user API KEY + USER_EMONHUB_APIKEY_CURRENT=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_emonhub_apikey=' | sed 's/.*=//') + sed -i "/apikey/c\ apikey = $USER_EMONHUB_APIKEY_CURRENT" /etc/emonhub/conf/emonhub.conf + + fi + + #RPIMONITOR + INSTALLING_INDEX=66 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - Update apt package stats + /usr/share/rpimonitor/scripts/updatePackagesStatus.pl + + # - USBdrive stats implimentation by Rich + if (( $USBDRIVE == 2 )); then + + sed -i '\/include=\/etc\/rpimonitor\/template\/sdcard.conf/a include=\/etc\/rpimonitor\/template\/usb_hdd.conf' /etc/rpimonitor/data.conf + + cat << _EOF_ > /etc/rpimonitor/template/usb_hdd.conf +######################################################################## +# Extract USB HDD (sda1) information +# Page: 1 +# Information Status Statistics +# - USBHDD1 total - yes - yes +# - USBHDD1 used - yes - yes +######################################################################## +static.10.name=usbhdd_total +static.10.source=df -t ext4 +static.10.regexp=sda1\s+(\d+) +static.10.postprocess=\$1/1024 + +dynamic.14.name=usbhdd_used +dynamic.14.source=df -t ext4 +dynamic.14.regexp=sda1\s+\d+\s+(\d+) +dynamic.14.postprocess=\$1/1024 +dynamic.14.rrd=GAUGE + +web.status.1.content.9.name=USB HDD +web.status.1.content.9.icon=usb_hdd.png +web.status.1.content.9.line.1="/sda1 Used: "+KMG(data.usbhdd_used,'M')+" ("+Percent(data.udbhdd_used,data.usbhdd_total,'M')+") Free: "+KMG(data.usbhdd_total-data.usbhdd_used,'M')+ " Total: "+ KMG(data.usbhdd_total,'M') +"" +web.status.1.content.9.line.2=ProgressBar(data.usbhdd_used,data.usbhdd_total) + +web.statistics.1.content.9.name=USB HDD +web.statistics.1.content.9.graph.1=usbhdd_total +web.statistics.1.content.9.graph.2=usbhdd_used +web.statistics.1.content.9.ds_graph_options.usbhdd_total.label=USB HDD total space (MB) +web.statistics.1.content.9.ds_graph_options.usbhdd_total.color="#FF7777" +web.statistics.1.content.9.ds_graph_options.usbhdd_used.label=USB HDD used space (MB) +web.statistics.1.content.9.ds_graph_options.usbhdd_used.lines={ fill: true } +web.statistics.1.content.9.ds_graph_options.usbhdd_used.color="#7777FF" +_EOF_ + + fi + + fi + + #NETDATA + INSTALLING_INDEX=65 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - service + cat << _EOF_ > /etc/systemd/system/netdata.service +[Unit] +Description=netdata +After=network.target httpd.service squid.service nfs-server.service mysqld.service named.service postfix.service + +[Service] +Type=forking +WorkingDirectory=/tmp +User=root +Group=root +PIDFile=/var/run/netdata.pid +ExecStart=/usr/sbin/netdata -pidfile /var/run/netdata.pid +ExecStop=/bin/kill -SIGTERM \$MAINPID + +TimeoutStopSec=30 + +[Install] +WantedBy=multi-user.target +_EOF_ + + systemctl daemon-reload + + # - Create netdata user/group + getent group netdata > /dev/null || groupadd -r netdata + getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata + + for x in /var/cache/netdata /usr/share/netdata/web /etc/netdata /var/log/netdata; do + + chown -R netdata.netdata $x + chmod 0775 -R $x + + done + + # - Workaround to prevent update checks and the "distracting update flashing button": https://github.com/firehol/netdata/issues/233#issuecomment-210468649 + #echo 0 > /usr/share/netdata/web/version.txt + + fi + + #BAIKAL + INSTALLING_INDEX=57 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - Permissions + chown -R www-data:www-data /var/www/baikal + + # - install/run composer | Also run for ampache. Move this to a global function.... + php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php + php composer-setup.php + php -r "unlink('composer-setup.php');" + + mv composer.phar /usr/local/bin/composer + + cd /var/www/baikal + composer install --no-interaction + cd ~/ + + # - Mysql DB + /DietPi/dietpi/func/create_mysql_db baikal dietpi root dietpi + + fi + + #MUMBLESERVER + INSTALLING_INDEX=43 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Cap total connections + sed -i '/users=/c\users=40' /etc/mumble-server.ini + + if (( $CPU_CORES_TOTAL == 1 )); then + + sed -i '/users=/c\users=8' /etc/mumble-server.ini + + fi + + #Name the root channel + sed -i '/registerName=/c\registerName=DietPi Mumble Server' /etc/mumble-server.ini + + #Disable DB logging + sed -i '/logdays=/c\logdays=-1' /etc/mumble-server.ini + + fi + + #EMBYSERVER + INSTALLING_INDEX=41 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Create_UserContent_Folders + Download_Test_Media + + fi + + #PLEXMEDIASERVER + INSTALLING_INDEX=42 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Create_UserContent_Folders + Download_Test_Media + + #For all ARM devices: + # - en_US.UTF8 must be installed and the default locale on system. This is for SBC installs using dev2day repo: https://github.com/Fourdee/DietPi/issues/116#issuecomment-222195911 + if (( $HW_ARCH < 20 )) && + (( ! $(locale | grep -ci -m1 'en_US.UTF-8') )); then + + sed -i '/en_US.UTF-8 UTF-8/c\en_US.UTF-8 UTF-8' /etc/locale.gen + locale-gen + + WHIP_QUESTION='Plex Media Server requires en_US.UTF8 locale to be installed and set to default, else, Plex will not start.\n\nOn the next screen:\n - Press enter (Do not make any changes to the selections, we have already selected en_US.UTF8 for you).\n\nOn the screen after:\n - Select en_US.UTF8 and press enter.' + whiptail --title "Plex en_US.UTF8" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 16 70 + + dpkg-reconfigure locales + + #en_US.UTF8 must be installed and the default locale for Plex Media Server to function correctly. If en_US.UTF8 is not the default locale on your system, DietPi will prompt you, with instructions, to set this up during installation. + + fi + + fi + + #CUBERITE + INSTALLING_INDEX=52 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + cat << _EOF_ > /etc/systemd/system/cuberite.service +[Unit] +Description=Cuberite Server + +[Service] +Type=oneshot +WorkingDirectory=/etc/cubrite +ExecStart=/etc/cubrite/Cuberite --service +ExecStop=/usr/bin/killall -w Cuberite +RemainAfterExit=yes +User=root + +[Install] +WantedBy=multi-user.target +_EOF_ +systemctl enable cuberite.service +systemctl daemon-reload + + #WebUI settings + cat << _EOF_ > /etc/cubrite/webadmin.ini +[User:root] +Password=dietpi + +[WebAdmin] +Ports=1339 +Enabled=1 +_EOF_ + + fi + + #MINEOS + INSTALLING_INDEX=53 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + #Stop mineos from running while we config it. When we didnt do this, the program would constantly overwrite our symlink from (/var/games/minecraft). + /DietPi/dietpi/dietpi-services stop + killall -w supervisord &> /dev/null + killall -w node &> /dev/null + killall -w nodejs &> /dev/null + + ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos_console.js /usr/local/bin/mineos + + cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos.conf /etc/mineos.conf + + # - setup SSL cert + cd "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft + ./generate-sslcert.sh + + # - Supervisor service + cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/init/supervisor_conf /etc/supervisor/conf.d/mineos.conf + + cd "$HOME" + + # - Add underprivilged user for web access + useradd mineos + echo -e "dietpi\ndietpi\n" | passwd mineos + + # - Move server data storage to userdata dir (High disk writes) + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata + mkdir -p /var/games #sometimes this is not created by mineos after installation... Ensures symlink creation does not fail. + cp -R /var/games/minecraft/* "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata/ + rm -R /var/games/minecraft + + ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata /var/games/minecraft + + chown -R mineos:mineos /var/games/minecraft + chown -R mineos:mineos "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata + + # - correct the node filepath for supervisor mineos + sed -i '/^command=/c\command=/usr/local/bin/node webui.js' /etc/supervisor/conf.d/mineos.conf + + # - Set directory to DIETPI_USERDATA_DIRECTORY + sed -i "/^directory=/c\directory=$DIETPI_USERDATA_DIRECTORY/mineos/minecraft" /etc/supervisor/conf.d/mineos.conf + + supervisorctl reload + + fi + + #GOGS + INSTALLING_INDEX=49 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - Data storage / user data + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/gogs-repo + + # - sqldb + /DietPi/dietpi/func/create_mysql_db gogs dietpi root dietpi + + # - service (couldnt get this to run as a new thread with systemD (&). so bash script ftw. + cat << _EOF_ > /etc/gogs/start.sh +#!/bin/bash +#Simple script to start gogs for DietPi systems +/etc/gogs/gogs web &> /var/log/gogs_daemon.log & +exit +_EOF_ + + chmod +x /etc/gogs/start.sh + + cat << _EOF_ > /etc/systemd/system/gogs.service +[Unit] +Description=DietPi Gogs service +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +User=root +ExecStart=/bin/bash /etc/gogs/start.sh +ExecStop=/usr/bin/killall -w gogs +StandardOutput=tty + +[Install] +WantedBy=multi-user.target +_EOF_ + + fi + + #QBITTORRENT + INSTALLING_INDEX=46 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Create_UserContent_Folders + + # - conf. + mkdir -p "$HOME"/.config/qBittorrent + cat << _EOF_ > "$HOME"/.config/qBittorrent/qBittorrent.conf +[General] +ported_to_new_savepath_system=true + +[Preferences] +Downloads\DiskWriteCacheSize=$(Optimize_BitTorrent 0) +Downloads\DiskWriteCacheTTL=60 +Queueing\MaxActiveDownloads=$(Optimize_BitTorrent 1) +Queueing\MaxActiveTorrents=$(Optimize_BitTorrent 1) +Queueing\MaxActiveUploads=1 +Queueing\IgnoreSlowTorrents=false +Bittorrent\MaxConnecs=$(Optimize_BitTorrent 2) +Bittorrent\MaxConnecsPerTorrent=$(Optimize_BitTorrent 2) +Bittorrent\MaxUploads=$(Optimize_BitTorrent 3) +Bittorrent\MaxUploadsPerTorrent=$(Optimize_BitTorrent 3) +WebUI\Port=1340 +WebUI\Enabled=true +General\Locale=en_GB +Downloads\SavePath=/mnt/dietpi_userdata/downloads +Downloads\TempPathEnabled=false +Downloads\TempPath=/mnt/dietpi_userdata/downloads +Downloads\ScanDirs=@Invalid() +Downloads\DownloadInScanDirs=@Invalid() +Downloads\TorrentExportDir= +MailNotification\enabled=false +MailNotification\email= +MailNotification\smtp_server=smtp.changeme.com +MailNotification\req_ssl=false +MailNotification\req_auth=false +MailNotification\username= +MailNotification\password= +Downloads\PreAllocation=false +Queueing\QueueingEnabled=false +Downloads\UseIncompleteExtension=false +Connection\PortRangeMin=6881 +Connection\UPnP=true +Connection\GlobalDLLimit=-1 +Connection\GlobalUPLimit=-1 +Bittorrent\uTP=true +Bittorrent\uTP_rate_limited=false +Advanced\IncludeOverhead=false +Connection\GlobalDLLimitAlt=10 +Connection\GlobalUPLimitAlt=10 +Scheduler\Enabled=false +Bittorrent\DHT=true +Bittorrent\sameDHTPortAsBT=true +Bittorrent\DHTPort=6881 +Bittorrent\PeX=true +Bittorrent\LSD=true +Bittorrent\Encryption=1 +Advanced\AnonymousMode=false +Connection\ProxyType=-1 +Connection\Proxy\IP=0.0.0.0 +Connection\Proxy\Port=8080 +Connection\ProxyPeerConnections=false +Connection\Proxy\Authentication=false +Connection\Proxy\Username= +Connection\Proxy\Password= +IPFilter\Enabled=false +IPFilter\File= +WebUI\Username=root +WebUI\LocalHostAuth=true +WebUI\HTTPS\Enabled=false +DynDNS\Enabled=false +DynDNS\Service=0 +DynDNS\Username= +DynDNS\Password= +DynDNS\DomainName=changeme.dyndns.org +WebUI\Password_ha1=@ByteArray(5e434b0004be6970cf8878fcf929baba) + +[LegalNotice] +Accepted=true + +[AutoRun] +enabled=false +program= +_EOF_ + + # - service + cat << _EOF_ > /etc/systemd/system/qbittorrent.service +[Unit] +Description=qBittorrent Daemon Service +After=network.target + +[Service] +Type=oneshot +User=root +RemainAfterExit=yes +ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=1340 +ExecStop=/usr/bin/killall -w qbittorrent-nox + +[Install] +WantedBy=multi-user.target +_EOF_ + + systemctl daemon-reload + + fi + + #SYNCTHING + INSTALLING_INDEX=50 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + # - run syncthing to create cert/config and exit + syncthing -generate="/$HOME/.config/syncthing" + + # - Disable automatic upgrades + sed -i '/<\/autoUpgradeIntervalH>/c\ 0<\/autoUpgradeIntervalH>' "$HOME"/.config/syncthing/config.xml + + # - Allow external access (LAN). + sed -i '/:8384<\/address>/c\
0.0.0.0:8384<\/address>' "$HOME"/.config/syncthing/config.xml + + # - Set default folder + sed -i '/label=\"Default Folder/c\ ' "$HOME"/.config/syncthing/config.xml + + # - Disable browser starting + sed -i '/<\/startBrowser>/c\ false<\/startBrowser>' "$HOME"/.config/syncthing/config.xml + + # service + cat << _EOF_ > /etc/systemd/system/syncthing.service +[Unit] +Description=Syncthing + +[Service] +Type=oneshot +ExecStart=/bin/bash -c '/usr/bin/syncthing > /var/log/syncthing.log &' +ExecStop=/usr/bin/killall -w syncthing +RemainAfterExit=yes +User=root + +[Install] +WantedBy=multi-user.target +_EOF_ +systemctl enable syncthing.service +systemctl daemon-reload + + fi + + #------------------------------------------------------------------- + #Install finished, set all installed software to state 2 (installed) + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + + if (( ${aSOFTWARE_TYPE[$i]} == 0 && + ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then + + aSOFTWARE_INSTALL_STATE[$i]=2 + + fi + + done + #------------------------------------------------------------------- + + } + + Install_Apply_GPU_Settings(){ + + local memory_split_mode=0 + + #Define Memory Split Modes with installed software + #Mode 3 (KODI / DIETPICAM / MED GPU RAM / 128MB) + if (( ${aSOFTWARE_INSTALL_STATE[31]} == 2 || + ${aSOFTWARE_INSTALL_STATE[59]} == 2 )); then + + memory_split_mode=3 + memory_split_mode=3 + + #Mode 2 (Desktop / LOW GPU RAM) + #All DESKTOP_* and OPENTYRIAN + elif (( ${aSOFTWARE_INSTALL_STATE[23]} == 2 || + ${aSOFTWARE_INSTALL_STATE[24]} == 2 || + ${aSOFTWARE_INSTALL_STATE[25]} == 2 || + ${aSOFTWARE_INSTALL_STATE[26]} == 2 || + ${aSOFTWARE_INSTALL_STATE[51]} == 2 )); then + + memory_split_mode=2 + + #Mode 1 - DIETPICLOUDSHELL (forces display output) + elif (( ${aSOFTWARE_INSTALL_STATE[62]} == 2 )); then + + memory_split_mode=1 + + #Mode 0 (Server) + else + + memory_split_mode=0 + + fi + + #Apply GPU Settings + #Mode 3 + if (( $memory_split_mode == 3 )); then + + #Odroid C2 + if (( $HW_MODEL == 12 )); then + + sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + + #odroid C1 + elif (( $HW_MODEL == 10 )); then + + sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini + sed -i '/setenv vpu /c\setenv vpu "1"' /DietPi/boot.ini + sed -i '/setenv m_bpp /c\setenv m_bpp "32"' /DietPi/boot.ini + + #rpi + elif (( $HW_MODEL < 10 )); then + + sed -i '/gpu_mem_256=/c\gpu_mem_256=128' /DietPi/config.txt + sed -i '/gpu_mem_512=/c\gpu_mem_512=128' /DietPi/config.txt + sed -i '/gpu_mem_1024=/c\gpu_mem_1024=128' /DietPi/config.txt + sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + + fi + + #Mode 2 + elif (( $memory_split_mode == 2 )); then + + #Odroid C2 + if (( $HW_MODEL == 12 )); then + + sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + + #odroid C1 + elif (( $HW_MODEL == 10 )); then + + sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini + sed -i '/setenv vpu /c\setenv vpu "1"' /DietPi/boot.ini + sed -i '/setenv m_bpp /c\setenv m_bpp "32"' /DietPi/boot.ini + + #rpi + elif (( $HW_MODEL < 10 )); then + + sed -i '/gpu_mem_256=/c\gpu_mem_256=64' /DietPi/config.txt + sed -i '/gpu_mem_512=/c\gpu_mem_512=64' /DietPi/config.txt + sed -i '/gpu_mem_1024=/c\gpu_mem_1024=64' /DietPi/config.txt + sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + + fi + + #Mode 1 - DietPi-Cloudshell + elif (( $memory_split_mode == 1 )); then + + #Odroid C2 + if (( $HW_MODEL == 12 )); then + + sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + + #odroid C1 + elif (( $HW_MODEL == 10 )); then + + sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini + sed -i '/setenv m_bpp /c\setenv m_bpp "16"' /DietPi/boot.ini + + #rpi + elif (( $HW_MODEL < 10 )); then + + sed -i '/gpu_mem_256=/c\gpu_mem_256=16' /DietPi/config.txt + sed -i '/gpu_mem_512=/c\gpu_mem_512=16' /DietPi/config.txt + sed -i '/gpu_mem_1024=/c\gpu_mem_1024=16' /DietPi/config.txt + sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + + fi + + #Mode 0 + elif (( $memory_split_mode == 0 )); then + + #Odroid C2 + if (( $HW_MODEL == 12 )); then + + echo -e "nothing here" &> /dev/null + #sed -i '/setenv nographics /c\setenv nographics "1"' /DietPi/boot.ini + #nographics is actually "headless", no output. + + #odroid C1 + elif (( $HW_MODEL == 10 )); then + + #sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini + sed -i '/setenv vpu /c\setenv vpu "0"' /DietPi/boot.ini + sed -i '/setenv m_bpp /c\setenv m_bpp "16"' /DietPi/boot.ini + + #rpi + elif (( $HW_MODEL < 10 )); then + + sed -i '/gpu_mem_256=/c\gpu_mem_256=16' /DietPi/config.txt + sed -i '/gpu_mem_512=/c\gpu_mem_512=16' /DietPi/config.txt + sed -i '/gpu_mem_1024=/c\gpu_mem_1024=16' /DietPi/config.txt + #sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + + fi + + fi + + } + + Dedicated_Usb_Drive_Enable(){ + + USBDRIVE=0 + + #Only enable if mounted + if (( $(df -P | grep -ci -m1 "$DIETPI_USBDRIVE_DIRECTORY") )); then + + USBDRIVE=2 + + fi + + } + + Uninstall_Software(){ + + #---------------------------------------------------------------------- + #Make sure apt-get_update thread is finished + /DietPi/dietpi/dietpi-apt-get_update 1 + + #---------------------------------------------------------------------- + #Inform User + /DietPi/dietpi/dietpi-banner 0 + + echo -e "" + /DietPi/dietpi/func/dietpi-notify 2 "Uninstalling ${aSOFTWARE_WHIP_NAME[$1]}: ${aSOFTWARE_WHIP_DESC[$1]}\n" + + #Was a uninstall event trigged? + local valid_input=1 + + #---------------------------------------------------------------------- + #DIETPI SOFTWARE + if (( $1 == 100 )); then + + grasshopper_directory='/var/www' + rm -R "$grasshopper_directory"/documentation + rm -R "$grasshopper_directory"/css + rm -R "$grasshopper_directory"/db + rm -R "$grasshopper_directory"/exec + rm -R "$grasshopper_directory"/includes + rm -R "$grasshopper_directory"/install + rm -R "$grasshopper_directory"/phpliteadmin + rm -R "$grasshopper_directory"/js + rm -R "$grasshopper_directory"/setup + rm -R "$grasshopper_directory"/pics + rm -R "$grasshopper_directory"/themes + rm "$grasshopper_directory"/favicon.ico + rm "$grasshopper_directory"/index.php + #PDF documentation + rm "$grasshopper_directory"/Grasshopper* + + update-rc.d grasshopper remove + rm /etc/init.d/grasshopper + + elif (( $1 == 23 )); then + + AGP lxde lxde-* upower policykit-1 iceweasel p7zip-full + + elif (( $1 == 24 )); then + + AGP mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full + + elif (( $1 == 26 )); then + + AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games upower policykit-1 iceweasel p7zip-full + + elif (( $1 == 25 )); then + + AGP xfce4 gnome-icon-theme tango-icon-theme iceweasel p7zip-full + + elif (( $1 == 22 )); then + + AGP quiterss + + elif (( $1 == 30 )); then + + AGP nomachine + + elif (( $1 == 29 )); then + + AGP xrdp + + elif (( $1 == 44 )); then + + AGP transmission-daemon + rm /etc/init.d/transmission-daemon &> /dev/null + rm /etc/systemd/system/transmission-daemon.service &> /dev/null + + elif (( $1 == 83 )); then + + AGP apache2 + + elif (( $1 == 85 )); then + + AGP nginx + + elif (( $1 == 84 )); then + + AGP lighttpd + + elif (( $1 == 86 )); then + + AGP mysql-server + + elif (( $1 == 88 )); then + + AGP mariadb-server mariadb-client + # - Remove debian flag generated by mariaDB install that prevents mysql 5.5 being installed. + rm /var/lib/mysql/debian-* + + elif (( $1 == 87 )); then + + AGP sqlite3 + + elif (( $1 == 91 )); then + + AGP redis-server + + elif (( $1 == 89 )); then + + AGP php5 libapache2-mod-php5 php5-fpm php5-cgi php5-mysql php5-curl php5-sqlite php-apc php5-apcu + rm /var/www/phpinfo.php + rm /var/www/apc.php + rm /var/www/opcache.php + rm /etc/php5/fpm/pool.d/www.conf + #temp php uploads + rm -R /var/tmp/php_upload_tmp + + elif (( $1 == 90 )); then + + AGP phpmyadmin + + elif (( $1 == 54 )); then + + service mysql start + mysqladmin -u root -pdietpi drop phpbb3 -f + rm -R /var/www/phpBB3 + + elif (( $1 == 47 )); then + + AGP owncloud + service mysql start + mysqladmin -u root -pdietpi drop owncloud -f + rm /etc/apt/sources.list.d/owncloud.list + /DietPi/dietpi/dietpi-apt-get_update 2 + rm -R /var/www/owncloud + + elif (( $1 == 32 )); then + + AGP mpd libmpdclient2 + update-rc.d ympd remove + rm /etc/init.d/ympd + rm /usr/bin/ympd + + elif (( $1 == 31 )); then + + AGP kodi + #+Odroids + AGP kodi-odroid + rm /usr/share/applications/kodi.desktop + rm ~/Desktop/kodi.desktop + + elif (( $1 == 39 )); then + + AGP minidlna + + elif (( $1 == 51 )); then + + AGP ibsdl1.2debian libsdl-net1.2 + rm -R /usr/local/games/opentyrian + rm /usr/share/applications/opentyrian.desktop + rm ~/Desktop/opentyrian.desktop + + elif (( $1 == 59 )); then + + AGP gpac motion + rm -R /var/www/dietpicam + rm /opt/vc/bin/raspimjpeg + rm /usr/bin/raspimjpeg + rm /etc/dietpi/dietpi-software/services/raspimjpeg.service + rm /etc/raspimjpeg + rm /etc/motion/motion.conf + + elif (( $1 == 45 )); then + + AGP deluged deluge-web deluge-webui deluge-console + rm /etc/dietpi/dietpi-software/services/deluge.service + rm -R ~/.config/deluge + + elif (( $1 == 94 )); then + + AGP proftpd-basic + + elif (( $1 == 96 )); then + + AGP samba samba-common-bin + + elif (( $1 == 95 )); then + + AGP vsftpd + + elif (( $1 == 67 )); then + + update-rc.d noip2 remove + rm /usr/local/bin/noip2 + rm /etc/init.d/noip2 + + elif (( $1 == 106 )); then + + rm -R /var/www/raspcontrol + rm -R /etc/raspcontrol + + elif (( $1 == 63 )); then + + rm -R /var/www/linuxdash + + elif (( $1 == 93 )); then + + AGP dnsmasq + rm /etc/dnsmasq.conf + rm /usr/local/bin/gravity.sh + rm /usr/local/bin/chronometer.sh + rm -R /var/www/pihole + rm -R /etc/pihole + rm -R /etc/.pihole + rm -R /opt/pihole + rm /var/log/pihole.log + rm /etc/cron.weekly/pihole_adlist_update + rm /etc/dnsmasq.d/01-pihole.conf + + rm /opt/pihole/gravity.sh + rm /etc/bash_completion.d/pihole + rm /usr/local/bin/pihole + rm /etc/sudoers.d/pihole + + + elif (( $1 == 33 || $1 == 34 )); then + + AGP subsonic + rm -R /var/subsonic + #Leave possible shared Java etc, on system + #AGP lame ffmpeg oracle-java8-jdk oracle-java8-installer + + elif (( $1 == 71 )); then + + update-rc.d webiopi remove + rm -R /etc/webiopi + rm -R /usr/share/webiopi + rm /usr/bin/webiopi + rm /etc/init.d/webiopi + + elif (( $1 == 68 )); then + + #Uninstaller does not uninstall. + #"$HOME"/weaved_software/uninstaller.sh + + rm -R /etc/weaved + rm -R "$HOME"/weaved_software + rm "$HOME"/weaved_setup.bin + + elif (( $1 == 62 )); then + + #Kill + killall dietpi-cloudshell + + #Disable auto login, revert boot index to console + /DietPi/dietpi/dietpi-autostart 0 + + #Remove alias + sed -i '/dietpi-cloudshell=/d' /etc/bash.bashrc + + elif (( $1 == 98 )); then + + update-rc.d haproxy remove + rm /etc/init.d/haproxy + + rm -r /etc/haproxy + + #Shared dev libaries. Leave these installed + #AGP libpcre3-dev libssl-dev + + elif (( $1 == 35 )); then + + AGP logitechmediaserver + rm /etc/dietpi/dietpi-software/services/squeezeboxserver.service + rm -R /var/lib/squeezeboxserver + + elif (( $1 == 55 )); then + + rm -R /var/www/wordpress + + elif (( $1 == 27 || $1 == 28)); then + + AGP tightvncserver + AGP vnc4server + + rm /etc/systemd/system/vncserver.service + rm /etc/init.d/vncserver + + rm /usr/local/bin/vncserver + + rm -R "$HOME"/.vnc + + elif (( $1 == 73 )); then + + AGP fail2ban + + elif (( $1 == 64 )); then + + rm -R /var/www/phpsysinfo + + elif (( $1 == 56 )); then + + rm /var/www/gallery/index.php + rm -R /var/www/gallery/_sfpg_data + + elif (( $1 == 40 )); then + + rm -R /var/www/ampache + + #drop database + service mysql start + mysqladmin -u root -pdietpi drop ampache -f + + elif (( $1 == 97 )); then + + AGP openvpn + rm -R /etc/openvpn &> /dev/null + + elif (( $1 == 92 )); then + + rm -R /etc/letsencrypt_scripts &> /dev/null + + elif (( $1 == 69 )); then + + AGP python-rpi.gpio python3-rpi.gpio + + elif (( $1 == 72 )); then + + AGP i2c-tools + #Disable + /DietPi/dietpi/func/dietpi-set_hardware i2c disable + + elif (( $1 == 70 )); then + + rm -R /root/wiringPi* &> /dev/null + + elif (( $1 == 60 )); then + + AGP hostapd isc-dhcp-server + + rm /etc/dhcp/dhcpd.conf &> /dev/null + rm /etc/hostapd/hostapd.conf &> /dev/null + rm /etc/default/isc-dhcp-server &> /dev/null + rm /etc/default/hostapd &> /dev/null + rm /etc/iptables.ipv4.nat &> /dev/null + # - remove binary (used a -f trigger to detect wifi hotspot mode in dietpi-config). + rm /usr/sbin/hostapd &> /dev/null + rm /usr/sbin/hostapd_cli &> /dev/null + + #Set Wlan back to inactive and ready for use with dietpi-config. + local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) + + # - Remove all entries below wlan, so we can recreate them. + sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces + + # - Disable wlan + sed -i "/allow-hotplug wlan/c\#allow-hotplug wlan$wifi_index" /etc/network/interfaces + + # - Add default wifi settings to network interfaces config + cat << _EOF_ >> /etc/network/interfaces +iface wlan$wifi_index inet dhcp +metric 1 +address 192.168.0.101 +netmask 255.255.255.0 +gateway 192.168.0.1 +wireless-essid FuzonWifi +wireless-key abcde12345 +wireless-mode Managed +wireless-power off +wpa-ssid FuzonWifi +wpa-psk abcde12345 +#dns-nameservers 8.8.8.8 8.8.4.4 +_EOF_ + + # - Flush IP tables + iptables -F + iptables -t nat -F + iptables-save > /etc/iptables.ipv4.nat + + elif (( $1 == 61 )); then + + AGP tor + + # - uninstall WIFIHOTSPOT ALSO. Due to IPtables needing reset. + Uninstall_Software 60 + + elif (( $1 == 37 )); then + + AGP shairport-sync* + + elif (( $1 == 38 )); then + + AGP brutefir + + rm -R /etc/BruteFIR + rm /etc/dietpi/dietpi-software/services/brutefir.service + rm /etc/asound.conf + + rm /etc/modules-load.d/brutefir-alsa-loopback.conf + rm /etc/modprobe.d/brutefir-alsa-loopback.conf + + elif (( $1 == 48 )); then + + rm -R /var/www/pydio + + #drop database + service mysql start + mysqladmin -u root -pdietpi drop pydio -f + + elif (( $1 == 36 )); then + + AGP squeezelite + + elif (( $1 == 99 )); then + + rm -R /etc/emonhub + rm /etc/init.d/emonhub + rm /etc/default/emonhub + + elif (( $1 == 66 )); then + + AGP rpimonitor + + elif (( $1 == 57 )); then + + rm -R /var/www/baikal + + #drop database + service mysql start + mysqladmin -u root -pdietpi drop baikal -f + + elif (( $1 == 65 )); then + + #all + rm /etc/systemd/system/netdata.service + + userdel -f netdata + groupdel netdata + + #1.2.0 + AGP netdata + + #1.0.0 + rm /usr/sbin/netdata + + rm -R /etc/netdata + rm -R /usr/share/netdata + rm -R /usr/libexec/netdata + rm -R /var/cache/netdata + rm -R /var/log/netdata + + elif (( $1 == 43 )); then + + AGP mumble-server + + elif (( $1 == 41 )); then + + AGP emby-server + + rm /etc/apt/sources.list.d/emby-server.list + /DietPi/dietpi/dietpi-apt-get_update 2 + + elif (( $1 == 58 )); then + + rm -R /etc/openbazaar-server + + # - remove service + rm /etc/dietpi/dietpi-software/services/openbazaar-server.service + + elif (( $1 == 42 )); then + + AGP plexmediaserver + + rm /etc/apt/sources.list.d/plex.list &> /dev/null + /DietPi/dietpi/dietpi-apt-get_update 2 + + elif (( $1 == 52 )); then + + rm -R /etc/cuberite + rm /etc/systemd/system/cuberite.service + + elif (( $1 == 53 )); then + + rm -R "$USERDATA_DIRECTORY"/mineos + rm -R /var/games/minecraft + + rm /etc/supervisor/conf.d/mineos.conf + supervisorctl reload + + rm /usr/local/bin/mineos + + userdel -f mineos + + elif (( $1 == 49 )); then + + rm -R /etc/gogs + rm /etc/systemd/system/gogs.service + + rm /var/log/gogs_daemon.log + rm /var/log/gogs.log + + mysqladmin -u root -pdietpi drop gogs -f + + elif (( $1 == 46 )); then + + AGP qbittorrent-nox + + rm /etc/systemd/system/qbittorrent.service + rm -R "$HOME"/.config/qBittorrent + + elif (( $1 == 50 )); then + + rm /usr/bin/syncthing + rm /etc/systemd/system/syncthing.service + rm -R "$HOME"/.config/syncthing + + #---------------------------------------------------------------------- + #LINUX SOFTWARE + + elif (( $1 == 15 )); then + + AGP tcpdump + + elif (( $1 == 14 )); then + + AGP nload + + elif (( $1 == 13 )); then + + AGP mtr-tiny + + elif (( $1 == 11 )); then + + AGP iptraf + + elif (( $1 == 10 )); then + + AGP iftop + + elif (( $1 == 19 )); then + + AGP jed + + elif (( $1 == 3 )); then + + AGP mc + + elif (( $1 == 18 )); then + + AGP emacs + + elif (( $1 == 20 || $i == 21 )); then + + AGP vim vim-tiny + + elif (( $1 == 0 )); then + + #This also removes OpenSSH server. So lets check OpenSSH server isnt installed before hand. + if (( $(dpkg -l | grep -ci -m1 'openssh-server') == 0 )); then + + AGP openssh-client + + fi + + elif (( $1 == 1 )); then + + umount /mnt/samba &> /dev/null + AGP smbclient + #Disable in fstab + sed -i '/\/mnt\/samba/c\#\/mnt\/samba . Please use dietpi-config and the networking menu to setup this mount' /etc/fstab + #Add info file for installation method. + echo -e "Samba client can be installed and setup by DietPi-Config.\nSimply run: dietpi-config 8" > /mnt/samba/readme.txt + + elif (( $1 == 16 )); then + + AGP build-essential + + elif (( $1 == 17 )); then + + AGP git + + elif (( $1 == 5 )); then + + AGP alsa-base alsa-utils + + elif (( $1 == 6 )); then + + AGP xinit xauth xserver-xorg xfonts-base x11-xserver-utils x11-common x11-utils + + elif (( $1 == 2 )); then + + umount /mnt/ftp_client &> /dev/null + AGP curlftpfs + + #Disable in fstab + sed -i '/\/mnt\/ftp_client/c\#\/mnt\/ftp_client . Please use dietpi-config and the networking menu to setup this mount' /etc/fstab + + #Add info file for installation method. + echo -e "FTP client mount can be installed and setup by DietPi-Config.\nSimply run: dietpi-config 8" > /mnt/ftp_client/readme.txt + + + elif (( $1 == 7 )); then + + AGP ffmpeg + + elif (( $1 == 8 )); then + + AGP oracle-java8-* + rm /etc/apt/sources.list.d/webupd8team-java.list + /DietPi/dietpi/dietpi-apt-get_update 2 + + elif (( $1 == 104 )); then + + AGP dropbear + + elif (( $1 == 105 )); then + + AGP openssh-server openssh-blacklist* + + elif (( $1 == 103 )); then + + sed -i '/\/var\/log/c\#\/var\/log DietPi Ramlog Disabled' /etc/fstab + + elif (( $1 == 101 )); then + + AGP logrotate + + elif (( $1 == 102 )); then + + AGP rsyslog + + elif (( $1 == 9 )); then + + AGP nodejs + + # - old install via repo + if [ -f /etc/apt/sources.list.d/nodesource_nodejs.list ]; then + + rm /etc/apt/sources.list.d/nodesource_nodejs.list + /DietPi/dietpi/dietpi-apt-get_update 2 + + fi + + rm /usr/local/bin/node + + elif (( $1 == 4 )); then + + AGP vifm + + else + + /DietPi/dietpi/func/dietpi-notify 2 "Software index $1 is unknown, or, has no removal code." + valid_input=0 + + fi + + #---------------------------------------------------------------------- + #log to .uninstalled file + if [ ! -f /DietPi/dietpi/.uninstalled ]; then + + echo -e "DietPi Uninstall Software Log\n----------------------\n" > /DietPi/dietpi/.uninstalled + + fi + + echo -e "$1 | $(date)" >> /DietPi/dietpi/.uninstalled + + #Update array installed state + aSOFTWARE_INSTALL_STATE[$1]=0 + + } + + Uninstall_Software_Finalize(){ + + #Purge + /DietPi/dietpi/dietpi-banner 0 + + echo -e "\n Removing packages that are no longer required.\n" + apt-get autoremove --purge -y + + #Check if we need to clear DietPi choices + dpkg -l > /tmp/.dietpi-uninstall_dpkg + if (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'openssh-server') == 0 && + $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'dropbear') == 0 )); then + + INDEX_SSHSERVER_CURRENT=0 + INDEX_SSHSERVER_TARGET=0 + + fi + + if (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 ' samba ') == 0 && + $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'proftpd-basic') == 0 )); then + + INDEX_FILESERVER_CURRENT=0 + INDEX_FILESERVER_TARGET=0 + + fi + + if (( $(cat /etc/fstab | grep -ci -m1 '#/var/log') == 1 && + $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'rsyslog') == 0 && + $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'logrotate') == 0 )); then + + INDEX_LOGGING_CURRENT=0 + INDEX_LOGGING_TARGET=0 + + fi + + rm /tmp/.dietpi-uninstall_dpkg + + #SystemD reload daemon + if (( $DISTRO == 3 )); then + + systemctl daemon-reload + + fi + + } + + Run_Installations(){ + + #------------------------------------------------------------ + #Disable powersaving on Main screen during installation + setterm -blank 0 -powersave off 2> /dev/null + + #------------------------------------------------------------ + #Check if we need to setup different userdata directory for this run. + local current_userdata_dir=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) + local target_userdata_dir=$DIETPI_USERDATA_DIRECTORY + + # - Auto | flash is default value, set to USB drive if available + dietpi_userdata_basedirectory=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') + if [ "$dietpi_userdata_basedirectory" = "auto" ]; then + + if (( $USBDRIVE == 2 )); then + target_userdata_dir=$DIETPI_USBDRIVE_DIRECTORY + fi + + # - custom directory + else + target_userdata_dir=$dietpi_userdata_basedirectory + fi + + # - Setup user directory and move existing userdata if required + /DietPi/dietpi/func/dietpi-set_userdata "$current_userdata_dir" "$target_userdata_dir" + # - Check for failure + if (( $? != 0 )); then + + Error_Create_UserDataDirectory + Exit_Destroy + + fi + + + #------------------------------------------------------------ + #Set current path to home folder + cd "$HOME" + + #Update Apt + Banner_Apt_Update + + #Always clean and update apt, before running installs. + #The previous "once every 7days" update caused missing package errors if a package filename was changed in the repo during that time. + # - Wait for outstanding DietPi apt-get update thread to finish. + /DietPi/dietpi/dietpi-apt-get_update 1 + # - use normal apt as visual for user. + apt-get clean + apt-get update + + #Simluated apt installation to check for failures related to apt-cache. + /DietPi/dietpi/func/dietpi-notify 2 "Running apt simulation to check for errors, please wait..." + local package_to_test="bash-doc" + apt-get install $package_to_test -s -y &> /dev/null + local result=$? + + /DietPi/dietpi/func/dietpi-notify -1 $result "Apt simulation |" + + if (( $result != 0 )); then + + /DietPi/dietpi/func/dietpi-notify 2 "The apt cache may be corrupt, or you have held broken pacakages. DietPi-Software will now exit.\n" + /DietPi/dietpi/func/dietpi-notify 2 "Please try:" + /DietPi/dietpi/func/dietpi-notify 2 "- Fixing apt package errors with 'apt-get install -f'" + /DietPi/dietpi/func/dietpi-notify 2 "- Changing '/etc/apt/sources.list' to another repo mirror." + /DietPi/dietpi/func/dietpi-notify 2 "- Clear and refresh apt '/DietPi/dietpi/dietpi-apt-get_update 2'\n" + + Exit_Destroy + + fi + + #Upgrade Apt + Banner_Setup + Banner_Apt_Update + # - Set noninteractive | Allows automation for some software + DEBIAN_FRONTEND='noninteractive' apt-get upgrade -y + + #Generate dir for dietpi-software installed "non-service" based control scripts + mkdir -p /etc/dietpi/dietpi-software/services + chmod -R +x /etc/dietpi/dietpi-software/services + + #Apply DietPi choice systems + Apply_FileServer_Choices + Apply_SSHServer_Choices + Apply_Logging_Choices + + #Apply DietPi preference systems + Apply_Webserver_Preference + + #Update required software that needs to be installed + Install_Flag_Prereq_Software + + #Install Linux Software + Install_Linux_Software + + #Install DietPi Optimized Software + Install_Dietpi_Software + + #Apply Uninstall script created by DietPi choice system + Uninstall_NonSelected_Choices + + #Apply DietPi Configuration and Optimization Files + Banner_Configs + Install_Apply_Configs + + #Apply GPU Memory Splits + Install_Apply_GPU_Settings + + #Disable services so DietPi-services can take control (DietPi will start all services from rc.local) + /DietPi/dietpi/dietpi-services disable + + #Write to .install File + Write_InstallFileList + + #DietPi-Automation + if (( $DIETPI_INSTALL_STAGE == 0 )); then + + #Apply Timezone + if [ "$AUTOINSTALL_TIMEZONE" != "Europe/London" ]; then + + echo -e "\nDietPi: Setting Timezone = $AUTOINSTALL_TIMEZONE" + echo -e "$AUTOINSTALL_TIMEZONE" > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata + + fi + + #Apply Language (Locale) + if [ "$AUTOINSTALL_LANGUAGE" != "en_GB" ]; then + + /DietPi/dietpi/func/dietpi-notify 2 "Setting Locale $AUTOINSTALL_LANGUAGE. Please wait....\n" + + #Disable en_GB + sed -i "/en_GB.UTF-8/c\# en_GB.UTF-8 UTF-8" /etc/locale.gen + + #Enable user setting + sed -i "/$AUTOINSTALL_LANGUAGE.UTF-8/c $AUTOINSTALL_LANGUAGE.UTF-8 UTF-8" /etc/locale.gen + echo -e "LANG=$AUTOINSTALL_LANGUAGE.UTF-8" > /etc/default/locale + locale-gen + localectl set-locale LANG=$AUTOINSTALL_LANGUAGE + + fi + + #Apply Keyboard + if [ "$AUTOINSTALL_KEYBOARD" != "gb" ]; then + + /DietPi/dietpi/func/dietpi-notify 2 "Setting Keyboard $AUTOINSTALL_KEYBOARD. Please wait....\n" + sed -i '/XKBLAYOUT=/c XKBLAYOUT="'"$AUTOINSTALL_KEYBOARD"'"' /etc/default/keyboard + #systemctl restart keyboard-setup + + fi + + #Apply & Mount Network drives if installed + if (( $SMBCLIENT == 2 )); then + + /DietPi/dietpi/func/dietpi-set_smbclient 1 + + fi + + if (( $CURLFTPFS == 2 )); then + + /DietPi/dietpi/func/dietpi-set_curlftpfs 1 + + fi + + local run_custom_script=0 + #Custom 1st run Script (Local file) + if [ -f /boot/Automation_Custom_Script.sh ]; then + + INSTALL_DESCRIPTION='Automation - Local Custom Script' + Banner_Installing + + cp /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh + run_custom_script=1 + + #Custom 1st run Script (Online file) + elif [ "$AUTOINSTALL_CUSTOMSCRIPTURL" != "0" ]; then + + INSTALL_DESCRIPTION='Automation - Online Custom Script' + Banner_Installing + + #check source is online + INSTALL_URL_ADDRESS=$AUTOINSTALL_CUSTOMSCRIPTURL + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + + #Install + if (( $? == 0 )); then + + #Get script and execute + wget "$INSTALL_URL_ADDRESS" -O /root/AUTO_CustomScript.sh + run_custom_script=1 + + else + + echo -e "Automated Custom Script URL Error:\n $AUTOINSTALL_CUSTOMSCRIPTURL is offline and/or unreachable" >> "$FP_DIETPIAUTOMATION_LOG" + + fi + + fi + + if (( $run_custom_script == 1 )); then + + chmod +x /root/AUTO_CustomScript.sh + /root/AUTO_CustomScript.sh + local result=$? + if (( $result == 0 )); then + + echo -e "Automated custom script executed succesfully:\n - Filepath = /root/AUTO_CustomScript.sh\n - URL = $AUTOINSTALL_CUSTOMSCRIPTURL" >> "$FP_DIETPIAUTOMATION_LOG" + + else + + echo -e "Automated Custom Script Error:\n - Exit code = $result\n - Filepath = /root/AUTO_CustomScript.sh\n - URL = $AUTOINSTALL_CUSTOMSCRIPTURL" >> "$FP_DIETPIAUTOMATION_LOG" + + fi + + fi + + #Apply AutoStart + /DietPi/dietpi/dietpi-autostart $AUTOINSTALL_AUTOSTARTTARGET + + fi + + #Set Install Stage to Finished + echo 1 > /DietPi/dietpi/.install_stage + + } + + #///////////////////////////////////////////////////////////////////////////////////// + # First Run / Automation functions Vars (eg: on a fresh install) + #///////////////////////////////////////////////////////////////////////////////////// + AUTOINSTALL_INDEX=0 + + AUTOINSTALL_SSHINDEX=0 + AUTOINSTALL_FILESERVERINDEX=0 + AUTOINSTALL_LOGGINGINDEX=0 + AUTOINSTALL_WEBSERVERINDEX=0 + + AUTOINSTALL_AUTOSTARTTARGET=0 + + AUTOINSTALL_TIMEZONE=0 + AUTOINSTALL_LANGUAGE=0 + AUTOINSTALL_KEYBOARD=0 + + AUTOINSTALL_CUSTOMSCRIPTURL=0 + + FirstRun_Automation_Init(){ + + #Get settings + AUTOINSTALL_INDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Install_Index=' | sed 's/.*=//') + + AUTOINSTALL_AUTOSTARTTARGET=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_AutoStartTarget=' | sed 's/.*=//' ) + + AUTOINSTALL_SSHINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_SSHServerIndex=' | sed 's/.*=//') + AUTOINSTALL_FILESERVERINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_FileServerIndex=' | sed 's/.*=//') + AUTOINSTALL_LOGGINGINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_LoggingIndex=' | sed 's/.*=//') + AUTOINSTALL_WEBSERVERINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_WebserverIndex=' | sed 's/.*=//') + + AUTOINSTALL_TIMEZONE=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Timezone=' | sed 's/.*=//' ) + AUTOINSTALL_LANGUAGE=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Locale=' | sed 's/.*=//' ) + AUTOINSTALL_KEYBOARD=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_KeyboardLayout=' | sed 's/.*=//' ) + + AUTOINSTALL_CUSTOMSCRIPTURL=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_CustomScriptURL=' | sed 's/AUTO_CustomScriptURL=//') + + } + + FirstRun_Automation_Set(){ + + #Automated install + if (( $AUTOINSTALL_INDEX >= 1 )); then + + /DietPi/dietpi/dietpi-banner 0 + echo -e "\n Running Automated Installation:\n" + + #Skip dietpi-software menu + TARGETMENUID=-1 + + #Set start install + GOSTARTINSTALL=1 + + #Auto format/setup USB drive + if [ -f /boot/Automation_Format_My_Usb_Drive ]; then + + #Run Format + /DietPi/dietpi/dietpi-external_drive_setup 1 + + fi + + #Find all software entires of AUTO_DietpiSoftware_Install_ID= in dietpi.txt. Then set to state 1 for installation. + while read -r line + do + + local index=$( echo -e "$line" | grep '^AUTO_DietpiSoftware_Install_ID=' | sed 's/[^0-9]*//g' ) + + # - Flag for installation + aSOFTWARE_INSTALL_STATE[$index]=1 + + /DietPi/dietpi/func/dietpi-notify 2 "Automation: ${aSOFTWARE_WHIP_NAME[$index]}. Flagged for installation." + + done < /DietPi/dietpi.txt + + fi + + #Further Automated options. (Applied regardless of AUTOINSTALL_INDEX) + INDEX_SSHSERVER_TARGET=$AUTOINSTALL_SSHINDEX + INDEX_FILESERVER_TARGET=$AUTOINSTALL_FILESERVERINDEX + INDEX_LOGGING_TARGET=$AUTOINSTALL_LOGGINGINDEX + INDEX_WEBSERVER_TARGET=$AUTOINSTALL_WEBSERVERINDEX + + } + + FirstRun_DietPi_Update(){ + + #Disable powersaving on main screen + setterm -blank 0 -powersave off 2> /dev/null + + #-1 = 1st run | 0 = Reboot, updates applied | 1 = Idle, No updates + #Update .update_stage file to completed + echo 1 > /DietPi/dietpi/.update_stage + + #Check for updates and apply if needed (1=force apply updates). + /DietPi/dietpi/dietpi-update 1 + + #Check update stage file again (dietpi-update will set to 0 if an update was applied and requires a reboot) + if (( $(cat /DietPi/dietpi/.update_stage) == 0 )); then + + #Update .update_stage file to completed + echo 1 > /DietPi/dietpi/.update_stage + + clear + /DietPi/dietpi/dietpi-banner 0 + + #Prompt user for reboot + if (( $USER_INPUTS )); then + + WHIP_TITLE='DietPi Update Completed' + whiptail --title "$WHIP_TITLE" --msgbox "DietPi has been updated to the latest version.\nYour system will now reboot. Once completed, simply login to resume DietPi Setup. \n\nPress Enter to Continue." 13 65 + + fi + + #Make sure apt-get_update thread is finished + /DietPi/dietpi/dietpi-apt-get_update 1 + + #Reboot required NOW + reboot + Exit_Destroy + + fi + + } + + FirstRun_Questions(){ + + if (( $USER_INPUTS )); then + + #Questions Start (Ask our inital questions, before allowing access to the software selection menus) + WHIP_TITLE='DietPi - Welcome' + whiptail --title "$WHIP_TITLE" --msgbox "Welcome to the DietPi Installation System. \n \nBefore we can begin, we need to ask you a few questions regarding this installation. \n \nPress Enter to begin." 14 70 + + #Request for Dedicated External Drive installation. + if (( $USBDRIVE == 0 && $HW_MODEL != 20 )); then + + WHIP_TITLE='Setup USB Dedicated Drive?' + WHIP_QUESTION='If you choose to setup a dedicated USB drive, DietPi will automatically configure your future software installations to utilize the USB drive for user data storage, instead of SD.\nAs USB hard drives can be faster than most SD cards, using a USB drive can vastly improve system performance.\n\nExamples of software, that will benefit from a USB drive: \n - BitTorrent (Store downloads) \n - OwnCloud (Larger data storage)\n - Kodi / Plex / Emby etc (Store Media Files)\n\nMore information on user data in DietPi:\n - http://dietpi.com/phpbb/viewtopic.php?f=8&t=478&p=2087\n\nWould you like to setup a USB drive now?' + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --defaultno 21 70 + CHOICE=$? + if (( $CHOICE == 0 )); then + + # XENFOMATION: Place holder to wrap up 2 USB dedicated drives + + #Run external drive setup script + /DietPi/dietpi/dietpi-external_drive_setup -[Service] -Type=oneshot -User=root -RemainAfterExit=yes -ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=1340 -ExecStop=/usr/bin/killall -w qbittorrent-nox + fi -[Install] -WantedBy=multi-user.target -_EOF_ + fi - systemctl daemon-reload + #Questions End + if (( $AUTOINSTALL_INDEX == 0 )); then + WHIP_TITLE='DietPi - Questions Completed' + whiptail --title "$WHIP_TITLE" --msgbox "The DietPi-Software menu will now appear with the following options: \n\n- Select DietPi Optimized Software\nThis will allow you to select Optimized and Ready to Run software.\nhttp://dietpi.com/software\n\n- Select Additional Linux Software.\nThis will allow you to select standard linux software relative to this installation. \n\n- DietPi-Config\nA feature rich configuration tool for your device.\n \n- Go Start Install\nThis will start the installation process for your selected items." 21 75 - QBITTORRENT=2 + fi fi - #SYNCTHING - if (( $SYNCTHING == 1 )); then + } - # - run syncthing to create cert/config and exit - syncthing -generate="/$HOME/.config/syncthing" + #///////////////////////////////////////////////////////////////////////////////////// + # Internet Connection Test Vars + #///////////////////////////////////////////////////////////////////////////////////// + INTERNET_CONNECTED=0 + #Use /etc/apt/sources.list for connection test + INTERNET_URL_TEST=$(cat /etc/apt/sources.list | grep -m1 "deb http" | awk '{print $2}') - # - Disable automatic upgrades - sed -i '/<\/autoUpgradeIntervalH>/c\ 0<\/autoUpgradeIntervalH>' "$HOME"/.config/syncthing/config.xml + Check_Internet_Connection(){ - # - Allow external access (LAN). - sed -i '/:8384<\/address>/c\
0.0.0.0:8384<\/address>' "$HOME"/.config/syncthing/config.xml + #Max loops for USER_INPUTS=0 + local max_loops=10 + local current_loop=0 - # - Set default folder - sed -i '/label=\"Default Folder/c\ ' "$HOME"/.config/syncthing/config.xml + INTERNET_CONNECTED=0 + while (( $INTERNET_CONNECTED == 0 )); do - # - Disable browser starting - sed -i '/<\/startBrowser>/c\ false<\/startBrowser>' "$HOME"/.config/syncthing/config.xml + /DietPi/dietpi/func/check_connection "$INTERNET_URL_TEST" + if (( $? == 0 )); then - # service - cat << _EOF_ > /etc/systemd/system/syncthing.service -[Unit] -Description=Syncthing + INTERNET_CONNECTED=1 -[Service] -Type=oneshot -ExecStart=/bin/bash -c '/usr/bin/syncthing > /var/log/syncthing.log &' -ExecStop=/usr/bin/killall -w syncthing -RemainAfterExit=yes -User=root + elif (( $USER_INPUTS )); then -[Install] -WantedBy=multi-user.target -_EOF_ -systemctl enable syncthing.service -systemctl daemon-reload + Menu_No_Internet + else - SYNCTHING=2 + if (( $current_loop >= $max_loops )); then - fi + /DietPi/dietpi/func/dietpi-notify 1 "Connection test failed. $INTERNET_URL_TEST" + Exit_Destroy - } + else - Install_Apply_GPU_Settings(){ + ((current_loop++)) + /DietPi/dietpi/func/dietpi-notify 2 "Testing connection to $INTERNET_URL_TEST" + /DietPi/dietpi/func/dietpi-notify 2 "Attempt ($current_loop / $max_loops), please wait..." + sleep 1 - local memory_split_mode=0 + fi - #Define Memory Split Modes with installed software - #Mode 3 (Kodi / Dietpicam / MED GPU RAM / 128MB) - if (( $KODI == 2 )); then - memory_split_mode=3 - elif (( $DIETPICAM == 2 )); then - memory_split_mode=3 + fi - #Mode 2 (Desktop / LOW GPU RAM) - elif (( $DESKTOP_LXDE == 2 )); then - memory_split_mode=2 - elif (( $DESKTOP_MATE == 2 )); then - memory_split_mode=2 - elif (( $DESKTOP_GNUSTEP == 2 )); then - memory_split_mode=2 - elif (( $OPENTYRIAN == 2 )); then - memory_split_mode=2 - #Mode 1 - DietPi-Cloudshell (forces display output) - elif (( $DIETPICLOUDSHELL == 2 )); then - memory_split_mode=1 + done - #Mode 0 (Server) - else - memory_split_mode=0 - fi + } - #Apply GPU Settings - #Mode 3 - if (( $memory_split_mode == 3 )); then + #///////////////////////////////////////////////////////////////////////////////////// + # Globals + #///////////////////////////////////////////////////////////////////////////////////// + #Enable all user inputs (eg: prompts) + USER_INPUTS=1 - #Odroid C2 - if (( $HW_MODEL == 12 )); then + Input_Modes(){ - sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + # - Skip menu + TARGETMENUID=-1 - #odroid C1 - elif (( $HW_MODEL == 10 )); then + DISABLE_REBOOT=1 - sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini - sed -i '/setenv vpu /c\setenv vpu "1"' /DietPi/boot.ini - sed -i '/setenv m_bpp /c\setenv m_bpp "32"' /DietPi/boot.ini + local ainput=("$@") - #rpi - elif (( $HW_MODEL < 10 )); then + #FOURDEE: Disable these functions if dietpi-software is already running +1. To prevent read/write issues? - sed -i '/gpu_mem_256=/c\gpu_mem_256=128' /DietPi/config.txt - sed -i '/gpu_mem_512=/c\gpu_mem_512=128' /DietPi/config.txt - sed -i '/gpu_mem_1024=/c\gpu_mem_1024=128' /DietPi/config.txt - sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + #Install software and exit. + if [ "$1" = "install" ]; then - fi + # - Make sure we have at least one entry + if [ -z "$2" ]; then - #Mode 2 - elif (( $memory_split_mode == 2 )); then + /DietPi/dietpi/func/dietpi-notify 1 "Please enter a software index ID, or, choice system INDEX_*_TARGET=-?" - #Odroid C2 - if (( $HW_MODEL == 12 )); then + else - sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + for i in "${ainput[@]}" + do - #odroid C1 - elif (( $HW_MODEL == 10 )); then + # - Ignore 1st entry + if [ "$i" != "install" ]; then - sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini - sed -i '/setenv vpu /c\setenv vpu "1"' /DietPi/boot.ini - sed -i '/setenv m_bpp /c\setenv m_bpp "32"' /DietPi/boot.ini + #Valid int means input is unique ID for software index to be installed + if [[ $i =~ ^-?[0-9]+$ ]]; then - #rpi - elif (( $HW_MODEL < 10 )); then + if (( ${aSOFTWARE_INSTALL_STATE[$i]} != 2 )); then - sed -i '/gpu_mem_256=/c\gpu_mem_256=64' /DietPi/config.txt - sed -i '/gpu_mem_512=/c\gpu_mem_512=64' /DietPi/config.txt - sed -i '/gpu_mem_1024=/c\gpu_mem_1024=64' /DietPi/config.txt - sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + aSOFTWARE_INSTALL_STATE[$i]=1 + GOSTARTINSTALL=1 - fi + /DietPi/dietpi/func/dietpi-notify 0 "Installing ${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}" - #Mode 1 - DietPi-Cloudshell - elif (( $memory_split_mode == 1 )); then + else - #Odroid C2 - if (( $HW_MODEL == 12 )); then + /DietPi/dietpi/func/dietpi-notify 2 "$i: ${aSOFTWARE_WHIP_NAME[$i]} is already installed" - sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini + fi - #odroid C1 - elif (( $HW_MODEL == 10 )); then + #Assume this is a choice system change (eg: INDEX_*_TARGET=-2) + else - sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini - sed -i '/setenv m_bpp /c\setenv m_bpp "16"' /DietPi/boot.ini + local target_value=$(echo -e "$i" | sed 's/.*=//') # Grab the value + local target_name=$(echo -e "$i" | sed 's/=.*//') + local target_name+='=' + #FOURDEE: I dont want to write/read settings file, so lets change the variable. + #sed -i "/^$target_name/c $target_name$target_value" "$FP_INSTALLED_FILE" - #rpi - elif (( $HW_MODEL < 10 )); then + fi - sed -i '/gpu_mem_256=/c\gpu_mem_256=16' /DietPi/config.txt - sed -i '/gpu_mem_512=/c\gpu_mem_512=16' /DietPi/config.txt - sed -i '/gpu_mem_1024=/c\gpu_mem_1024=16' /DietPi/config.txt - sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + fi + + done fi - #Mode 0 - elif (( $memory_split_mode == 0 )); then + #Uninstall Software + elif [ "$1" = "uninstall" ]; then - #Odroid C2 - if (( $HW_MODEL == 12 )); then + # - stop services + /DietPi/dietpi/dietpi-services stop - echo -e "nothing here" &> /dev/null - #sed -i '/setenv nographics /c\setenv nographics "1"' /DietPi/boot.ini - #nographics is actually "headless", no output. + for i in "${ainput[@]}" + do - #odroid C1 - elif (( $HW_MODEL == 10 )); then + # - Ignore 1st entry + if [ "$i" != "uninstall" ]; then - #sed -i '/setenv hdmioutput /c\setenv hdmioutput "1"' /DietPi/boot.ini - sed -i '/setenv vpu /c\setenv vpu "0"' /DietPi/boot.ini - sed -i '/setenv m_bpp /c\setenv m_bpp "16"' /DietPi/boot.ini + Uninstall_Software "$i" - #rpi - elif (( $HW_MODEL < 10 )); then + fi - sed -i '/gpu_mem_256=/c\gpu_mem_256=16' /DietPi/config.txt - sed -i '/gpu_mem_512=/c\gpu_mem_512=16' /DietPi/config.txt - sed -i '/gpu_mem_1024=/c\gpu_mem_1024=16' /DietPi/config.txt - #sed -i "/rpi_hdmi_output=/c\rpi_hdmi_output=1" /DietPi/dietpi.txt + done - fi + #Finish up and clear non-required packages + Uninstall_Software_Finalize - fi + #Save + Write_InstallFileList - } + # - Start services + /DietPi/dietpi/dietpi-services start - Dedicated_Usb_Drive_Enable(){ + #List unique software names and ID's + elif [ "$1" = "list" ]; then - USBDRIVE=0 + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - #Only enable if mounted - if (( $(df -P | grep -ci -m1 "$DIETPI_USBDRIVE_DIRECTORY") )); then + local string='' - USBDRIVE=2 + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )); then - fi + string="\e[32mID $i | " - } + else - Run_Installations(){ + string="\e[0mID $i | " - #------------------------------------------------------------ - #Disable powersaving on Main screen during installation - setterm -blank 0 -powersave off 2> /dev/null + fi - #------------------------------------------------------------ - #Check if we need to setup different userdata directory for this run. - local current_userdata_dir=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) - local target_userdata_dir=$DIETPI_USERDATA_DIRECTORY + string+=" =${aSOFTWARE_INSTALL_STATE[$i]} | ${aSOFTWARE_UNIQUE_NAME[$i]} |" - # - Auto | flash is default value, set to USB drive if available - dietpi_userdata_basedirectory=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') - if [ "$dietpi_userdata_basedirectory" = "auto" ]; then + if (( ${aSOFTWARE_REQUIRES_ALSA[$i]} == 1 )); then - if (( $USBDRIVE == 2 )); then - target_userdata_dir=$DIETPI_USBDRIVE_DIRECTORY - fi + string+=' +ALSA' + fi - # - custom directory - else - target_userdata_dir=$dietpi_userdata_basedirectory - fi + if (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]} == 1 )); then - # - Setup user directory and move existing userdata if required - /DietPi/dietpi/func/dietpi-set_userdata "$current_userdata_dir" "$target_userdata_dir" - # - Check for failure - if (( $? != 0 )); then - Error_Create_UserDataDirectory - exit - fi + string+=' +XSERVER' + fi - #------------------------------------------------------------ - #Set current path to home folder - cd "$HOME" + if (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]} == 1 )); then - #Update Apt - Banner_Apt_Update + string+=' +DESKTOP' - #Always clean and update apt, before running installs. - #The previous "once every 7days" update caused missing package errors if a package filename was changed in the repo during that time. - # - Wait for outstanding DietPi apt-get update thread to finish. - /DietPi/dietpi/dietpi-apt-get_update 1 - # - use normal apt as visual for user. - apt-get clean - apt-get update + fi - #Simluated apt installation to check for failures related to apt-cache. - /DietPi/dietpi/func/dietpi-notify 2 "Running apt simulation to check for errors, please wait..." - local package_to_test="bash-doc" - apt-get install $package_to_test -s -y &> /dev/null - local result=$? + if (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]} == 1 )); then - /DietPi/dietpi/func/dietpi-notify -1 $result "Apt simulation |" + string+=' +RSYSLOG' - if (( $result != 0 )); then + fi - /DietPi/dietpi/func/dietpi-notify 2 "The apt cache may be corrupt, or you have held broken pacakages. DietPi-Software will now exit.\n" - /DietPi/dietpi/func/dietpi-notify 2 "Please try:" - /DietPi/dietpi/func/dietpi-notify 2 "- Fixing apt package errors with 'apt-get install -f'" - /DietPi/dietpi/func/dietpi-notify 2 "- Changing '/etc/apt/sources.list' to another repo mirror." - /DietPi/dietpi/func/dietpi-notify 2 "- Clear and refresh apt '/DietPi/dietpi/dietpi-apt-get_update 2'\n" + if (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]} == 1 )); then - exit + string+=' +FFMPEG' - fi + fi + + if (( ${aSOFTWARE_REQUIRES_ORACLEJAVA[$i]} == 1 )); then + + string+=' +ORACLEJAVA' + + fi - #Upgrade Apt - Banner_Setup - Banner_Apt_Update - # - Set noninteractive | Allows automation for Odroid kernel updates without user prompt. - DEBIAN_FRONTEND='noninteractive' apt-get upgrade -y + if (( ${aSOFTWARE_REQUIRES_NODEJS[$i]} == 1 )); then - #Generate dir for dietpi-software installed "non-service" based control scripts - mkdir -p /etc/dietpi/dietpi-software/services - chmod -R +x /etc/dietpi/dietpi-software/services + string+=' +NODEJS' - #Apply DietPi choice systems - Apply_FileServer_Choices - Apply_SSHServer_Choices - Apply_Logging_Choices + fi - #Apply DietPi preference systems - Apply_Webserver_Preference + if (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]} == 1 )); then - #Install Linux Software - Install_Linux_Software + string+=' +BUILDESSENTIAL' - #Install DietPi Optimized Software - Install_Dietpi_Software + fi - #Apply Uninstall script created by DietPi choice system - Uninstall_NonSelected_Choices + if (( ${aSOFTWARE_REQUIRES_GIT[$i]} == 1 )); then - #Apply DietPi Configuration and Optimization Files - Banner_Configs - Install_Apply_Configs + string+=' +GIT' - #Apply GPU Memory Splits - Install_Apply_GPU_Settings + fi - #Disable services so DietPi-services can take control (DietPi will start all services from rc.local) - /DietPi/dietpi/dietpi-services disable + if (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]} == 1 )); then - #Write to .install File - Write_InstallFileList + string+=' +WEBSERVER' - #DietPi-Automation - if (( $DIETPI_INSTALL_STAGE == 0 )); then + fi - #Apply Timezone - if [ "$AUTOINSTALL_TIMEZONE" != "Europe/London" ]; then + if (( ${aSOFTWARE_REQUIRES_MYSQL[$i]} == 1 )); then - echo -e "\nDietPi: Setting Timezone = $AUTOINSTALL_TIMEZONE" - echo -e "$AUTOINSTALL_TIMEZONE" > /etc/timezone - dpkg-reconfigure -f noninteractive tzdata + string+=' +MYSQL' - fi + fi - #Apply Language (Locale) - if [ "$AUTOINSTALL_LANGUAGE" != "en_GB" ]; then + if (( ${aSOFTWARE_REQUIRES_SQLITE[$i]} == 1 )); then - /DietPi/dietpi/func/dietpi-notify 2 "Setting Locale $AUTOINSTALL_LANGUAGE. Please wait....\n" + string+=' +SQLITE' - #Disable en_GB - sed -i "/en_GB.UTF-8/c\# en_GB.UTF-8 UTF-8" /etc/locale.gen + fi - #Enable user setting - sed -i "/$AUTOINSTALL_LANGUAGE.UTF-8/c $AUTOINSTALL_LANGUAGE.UTF-8 UTF-8" /etc/locale.gen - echo -e "LANG=$AUTOINSTALL_LANGUAGE.UTF-8" > /etc/default/locale - locale-gen - localectl set-locale LANG=$AUTOINSTALL_LANGUAGE + # - Available for HW_ARCH? + if (( ! ${aSOFTWARE_AVAIL_HW_ARCH[$i,$HW_ARCH]} )); then - fi + string+=" \e[31mDISABLED for HW_ARCH\e[0m" - #Apply Keyboard - if [ "$AUTOINSTALL_KEYBOARD" != "gb" ]; then + fi - /DietPi/dietpi/func/dietpi-notify 2 "Setting Keyboard $AUTOINSTALL_KEYBOARD. Please wait....\n" - sed -i '/XKBLAYOUT=/c XKBLAYOUT="'"$AUTOINSTALL_KEYBOARD"'"' /etc/default/keyboard - #systemctl restart keyboard-setup + # - Available for HW_MODEL? + if (( ! ${aSOFTWARE_AVAIL_HW_MODEL[$i,$HW_MODEL]} )); then - fi + string+=" \e[31mDISABLED for HW_MODEL\e[0m" - #Apply & Mount Network drives if installed - if (( $SMBCLIENT == 2 )); then + fi - /DietPi/dietpi/func/dietpi-set_smbclient 1 + echo -e "$string" - fi + done - if (( $CURLFTPFS == 2 )); then + echo -e "Total Software index HARD limit : $TOTAL_SOFTWARE_INDEXS_HARDLIMIT" + echo -e "Total Software index Current : $TOTAL_SOFTWARE_INDEXS" - /DietPi/dietpi/func/dietpi-set_curlftpfs 1 - fi + else - local run_custom_script=0 - #Custom 1st run Script (Local file) - if [ -f /boot/Automation_Custom_Script.sh ]; then + /DietPi/dietpi/func/dietpi-notify 2 "Unknown command $1" - INSTALL_DESCRIPTION='Automation - Local Custom Script' - Banner_Installing + fi - cp /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh - run_custom_script=1 + unset ainput - #Custom 1st run Script (Online file) - elif [ "$AUTOINSTALL_CUSTOMSCRIPTURL" != "0" ]; then + } - INSTALL_DESCRIPTION='Automation - Online Custom Script' - Banner_Installing + Exit_Destroy(){ - #check source is online - INSTALL_URL_ADDRESS=$AUTOINSTALL_CUSTOMSCRIPTURL - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + #Reset any selected items for installation (1) back to not installed (0) + # for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + # do - #Install - if (( $? == 0 )); then + # if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #Get script and execute - wget "$INSTALL_URL_ADDRESS" -O /root/AUTO_CustomScript.sh - run_custom_script=1 + # aSOFTWARE_INSTALL_STATE[$i]=0 - else + # fi - echo -e "Automated Custom Script URL Error:\n $AUTOINSTALL_CUSTOMSCRIPTURL is offline and/or unreachable" >> "$FP_DIETPIAUTOMATION_LOG" + # done - fi + Software_Arrays_Destroy - fi + exit - if (( $run_custom_script == 1 )); then + } - chmod +x /root/AUTO_CustomScript.sh - /root/AUTO_CustomScript.sh - local result=$? - if (( $result == 0 )); then + #///////////////////////////////////////////////////////////////////////////////////// + # Error Functions + #///////////////////////////////////////////////////////////////////////////////////// + ERROR_TEXT="" - echo -e "Automated custom script executed succesfully:\n - Filepath = /root/AUTO_CustomScript.sh\n - URL = $AUTOINSTALL_CUSTOMSCRIPTURL" >> "$FP_DIETPIAUTOMATION_LOG" + Error_Display(){ - else + #Automation | Save to logfile if errors are being ignored - echo -e "Automated Custom Script Error:\n - Exit code = $result\n - Filepath = /root/AUTO_CustomScript.sh\n - URL = $AUTOINSTALL_CUSTOMSCRIPTURL" >> "$FP_DIETPIAUTOMATION_LOG" + if (( $USER_INPUTS )); then - fi + whiptail --title "Error" --msgbox "$ERROR_TEXT" 16 70 - fi + else - #Apply AutoStart - /DietPi/dietpi/dietpi-autostart $AUTOINSTALL_AUTOSTARTTARGET + echo -e "Error: $ERROR_TEXT" >> "$FP_DIETPIAUTOMATION_LOG" fi - #Set Install Stage to Finished - echo 1 > /DietPi/dietpi/.install_stage - } - FirstRun_Automation_Init(){ + Error_NoConnection_NoInstall(){ - #Get settings - AUTOINSTALL_INDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Install_Index=' | sed 's/.*=//') + #Abort install + aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]=0 - AUTOINSTALL_AUTOSTARTTARGET=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_AutoStartTarget=' | sed 's/.*=//' ) + ERROR_TEXT="Unable to Install ${aSOFTWARE_WHIP_NAME[$INSTALLING_INDEX]}: ${aSOFTWARE_WHIP_DESC[$INSTALLING_INDEX]}\n\n$INSTALL_URL_ADDRESS is offline and/or unreachable." + Error_Display - AUTOINSTALL_SSHINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_SSHServerIndex=' | sed 's/.*=//') - AUTOINSTALL_FILESERVERINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_FileServerIndex=' | sed 's/.*=//') - AUTOINSTALL_LOGGINGINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_LoggingIndex=' | sed 's/.*=//') - AUTOINSTALL_WEBSERVERINDEX=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_DietpiSoftware_WebserverIndex=' | sed 's/.*=//') + } - AUTOINSTALL_TIMEZONE=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Timezone=' | sed 's/.*=//' ) - AUTOINSTALL_LANGUAGE=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Locale=' | sed 's/.*=//' ) - AUTOINSTALL_KEYBOARD=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_KeyboardLayout=' | sed 's/.*=//' ) + Error_AptGet_Failed(){ - AUTOINSTALL_CUSTOMSCRIPTURL=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_CustomScriptURL=' | sed 's/AUTO_CustomScriptURL=//') + ERROR_TEXT="Apt-get has failed:\n - Apt string = $string\n - Error code = $result\n - Software Title = ${aSOFTWARE_WHIP_NAME[$INSTALLING_INDEX]}: ${aSOFTWARE_WHIP_DESC[$INSTALLING_INDEX]}" + Error_Display } - FirstRun_Automation_Set(){ + Error_Create_UserDataDirectory(){ - #Automated install - if (( $AUTOINSTALL_INDEX >= 1 )); then + ERROR_TEXT="DietPi was unable to create your user data directory:\n\n $(cat /var/log/dietpi-move_userdata.log)\n\nDietPi-Software will now exit." + Error_Display - /DietPi/dietpi/dietpi-banner 0 - echo -e "\n Running Automated Installation:\n" + } - #Skip dietpi-software menu - TARGETMENUID=-1 + #///////////////////////////////////////////////////////////////////////////////////// + # Whip menus + #///////////////////////////////////////////////////////////////////////////////////// + WHIP_BACKTITLE='DietPi-Software' + WHIP_TITLE=0 + WHIP_QUESTION=0 + MENU_MAIN_LASTITEM="" + TARGETMENUID=0 - #Set start install - GOSTARTINSTALL=1 + Menu_CreateSoftwareList(){ - #Auto format/setup USB drive - if [ -f /boot/Automation_Format_My_Usb_Drive ]; then + #software type for this menu + local software_type=$1 #0=dietpi 1=linux - #Run Format - /DietPi/dietpi/dietpi-external_drive_setup 1 + local max_categories=$MAX_SOFTWARE_CATEGORIES_DIETPI + if (( $1 == 1 )); then - fi + max_categories=$MAX_SOFTWARE_CATEGORIES_LINUX fi - #Further Automated options. (Applied regardless of AUTOINSTALL_INDEX) - INDEX_SSHSERVER_TARGET=$AUTOINSTALL_SSHINDEX - INDEX_FILESERVER_TARGET=$AUTOINSTALL_FILESERVERINDEX - INDEX_LOGGING_TARGET=$AUTOINSTALL_LOGGINGINDEX - INDEX_WEBSERVER_TARGET=$AUTOINSTALL_WEBSERVERINDEX - - } + #----------------------------------------------------------------------------- + #Generate Whiptail menu list based on category + local whiptail_list=() + for ((i=0; i<$max_categories; i++)) + do - FirstRun_DietPi_Update(){ + #Only add the category if we have software for it. + local category_enabled=0 - #Disable powersaving on main screen - setterm -blank 0 -powersave off 2> /dev/null + #Now run through all available software + for ((j=0; j<$TOTAL_SOFTWARE_INDEXS; j++)) + do - #-1 = 1st run | 0 = Reboot, updates applied | 1 = Idle, No updates - #Update .update_stage file to completed - echo 1 > /DietPi/dietpi/.update_stage + #Check if this software matches the current category and sofware type for this menu. + # - I originally had "aSOFTWARE_AVAIL_HW_MODEL" and "aSOFTWARE_AVAIL_HW_ARCH" in one 'if' statement below, however, this seems to takes 4x longer to process in bash. + if (( ${aSOFTWARE_CATEGORY_INDEX[$j]} == $i && ${aSOFTWARE_TYPE[$j]} == $software_type )); then - #Check for updates and apply if needed (1=force apply updates). - /DietPi/dietpi/dietpi-update 1 + # + is available for hardware? + # + is available for distro? + if (( ${aSOFTWARE_AVAIL_HW_MODEL[$j,$HW_MODEL]} && + ${aSOFTWARE_AVAIL_HW_ARCH[$j,$HW_ARCH]} )); then - #Check update stage file again (dietpi-update will set to 0 if an update was applied and requires a reboot) - if (( $(cat /DietPi/dietpi/.update_stage) == 0 )); then + local selected="off" - #Update .update_stage file to completed - echo 1 > /DietPi/dietpi/.update_stage + if (( ${aSOFTWARE_INSTALL_STATE[$j]} > 0 )); then - clear - /DietPi/dietpi/dietpi-banner 0 + selected="on" - #Prompt user for reboot - if (( $USER_INPUTS )); then + if (( ${aSOFTWARE_INSTALL_STATE[$j]} == 1 )); then + #Reset to 0. Menu checklists will apply back to 1 + aSOFTWARE_INSTALL_STATE[$j]=0 + fi - WHIP_TITLE='DietPi Update Completed' - whiptail --title "$WHIP_TITLE" --msgbox "DietPi has been updated to the latest version.\nYour system will now reboot. Once completed, simply login to resume DietPi Setup. \n\nPress Enter to Continue." 13 65 + fi - fi + #Add category + if (( $category_enabled == 0 )); then - #Make sure apt-get_update thread is finished - /DietPi/dietpi/dietpi-apt-get_update 1 + # - dietpi + if (( $1 == 0 )); then - #Reboot required NOW, exit this script NOW - reboot - exit - fi + whiptail_list+=("" "${aSOFTWARE_CATEGORIES_DIETPI[$i]}" "off") - } + # - linux + elif (( $1 == 1 )); then - FirstRun_Questions(){ + whiptail_list+=("" "${aSOFTWARE_CATEGORIES_LINUX[$i]}" "off") - if (( $USER_INPUTS )); then + fi - #Questions Start (Ask our inital questions, before allowing access to the software selection menus) - WHIP_TITLE='DietPi - Welcome' - whiptail --title "$WHIP_TITLE" --msgbox "Welcome to the DietPi Installation System. \n \nBefore we can begin, we need to ask you a few questions regarding this installation. \n \nPress Enter to begin." 14 70 + category_enabled=1 - #Request for Dedicated External Drive installation. - if (( $USBDRIVE == 0 && $HW_MODEL != 20 )); then - WHIP_TITLE='Setup USB Dedicated Drive?' - WHIP_QUESTION='If you choose to setup a dedicated USB drive, DietPi will automatically configure your future software installations to utilize the USB drive for user data storage, instead of SD.\nAs USB hard drives can be faster than most SD cards, using a USB drive can vastly improve system performance.\n\nExamples of software, that will benefit from a USB drive: \n - BitTorrent (Store downloads) \n - OwnCloud (Larger data storage)\n - Kodi / Plex / Emby etc (Store Media Files)\n\nMore information on user data in DietPi:\n - http://dietpi.com/phpbb/viewtopic.php?f=8&t=478&p=2087\n\nWould you like to setup a USB drive now?' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --defaultno 21 70 - CHOICE=$? - if (( $CHOICE == 0 )); then + fi - # XENFOMATION: Place holder to wrap up 2 USB dedicated drives + #Add this option to whiptail list + whiptail_list+=("${aSOFTWARE_WHIP_NAME[$j]}" "${aSOFTWARE_WHIP_DESC[$j]}" "$selected") - #Run external drive setup script - /DietPi/dietpi/dietpi-external_drive_setup + fi fi - fi - - #Questions End - if (( $AUTOINSTALL_INDEX == 0 )); then - WHIP_TITLE='DietPi - Questions Completed' - whiptail --title "$WHIP_TITLE" --msgbox "The DietPi-Software menu will now appear with the following options: \n\n- Select DietPi Optimized Software\nThis will allow you to select Optimized and Ready to Run software.\nhttp://dietpi.com/software\n\n- Select Additional Linux Software.\nThis will allow you to select standard linux software relative to this installation. \n\n- DietPi-Config\nA feature rich configuration tool for your device.\n \n- Go Start Install\nThis will start the installation process for your selected items." 21 75 - fi - fi + done - } + done - #///////////////////////////////////////////////////////////////////////////////////// - # Error Functions - #///////////////////////////////////////////////////////////////////////////////////// - Error_Display(){ + #----------------------------------------------------------------------------- + WHIP_TITLE='DietPi Optimized Software Selection' + whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_TITLE" 22 78 12 "${whiptail_list[@]}" 2>/tmp/dietpi-software_results - #Automation | Save to logfile if errors are being ignored + #delete[] + unset whiptail_list - if (( $USER_INPUTS )); then + #Reset Choices made flag + # - dietpi + if (( $1 == 0 )); then - whiptail --title "Error" --msgbox "$ERROR_TEXT" 16 70 + INSTALL_DIETPI_CHOICESMADE=0 - else + # - linux + elif (( $1 == 1 )); then - echo -e "Error: $ERROR_TEXT" >> "$FP_DIETPIAUTOMATION_LOG" + INSTALL_LINUX_CHOICESMADE=0 fi - } + #Check for matching results (selected items) + while read choice + do + + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + + #enable + if [ "$choice" = "${aSOFTWARE_WHIP_NAME[$i]}" ] && + (( ${aSOFTWARE_INSTALL_STATE[$i]} == 0 )); then + + # - dietpi + if (( $1 == 0 )); then + + INSTALL_DIETPI_CHOICESMADE=1 + + # - linux + elif (( $1 == 1 )); then + + INSTALL_LINUX_CHOICESMADE=1 - Error_NoConnection_NoInstall(){ + fi - ERROR_TEXT="Unable to Install $INSTALL_DESCRIPTION \n\n$INSTALL_URL_ADDRESS is offline and/or unreachable." - Error_Display - } + aSOFTWARE_INSTALL_STATE[$i]=1 - Error_AptGet_Failed(){ + fi - ERROR_TEXT="Apt-get has failed:\n - Apt string = $string\n - Error code = $result\n - Software Title = $INSTALL_DESCRIPTION" - Error_Display - } + done - Error_Create_UserDataDirectory(){ + done < /tmp/dietpi-software_results + rm /tmp/dietpi-software_results &> /dev/null - ERROR_TEXT="DietPi was unable to create your user data directory:\n\n $(cat /var/log/dietpi-move_userdata.log)\n\nDietPi-Software will now exit." - Error_Display } - #///////////////////////////////////////////////////////////////////////////////////// - # WHIPTAIL MENU Functions - #///////////////////////////////////////////////////////////////////////////////////// Menu_No_Internet(){ #Ask to check settings, @@ -6220,7 +8630,7 @@ systemctl daemon-reload Banner_Aborted #Exit Script NOW - exit + Exit_Destroy fi } @@ -6279,15 +8689,16 @@ systemctl daemon-reload WHIP_TITLE='DietPi-Software' WHIP_BACKTITLE="DietPi-Software | IP: $(sed -n 4p /DietPi/dietpi/.network) | Device: $HW_MODEL_DESCRIPTION" - OPTION=$(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "" --default-item "$MENU_MAIN_LASTITEM" --cancel-button "Exit" 17 75 10 \ - "Software Optimized" "Select DietPi Optimized Software for installation." \ - "Software Additional " "Select Additional Linux Software for installation." \ + OPTION=$(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "" --default-item "$MENU_MAIN_LASTITEM" --cancel-button "Exit" 18 75 11 \ + "Software Optimized" "Select DietPi Optimized Software for installation" \ + "Software Additional " "Select Additional Linux Software for installation" \ "SSH Server" ": $index_sshserver_text" \ "File Server" ": $index_fileserver_text" \ "Log System" ": $index_logging_text" \ "Webserver Preference" ": $index_webserver_text" \ "User Data Location" ": $user_data_mode_description | $user_data_location_actual" \ "DietPi-Config" "Feature-rich configuration tool for your device." \ + "Uninstall" "Select installed software for removal." \ "Help!" "Links to online guides and information." \ "Go" ">> Start Installation." 3>&1 1>&2 2>&3) @@ -6297,6 +8708,9 @@ systemctl daemon-reload MENU_MAIN_LASTITEM="$OPTION" case "$OPTION" in + "Uninstall") + TARGETMENUID=3 + ;; "Software Optimized") TARGETMENUID=1 ;; @@ -6621,10 +9035,14 @@ systemctl daemon-reload Menu_StartInstall ;; esac + #Exit/Abort Setup else + Menu_Exit + fi + } Menu_Exit(){ @@ -6638,7 +9056,7 @@ systemctl daemon-reload if (( $CHOICE == 0 )); then Banner_Aborted #Exit script NOW - exit + Exit_Destroy else #Return to Main Menu TARGETMENUID=0 @@ -6647,1670 +9065,118 @@ systemctl daemon-reload elif (( $DIETPI_INSTALL_STAGE == 1 )); then WHIP_TITLE='Exit DietPi-Software?' WHIP_QUESTION='Do you wish to exit DietPi-Software?\n\nAll changes to software selections will be cleared.' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --yes-button "Ok" --no-button "Back" --defaultno 11 65 - CHOICE=$? - if (( $CHOICE == 0 )); then - Banner_Aborted - #Exit script NOW - exit - else - #Return to Main Menu - TARGETMENUID=0 - fi - fi - } - - Menu_ConfirmInstall(){ - - ##create temp file with list of software selected for install. - #Write_InstallFileList 1 - ##Load data into a 1 line string - #local string_output=$(cat /tmp/dietpi-software_selected | grep -m1 ' 1' | sed 's/ 1//g' | paste -s -d' ') - #rm /tmp/dietpi-software_selected - - #Leave this until we have a SQL database to read the list from. - - #Confirm Software install - WHIP_TITLE='DietPi - Start Installation?' - WHIP_QUESTION="DietPi is now ready to install your software choices.\n\nSoftware details, usernames, passwords etc:\n - http://dietpi.com/software\n\nWould you like to begin?" - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 13 70 - CHOICE=$? - if (( $CHOICE == 0 )); then - #exit menu system - TARGETMENUID=-1 - - #Enable installation start flag - GOSTARTINSTALL=1 - else - #Return to Main Menu - TARGETMENUID=0 - fi - - } - - Menu_StartInstall(){ - - #Check if the user has made changes to their software selections. - if (( $INSTALL_DIETPI_CHOICESMADE || - $INSTALL_LINUX_CHOICESMADE || - $INSTALL_SSHSERVER_CHOICESMADE || - $INSTALL_FILESERVER_CHOICESMADE || - $INSTALL_LOGGING_CHOICESMADE )); then - - # Confirm install with user - Menu_ConfirmInstall - - else - #1st run install - if (( $DIETPI_INSTALL_STAGE == 0 )); then - WHIP_TITLE='No Software Selected. Continue?' - WHIP_QUESTION='DietPi was unable to detect any software selections for install. Do you wish to continue?\n\nBy selecting Ok: \n- DietPi optimized software will NOT be installed.\nYou can use dietpi-software at a later date if you change your mind. \n\n- You want a Minimal Raspbian/Debian Server Install.\nDietPi is a minimal image. A great OS base to use with your projects.' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --yes-button "Ok" --no-button "Back" --defaultno 16 75 - CHOICE=$? - if (( $CHOICE == 0 )); then - #exit menu system - TARGETMENUID=-1 - - #Enable installation start flag - GOSTARTINSTALL=1 - else - #Return to Main Menu - TARGETMENUID=0 - fi - #Not 1st run - elif (( $DIETPI_INSTALL_STAGE == 1 )); then - WHIP_TITLE='No Changes to Software Selection' - whiptail --title "$WHIP_TITLE" --msgbox "No changes have been detected. Unable to start installation." 8 65 - fi - - fi - } - - #TARGETMENUID=1 - Menu_Dietpi_Software(){ - - #Reset Choices made flag - INSTALL_DIETPI_CHOICESMADE=0 - - #Obtain On/Off state for whiptail menu - local grasshopper_w="off" - if (( $GRASSHOPPER > 0 )); then - grasshopper_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $GRASSHOPPER == 1 )); then - GRASSHOPPER=0 - fi - fi - - local emonhub_w="off" - if (( $EMONHUB > 0 )); then - emonhub_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $EMONHUB == 1 )); then - EMONHUB=0 - fi - fi - - local desktop_lxde_w="off" - if (( $DESKTOP_LXDE > 0 )); then - desktop_lxde_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DESKTOP_LXDE == 1 )); then - DESKTOP_LXDE=0 - fi - fi - - local desktop_mate_w="off" - if (( $DESKTOP_MATE > 0 )); then - desktop_mate_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DESKTOP_MATE == 1 )); then - DESKTOP_MATE=0 - fi - fi - - #Desktop GNUSetp - local desktop_gnustep_w="off" - if (( $DESKTOP_GNUSTEP > 0 )); then - desktop_gnustep_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DESKTOP_GNUSTEP == 1 )); then - DESKTOP_GNUSTEP=0 - fi - fi - - local desktop_xfce_w="off" - if (( $DESKTOP_XFCE > 0 )); then - desktop_xfce_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DESKTOP_XFCE == 1 )); then - DESKTOP_XFCE=0 - fi - fi - - local transmission_w="off" - if (( $TRANSMISSION > 0 )); then - transmission_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $TRANSMISSION == 1 )); then - TRANSMISSION=0 - fi - fi - - local openbazaar_w="off" - if (( $OPENBAZAAR > 0 )); then - openbazaar_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $OPENBAZAAR == 1 )); then - OPENBAZAAR=0 - fi - fi - - local owncloud_w="off" - if (( $OWNCLOUD > 0 )); then - owncloud_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $OWNCLOUD == 1 )); then - OWNCLOUD=0 - fi - fi - - local phpbb_w="off" - if (( $PHPBB > 0 )); then - phpbb_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PHPBB == 1 )); then - PHPBB=0 - fi - fi - - local webserver_lamp_w="off" - if (( $WEBSERVER_LAMP > 0 )); then - webserver_lamp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LAMP == 1 )); then - WEBSERVER_LAMP=0 - fi - fi - - local webserver_lasp_w="off" - if (( $WEBSERVER_LASP > 0 )); then - webserver_lasp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LASP == 1 )); then - WEBSERVER_LASP=0 - fi - fi - - local webserver_laap_w="off" - if (( $WEBSERVER_LAAP > 0 )); then - webserver_laap_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LAAP == 1 )); then - WEBSERVER_LAAP=0 - fi - fi - - local webserver_lemp_w="off" - if (( $WEBSERVER_LEMP > 0 )); then - webserver_lemp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LEMP == 1 )); then - WEBSERVER_LEMP=0 - fi - fi - - local webserver_lesp_w="off" - if (( $WEBSERVER_LESP > 0 )); then - webserver_lesp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LESP == 1 )); then - WEBSERVER_LESP=0 - fi - fi - - local webserver_leap_w="off" - if (( $WEBSERVER_LEAP > 0 )); then - webserver_leap_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LEAP == 1 )); then - WEBSERVER_LEAP=0 - fi - fi - - local webserver_llmp_w="off" - if (( $WEBSERVER_LLMP > 0 )); then - webserver_llmp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LLMP == 1 )); then - WEBSERVER_LLMP=0 - fi - fi - - local webserver_llsp_w="off" - if (( $WEBSERVER_LLSP > 0 )); then - webserver_llsp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LLSP == 1 )); then - WEBSERVER_LLSP=0 - fi - fi - - local webserver_llap_w="off" - if (( $WEBSERVER_LLAP > 0 )); then - webserver_llap_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_LLAP == 1 )); then - WEBSERVER_LLAP=0 - fi - fi - - local webserver_phpmyadmin_w="off" - if (( $WEBSERVER_MYADMINPHP > 0 )); then - webserver_phpmyadmin_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_MYADMINPHP == 1 )); then - WEBSERVER_MYADMINPHP=0 - fi - fi - - local webserver_redis_w="off" - if (( $WEBSERVER_REDIS > 0 )); then - webserver_redis_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBSERVER_REDIS == 1 )); then - WEBSERVER_REDIS=0 - fi - fi - - local fileserver_proftp_w="off" - if (( $FILESERVER_PROFTP > 0 )); then - fileserver_proftp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $FILESERVER_PROFTP == 1 )); then - FILESERVER_PROFTP=0 - fi - fi - - local fileserver_samba_w="off" - if (( $FILESERVER_SAMBA > 0 )); then - fileserver_samba_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $FILESERVER_SAMBA == 1 )); then - FILESERVER_SAMBA=0 - fi - fi - - local fileserver_vsftpd_w="off" - if (( $FILESERVER_VSFTPD > 0 )); then - fileserver_vsftpd_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $FILESERVER_VSFTPD == 1 )); then - FILESERVER_VSFTPD=0 - fi - fi - - local hifi_w="off" - if (( $HIFI > 0 )); then - hifi_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $HIFI == 1 )); then - HIFI=0 - fi - fi - - local kodi_w="off" - if (( $KODI > 0 )); then - kodi_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $KODI == 1 )); then - KODI=0 - fi - fi - - local minidlna_w="off" - if (( $MINIDLNA > 0 )); then - minidlna_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MINIDLNA == 1 )); then - MINIDLNA=0 - fi - fi - - local noipdyndns_w="off" - if (( $NOIPDYNDNS > 0 )); then - noipdyndns_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NOIPDYNDNS == 1 )); then - NOIPDYNDNS=0 - fi - fi - - local opentyrian_w="off" - if (( $OPENTYRIAN > 0 )); then - opentyrian_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $OPENTYRIAN == 1 )); then - OPENTYRIAN=0 - fi - fi - - local dietpicam_w="off" - if (( $DIETPICAM > 0 )); then - dietpicam_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DIETPICAM == 1 )); then - DIETPICAM=0 - fi - fi - - local deluge_w="off" - if (( $DELUGE > 0 )); then - deluge_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DELUGE == 1 )); then - DELUGE=0 - fi - fi - - local raspcontrol_w="off" - if (( $RASPCONTROL > 0 )); then - raspcontrol_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $RASPCONTROL == 1 )); then - RASPCONTROL=0 - fi - fi - - local linuxdash_w="off" - if (( $LINUXDASH > 0 )); then - linuxdash_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $LINUXDASH == 1 )); then - LINUXDASH=0 - fi - fi - - local pihole_w="off" - if (( $PIHOLE > 0 )); then - pihole_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PIHOLE == 1 )); then - PIHOLE=0 - fi - fi - - local subsonic5_w="off" - if (( $SUBSONIC5 > 0 )); then - subsonic5_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SUBSONIC5 == 1 )); then - SUBSONIC5=0 - fi - fi - - local subsonic6_w="off" - if (( $SUBSONIC6 > 0 )); then - subsonic6_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SUBSONIC6 == 1 )); then - SUBSONIC6=0 - fi - fi - - local webiopi_w="off" - if (( $WEBIOPI > 0 )); then - webiopi_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEBIOPI == 1 )); then - WEBIOPI=0 - fi - fi - - local weaved_w="off" - if (( $WEAVED > 0 )); then - weaved_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WEAVED == 1 )); then - WEAVED=0 - fi - fi - - local dietpicloudshell_w="off" - if (( $DIETPICLOUDSHELL > 0 )); then - dietpicloudshell_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $DIETPICLOUDSHELL == 1 )); then - DIETPICLOUDSHELL=0 - fi - fi - - local haproxy_w="off" - if (( $HAPROXY > 0 )); then - haproxy_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $HAPROXY == 1 )); then - HAPROXY=0 - fi - fi - - local squeezeboxserver_w="off" - if (( $SQUEEZEBOXSERVER > 0 )); then - squeezeboxserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SQUEEZEBOXSERVER == 1 )); then - SQUEEZEBOXSERVER=0 - fi - fi - - local wordpress_w="off" - if (( $WORDPRESS > 0 )); then - wordpress_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WORDPRESS == 1 )); then - WORDPRESS=0 - fi - fi - - local tightvncserver_w="off" - if (( $TIGHTVNCSERVER > 0 )); then - tightvncserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $TIGHTVNCSERVER == 1 )); then - TIGHTVNCSERVER=0 - fi - fi - - local vnc4server_w="off" - if (( $VNC4SERVER > 0 )); then - vnc4server_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $VNC4SERVER == 1 )); then - VNC4SERVER=0 - fi - fi - - local fail2ban_w="off" - if (( $FAIL2BAN > 0 )); then - fail2ban_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $FAIL2BAN == 1 )); then - FAIL2BAN=0 - fi - fi - - local phpsysinfo_w="off" - if (( $PHPSYSINFO > 0 )); then - phpsysinfo_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PHPSYSINFO == 1 )); then - PHPSYSINFO=0 - fi - fi - - local phpimagegallery_w="off" - if (( $PHPIMAGEGALLERY > 0 )); then - phpimagegallery_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PHPIMAGEGALLERY == 1 )); then - PHPIMAGEGALLERY=0 - fi - fi - - local ampache_w="off" - if (( $AMPACHE > 0 )); then - ampache_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $AMPACHE == 1 )); then - AMPACHE=0 - fi - fi - - local openvpnserver_w="off" - if (( $OPENVPNSERVER > 0 )); then - openvpnserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $OPENVPNSERVER == 1 )); then - OPENVPNSERVER=0 - fi - fi - - local letsencrypt_w="off" - if (( $LETSENCRYPT > 0 )); then - letsencrypt_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $LETSENCRYPT == 1 )); then - LETSENCRYPT=0 - fi - fi - - local wiringpi_w="off" - if (( $WIRINGPI > 0 )); then - wiringpi_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WIRINGPI == 1 )); then - WIRINGPI=0 - fi - fi - - local rpigpio_w="off" - if (( $RPIGPIO > 0 )); then - rpigpio_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $RPIGPIO == 1 )); then - RPIGPIO=0 - fi - fi - - local rpii2c_w="off" - if (( $RPII2C > 0 )); then - rpii2c_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $RPII2C == 1 )); then - RPII2C=0 - fi - fi - - local wifihotspot_w="off" - if (( $WIFIHOTSPOT > 0 )); then - wifihotspot_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $WIFIHOTSPOT == 1 )); then - WIFIHOTSPOT=0 + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --yes-button "Ok" --no-button "Back" --defaultno 11 65 + CHOICE=$? + if (( $CHOICE == 0 )); then + Banner_Aborted + #Exit script NOW + Exit_Destroy + else + #Return to Main Menu + TARGETMENUID=0 fi fi + } + Menu_ConfirmInstall(){ - local torhotspot_w="off" - if (( $TORHOTSPOT > 0 )); then - torhotspot_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $TORHOTSPOT == 1 )); then - TORHOTSPOT=0 - fi - fi - - local shairportsync_w="off" - if (( $SHAIRPORTSYNC > 0 )); then - shairportsync_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SHAIRPORTSYNC == 1 )); then - SHAIRPORTSYNC=0 - fi - fi + #Obtain list of pending software installation: + local string_output='' + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do - local brutefir_w="off" - if (( $BRUTEFIR > 0 )); then - brutefir_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $BRUTEFIR == 1 )); then - BRUTEFIR=0 - fi - fi + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - local pydio_w="off" - if (( $PYDIO > 0 )); then - pydio_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PYDIO == 1 )); then - PYDIO=0 - fi - fi + string_output+="\n - ${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}" - local squeezelite_w="off" - if (( $SQUEEZELITE > 0 )); then - squeezelite_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SQUEEZELITE == 1 )); then - SQUEEZELITE=0 fi - fi - #RPIMONITOR - local rpimonitor_w="off" - if (( $RPIMONITOR > 0 )); then - rpimonitor_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $RPIMONITOR == 1 )); then - RPIMONITOR=0 - fi - fi + done - #BAIKAL - local baikal_w="off" - if (( $BAIKAL > 0 )); then - baikal_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $BAIKAL == 1 )); then - BAIKAL=0 - fi - fi + #Confirm Software install + WHIP_TITLE='DietPi - Start Installation?' + WHIP_QUESTION="DietPi is now ready to install your software choices: $string_output\n\nSoftware details, usernames, passwords etc:\n - http://dietpi.com/software\n\nWould you like to begin?" + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 20 70 + CHOICE=$? + if (( $CHOICE == 0 )); then - #NETDATA - local netdata_w="off" - if (( $NETDATA > 0 )); then - netdata_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NETDATA == 1 )); then - NETDATA=0 - fi - fi + #exit menu system + TARGETMENUID=-1 - #MUMBLESERVER - local mumbleserver_w="off" - if (( $MUMBLESERVER > 0 )); then - mumbleserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MUMBLESERVER == 1 )); then - MUMBLESERVER=0 - fi - fi + #Enable installation start flag + GOSTARTINSTALL=1 - #EMBYSERVER - local embyserver_w="off" - if (( $EMBYSERVER > 0 )); then - embyserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $EMBYSERVER == 1 )); then - EMBYSERVER=0 - fi - fi + else - #PLEXMEDIASERVER - local plexmediaserver_w="off" - if (( $PLEXMEDIASERVER > 0 )); then - plexmediaserver_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $PLEXMEDIASERVER == 1 )); then - PLEXMEDIASERVER=0 - fi - fi + #Return to Main Menu + TARGETMENUID=0 - #Remote Desktop: XRDP - local xrdp_w="off" - if (( $XRDP > 0 )); then - xrdp_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $XRDP == 1 )); then - XRDP=0 - fi fi - #Remote Desktop: No Machine - local nomachine_w="off" - if (( $NOMACHINE > 0 )); then - nomachine_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NOMACHINE == 1 )); then - NOMACHINE=0 - fi - fi + } - local cuberite_w="off" - if (( $CUBERITE > 0 )); then - cuberite_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $CUBERITE == 1 )); then - CUBERITE=0 - fi - fi + Menu_StartInstall(){ - local mineos_w="off" - if (( $MINEOS > 0 )); then - mineos_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MINEOS == 1 )); then - MINEOS=0 - fi - fi + #Check if the user has made changes to their software selections. + if (( $INSTALL_DIETPI_CHOICESMADE || + $INSTALL_LINUX_CHOICESMADE || + $INSTALL_SSHSERVER_CHOICESMADE || + $INSTALL_FILESERVER_CHOICESMADE || + $INSTALL_LOGGING_CHOICESMADE )); then - local gogs_w="off" - if (( $GOGS > 0 )); then - gogs_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $GOGS == 1 )); then - GOGS=0 - fi - fi + # Confirm install with user + Menu_ConfirmInstall - local qbittorrent_w="off" - if (( $QBITTORRENT > 0 )); then - qbittorrent_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $QBITTORRENT == 1 )); then - QBITTORRENT=0 - fi - fi + else - local syncthing_w="off" - if (( $SYNCTHING > 0 )); then - syncthing_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SYNCTHING == 1 )); then - SYNCTHING=0 - fi - fi + #1st run install + if (( $DIETPI_INSTALL_STAGE == 0 )); then - #----------------------------------------------------------------------------- - WHIP_TITLE='DietPi Optimized Software Selection' + WHIP_TITLE='No Software Selected. Continue?' + WHIP_QUESTION='DietPi was unable to detect any software selections for install. Do you wish to continue?\n\nBy selecting Ok: \n- DietPi optimized software will NOT be installed.\nYou can use dietpi-software at a later date if you change your mind. \n\n- You want a Minimal Raspbian/Debian Server Install.\nDietPi is a minimal image. A great OS base to use with your projects.' + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --yes-button "Ok" --no-button "Back" --defaultno 16 75 + CHOICE=$? + if (( $CHOICE == 0 )); then - #----------------------------------------------------------------------------- - #ARM64 (Pine A64/A64+ | C2) Software Installation - if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ - "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ - "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ - "XFCE: Desktop" "lightweight desktop environment." $desktop_xfce_w \ - "" "────Remote Desktop Access──────────────────" "off" \ - "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ - "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ - "" "────Media Systems───────────────────────────" "off" \ - "Kodi" "Your very own media centre / player." $kodi_w \ - "HiFi" "Web interface music / radio player." $hifi_w \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "Shairport Sync" "AirPlay audio player with multiroom sync" $shairportsync_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "Murmur" "Mumble VoIP server." $mumbleserver_w \ - "" "────BitTorrent──────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "qBitTorrent" "BitTorrent server with web interface." $qbittorrent_w \ - "" "────Cloud / Backups─────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "Pydio" "Feature-rich backup and sync server" $pydio_w \ - "Syncthing" "Backup and sync server with web interface." $syncthing_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "BaiKal" "Lightweight CalDAV + CardDAV server." $baikal_w \ - "OpenBazaar" "Decentralized peer to peer Bitcoin market." $openbazaar_w \ - "" "────WiFi Hotspot────────────────────────────" "off" \ - "WiFi Hotspot" "Turn your device into a WiFi hotspot." $wifihotspot_w \ - "Tor Hotspot" "Optional: Route HotSpot traffic through Tor." $torhotspot_w \ - "" "────Remote Access───────────────────────────" "off" \ - "Weaved" "Access your device over the internet." $weaved_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "netdata" "real-time performance monitoring" $netdata_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LAAP" "Webserver: Apache2 | MariaDB | Php." $webserver_laap_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "LEAP" "Webserver: Nginx | MariaDB | Php." $webserver_leap_w \ - "LLMP" "Webserver: Lighttpd | MySql | Php." $webserver_llmp_w \ - "LLSP" "Webserver: Lighttpd | SQLite | Php." $webserver_llsp_w \ - "LLAP" "Webserver: Lighttpd | MariaDB | Php." $webserver_llap_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "CertBot" "Free, auto SSL cert install allowing https://" $letsencrypt_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results + #exit menu system + TARGETMENUID=-1 - #----------------------------------------------------------------------------- - #H3 + A20 Software Installation (basically all devices without supported and implimented GPU/VPU accel) - elif (( $HW_MODEL == 30 || $HW_MODEL == 50 || $HW_MODEL == 51 )); then - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ - "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ - "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ - "XFCE: Desktop" "lightweight desktop environment." $desktop_xfce_w \ - "" "────Remote Desktop Access──────────────────" "off" \ - "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ - "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ - "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ - "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ - "" "────Media Systems───────────────────────────" "off" \ - "HiFi" "Web interface music / radio player." $hifi_w \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "Shairport Sync" "AirPlay audio player with multiroom sync" $shairportsync_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "Plex Server" "Web interface media streaming server." $plexmediaserver_w \ - "Murmur" "Mumble VoIP server." $mumbleserver_w \ - "" "────BitTorrent──────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "qBitTorrent" "BitTorrent server with web interface." $qbittorrent_w \ - "" "────Cloud / Backups─────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "Pydio" "Feature-rich backup and sync server" $pydio_w \ - "Gogs" "Personal GitHub server with web interface" $gogs_w \ - "Syncthing" "Backup and sync server with web interface." $syncthing_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ - "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "BaiKal" "Lightweight CalDAV + CardDAV server." $baikal_w \ - "OpenBazaar" "Decentralized peer to peer Bitcoin market." $openbazaar_w \ - "" "────WiFi Hotspot────────────────────────────" "off" \ - "WiFi Hotspot" "Turn your device into a WiFi hotspot." $wifihotspot_w \ - "Tor Hotspot" "Optional: Route HotSpot traffic through Tor." $torhotspot_w \ - "" "────Remote Access───────────────────────────" "off" \ - "Weaved" "Access your device over the internet." $weaved_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "netdata" "real-time performance monitoring" $netdata_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LAAP" "Webserver: Apache2 | MariaDB | Php." $webserver_laap_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "LEAP" "Webserver: Nginx | MariaDB | Php." $webserver_leap_w \ - "LLMP" "Webserver: Lighttpd | MySql | Php." $webserver_llmp_w \ - "LLSP" "Webserver: Lighttpd | SQLite | Php." $webserver_llsp_w \ - "LLAP" "Webserver: Lighttpd | MariaDB | Php." $webserver_llap_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "CertBot" "Free, auto SSL cert install allowing https://" $letsencrypt_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results + #Enable installation start flag + GOSTARTINSTALL=1 - #----------------------------------------------------------------------------- - #VM Software Installation - elif (( $HW_MODEL == 20 )); then - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops───────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ - "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ - "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ - "XFCE: Desktop" "lightweight desktop environment." $desktop_xfce_w \ - "" "────Remote Desktop Access──────────────────" "off" \ - "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ - "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ - "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ - "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ - "" "────Media Systems──────────────────────────" "off" \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "Emby Server" "Web interface media streaming server." $embyserver_w \ - "Plex Server" "Web interface media streaming server." $plexmediaserver_w \ - "Murmur" "Mumble VoIP server." $mumbleserver_w \ - "" "────BitTorrent─────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "qBitTorrent" "BitTorrent server with web interface." $qbittorrent_w \ - "" "────Cloud / Backups────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "Pydio" "Feature-rich backup and sync server" $pydio_w \ - "Gogs" "Personal GitHub server with web interface" $gogs_w \ - "Syncthing" "Backup and sync server with web interface." $syncthing_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ - "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "BaiKal" "Lightweight CalDAV + CardDAV server." $baikal_w \ - "OpenBazaar" "Decentralized peer to peer Bitcoin market." $openbazaar_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LAAP" "Webserver: Apache2 | MariaDB | Php." $webserver_laap_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "LEAP" "Webserver: Nginx | MariaDB | Php." $webserver_leap_w \ - "LLMP" "Webserver: Lighttpd | MySql | Php." $webserver_llmp_w \ - "LLSP" "Webserver: Lighttpd | SQLite | Php." $webserver_llsp_w \ - "LLAP" "Webserver: Lighttpd | MariaDB | Php." $webserver_llap_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "CertBot" "Free, auto SSL cert install allowing https://" $letsencrypt_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results + else - #----------------------------------------------------------------------------- - #Odroid XU4 + C1 Software Installation - elif (( $HW_MODEL == 10 || $HW_MODEL == 11 )); then - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ - "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ - "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ - "XFCE: Desktop" "lightweight desktop environment." $desktop_xfce_w \ - "" "────Remote Desktop Access──────────────────" "off" \ - "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ - "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ - "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ - "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ - "" "────Media Systems───────────────────────────" "off" \ - "Kodi" "Your very own media centre / player." $kodi_w \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "Shairport Sync" "AirPlay audio player with multiroom sync" $shairportsync_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "Emby Server" "Web interface media streaming server." $embyserver_w \ - "Plex Server" "Web interface media streaming server." $plexmediaserver_w \ - "Murmur" "Mumble VoIP server." $mumbleserver_w \ - "" "────BitTorrent──────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "qBitTorrent" "BitTorrent server with web interface." $qbittorrent_w \ - "" "────Cloud / Backups─────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "Pydio" "Feature-rich backup and sync server" $pydio_w \ - "Gogs" "Personal GitHub server with web interface" $gogs_w \ - "Syncthing" "Backup and sync server with web interface." $syncthing_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ - "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "BaiKal" "Lightweight CalDAV + CardDAV server." $baikal_w \ - "OpenBazaar" "Decentralized peer to peer Bitcoin market." $openbazaar_w \ - "" "────WiFi Hotspot────────────────────────────" "off" \ - "WiFi Hotspot" "Turn your device into a WiFi hotspot." $wifihotspot_w \ - "Tor Hotspot" "Optional: Route HotSpot traffic through Tor." $torhotspot_w \ - "" "────Remote Access───────────────────────────" "off" \ - "Weaved" "Access your device over the internet." $weaved_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "netdata" "real-time performance monitoring" $netdata_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LAAP" "Webserver: Apache2 | MariaDB | Php." $webserver_laap_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "LEAP" "Webserver: Nginx | MariaDB | Php." $webserver_leap_w \ - "LLMP" "Webserver: Lighttpd | MySql | Php." $webserver_llmp_w \ - "LLSP" "Webserver: Lighttpd | SQLite | Php." $webserver_llsp_w \ - "LLAP" "Webserver: Lighttpd | MariaDB | Php." $webserver_llap_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "CertBot" "Free, auto SSL cert install allowing https://" $letsencrypt_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results + #Return to Main Menu + TARGETMENUID=0 - #----------------------------------------------------------------------------- - #Rpi Software Installation - elif (( $HW_MODEL < 10 )); then + fi - #Jessie - if (( $DISTRO == 3 )); then + #Not 1st run + elif (( $DIETPI_INSTALL_STAGE == 1 )); then - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ - "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ - "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ - "XFCE: Desktop" "lightweight desktop environment." $desktop_xfce_w \ - "" "────Remote Desktop Access──────────────────" "off" \ - "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ - "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ - "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ - "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ - "" "────Media Systems───────────────────────────" "off" \ - "Kodi" "Your very own media centre / player." $kodi_w \ - "HiFi" "Web interface music / radio player." $hifi_w \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "SqueezeBox" "Logitech Media Server (LMS)." $squeezeboxserver_w \ - "SqueezeLite" "Audio player for LMS" $squeezelite_w \ - "Shairport Sync" "AirPlay audio player with multiroom sync" $shairportsync_w \ - "BruteFIR" "EQ and Digital Room Correction via ALSA." $brutefir_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "Emby Server" "Web interface media streaming server." $embyserver_w \ - "Plex Server" "Web interface media streaming server." $plexmediaserver_w \ - "Murmur" "Mumble VoIP server." $mumbleserver_w \ - "" "────BitTorrent──────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "qBitTorrent" "BitTorrent server with web interface." $qbittorrent_w \ - "" "────Cloud / Backups─────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "Pydio" "Feature-rich backup and sync server" $pydio_w \ - "Gogs" "Personal GitHub server with web interface" $gogs_w \ - "Syncthing" "Backup and sync server with web interface." $syncthing_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "OpenTyrian" "Gaming: A classic retro game, addictive." $opentyrian_w \ - "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ - "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "BaiKal" "Lightweight CalDAV + CardDAV server." $baikal_w \ - "OpenBazaar" "Decentralized peer to peer Bitcoin market." $openbazaar_w \ - "" "────Camera / Surveillance───────────────────" "off" \ - "DietPi Cam" "RPi Cam Control / Web Interface Surveillance." $dietpicam_w \ - "" "────WiFi Hotspot────────────────────────────" "off" \ - "WiFi Hotspot" "Turn your device into a WiFi hotspot." $wifihotspot_w \ - "Tor Hotspot" "Optional: Route HotSpot traffic through Tor." $torhotspot_w \ - "" "────Home Automation─────────────────────────" "off" \ - "EmonPi" "Energy usage addon board with web interface." $emonhub_w \ - "Grasshopper" "Web App to control Bticino MyHome." $grasshopper_w \ - "" "────RPi Hardware Projects───────────────────" "off" \ - "RPi.GPIO" "GPIO Interface library for RPi (python)." $rpigpio_w \ - "WiringPi" "GPIO Interface library for RPi (c)." $wiringpi_w \ - "WebIOPi" "Web interface to control RPi.GPIO." $webiopi_w \ - "I2c" "Enables support for I2c based hardware." $rpii2c_w \ - "" "────Remote Access───────────────────────────" "off" \ - "Weaved" "Access your device over the internet." $weaved_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "netdata" "real-time performance monitoring" $netdata_w \ - "RPi-Monitor" "Web interface system stats." $rpimonitor_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LAAP" "Webserver: Apache2 | MariaDB | Php." $webserver_laap_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "LEAP" "Webserver: Nginx | MariaDB | Php." $webserver_leap_w \ - "LLMP" "Webserver: Lighttpd | MySql | Php." $webserver_llmp_w \ - "LLSP" "Webserver: Lighttpd | SQLite | Php." $webserver_llsp_w \ - "LLAP" "Webserver: Lighttpd | MariaDB | Php." $webserver_llap_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "Redis" "Optional non-SQL database store." $webserver_redis_w \ - "CertBot" "Free, auto SSL cert install allowing https://" $letsencrypt_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results - - #Wheezy - elif (( $DISTRO == 1 )); then - - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ - "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_lxde_w \ - "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ - "" "────Media Systems───────────────────────────" "off" \ - "Kodi" "Your very own media centre / player." $kodi_w \ - "HiFi" "Web interface music / radio player." $hifi_w \ - "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ - "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ - "SqueezeBox" "Logitech Media Server (LMS)." $squeezeboxserver_w \ - "MiniDLNA" "Media streaming server (DLNA, UPnP)." $minidlna_w \ - "Ampache" "Web interface media streaming server." $ampache_w \ - "" "────BitTorrent──────────────────────────────" "off" \ - "Transmission" "BitTorrent server with web interface." $transmission_w \ - "Deluge" "BitTorrent server with web interface." $deluge_w \ - "" "────Gaming──────────────────────────────────" "off" \ - "OpenTyrian" "Gaming: A classic retro game, addictive." $opentyrian_w \ - "" "────Cloud / Backups─────────────────────────" "off" \ - "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ - "" "────Social Media───────────────────────────" "off" \ - "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ - "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ - "Image Gallery" "Website to host / browse your images." $phpimagegallery_w \ - "" "────Camera / Surveillance───────────────────" "off" \ - "DietPi Cam" "RPi Cam Control / Web Interface Surveillance." $dietpicam_w \ - "" "────WiFi Hotspot────────────────────────────" "off" \ - "WiFi Hotspot" "Turn your device into a WiFi hotspot." $wifihotspot_w \ - "" "────Home Automation─────────────────────────" "off" \ - "Grasshopper" "Web App to control Bticino MyHome." $grasshopper_w \ - "" "────RPi Hardware Projects───────────────────" "off" \ - "RPi.GPIO" "GPIO Interface library for RPi (python)." $rpigpio_w \ - "WiringPi" "GPIO Interface library for RPi (c)." $wiringpi_w \ - "WebIOPi" "Web interface to control RPi.GPIO." $webiopi_w \ - "I2c" "Enables support for I2c based hardware." $rpii2c_w \ - "" "────Remote Access──────────────────────────" "off" \ - "Weaved" "Access your device over the internet." $weaved_w \ - "" "────System Stats / Management──────────────" "off" \ - "DietPi-Cloudshell" "System stats for your LCD display or monitor." $dietpicloudshell_w \ - "Raspcontrol" "Web interface system stats." $raspcontrol_w \ - "LinuxDash" "Web interface system stats." $linuxdash_w \ - "PhpSysInfo" "Web interface system stats." $phpsysinfo_w \ - "" "────System Security────────────────────────" "off" \ - "Fail2Ban" "Prevents brute-force attacks with IP ban." $fail2ban_w \ - "" "────Webserver Stacks───────────────────────" "off" \ - "LAMP" "Webserver: Apache2 | MySql | Php." $webserver_lamp_w \ - "LASP" "Webserver: Apache2 | SQLite | Php." $webserver_lasp_w \ - "LEMP" "Webserver: Nginx | MySql | Php." $webserver_lemp_w \ - "LESP" "Webserver: Nginx | SQLite | Php." $webserver_lesp_w \ - "phpMyAdmin" "Optional MySql admin tools." $webserver_phpmyadmin_w \ - "" "────DNS Servers────────────────────────────" "off" \ - "Pi-hole" "Block adverts for any device on your network." $pihole_w \ - "" "────File Servers───────────────────────────" "off" \ - "ProFTP" "Lightweight FTP / file server." $fileserver_proftp_w \ - "vsFTPD" "Alternative FTP / file server." $fileserver_vsftpd_w \ - "Samba" "Feature-rich file server." $fileserver_samba_w \ - "" "────VPN Servers────────────────────────────" "off" \ - "OpenVPN" "VPN server." $openvpnserver_w \ - "" "────Network Load Balancing─────────────────" "off" \ - "HaProxy" "High performance TCP/HTTP load balancer." $haproxy_w \ - "" "────Website URLs───────────────────────────" "off" \ - "NoIp" "URL website address for your device." $noipdyndns_w 2>/tmp/dietpi-software_results + WHIP_TITLE='No Changes to Software Selection' + whiptail --title "$WHIP_TITLE" --msgbox "No changes have been detected. Unable to start installation." 8 65 fi fi + } + #TARGETMENUID=1 + Menu_Dietpi_Software(){ - while read choice - do - case $choice in + #----------------------------------------------------------------------------- + #Generate Whiptail menu and store results into our software arrays + Menu_CreateSoftwareList 0 - Syncthing) - if (( $SYNCTHING == 0 )); then - SYNCTHING=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - qBitTorrent) - if (( $QBITTORRENT == 0 )); then - QBITTORRENT=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "XFCE: Desktop") - if (( $DESKTOP_XFCE == 0 )); then - DESKTOP_XFCE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Gogs) - if (( $GOGS == 0 )); then - GOGS=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - MineOS) - if (( $MINEOS == 0 )); then - MINEOS=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Cuberite) - if (( $CUBERITE == 0 )); then - CUBERITE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "MATE: Desktop") - if (( $DESKTOP_MATE == 0 )); then - DESKTOP_MATE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "XRDP") - if (( $XRDP == 0 )); then - XRDP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "NoMachine") - if (( $NOMACHINE == 0 )); then - NOMACHINE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Plex Server") - if (( $PLEXMEDIASERVER == 0 )); then - PLEXMEDIASERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "SubSonic 5") - if (( $SUBSONIC5 == 0 )); then - SUBSONIC5=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "SubSonic 6") - if (( $SUBSONIC6 == 0 )); then - SUBSONIC6=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Emby Server") - if (( $EMBYSERVER == 0 )); then - EMBYSERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Murmur) - if (( $MUMBLESERVER == 0 )); then - MUMBLESERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Tor Hotspot") - if (( $TORHOTSPOT == 0 )); then - TORHOTSPOT=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - BaiKal) - if (( $BAIKAL == 0 )); then - BAIKAL=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "RPi-Monitor") - if (( $RPIMONITOR == 0 )); then - RPIMONITOR=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - EmonHUB|EmonPi) - if (( $EMONHUB == 0 )); then - EMONHUB=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Redis) - if (( $WEBSERVER_REDIS == 0 )); then - WEBSERVER_REDIS=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - SqueezeLite) - if (( $SQUEEZELITE == 0 )); then - SQUEEZELITE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Pydio) - if (( $PYDIO == 0 )); then - PYDIO=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - BruteFIR) - if (( $BRUTEFIR == 0 )); then - BRUTEFIR=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Shairport Sync") - if (( $SHAIRPORTSYNC == 0 )); then - SHAIRPORTSYNC=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "WiFi Hotspot") - if (( $WIFIHOTSPOT == 0 )); then - WIFIHOTSPOT=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - RPi.GPIO) - if (( $RPIGPIO == 0 )); then - RPIGPIO=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - I2c) - if (( $RPII2C == 0 )); then - RPII2C=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - WiringPi) - if (( $WIRINGPI == 0 )); then - WIRINGPI=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - CertBot) - if (( $LETSENCRYPT == 0 )); then - LETSENCRYPT=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - OpenVPN) - if (( $OPENVPNSERVER == 0 )); then - OPENVPNSERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Ampache) - if (( $AMPACHE == 0 )); then - AMPACHE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Image Gallery") - if (( $PHPIMAGEGALLERY == 0 )); then - PHPIMAGEGALLERY=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - PhpSysInfo) - if (( $PHPSYSINFO == 0 )); then - PHPSYSINFO=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Fail2Ban) - if (( $FAIL2BAN == 0 )); then - FAIL2BAN=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "TightVNC Server") - if (( $TIGHTVNCSERVER == 0 )); then - TIGHTVNCSERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "VNC4 Server") - if (( $VNC4SERVER == 0 )); then - VNC4SERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "GNUStep: Desktop") - if (( $DESKTOP_GNUSTEP == 0 )); then - DESKTOP_GNUSTEP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Wordpress) - if (( $WORDPRESS == 0 )); then - WORDPRESS=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - SqueezeBox) - if (( $SQUEEZEBOXSERVER == 0 )); then - SQUEEZEBOXSERVER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - HaProxy) - if (( $HAPROXY == 0 )); then - HAPROXY=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "DietPi-Cloudshell") - if (( $DIETPICLOUDSHELL == 0 )); then - DIETPICLOUDSHELL=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - WebIOPi) - if (( $WEBIOPI == 0 )); then - WEBIOPI=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Weaved) - if (( $WEAVED == 0 )); then - WEAVED=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "Pi-hole") - if (( $PIHOLE == 0 )); then - PIHOLE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Grasshopper) - if (( $GRASSHOPPER == 0 )); then - GRASSHOPPER=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LinuxDash) - if (( $LINUXDASH == 0 )); then - LINUXDASH=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "LXDE: Desktop") - if (( $DESKTOP_LXDE == 0 )); then - DESKTOP_LXDE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Kodi) - if (( $KODI == 0 )); then - KODI=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - OpenTyrian) - if (( $OPENTYRIAN == 0 )); then - OPENTYRIAN=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Transmission) - if (( $TRANSMISSION == 0 )); then - TRANSMISSION=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Deluge) - if (( $DELUGE == 0 )); then - DELUGE=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - OpenBazaar) - if (( $OPENBAZAAR == 0 )); then - OPENBAZAAR=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - OwnCloud) - if (( $OWNCLOUD == 0 )); then - OWNCLOUD=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - "DietPi Cam") - if (( $DIETPICAM == 0 )); then - DIETPICAM=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - MiniDLNA) - if (( $MINIDLNA == 0 )); then - MINIDLNA=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - HiFi) - if (( $HIFI == 0 )); then - HIFI=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Forums) - if (( $PHPBB == 0 )); then - PHPBB=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LAMP) - if (( $WEBSERVER_LAMP == 0 )); then - WEBSERVER_LAMP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LASP) - if (( $WEBSERVER_LASP == 0 )); then - WEBSERVER_LASP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LAAP) - if (( $WEBSERVER_LAAP == 0 )); then - WEBSERVER_LAAP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LEMP) - if (( $WEBSERVER_LEMP == 0 )); then - WEBSERVER_LEMP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LESP) - if (( $WEBSERVER_LESP == 0 )); then - WEBSERVER_LESP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LEAP) - if (( $WEBSERVER_LEAP == 0 )); then - WEBSERVER_LEAP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LLMP) - if (( $WEBSERVER_LLMP == 0 )); then - WEBSERVER_LLMP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LLSP) - if (( $WEBSERVER_LLSP == 0 )); then - WEBSERVER_LLSP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - LLAP) - if (( $WEBSERVER_LLAP == 0 )); then - WEBSERVER_LLAP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - phpMyAdmin) - if (( $WEBSERVER_MYADMINPHP == 0 )); then - WEBSERVER_MYADMINPHP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - ProFTP) - if (( $FILESERVER_PROFTP == 0 )); then - FILESERVER_PROFTP=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Samba) - if (( $FILESERVER_SAMBA == 0 )); then - FILESERVER_SAMBA=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - vsFTPD) - if (( $FILESERVER_VSFTPD == 0 )); then - FILESERVER_VSFTPD=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - NoIp) - if (( $NOIPDYNDNS == 0 )); then - NOIPDYNDNS=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - Raspcontrol) - if (( $RASPCONTROL == 0 )); then - RASPCONTROL=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - netdata) - if (( $NETDATA == 0 )); then - NETDATA=1 - INSTALL_DIETPI_CHOICESMADE=1 - fi - ;; - esac - done < /tmp/dietpi-software_results - rm /tmp/dietpi-software_results &> /dev/null + #Return to Main Menu + TARGETMENUID=0 #----------------------------------------------------------------------------- #Install Info/Warnings #Gogs: Requires OpenSSH for ssh-keygen binary: https://github.com/Fourdee/DietPi/issues/442 - if (( $GOGS == 1 && $INDEX_SSHSERVER_TARGET != -2 )); then + if (( ${aSOFTWARE_INSTALL_STATE[49]} == 1 && $INDEX_SSHSERVER_TARGET != -2 )); then WHIP_TITLE='Gogs: Requires OpenSSH' WHIP_QUESTION="Gogs requires OpenSSH server to function.\nIf you continue, OpenSSH will be selected for install on your system. OpenSSH will also replace Dropbear (if currently installed).\n\nWould you like to continue with the Gogs installation?" @@ -8323,65 +9189,53 @@ systemctl daemon-reload else - GOGS=0 + aSOFTWARE_INSTALL_STATE[49]=0 fi fi - #WebIOPi is only available for RPi <= 2 - if (( $HW_MODEL >= 3 && $WEBIOPI == 1 )); then - WHIP_TITLE='WebIOPi' - WHIP_QUESTION="WebIOPi is only available for RPi 1 and RPi 2 devices. Your selection has been removed.\n\nhttps://github.com/Fourdee/DietPi/issues/412" - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 12 65 - - WEBIOPI=0 - fi + #Webserver stacks, please let DietPi install them for you... + for ((i=74; i<=82; i++)) + do + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - #Disable Kodi for Pine64: https://github.com/Fourdee/DietPi/issues/380 - if (( $HW_MODEL >= 40 && $HW_MODEL < 50 && $KODI == 1 )); then - WHIP_TITLE='Kodi' - WHIP_QUESTION="Kodi for PineA64 is not currently functional and is disabled. Your selection has been removed.\n\nPlease see here for discussions and updates: https://github.com/Fourdee/DietPi/issues/380" - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 12 65 + WHIP_TITLE='Info: Webserver Stack' + WHIP_QUESTION="DietPi will automatically install a webserver stack (based on your Webserver Preference) when any software that requires a webserver is selected for installation (eg: Owncloud, PiHole etc).\n\nIt is highly recommended that you allow DietPi to do this for you, ensuring compatibility and stability across DietPi installed programs.\n\nPlease only select a webserver stack if you specifically need it, and, no other webserver stack is installed.\n\nTLDR: You do NOT need to select a webserver stack for installation with DietPi. Its all automatic." + whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 19 70 - KODI=0 - fi + break - #Webserver stacks, please let DietPi install them for you... - # - == 1 to prevent installed stacks appearing - if (( $WEBSERVER_LAMP == 1 || $WEBSERVER_LASP == 1 || $WEBSERVER_LAAP == 1 || - $WEBSERVER_LEMP == 1 || $WEBSERVER_LESP == 1 || $WEBSERVER_LEAP == 1 || - $WEBSERVER_LLMP == 1 || $WEBSERVER_LLSP == 1 || $WEBSERVER_LLAP == 1 )); then - WHIP_TITLE='Info: Webserver Stack' - WHIP_QUESTION="DietPi will automatically install a webserver stack (based on your Webserver Preference) when any software that requires a webserver is selected for installation (eg: Owncloud, PiHole etc).\n\nIt is highly recommended that you allow DietPi to do this for you, ensuring compatibility and stability across DietPi installed programs.\n\nPlease only select a webserver stack if you specifically need it, and, no other webserver stack is installed.\n\nTLDR: You do NOT need to select a webserver stack for installation with DietPi. Its all automatic." - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 19 70 + fi - fi + done #phpmyadmin + Lighttpd | broken apt-get installation. User must have a fully installed LLM* stack before phpmyadmin can be selected: #https://github.com/Fourdee/DietPi/issues/316#issuecomment-219474664 - if (( $WEBSERVER_MYADMINPHP == 1 && + if (( ${aSOFTWARE_INSTALL_STATE[90]} == 1 && $INDEX_WEBSERVER_TARGET == -2 && - ( $WEBSERVER_LLMP < 2 && $WEBSERVER_LLAP < 2 ) )); then + ( ${aSOFTWARE_INSTALL_STATE[80]} < 2 && ${aSOFTWARE_INSTALL_STATE[82]} < 2 ) )); then WHIP_TITLE='PhpMyAdmin' WHIP_QUESTION="Due to a apt-get installation issue with PhpMyAdmin, you must have a fully installed Lighttpd + Mysql/MaridaDB webserver stack, before PhpMyAdmin can be selected for install.\n\nYour selection for PhpMyAdmin has been removed." whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 13 70 - WEBSERVER_MYADMINPHP=0 - fi + aSOFTWARE_INSTALL_STATE[90]=0 + fi #DietPiCam - warn user of locking out camera: https://github.com/Fourdee/DietPi/issues/249 - if (( $DIETPICAM == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[59]} == 1 )); then + WHIP_TITLE='DietPi Cam - Camera' WHIP_QUESTION="DietPi Cam will automatically start and activate the camera during boot. This will prevent other programs (eg: raspistill) from using the camera.\n\nYou can free up the camera by selecting \"Stop Camera\" from the web interface:\nhttp://myip/dietpicam" whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 15 70 + fi #EmonHUB/EmonPi - if (( $EMONHUB == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[99]} == 1 )); then # - Enter API KEY # - Grab key from dietpi.txt @@ -8417,7 +9271,8 @@ systemctl daemon-reload fi #Pi-hole. prompt for static ip. - if (( $PIHOLE == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[93]} == 1 )); then + WHIP_TITLE=' Pi-hole - Setup Static IP Now?' WHIP_QUESTION='A static IP address is essential for Pi-hole installations. DietPi-Config can be used to quickly setup your static IP address.\n\nIf you have already setup your static IP, please ignore this message.\n\nWould you like to setup your static IP address now?' whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --defaultno --backtitle "$WHIP_BACKTITLE" 15 70 @@ -8435,8 +9290,8 @@ systemctl daemon-reload fi #Wifi Hotspot Criteria - if (( $WIFIHOTSPOT == 1 )) || - (( $TORHOTSPOT == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[60]} == 1 )) || + (( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )); then #Enable wifi modules /DietPi/dietpi/func/dietpi-set_hardware wifi enable @@ -8451,40 +9306,54 @@ systemctl daemon-reload local ethernet_active_state=$(ip r | grep -ci -m1 "eth$(sed -n 1p /DietPi/dietpi/.network)") if (( $ethernet_active_state == 1 )); then + WHIP_QUESTION+="\n\n - Ethernet online: PASSED" + else + criteria_passed=0 WHIP_QUESTION+="\n\n - Ethernet online: FAILED.\nUse dietpi-config to connect and configure ethernet." + fi if [ -d /sys/class/net/wlan$(sed -n 2p /DietPi/dietpi/.network) ]; then + WHIP_QUESTION+="\n\n - Wifi adapter detected: PASSED" + else + criteria_passed=0 WHIP_QUESTION+="\n\n - Wifi adapter detected: FAILED.\nPlease connect a WiFi adapter and try again." + fi #Passed if (( $criteria_passed == 1 )); then + WHIP_QUESTION+="\n\nPASSED: Criteria met. Good to go." whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 14 75 check_criteria=0 #Failed, retry? else + WHIP_QUESTION+="\n\nFAILED: Criteria not met. Would you like to check again?" whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 16 75 CHOICE=$? if (( $CHOICE == 0 )); then + echo "retry" &> /dev/null + else + # - Disable user selection check_criteria=0 - WIFIHOTSPOT=0 - TORHOTSPOT=0 + aSOFTWARE_INSTALL_STATE[60]=0 + aSOFTWARE_INSTALL_STATE[61]=0 whiptail --title "WiFi Hotspot Failed" --msgbox "WiFi Hotspot criteria was not met. Your selection has been removed." --backtitle "$WHIP_BACKTITLE" 10 65 fi + fi done @@ -8492,551 +9361,312 @@ systemctl daemon-reload fi #Weaved - if (( $WEAVED == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[68]} == 1 )); then + WHIP_TITLE=' Weaved - 1st run setup' WHIP_QUESTION='Weaved requires you to create an online account, and, link it this device.\n\nOnce DietPi has completed your software installations, and rebooted, please follow the First Run tutorial here:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=188#p188' whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 14 70 + fi #LetsEncrypt - if (( $LETSENCRYPT == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[92]} == 1 )); then + WHIP_TITLE='Lets Encrypt Info' WHIP_QUESTION='Currently, the DietPi installation of CertBot supports Apache2 (LAMP / LASP) only.\n\nOnce the installation has finished, you can setup your free SSL cert with:\n - DietPi-LetsEncrypt\n\nThis is a easy to use frontend for CertBot and allows intergration into DietPi systems.\n\nMore information:\n - http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1061#p1062' whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 18 70 - fi - - #RPi - if (( $HW_MODEL < 10 )); then - #Wheezy - if (( $DISTRO == 1 )); then - #Give full credit to Micheal and his Repo. - if (( $KODI == 1 )); then - WHIP_TITLE=' Kodi - Thanks to Michael Groven' - WHIP_QUESTION=' DietPi uses the Kodi installation which is provided by Michael Grovens excellent Repository \n \n For more information and to thank Michael for his hard work, please goto http://michael.gorven.za.net/raspberrypi/xbmc' - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 14 70 - fi - fi fi #----------------------------------------------------------------------------- #dietpi-config can be used to install/configure the following software. Ask user. #NoIp - - if (( $NOIPDYNDNS == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[67]} == 1 )); then + WHIP_TITLE='NoIp - Setup Now?' WHIP_QUESTION='NoIp can be setup and configured by using DietPi-Config. Would you like to go there now? \n\n- Once completed, exit DietPi-Config to resume setup. \n\n- More information:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=10#p58' whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Cancel" --defaultno --backtitle "$WHIP_BACKTITLE" 15 70 CHOICE=$? if (( $CHOICE == 0 )); then + + #Write installed states to temp + Write_InstallFileList temp + #Launch DietPi-config /DietPi/dietpi/dietpi-config 16 1 - #DietPi-Config will change .installed file, so reload new value into var - . "$FP_INSTALLED_FILE" + #Read installed states from temp + Read_InstallFileList temp fi + fi #----------------------------------------------------------------------------- #Installations that might require File server to access data. #Lets inform the user of File Server option - local inform_user_fileserver=0 - if (( $INDEX_FILESERVER_TARGET == 0 )); then - if (( $TRANSMISSION == 1 )); then - inform_user_fileserver=1 - elif (( $DELUGE == 1 )); then - inform_user_fileserver=1 - elif (( $MINIDLNA == 1 )); then - inform_user_fileserver=1 - elif (( $HIFI == 1 )); then - inform_user_fileserver=1 - elif (( $SQUEEZEBOXSERVER == 1 )); then - inform_user_fileserver=1 - elif (( $SUBSONIC5 == 1 || $SUBSONIC6 == 1 )); then - inform_user_fileserver=1 - elif (( $AMPACHE == 1 )); then - inform_user_fileserver=1 - elif (( $EMBYSERVER == 1 )); then - inform_user_fileserver=1 - elif (( $PLEXMEDIASERVER == 1 )); then - inform_user_fileserver=1 - fi - - if (( $inform_user_fileserver == 1 )); then - WHIP_TITLE='File Server Recommended' - WHIP_QUESTION="Your installation choices may benefit from a File Server. This would allow you to access and transfer files on this DietPi system.\n\nWhen you return to the main menu, select:\n- File Server\n\nThis will allow you to see the complete list of available fileserver choices." - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 16 70 - fi - fi + # local inform_user_fileserver=0 + # if (( $INDEX_FILESERVER_TARGET == 0 )); then + # if (( $TRANSMISSION == 1 )); then + # inform_user_fileserver=1 + # elif (( $DELUGE == 1 )); then + # inform_user_fileserver=1 + # elif (( $MINIDLNA == 1 )); then + # inform_user_fileserver=1 + # elif (( $HIFI == 1 )); then + # inform_user_fileserver=1 + # elif (( $SQUEEZEBOXSERVER == 1 )); then + # inform_user_fileserver=1 + # elif (( $SUBSONIC5 == 1 || $SUBSONIC6 == 1 )); then + # inform_user_fileserver=1 + # elif (( $AMPACHE == 1 )); then + # inform_user_fileserver=1 + # elif (( $EMBYSERVER == 1 )); then + # inform_user_fileserver=1 + # elif (( $PLEXMEDIASERVER == 1 )); then + # inform_user_fileserver=1 + # fi + + # if (( $inform_user_fileserver == 1 )); then + # WHIP_TITLE='File Server Recommended' + # WHIP_QUESTION="Your installation choices may benefit from a File Server. This would allow you to access and transfer files on this DietPi system.\n\nWhen you return to the main menu, select:\n- File Server\n\nThis will allow you to see the complete list of available fileserver choices." + # whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 16 70 + # fi + # fi #----------------------------------------------------------------------------- #Boot Choices local bootchoices_available=0 - if (( $DESKTOP_LXDE == 1 )); then - bootchoices_available=1 - elif (( $DESKTOP_MATE == 1 )); then - bootchoices_available=1 - elif (( $DESKTOP_GNUSTEP == 1 )); then - bootchoices_available=1 - elif (( $DESKTOP_XFCE == 1 )); then - bootchoices_available=1 - elif (( $KODI == 1 )); then - bootchoices_available=1 - elif (( $OPENTYRIAN == 1 )); then - bootchoices_available=1 - fi - - if (( $bootchoices_available == 1 )); then - # Set Boot Order - WHIP_TITLE=' DietPi - Boot Options' - WHIP_QUESTION='Would you like to configure the auto boot options for DietPi?\n\nThis will allow you to choose which program loads automatically after booting eg:\n - Console\n - Desktop\n - Kodi' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --defaultno --backtitle "$WHIP_BACKTITLE" 14 70 - CHOICE=$? - if (( $CHOICE == 0 )); then - /DietPi/dietpi/dietpi-autostart - fi - fi + if (( ${aSOFTWARE_INSTALL_STATE[23]} == 1 )); then - #Return to Main Menu - TARGETMENUID=0 - } + bootchoices_available=1 - #TARGETMENUID=2 - Menu_Linux_Software(){ + elif (( ${aSOFTWARE_INSTALL_STATE[24]} == 1 )); then - #Inform User that DietPi software will automatically install additional linux software when required. - WHIP_TITLE='Additional Linux Software' - WHIP_QUESTION='DietPi will automatically install additional Linux software on the next screen, when required (eg: Desktop LXDE will install ALSA + Xserver).\n\nThis means you only need to select the software you actually require.' - whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 12 70 + bootchoices_available=1 - #Reset Choices made flag - INSTALL_LINUX_CHOICESMADE=0 + elif (( ${aSOFTWARE_INSTALL_STATE[25]} == 1 )); then - #Obtain On/Off state for whiptail menu - local vimfull_w="off" - if (( $VIMFULL > 0 )); then - vimfull_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $VIMFULL == 1 )); then - VIMFULL=0 - fi - fi + bootchoices_available=1 - local vimtiny_w="off" - if (( $VIMTINY > 0 )); then - vimtiny_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $VIMTINY == 1 )); then - VIMTINY=0 - fi - fi + elif (( ${aSOFTWARE_INSTALL_STATE[26]} == 1 )); then - local gnuemacs_w="off" - if (( $GNUEMACS > 0 )); then - gnuemacs_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $GNUEMACS == 1 )); then - GNUEMACS=0 - fi - fi + bootchoices_available=1 - local jed_w="off" - if (( $JED > 0 )); then - jed_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $JED == 1 )); then - JED=0 - fi - fi + elif (( ${aSOFTWARE_INSTALL_STATE[31]} == 1 )); then - local midnightcommander_w="off" - if (( $MIDNIGHTCOMMANDER > 0 )); then - midnightcommander_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MIDNIGHTCOMMANDER == 1 )); then - MIDNIGHTCOMMANDER=0 - fi - fi + bootchoices_available=1 - local iftop_w="off" - if (( $IFTOP > 0 )); then - iftop_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IFTOP == 1 )); then - IFTOP=0 - fi - fi + elif (( ${aSOFTWARE_INSTALL_STATE[51]} == 1 )); then - local iptraf_w="off" - if (( $IPTRAF > 0 )); then - iptraf_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IPTRAF == 1 )); then - IPTRAF=0 - fi - fi + bootchoices_available=1 - local iperf_w="off" - if (( $IPERF > 0 )); then - iperf_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IPERF == 1 )); then - IPERF=0 - fi fi - local mtrtiny_w="off" - if (( $MTRTINY > 0 )); then - mtrtiny_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MTRTINY == 1 )); then - MTRTINY=0 - fi - fi + if (( $bootchoices_available == 1 )); then - local nload_w="off" - if (( $NLOAD > 0 )); then - nload_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NLOAD == 1 )); then - NLOAD=0 - fi - fi + # Set Boot Order + WHIP_TITLE=' DietPi - Boot Options' + WHIP_QUESTION='Would you like to configure the auto boot options for DietPi?\n\nThis will allow you to choose which program loads automatically after booting eg:\n - Console\n - Desktop\n - Kodi' + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --defaultno --backtitle "$WHIP_BACKTITLE" 14 70 + CHOICE=$? + if (( $CHOICE == 0 )); then - local tcpdump_w="off" - if (( $TCPDUMP > 0 )); then - tcpdump_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $TCPDUMP == 1 )); then - TCPDUMP=0 - fi - fi + /DietPi/dietpi/dietpi-autostart - local sshclient_w="off" - if (( $SSHCLIENT > 0 )); then - sshclient_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SSHCLIENT == 1 )); then - SSHCLIENT=0 fi - fi - local smbclient_w="off" - if (( $SMBCLIENT > 0 )); then - smbclient_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $SMBCLIENT == 1 )); then - SMBCLIENT=0 - fi fi - local gitclient_w="off" - if (( $GITCLIENT > 0 )); then - gitclient_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $GITCLIENT == 1 )); then - GITCLIENT=0 - fi - fi + } - local buildessential_w="off" - if (( $BUILDESSENTIAL > 0 )); then - buildessential_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $BUILDESSENTIAL == 1 )); then - BUILDESSENTIAL=0 - fi - fi + #TARGETMENUID=2 + Menu_Linux_Software(){ - local alsabase_w="off" - if (( $ALSABASE > 0 )); then - alsabase_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $ALSABASE == 1 )); then - ALSABASE=0 - fi - fi + #Inform User that DietPi software will automatically install additional linux software when required. + if (( ! $USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED )); then - #XSERVERXORG - local xserverxorg_w="off" - if (( $XSERVERXORG > 0 )); then - xserverxorg_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $XSERVERXORG == 1 )); then - XSERVERXORG=0 - fi - fi + WHIP_TITLE='Additional Linux Software' + WHIP_QUESTION='DietPi will automatically install additional Linux software on the next screen, when required (eg: Desktop LXDE will install ALSA + Xserver).\n\nThis means you only need to select the software you actually require.' + whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 12 70 - #CURLFTPFS - local curlftpfs_w="off" - if (( $CURLFTPFS > 0 )); then - curlftpfs_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $CURLFTPFS == 1 )); then - CURLFTPFS=0 - fi - fi + USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED=1 - #FFMPEG - local ffmpeg_w="off" - if (( $FFMPEG > 0 )); then - ffmpeg_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $FFMPEG == 1 )); then - FFMPEG=0 - fi fi - #ORACLEJAVA - local oraclejava_w="off" - if (( $ORACLEJAVA > 0 )); then - oraclejava_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $ORACLEJAVA == 1 )); then - ORACLEJAVA=0 - fi - fi - - local nodejs_w="off" - if (( $NODEJS > 0 )); then - nodejs_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NODEJS == 1 )); then - NODEJS=0 - fi - fi - - local quiterss_w="off" - if (( $QUITERSS > 0 )); then - quiterss_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $QUITERSS == 1 )); then - QUITERSS=0 - fi - fi - - local vifm_w="off" - if (( $VIFM > 0 )); then - vifm_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $VIFM == 1 )); then - VIFM=0 - fi - fi - - WHIP_TITLE='Linux - Software Selection' - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Press the spacebar to select additional software for installation." --backtitle "$WHIP_BACKTITLE" 19 71 12 \ - "" "────Desktops and Utilities───────────────────" "off" \ - "QuiteRSS" "Cross-Platform, Free RSS Reader" $quiterss_w \ - "" "────Editors──────────────────────────────────" "off" \ - "Emacs" "GNU Emacs editor." $gnuemacs_w \ - "Jed" "Editor for programmers." $jed_w \ - "Vim" "Vi Enhanced Text Editor." $vimfull_w \ - "Vim-Tiny" "Compact release of Vim." $vimtiny_w \ - "" "────File Managers────────────────────────────" "off" \ - "MC" "Midnight Commander - a powerful file manager." $midnightcommander_w \ - "ViFM" "File Manager with Vi bindings." $vifm_w \ - "" "────SSH Clients──────────────────────────────" "off" \ - "OpenSSH" "SSH Client: OpenSSH." $sshclient_w \ - "" "────Fileserver Clients───────────────────────" "off" \ - "Samba" "Samba Client: Access Network Shares." $smbclient_w \ - "Curlftpfs" "FTP Client: Allows filesystem mount." $curlftpfs_w \ - "" "────Development / Programming────────────────" "off" \ - "Build" "Build-Essentials." $buildessential_w \ - "Git" "Git Client." $gitclient_w \ - "" "────Network Tools─────────────────────────────" "off" \ - "iftop" "Displays bandwidth usage information." $iftop_w \ - "IPTraf" "Interactive Colorful IP LAN Monitor." $iptraf_w \ - "Iperf" "Internet Protocol bandwidth measuring tool." $iperf_w \ - "MTR-Tiny" "Full screen ncurses traceroute tool." $mtrtiny_w \ - "nLoad" "Realtime console network usage monitor." $nload_w \ - "tcpdump" "Command-line network traffic analyzer." $tcpdump_w \ - "" "────Shared Libraries──────────────────────────" "off" \ - "FFmpeg" "Audio / Visual libary." $ffmpeg_w \ - "Java" "Oracle Java 8 jdk/jre libary." $oraclejava_w \ - "Node.js" "Javascript Runtime." $nodejs_w \ - "" "────System───────────────────────────────────" "off" \ - "ALSA" "Linux Sound System" $alsabase_w \ - "Xserver" "Xinit / Xauth." $xserverxorg_w 2>/tmp/dietpi-software_results + #----------------------------------------------------------------------------- + #Generate Whiptail menu and store results into our software arrays + Menu_CreateSoftwareList 1 - while read choice - do - case $choice in - "QuiteRSS") - if (( $QUITERSS == 0 )); then - QUITERSS=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - "ViFM") - if (( $VIFM == 0 )); then - VIFM=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Iperf) - if (( $IPERF == 0 )); then - IPERF=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - IPTraf) - if (( $IPTRAF == 0 )); then - IPTRAF=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - "MTR-Tiny") - if (( $MTRTINY == 0 )); then - MTRTINY=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - nLoad) - if (( $NLOAD == 0 )); then - NLOAD=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - tcpdump) - if (( $TCPDUMP == 0 )); then - TCPDUMP=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - "Node.js") - if (( $NODEJS == 0 )); then - NODEJS=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - MC) - if (( $MIDNIGHTCOMMANDER == 0 )); then - MIDNIGHTCOMMANDER=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Java) - if (( $ORACLEJAVA == 0 )); then - ORACLEJAVA=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - FFmpeg) - if (( $FFMPEG == 0 )); then - FFMPEG=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Emacs) - if (( $GNUEMACS == 0 )); then - GNUEMACS=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Jed) - if (( $JED == 0 )); then - JED=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Vim) - if (( $VIMFULL == 0 )); then - VIMFULL=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - "Vim-Tiny") - if (( $VIMTINY == 0 )); then - VIMTINY=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - OpenSSH) - if (( $SSHCLIENT == 0 )); then - SSHCLIENT=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Samba) - if (( $SMBCLIENT == 0 )); then - SMBCLIENT=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Curlftpfs) - if (( $CURLFTPFS == 0 )); then - CURLFTPFS=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Build) - if (( $BUILDESSENTIAL == 0 )); then - BUILDESSENTIAL=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Git) - if (( $GITCLIENT == 0 )); then - GITCLIENT=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - ALSA) - if (( $ALSABASE == 0 )); then - ALSABASE=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - Xserver) - if (( $XSERVERXORG == 0 )); then - XSERVERXORG=1 - INSTALL_LINUX_CHOICESMADE=1 - fi - ;; - esac - done < /tmp/dietpi-software_results - rm /tmp/dietpi-software_results &> /dev/null + #Return to Main Menu + TARGETMENUID=0 #----------------------------------------------------------------------------- #dietpi-config can be used to install/configure the following software. Ask user. #CurlFTPfs - - if (( $CURLFTPFS == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[2]} == 1 )); then + WHIP_TITLE='FTP Client - Setup Now?' WHIP_QUESTION='FTP Client as a filesystem mount (CurlFTPfs) can be setup and configured by using DietPi-Config. Would you like to go there now? \n\n- Once completed, exit DietPi-Config to resume setup.' whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Cancel" --defaultno --backtitle "$WHIP_BACKTITLE" 13 70 CHOICE=$? if (( $CHOICE == 0 )); then + + #Write installed states to temp + Write_InstallFileList temp + #Launch DietPi-config /DietPi/dietpi/dietpi-config 16 1 - #DietPi-Config will change .installed file, so reload new value into var - . "$FP_INSTALLED_FILE" + #Read installed states from temp + Read_InstallFileList temp + fi + fi #SMBCLIENT - - if (( $SMBCLIENT == 1 )); then + if (( ${aSOFTWARE_INSTALL_STATE[1]} == 1 )); then + WHIP_TITLE='Samba Client - Setup Now?' WHIP_QUESTION='Samba Client can be setup and configured by using DietPi-Config. Would you like to go there now? \n\n- Once completed, exit DietPi-Config to resume setup.' whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Cancel" --defaultno --backtitle "$WHIP_BACKTITLE" 13 70 CHOICE=$? if (( $CHOICE == 0 )); then + + #Write installed states to temp + Write_InstallFileList temp + #Launch DietPi-config /DietPi/dietpi/dietpi-config 16 1 - #DietPi-Config will change .installed file, so reload new value into var - . "$FP_INSTALLED_FILE" + #Read installed states from temp + Read_InstallFileList temp + fi + fi + #----------------------------------------------------------------------------- - #Return to Main Menu + + } + + #TARGETMENUID=3 + Menu_Uninstall_Software(){ + + #Return to main menu TARGETMENUID=0 + + #Array which will hold all software indexs to be removed. + local asoftware_for_uninstall=() + local software_installed_count=0 + + #Obtain list of installed software + for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + do + + if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )); then + + whiptail_list_array+=("$i" "${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}" "off") + ((software_installed_count++)) + + fi + + done + + # - Hide specific software (eg: stacks) in for loop ? + + if (( $software_installed_count == 0 )); then + + whiptail --title "Uninstall Software" --msgbox "No software is currently installed, or, available for removal." --backtitle "$WHIP_BACKTITLE" 9 60 + + #Run menu + else + + whiptail --title "Uninstall Software" --checklist --separate-output "Use the spacebar to select the software you would like to remove." --cancel-button "Cancel" --backtitle "$WHIP_TITLE" 18 75 10 "${whiptail_list_array[@]}" 2>/tmp/dietpi-software_uninstall_results + + while read choice + do + case $choice in + *) + #Convert lined list into a 1 line string. + asoftware_for_uninstall+=("$choice") + ;; + esac + + done < /tmp/dietpi-software_uninstall_results + rm /tmp/dietpi-software_uninstall_results &> /dev/null + + unset whiptail_list_array + + #Prompt user with list of their selected software for removal + if (( ${#asoftware_for_uninstall[@]} > 0 )); then + + # - Create list + WHIP_QUESTION='The following software will be REMOVED from your system:\n' + + for ((i=0; i<${#asoftware_for_uninstall[@]}; i++)) + do + + for ((j=0; j<$TOTAL_SOFTWARE_INDEXS; j++)) + do + + if (( ${asoftware_for_uninstall[$i]} == $j )); then + + WHIP_QUESTION+=" - ${aSOFTWARE_WHIP_NAME[$j]}: ${aSOFTWARE_WHIP_DESC[$j]}\n" + break + + fi + + done + + done + + #Ask for confirmation + whiptail --title "Uninstall Software?" --yesno "$WHIP_QUESTION \nDo you wish to continue?" --yes-button "Ok" --no-button "Cancel" --defaultno --backtitle "$WHIP_TITLE" 16 70 + CHOICE=$? + + #Run uninstall + if (( $CHOICE == 0 )); then + + # - stop services + /DietPi/dietpi/dietpi-services stop + + for ((i=0; i<${#asoftware_for_uninstall[@]}; i++)) + do + + Uninstall_Software ${asoftware_for_uninstall[$i]} + + done + + #Finish up and clear non-required packages + Uninstall_Software_Finalize + + #Save + Write_InstallFileList + + # - start services + /DietPi/dietpi/dietpi-services start + + #inform user + whiptail --title "Uninstall Software" --msgbox "Uninstall completed." --backtitle "$WHIP_BACKTITLE" 9 60 + + fi + + fi + + fi + + #delete[] arrays + unset whiptail_list_array + unset asoftware_for_uninstall + } #///////////////////////////////////////////////////////////////////////////////////// # Banner Print #///////////////////////////////////////////////////////////////////////////////////// + Banner_Setup(){ /DietPi/dietpi/dietpi-banner 0 @@ -9047,7 +9677,7 @@ systemctl daemon-reload Banner_Installing(){ /DietPi/dietpi/dietpi-banner 0 - echo -e "\n Installing Software: $INSTALL_DESCRIPTION \n Please Wait, this may take some time... \n " + echo -e "\n Installing ${aSOFTWARE_WHIP_NAME[$INSTALLING_INDEX]}: ${aSOFTWARE_WHIP_DESC[$INSTALLING_INDEX]} \n Please Wait, this may take some time... \n " /DietPi/dietpi/dietpi-funtime 0 } @@ -9077,76 +9707,53 @@ systemctl daemon-reload } Banner_Configs(){ + /DietPi/dietpi/dietpi-banner 0 echo -e "\n Please Wait: \n Applying DietPi optimizations and configurations for $HW_MODEL_DESCRIPTION \n" /DietPi/dietpi/dietpi-funtime 0 - } - - Banner_Aborted(){ - #1st run abort - if (( $DIETPI_INSTALL_STAGE == 0 )); then - /DietPi/dietpi/dietpi-banner 0 - echo -e "\n Installation Aborted by User \n Installation must be completed prior to using DietPi \n Please run dietpi-software to restart the installation \n" - #Standard abort - else - /DietPi/dietpi/dietpi-banner 1 - fi - } - - Input_Modes(){ - - # - Skip menu - TARGETMENUID=-1 - - local ainput=("$@") - - #Install software and exit. - if [ "$1" = "install" ]; then - - GOSTARTINSTALL=1 - DISABLE_REBOOT=1 + #List software due for configuration + # for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++)) + # do - for i in "${ainput[@]}" # NB: need a way to skip the 1st entry. Could do if != install, but rather find a better method. - do + # if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then - # - grab the name to use in sed pattern match - local target_name=$(echo -e "$i" | cut -f1 -d "=") - target_name+='=' + # /DietPi/dietpi/func/dietpi-notify 2 "${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}" - # - grab the target value - local target_value=$(echo -e "$i" | sed 's/.*=//') - # If input doesnt contain a "=" , Assume user wants to install it and add "=1". Saves us having to use KODI=1, where KODI will do the same. - # NB: we must ensure "INDEX_*_TARGET" entries have a value eg: "=-1" - if (( ! $(echo -e "$target_value" | grep -ci -m1 '=') )); then + # fi - target_value+="=1" + # done - fi + } - sed -i "/^$target_name/c $target_name$target_value" "$FP_INSTALLED_FILE" + Banner_Aborted(){ - done + #1st run abort + if (( $DIETPI_INSTALL_STAGE == 0 )); then - Read_InstallFileList + /DietPi/dietpi/dietpi-banner 0 + echo -e "\n Installation Aborted by User \n Installation must be completed prior to using DietPi \n Please run dietpi-software to restart the installation \n" + #Standard abort else - /DietPi/dietpi/func/dietpi-notify 2 "Unknown command $1" - - unset ainput - - exit + /DietPi/dietpi/dietpi-banner 1 fi - unset ainput - } #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// + #-------------------------------------------------------------------------------------- + #Init software arrays + Software_Arrays_Init + + #-------------------------------------------------------------------------------------- + #load .installed file, update vars, if it exists + Read_InstallFileList + #-------------------------------------------------------------------------------------- #Check if we are setting no user inputs and prompts # - Load all automation vars @@ -9198,14 +9805,7 @@ systemctl daemon-reload clear #-------------------------------------------------------------------------------------- - #load .installed file, update vars, if it exists - Read_InstallFileList - - #Generate blank .installed file if it doesnt exist on a fresh image or update with current values. - Write_InstallFileList - - #-------------------------------------------------------------------------------------- - #DietPi-Software, 1st run questions. + #Apply 1st run automation and ask questions. if (( $DIETPI_INSTALL_STAGE == 0 )); then #Activate automation settings from dietpi.txt, if set. @@ -9230,16 +9830,27 @@ systemctl daemon-reload #-------------------------------------------------------------------------------------- #Start DietPi Menu + while (( $TARGETMENUID > -1 )); do clear if (( $TARGETMENUID == 0 )); then + Menu_Main + elif (( $TARGETMENUID == 1 )); then + Menu_Dietpi_Software + elif (( $TARGETMENUID == 2 )); then + Menu_Linux_Software + + elif (( $TARGETMENUID == 3 )); then + + Menu_Uninstall_Software + fi done @@ -9261,7 +9872,12 @@ systemctl daemon-reload #Reboot Banner_Reboot - if (( ! $DISABLE_REBOOT )); then + if (( $DISABLE_REBOOT )); then + + # - Start services + /DietPi/dietpi/dietpi-services start + + else reboot @@ -9272,6 +9888,6 @@ systemctl daemon-reload fi #----------------------------------------------------------------------------------- - exit + Exit_Destroy #----------------------------------------------------------------------------------- } diff --git a/dietpi/dietpi-uninstall b/dietpi/dietpi-uninstall deleted file mode 100644 index e5ef960e24..0000000000 --- a/dietpi/dietpi-uninstall +++ /dev/null @@ -1,756 +0,0 @@ -#!/bin/bash -{ - #//////////////////////////////////// - # DietPi-Software Uninstaller - # - #//////////////////////////////////// - # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com - # - #//////////////////////////////////// - # - # Info: - # - Removes DietPi installed software - # - Use of this script is not recommended for inexperienced users, due to the nature of Linux packages and dependencies. - # eg: Removing Xserver will break Kodi/Desktop etc.... - # - # Usage: - # - /DietPi/dietpi/dietpi-uninstall (runs menu) - # - /DietPi/dietpi/dietpi-uninstall sNAME sNAME (uninstalls software) - # - # Notes: - # - if removing any /etc/apt/sources.list.d/* always run "/DietPi/dietpi/dietpi-apt-get_update 2" to clean and update apt-cache - #//////////////////////////////////// - - #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. - LANG=en_GB.UTF-8 - - INPUT=$1 - VALIDINPUT=1 - - #Exit path for non-root logins. - if (( $UID != 0 )); then - clear - echo -e "\n ERROR: You do not have root privileges.\n Please login as root, or, use:\n sudo dietpi-uninstall\n" - - exit - fi - - #///////////////////////////////////////////////////////////////////////////////////// - #Global - #///////////////////////////////////////////////////////////////////////////////////// - #Count what we have uninstalled. If >=1 autoremove will be run. - UNINSTALLED_COUNT=0 - - #Apt-get purge - AGP='apt-get purge -y' - - USERDATA_DIRECTORY='/mnt/dietpi_userdata' - - # - dietpi.txt custom override? (DIETPI_USERDATA_BASEDIRECTORY=) - DIETPI_USERDATA_BASEDIRECTORY=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') - if [ "$DIETPI_USERDATA_BASEDIRECTORY" != "auto" ]; then - USERDATA_DIRECTORY="$DIETPI_USERDATA_BASEDIRECTORY" - fi - - HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) - HW_MODEL_DESCRIPTION=$(sed -n 2p /DietPi/dietpi/.hw_model) - DISTRO=$(sed -n 3p /DietPi/dietpi/.hw_model) - - #///////////////////////////////////////////////////////////////////////////////////// - #Menu - #///////////////////////////////////////////////////////////////////////////////////// - WHIP_TITLE='- DietPi-Uninstall -' - - Menu_Uninstall(){ - - #Final string which will hold all software to be removed. This can then be used as dietpi-uninstall "$string_output" - local string_output="" - - #create temp file with list of .installed software. Remove ( 2) installed flag. - cat /DietPi/dietpi/.installed | grep '=2' | sed 's/=2//g' > /tmp/dietpi-uninstall_temp - - #Delete software lines not available for removal - sed -i '/USBDRIVE/d' /tmp/dietpi-uninstall_temp - - #Hide webserver stacks. - sed -i '/WEBSERVER_L...$/d' /tmp/dietpi-uninstall_temp - - #Read into array - readarray installed_list_array < /tmp/dietpi-uninstall_temp - - #Create List for Whiptail - local whiptail_list_array=() - for ((i=0; i<${#installed_list_array[@]}; i++)) - do - whiptail_list_array+=(${installed_list_array[$i]} " " "off") - done - - #Run menu - whiptail --title "$WHIP_TITLE" --checklist --separate-output "Use the spacebar to select the software you would like to remove." --cancel-button "Exit" --backtitle "$WHIP_TITLE" 18 60 10 "${whiptail_list_array[@]}" 2>/tmp/dietpi-uninstall_results - while read choice - do - case $choice in - *) - #Convert lined list into a 1 line string. - string_output+="$choice " - ;; - esac - - done < /tmp/dietpi-uninstall_results - - #Prompt user with list of software selected for removal - if [ "$string_output" != "" ]; then - - #Ask for confirmation - whiptail --title "Uninstall Software?" --yesno "The following software will be REMOVED from your system:\n\n$string_output\n\nDo you wish to continue?" --yes-button "Ok" --no-button "Exit" --defaultno --backtitle "$WHIP_TITLE" 14 70 - CHOICE=$? - - #Run uninstall - if (( $CHOICE == 0 )); then - - # - stop services - /DietPi/dietpi/dietpi-services stop - - /DietPi/dietpi/dietpi-uninstall $string_output - - # - start services - /DietPi/dietpi/dietpi-services start - - #inform user - /DietPi/dietpi/dietpi-banner 0 - echo -e "\n DietPi-Uninstall completed.\n" - fi - fi - - #Clean up tmp files - rm /tmp/dietpi-uninstall_temp &> /dev/null - rm /tmp/dietpi-uninstall_results &> /dev/null - - #delete[] arrays - unset installed_list_array - unset whiptail_list_array - - } - - #///////////////////////////////////////////////////////////////////////////////////// - # Main Loop - #///////////////////////////////////////////////////////////////////////////////////// - - #---------------------------------------------------------------------- - #Check installed file exists - if [ ! -f /DietPi/dietpi/.installed ]; then - echo -e "/DietPi/dietpi/.installed does not exist yet. Please run dietpi-software to complete your DietPi installation." - exit - fi - - #---------------------------------------------------------------------- - #Menu mode - if [ "$INPUT" = "" ]; then - Menu_Uninstall - - #---------------------------------------------------------------------- - #Process all inputs and apply removal. - else - #---------------------------------------------------------------------- - #Make sure apt-get_update thread is finished - /DietPi/dietpi/dietpi-apt-get_update 1 - - #---------------------------------------------------------------------- - for INPUT in "$@" - do - #reset valid input - VALIDINPUT=1 - - #Inform User - /DietPi/dietpi/dietpi-banner 0 - echo -e "\n Uninstalling: $INPUT \n" - - #---------------------------------------------------------------------- - #DIETPI SOFTWARE - if [ "$INPUT" = "GRASSHOPPER" ]; then - - grasshopper_directory='/var/www' - rm -R "$grasshopper_directory"/documentation - rm -R "$grasshopper_directory"/css - rm -R "$grasshopper_directory"/db - rm -R "$grasshopper_directory"/exec - rm -R "$grasshopper_directory"/includes - rm -R "$grasshopper_directory"/install - rm -R "$grasshopper_directory"/phpliteadmin - rm -R "$grasshopper_directory"/js - rm -R "$grasshopper_directory"/setup - rm -R "$grasshopper_directory"/pics - rm -R "$grasshopper_directory"/themes - rm "$grasshopper_directory"/favicon.ico - rm "$grasshopper_directory"/index.php - #PDF documentation - rm "$grasshopper_directory"/Grasshopper* - - update-rc.d grasshopper remove - rm /etc/init.d/grasshopper - - elif [ "$INPUT" = "DESKTOP_LXDE" ]; then - $AGP lxde lxde-* upower policykit-1 iceweasel p7zip-full - elif [ "$INPUT" = "DESKTOP_MATE" ]; then - $AGP mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full - elif [ "$INPUT" = "DESKTOP_GNUSTEP" ]; then - $AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games upower policykit-1 iceweasel p7zip-full - elif [ "$INPUT" = "DESKTOP_XFCE" ]; then - $AGP xfce4 gnome-icon-theme tango-icon-theme iceweasel p7zip-full - elif [ "$INPUT" = "QUITERSS" ]; then - $AGP quiterss - elif [ "$INPUT" = "NOMACHINE" ]; then - $AGP nomachine - elif [ "$INPUT" = "XRDP" ]; then - $AGP xrdp - elif [ "$INPUT" = "TRANSMISSION" ]; then - $AGP transmission-daemon - rm /etc/init.d/transmission-daemon &> /dev/null - rm /etc/systemd/system/transmission-daemon.service &> /dev/null - - elif [ "$INPUT" = "WEBSERVER_APACHE" ]; then - $AGP apache2 - sed -i "/WEBSERVER_LAMP=/c\WEBSERVER_LAMP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LASP=/c\WEBSERVER_LASP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LAAP=/c\WEBSERVER_LAAP=0" /DietPi/dietpi/.installed - - elif [ "$INPUT" = "WEBSERVER_NGINX" ]; then - $AGP nginx - sed -i "/WEBSERVER_LEMP=/c\WEBSERVER_LEMP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LESP=/c\WEBSERVER_LESP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LEAP=/c\WEBSERVER_LEAP=0" /DietPi/dietpi/.installed - - elif [ "$INPUT" = "WEBSERVER_LIGHTTPD" ]; then - $AGP lighttpd - sed -i "/WEBSERVER_LLMP=/c\WEBSERVER_LLMP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LLSP=/c\WEBSERVER_LLSP=0" /DietPi/dietpi/.installed - sed -i "/WEBSERVER_LLAP=/c\WEBSERVER_LLAP=0" /DietPi/dietpi/.installed - - elif [ "$INPUT" = "WEBSERVER_MYSQL" ]; then - $AGP mysql-server - elif [ "$INPUT" = "WEBSERVER_MARIADB" ]; then - $AGP mariadb-server mariadb-client - # - Remove debian flag generated by mariaDB install that prevents mysql 5.5 being installed. - rm /var/lib/mysql/debian-* - - elif [ "$INPUT" = "WEBSERVER_SQLITE" ]; then - $AGP sqlite3 - elif [ "$INPUT" = "WEBSERVER_REDIS" ]; then - $AGP redis-server - elif [ "$INPUT" = "WEBSERVER_PHP" ]; then - $AGP php5 libapache2-mod-php5 php5-fpm php5-cgi php5-mysql php5-curl php5-sqlite php-apc php5-apcu - rm /var/www/phpinfo.php - rm /var/www/apc.php - rm /var/www/opcache.php - rm /etc/php5/fpm/pool.d/www.conf - #temp php uploads - rm -R /var/tmp/php_upload_tmp - elif [ "$INPUT" = "WEBSERVER_MYADMINPHP" ]; then - $AGP phpmyadmin - elif [ "$INPUT" = "PHPBB" ]; then - service mysql start - mysqladmin -u root -pdietpi drop phpbb3 -f - rm -R /var/www/phpBB3 - elif [ "$INPUT" = "OWNCLOUD" ]; then - $AGP owncloud - service mysql start - mysqladmin -u root -pdietpi drop owncloud -f - rm /etc/apt/sources.list.d/owncloud.list - /DietPi/dietpi/dietpi-apt-get_update 2 - rm -R /var/www/owncloud - elif [ "$INPUT" = "HIFI" ]; then - $AGP mpd libmpdclient2 - update-rc.d ympd remove - rm /etc/init.d/ympd - rm /usr/bin/ympd - elif [ "$INPUT" = "KODI" ]; then - $AGP kodi - #+Odroids - $AGP kodi-odroid - rm /usr/share/applications/kodi.desktop - rm ~/Desktop/kodi.desktop - elif [ "$INPUT" = "MINIDLNA" ]; then - $AGP minidlna - elif [ "$INPUT" = "OPENTYRIAN" ]; then - $AGP ibsdl1.2debian libsdl-net1.2 - rm -R /usr/local/games/opentyrian - rm /usr/share/applications/opentyrian.desktop - rm ~/Desktop/opentyrian.desktop - elif [ "$INPUT" = "DIETPICAM" ]; then - $AGP gpac motion - rm -R /var/www/dietpicam - rm /opt/vc/bin/raspimjpeg - rm /usr/bin/raspimjpeg - rm /etc/dietpi/dietpi-software/services/raspimjpeg.service - rm /etc/raspimjpeg - rm /etc/motion/motion.conf - elif [ "$INPUT" = "DELUGE" ]; then - $AGP deluged deluge-web deluge-webui deluge-console - rm /etc/dietpi/dietpi-software/services/deluge.service - rm -R ~/.config/deluge - elif [ "$INPUT" = "FILESERVER_PROFTP" ]; then - $AGP proftpd-basic - elif [ "$INPUT" = "FILESERVER_SAMBA" ]; then - $AGP samba samba-common-bin - elif [ "$INPUT" = "FILESERVER_VSFTPD" ]; then - $AGP vsftpd - elif [ "$INPUT" = "NOIPDYNDNS" ]; then - update-rc.d noip2 remove - rm /usr/local/bin/noip2 - rm /etc/init.d/noip2 - elif [ "$INPUT" = "RASPCONTROL" ]; then - rm -R /var/www/raspcontrol - rm -R /etc/raspcontrol - elif [ "$INPUT" = "LINUXDASH" ]; then - rm -R /var/www/linuxdash - elif [ "$INPUT" = "PIHOLE" ]; then - $AGP dnsmasq - rm /etc/dnsmasq.conf - rm /usr/local/bin/gravity.sh - rm /usr/local/bin/chronometer.sh - rm -R /var/www/pihole - rm -R /etc/pihole - rm -R /etc/.pihole - rm -R /opt/pihole - rm /var/log/pihole.log - rm /etc/cron.weekly/pihole_adlist_update - rm /etc/dnsmasq.d/01-pihole.conf - - rm /opt/pihole/gravity.sh - rm /etc/bash_completion.d/pihole - rm /usr/local/bin/pihole - rm /etc/sudoers.d/pihole - - elif [ "$INPUT" = "SUBSONIC5" ] || [ "$INPUT" = "SUBSONIC6" ]; then - $AGP subsonic - rm -R /var/subsonic - #Leave possible shared Java etc, on system - #$AGP lame ffmpeg oracle-java8-jdk oracle-java8-installer - elif [ "$INPUT" = "WEBIOPI" ]; then - update-rc.d webiopi remove - rm -R /etc/webiopi - rm -R /usr/share/webiopi - rm /usr/bin/webiopi - rm /etc/init.d/webiopi - elif [ "$INPUT" = "WEAVED" ]; then - #Uninstaller does not uninstall. - #"$HOME"/weaved_software/uninstaller.sh - - rm -R /etc/weaved - rm -R "$HOME"/weaved_software - rm "$HOME"/weaved_setup.bin - - elif [ "$INPUT" = "DIETPICLOUDSHELL" ]; then - #Kill - killall dietpi-cloudshell - - #Disable auto login, revert boot index to console - /DietPi/dietpi/dietpi-autostart 0 - - #Remove alias - sed -i '/dietpi-cloudshell=/d' /etc/bash.bashrc - - elif [ "$INPUT" = "HAPROXY" ]; then - - update-rc.d haproxy remove - rm /etc/init.d/haproxy - - rm -r /etc/haproxy - - #Shared dev libaries. Leave these installed - #$AGP libpcre3-dev libssl-dev - - elif [ "$INPUT" = "SQUEEZEBOXSERVER" ]; then - - $AGP logitechmediaserver - rm /etc/dietpi/dietpi-software/services/squeezeboxserver.service - rm -R /var/lib/squeezeboxserver - - elif [ "$INPUT" = "WORDPRESS" ]; then - rm -R /var/www/wordpress - - elif [ "$INPUT" = "TIGHTVNCSERVER" ] || [ "$INPUT" = "VNC4SERVER" ]; then - $AGP tightvncserver - $AGP vnc4server - - rm /etc/systemd/system/vncserver.service - rm /etc/init.d/vncserver - - rm /usr/local/bin/vncserver - - rm -R "$HOME"/.vnc - - elif [ "$INPUT" = "FAIL2BAN" ]; then - $AGP fail2ban - - elif [ "$INPUT" = "PHPSYSINFO" ]; then - rm -R /var/www/phpsysinfo - - elif [ "$INPUT" = "PHPIMAGEGALLERY" ]; then - rm /var/www/gallery/index.php - rm -R /var/www/gallery/_sfpg_data - - elif [ "$INPUT" = "AMPACHE" ]; then - rm -R /var/www/ampache - - #drop database - service mysql start - mysqladmin -u root -pdietpi drop ampache -f - elif [ "$INPUT" = "OPENVPNSERVER" ]; then - $AGP openvpn - rm -R /etc/openvpn &> /dev/null - - elif [ "$INPUT" = "LETSENCRYPT" ]; then - rm -R /etc/letsencrypt_scripts &> /dev/null - - elif [ "$INPUT" = "RPIGPIO" ]; then - $AGP python-rpi.gpio python3-rpi.gpio - - elif [ "$INPUT" = "RPII2C" ]; then - $AGP i2c-tools - #Disable - /DietPi/dietpi/func/dietpi-set_hardware i2c disable - - elif [ "$INPUT" = "WIRINGPI" ]; then - rm -R /root/wiringPi* &> /dev/null - - elif [ "$INPUT" = "WIFIHOTSPOT" ]; then - $AGP hostapd isc-dhcp-server - - rm /etc/dhcp/dhcpd.conf &> /dev/null - rm /etc/hostapd/hostapd.conf &> /dev/null - rm /etc/default/isc-dhcp-server &> /dev/null - rm /etc/default/hostapd &> /dev/null - rm /etc/iptables.ipv4.nat &> /dev/null - # - remove binary (used a -f trigger to detect wifi hotspot mode in dietpi-config). - rm /usr/sbin/hostapd &> /dev/null - rm /usr/sbin/hostapd_cli &> /dev/null - - #Set Wlan back to inactive and ready for use with dietpi-config. - local wifi_index=$(sed -n 2p /DietPi/dietpi/.network) - - # - Remove all entries below wlan, so we can recreate them. - sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces - - # - Disable wlan - sed -i "/allow-hotplug wlan/c\#allow-hotplug wlan$wifi_index" /etc/network/interfaces - - # - Add default wifi settings to network interfaces config - cat << _EOF_ >> /etc/network/interfaces -iface wlan$wifi_index inet dhcp -metric 1 -address 192.168.0.101 -netmask 255.255.255.0 -gateway 192.168.0.1 -wireless-essid FuzonWifi -wireless-key abcde12345 -wireless-mode Managed -wireless-power off -wpa-ssid FuzonWifi -wpa-psk abcde12345 -#dns-nameservers 8.8.8.8 8.8.4.4 -_EOF_ - - # - Flush IP tables - iptables -F - iptables -t nat -F - iptables-save > /etc/iptables.ipv4.nat - - - elif [ "$INPUT" = "TORHOTSPOT" ]; then - $AGP tor - - # - uninstall WIFIHOTSPOT ALSO. Due to IPtables needing reset. - /DietPi/dietpi/dietpi-uninstall WIFIHOTSPOT - - elif [ "$INPUT" = "SHAIRPORTSYNC" ]; then - $AGP shairport-sync* - - elif [ "$INPUT" = "BRUTEFIR" ]; then - $AGP brutefir - - rm -R /etc/BruteFIR - rm /etc/dietpi/dietpi-software/services/brutefir.service - rm /etc/asound.conf - - rm /etc/modules-load.d/brutefir-alsa-loopback.conf - rm /etc/modprobe.d/brutefir-alsa-loopback.conf - - elif [ "$INPUT" = "PYDIO" ]; then - - rm -R /var/www/pydio - - #drop database - service mysql start - mysqladmin -u root -pdietpi drop pydio -f - - elif [ "$INPUT" = "SQUEEZELITE" ]; then - $AGP squeezelite - - elif [ "$INPUT" = "EMONCMS" ]; then - mysqladmin -u root -pdietpi drop emoncms -f - rm -R /var/www/emoncms - - elif [ "$INPUT" = "EMONHUB" ]; then - rm -R /etc/emonhub - rm /etc/init.d/emonhub - rm /etc/default/emonhub - - elif [ "$INPUT" = "RPIMONITOR" ]; then - $AGP rpimonitor - - elif [ "$INPUT" = "BAIKAL" ]; then - - rm -R /var/www/baikal - - #drop database - service mysql start - mysqladmin -u root -pdietpi drop baikal -f - - elif [ "$INPUT" = "NETDATA" ]; then - - #all - rm /etc/systemd/system/netdata.service - - userdel -f netdata - groupdel netdata - - #1.2.0 - $AGP netdata - - #1.0.0 - rm /usr/sbin/netdata - - rm -R /etc/netdata - rm -R /usr/share/netdata - rm -R /usr/libexec/netdata - rm -R /var/cache/netdata - rm -R /var/log/netdata - - - - elif [ "$INPUT" = "MUMBLESERVER" ]; then - $AGP mumble-server - - elif [ "$INPUT" = "EMBYSERVER" ]; then - $AGP emby-server - - rm /etc/apt/sources.list.d/emby-server.list - /DietPi/dietpi/dietpi-apt-get_update 2 - - elif [ "$INPUT" = "OPENBAZAAR" ]; then - rm -R /etc/openbazaar-server - - # - remove service - rm /etc/dietpi/dietpi-software/services/openbazaar-server.service - - elif [ "$INPUT" = "PLEXMEDIASERVER" ]; then - $AGP plexmediaserver - - rm /etc/apt/sources.list.d/plex.list &> /dev/null - /DietPi/dietpi/dietpi-apt-get_update 2 - - elif [ "$INPUT" = "CUBERITE" ]; then - - rm -R /etc/cuberite - rm /etc/systemd/system/cuberite.service - - elif [ "$INPUT" = "MINEOS" ]; then - - rm -R "$USERDATA_DIRECTORY"/mineos - rm -R /var/games/minecraft - - rm /etc/supervisor/conf.d/mineos.conf - supervisorctl reload - - rm /usr/local/bin/mineos - - userdel -f mineos - - - elif [ "$INPUT" = "GOGS" ]; then - - rm -R /etc/gogs - rm /etc/systemd/system/gogs.service - - rm /var/log/gogs_daemon.log - rm /var/log/gogs.log - - mysqladmin -u root -pdietpi drop gogs -f - - elif [ "$INPUT" = "QBITTORRENT" ]; then - - $AGP qbittorrent-nox - - rm /etc/systemd/system/qbittorrent.service - rm -R "$HOME"/.config/qBittorrent - - elif [ "$INPUT" = "SYNCTHING" ]; then - - rm /usr/bin/syncthing - rm /etc/systemd/system/syncthing.service - rm -R "$HOME"/.config/syncthing - - #---------------------------------------------------------------------- - #LINUX SOFTWARE - elif [ "$INPUT" = "TCPDUMP" ]; then - $AGP tcpdump - elif [ "$INPUT" = "NLOAD" ]; then - $AGP nload - elif [ "$INPUT" = "MTRTINY" ]; then - $AGP mtr-tiny - elif [ "$INPUT" = "IPTRAF" ]; then - $AGP iptraf - elif [ "$INPUT" = "IFTOP" ]; then - $AGP iftop - elif [ "$INPUT" = "JED" ]; then - $AGP jed - elif [ "$INPUT" = "MIDNIGHTCOMMANDER" ]; then - $AGP mc - elif [ "$INPUT" = "GNUEMACS" ]; then - $AGP emacs - elif [ "$INPUT" = "VIMFULL" ] || [ "$INPUT" = "VIMTINY" ]; then - $AGP vim vim-tiny - elif [ "$INPUT" = "SSHCLIENT" ]; then - #This also removes OpenSSH server. So lets check OpenSSH server isnt installed before hand. - if (( $(dpkg -l | grep -ci -m1 'openssh-server') == 0 )); then - $AGP openssh-client - #Dont remove - else - VALIDINPUT=0 - fi - elif [ "$INPUT" = "SMBCLIENT" ]; then - umount /mnt/samba &> /dev/null - $AGP smbclient - #Disable in fstab - sed -i '/\/mnt\/samba/c\#\/mnt\/samba . Please use dietpi-config and the networking menu to setup this mount' /etc/fstab - #Add info file for installation method. - echo -e "Samba client can be installed and setup by DietPi-Config.\nSimply run: dietpi-config 8" > /mnt/samba/readme.txt - - elif [ "$INPUT" = "BUILDESSENTIAL" ]; then - $AGP build-essential - elif [ "$INPUT" = "GITCLIENT" ]; then - $AGP git - elif [ "$INPUT" = "ALSABASE" ]; then - $AGP alsa-base alsa-utils - elif [ "$INPUT" = "XSERVERXORG" ]; then - $AGP xinit xauth xserver-xorg xfonts-base x11-xserver-utils x11-common x11-utils - #rpi - if (( $HW_MODEL < 10 )); then - $AGP xserver-xorg-video-fbturbo xserver-xorg-video-fbdev - fi - elif [ "$INPUT" = "CURLFTPFS" ]; then - umount /mnt/ftp_client &> /dev/null - $AGP curlftpfs - - #Disable in fstab - sed -i '/\/mnt\/ftp_client/c\#\/mnt\/ftp_client . Please use dietpi-config and the networking menu to setup this mount' /etc/fstab - - #Add info file for installation method. - echo -e "FTP client mount can be installed and setup by DietPi-Config.\nSimply run: dietpi-config 8" > /mnt/ftp_client/readme.txt - - elif [ "$INPUT" = "FFMPEG" ]; then - $AGP ffmpeg - elif [ "$INPUT" = "ORACLEJAVA" ]; then - $AGP oracle-java8-* - rm /etc/apt/sources.list.d/webupd8team-java.list - /DietPi/dietpi/dietpi-apt-get_update 2 - - elif [ "$INPUT" = "SSHSERVER_DROPBEAR" ]; then - $AGP dropbear - elif [ "$INPUT" = "SSHSERVER_OPENSSH" ]; then - $AGP openssh-server openssh-blacklist* - elif [ "$INPUT" = "LOGGING_RAMLOG" ]; then - sed -i '/\/var\/log/c\#\/var\/log DietPi Ramlog Disabled' /etc/fstab - elif [ "$INPUT" = "LOGGING_LOGROTATE" ]; then - $AGP logrotate - elif [ "$INPUT" = "LOGGING_RSYSLOG" ]; then - $AGP rsyslog - elif [ "$INPUT" = "NODEJS" ]; then - - $AGP nodejs - - # - old install via repo - if [ -f /etc/apt/sources.list.d/nodesource_nodejs.list ]; then - rm /etc/apt/sources.list.d/nodesource_nodejs.list - /DietPi/dietpi/dietpi-apt-get_update 2 - fi - - rm /usr/local/bin/node - - elif [ "$INPUT" = "OPENBAZAAR" ]; then - echo -e "nothing here" - - elif [ "$INPUT" = "VIFM" ]; then - $AGP vifm - - #---------------------------------------------------------------------- - #No Matching software - else - VALIDINPUT=0 - whiptail --title "DietPi-Uninstall" --msgbox "Invalid usage:\n- >> $INPUT << is unknown and/or not removable.\n\n- For more information and usage of DietPi-Uninstall:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=24&p=60#p60" 12 70 - fi - - #---------------------------------------------------------------------- - #Valid input. Set 0 in Dietpi's .installed file, and, log to .uninstalled file - if (( $VALIDINPUT == 1 )); then - - #Update our uninstalled count - ((UNINSTALLED_COUNT++)) - - #log to .uninstalled file - if [ ! -f /DietPi/dietpi/.uninstalled ]; then - echo -e "DietPi-Uninstall Software Log\n----------------------\n" > /DietPi/dietpi/.uninstalled - fi - echo -e "$(date)\n$INPUT\n" >> /DietPi/dietpi/.uninstalled - - #Remove from DietPi's installed list - sed -i "s/$INPUT=2/$INPUT=0/g" /DietPi/dietpi/.installed - - fi - done - fi - - #---------------------------------------------------------------------- - #At least one item was uninstalled - if (( $UNINSTALLED_COUNT > 0 )); then - - #Purge - /DietPi/dietpi/dietpi-banner 0 - - echo -e "\n Removing packages that are no longer required.\n" - apt-get autoremove --purge -y - - #Check if we need to clear DietPi choices - dpkg -l > /tmp/.dietpi-uninstall_dpkg - if (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'openssh-server') == 0 )) && - (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'dropbear') == 0 )); then - sed -i "/INDEX_SSHSERVER_CURRENT=/c\INDEX_SSHSERVER_CURRENT=0" /DietPi/dietpi/.installed - sed -i "/INDEX_SSHSERVER_TARGET=/c\INDEX_SSHSERVER_TARGET=0" /DietPi/dietpi/.installed - fi - - if (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 ' samba ') == 0 )) && - (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'proftpd-basic') == 0 )); then - sed -i "/INDEX_FILESERVER_CURRENT=/c\INDEX_FILESERVER_CURRENT=0" /DietPi/dietpi/.installed - sed -i "/INDEX_FILESERVER_TARGET=/c\INDEX_FILESERVER_TARGET=0" /DietPi/dietpi/.installed - fi - - if (( $(cat /etc/fstab | grep -ci -m1 '#/var/log') == 1 )) && - (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'rsyslog') == 0 )) && - (( $(cat /tmp/.dietpi-uninstall_dpkg | grep -ci -m1 'logrotate') == 0 )); then - sed -i "/INDEX_LOGGING_CURRENT=/c\INDEX_LOGGING_CURRENT=0" /DietPi/dietpi/.installed - sed -i "/INDEX_LOGGING_TARGET=/c\INDEX_LOGGING_TARGET=0" /DietPi/dietpi/.installed - fi - - rm /tmp/.dietpi-uninstall_dpkg - - #SystemD reload daemon - if (( $DISTRO == 3 )); then - systemctl daemon-reload - fi - fi - - #----------------------------------------------------------------------------------- - exit - #----------------------------------------------------------------------------------- -} diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 906f13ba66..6dd5dd105b 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -328,8 +328,8 @@ _EOF_ sed -i "/dtparam=i2c_arm=/c\dtparam=i2c_arm=on" /DietPi/config.txt sed -i "/dtparam=i2c1=/c\dtparam=i2c1=on" /DietPi/config.txt - #DietPi, set installed - sed -i '/RPII2C=/c\RPII2C=2' /DietPi/dietpi/.installed &> /dev/null + #DietPi-Software, set installed + sed -i '/^aSOFTWARE_INSTALL_STATE\[72\]=/c\aSOFTWARE_INSTALL_STATE\[72\]=2' /DietPi/dietpi/.installed elif [ "$INPUT_DEVICE_VALUE" = "disable" ]; then diff --git a/dietpi/patch_file b/dietpi/patch_file index 5a36ac75a2..f24955a80a 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -765,7 +765,7 @@ DISPLAY=\$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_vncserver_display=' | sed if [ -f /usr/bin/vnc4server ]; then BINARY_FP='/usr/bin/vnc4server' VNC_INSTALLED=1 -elif [ -f /usr/bin/vncserver ]; then +elif [ -f /usr/bin/vncserver ]; then BINARY_FP='/usr/bin/vncserver' VNC_INSTALLED=1 fi @@ -1223,7 +1223,16 @@ _EOF_ elif (( $VERSION_CURRENT == 126 )); then #------------------------------------------------------------------------------- - echo -e "remove me" + #uninstall from menu, during Write_Install, choice system targets are being saved, we need to set back to CURRENT. + #Or could I convert choice system into an array aswell? + + #Update dietpi-software with new automation var #AUTO_DietpiSoftware_Install_ID=23 + # Done, just needs testing + + #patch: Convert all .installed files to the new array system + + #remove dietpi-uninstall from bash alias + sed -i '/alias dietpi-uninstall/d' /etc/bash.bashrc #------------------------------------------------------------------------------- fi