#!/bin/bash
do {
#////////////////////////////////////
# DietPi Software
#
#////////////////////////////////////
# Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com
#
#////////////////////////////////////
#
# Info:
# - filename /DietPi/dietpi/dietpi-software
# - Installs "ready to run" software with optimizations unique to the device.
# - Runs dietpi-update during 1st run setup.
# - Generates and uses /DietPi/dietpi/.installed (software list) # 0=not installed, 1=selected for install, 2=installed
#
# Usage:
# - dietpi-software
# - /DietPi/dietpi/dietpi-software install iUNIQUEID (OR) sINDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int
# - /DietPi/dietpi/dietpi-software reinstall #Same as installed, however, only reinstalls if state =2. Does not uninstall due to package removal danger (eg: xserver removes kodi), simply flags to be installed (=1).
# - /DietPi/dietpi/dietpi-software uninstall iUNIQUEID
# - /DietPi/dietpi/dietpi-software list #Lists UNIQUEIDs for software.
# - /DietPi/dietpi/dietpi-software setpermissions #Sets shared permissions for /var/www and userdata folders.
#////////////////////////////////////
#Import DietPi-Globals ---------------------------------------------------------------
source /DietPi/dietpi/func/dietpi-globals
G_CHECK_ROOT_USER
G_CHECK_ROOTFS_RW
export G_PROGRAM_NAME='DietPi-Software'
#Import DietPi-Globals ---------------------------------------------------------------
#/////////////////////////////////////////////////////////////////////////////////////
#Filepath
#/////////////////////////////////////////////////////////////////////////////////////
setvar FP_INSTALLED_FILE = ''/DietPi/dietpi/.installed''
setvar FP_INSTALLED_FILE_TEMP = ''/tmp/dietpi-software.installed''
setvar FP_DIETPIAUTOMATION_LOG = ''/root/DietPi-Automation.log''
#Used to set user/personal data directories (eg: usbdrive)
setvar FP_DIETPI_DEDICATED_USBDRIVE = ''''
#Uninstall temp file
setvar UNINSTALL_FILE = ''/tmp/dietpi_uninstall_list''
#Default user content folders used in DietPi.
setvar FOLDER_MUSIC = ''Music''
setvar FOLDER_PICTURES = ''Pictures''
setvar FOLDER_VIDEO = ''Video''
setvar FOLDER_DOWNLOADS = ''downloads''
proc Write_InstallFileList {
local write_software_in_pending_state=0
local fp_target="$FP_INSTALLED_FILE"
if test $1 = "temp" {
setvar fp_target = "$FP_INSTALLED_FILE_TEMP"
setvar write_software_in_pending_state = '1'
}
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 <<< """ >> "$fp_target"
#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
"""
>> "$fp_target"
#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_
}
proc Read_InstallFileList {
local fp_target="$FP_INSTALLED_FILE"
if test $1 = "temp" {
setvar fp_target = "$FP_INSTALLED_FILE_TEMP"
}
#Load Software states
G_DIETPI-NOTIFY 2 "Reading database, please wait..."
#Load
if test -f $fp_target {
source "$fp_target"
}
#Always reset choice system during first run to defaults: https://github.com/Fourdee/DietPi/issues/1122
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
setvar INDEX_SSHSERVER_CURRENT = '-1'
setvar INDEX_SSHSERVER_TARGET = '-1'
setvar INDEX_FILESERVER_CURRENT = '0'
setvar INDEX_FILESERVER_TARGET = '0'
setvar INDEX_LOGGING_CURRENT = '-1'
setvar INDEX_LOGGING_TARGET = '-1'
setvar INDEX_WEBSERVER_CURRENT = '-2'
setvar INDEX_WEBSERVER_TARGET = '-2'
}
}
proc Reset_NTPD {
killall -w /DietPi/dietpi/func/run_ntpd &> /dev/null
killall -w ntpd &> /dev/null
rm /var/lib/dietpi/.ntpd_exit_status &> /dev/null
}
proc Check_NTPD_Status {
if (( $(route | awk '{print $4}' | grep -ci -m1 'UG') )) {
while true
{
/DietPi/dietpi/func/run_ntpd status
if (( $? != 0 )) {
# Endless retry
if (( ! $G_USER_INPUTS )) {
Reset_NTPD
# Ask
} else {
whiptail --title "NTPD update failed" --yesno "NTPD timesync has not yet completed, or, failed to update. To prevent issues with outdated system time during installations, you must either:\n\n - Retry NTPD update (recommended)\nThis will kill the current NTPD process and retry NTPD update. If this fails again, please use option below.\n\n - Override (last resort)\nThis will override NTPD update checks, however, your system time will be out of sync and may cause issues during installations.\n\nYou can check the NTPD logs for debugging purposes with:\n cat /var/log/ntpd.log" --yes-button "Override" --no-button "Retry" --defaultno --backtitle $WHIP_BACKTITLE 20 80
if (( $? == 1 )) {
Reset_NTPD
} else {
Reset_NTPD
echo 0 > /var/lib/dietpi/.ntpd_exit_status
echo 1 > /var/lib/dietpi/.ntpd_override
}
}
} else {
break
}
}
}
}
#/////////////////////////////////////////////////////////////////////////////////////
# Installation System
#/////////////////////////////////////////////////////////////////////////////////////
#Reboot after installation has finished.
setvar DISABLE_REBOOT = '0'
#Global Password: Exception to AUTO first run init.
setvar GLOBAL_PW = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_GLOBAL_PASSWORD=' | sed 's/.*=//')
if test ! -n $GLOBAL_PW {
setvar GLOBAL_PW = ''dietpi''
}
#Total system RAM (used to calculate percentage based value for software cache levels, eg: opcache/apcu max sizes)
setvar RAM_TOTAL = $(free -m | grep -m1 'Mem:' | awk '{print $2}')
#Run Installation Flag (1 = run installs)
setvar GOSTARTINSTALL = '0'
setvar INSTALL_URL_ADDRESS = ''''
setvar INSTALL_DESCRIPTION = ''DietPi''
#Special installation Vars
setvar USER_EMONHUB_APIKEY_COMPLETED = '0'
setvar USER_EMONHUB_APIKEY_CURRENT = '0'
setvar WIFIHOTSPOT_RTL8188C_DEVICE = '0'
setvar USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED = '0'
#PHP5/7 specific directories, apt package-, module- and command names
setvar FP_PHP_BASE_DIR = ''/etc/php/7.0''
setvar PHP_APT_PACKAGE_NAME = ''php''
if (( $G_DISTRO < 4 )) {
setvar FP_PHP_BASE_DIR = ''/etc/php5''
setvar PHP_APT_PACKAGE_NAME = ''php5''
}
#
setvar USBDRIVE = '0'
#Choices Made?
setvar INSTALL_DIETPI_CHOICESMADE = '0'
setvar INSTALL_LINUX_CHOICESMADE = '0'
#DietPi Choice System: SSH Server
#NB: Update Read_InstallFileList with defaults
setvar INSTALL_SSHSERVER_CHOICESMADE = '0'
setvar INDEX_SSHSERVER_CURRENT = '-1'
setvar INDEX_SSHSERVER_TARGET = '-1'
#DietPi Choice System: Fileserver
#NB: Update Read_InstallFileList with defaults
setvar INSTALL_FILESERVER_CHOICESMADE = '0'
setvar INDEX_FILESERVER_CURRENT = '0'
setvar INDEX_FILESERVER_TARGET = '0'
#DietPi Choice System: Logging
#NB: Update Read_InstallFileList with defaults
setvar INSTALL_LOGGING_CHOICESMADE = '0'
setvar INDEX_LOGGING_CURRENT = '-1'
setvar INDEX_LOGGING_TARGET = '-1'
#DietPi Preference System: Webserver base
#NB: Update Read_InstallFileList with defaults
setvar INDEX_WEBSERVER_CURRENT = '-2'
setvar INDEX_WEBSERVER_TARGET = '-2'
#Create DietPi-Software Arrays
# - Categories
setvar aSOFTWARE_CATEGORIES_DIETPI = '0' #List of cats
setvar MAX_SOFTWARE_CATEGORIES_DIETPI = '0'
setvar aSOFTWARE_CATEGORIES_LINUX = '0'
setvar MAX_SOFTWARE_CATEGORIES_LINUX = '0'
# - Software
#NB: All software has a unique index that must not be changed (eg: DESKTOP_LXDE = 23)
setvar TOTAL_SOFTWARE_INDEXS = '0'
setvar TOTAL_SOFTWARE_INDEXS_HARDLIMIT = '171' #Increase as needed. Must be higher than TOTAL_SOFTWARE_INDEXS once calculated in Software_Arrays_Init
setvar INSTALLING_INDEX = '0' #Which software index is currently being installed?
setvar aSOFTWARE_CATEGORY_INDEX = '0' #Category index
setvar aSOFTWARE_TYPE = '0' #0=DietPi 1=Linux | -1=Hidden from install menu, visible in uninstall menu | -2 Hidden from all menus
setvar aSOFTWARE_INSTALL_STATE = '0' #0=not / 1=tobe, or not tobe that is the... / 2=installed
setvar aSOFTWARE_WHIP_NAME = '0' #Item name eg: Kodi
setvar aSOFTWARE_WHIP_DESC = '0' #Blah blah
setvar FP_ONLINEDOC_URL = ''http://dietpi.com/phpbb/viewtopic.php?''
setvar aSOFTWARE_ONLINEDOC_URL = '0'
# - Disable software installation, if user input is required for automated installs
setvar aSOFTWARE_REQUIRES_USERINPUT = '0'
# - Optional pre req software that needs to be installed
setvar aSOFTWARE_REQUIRES_ALSA = '0'
setvar aSOFTWARE_REQUIRES_XSERVERXORG = '0'
setvar aSOFTWARE_REQUIRES_MYSQL = '0'
setvar aSOFTWARE_REQUIRES_SQLITE = '0'
setvar aSOFTWARE_REQUIRES_WEBSERVER = '0'
setvar aSOFTWARE_REQUIRES_DESKTOP = '0'
setvar aSOFTWARE_REQUIRES_GIT = '0'
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL = '0'
setvar aSOFTWARE_REQUIRES_RSYSLOG = '0'
setvar aSOFTWARE_REQUIRES_FFMPEG = '0'
setvar aSOFTWARE_REQUIRES_ORACLEJAVA = '0'
setvar aSOFTWARE_REQUIRES_NODEJS = '0'
# - Available for
setvar MAX_G_HW_MODEL = '71' #This needs to match highest G_HW_MODEL value in dietpi-obtain_hw_model
setvar MAX_G_HW_ARCH = '10' #This needs to match highest G_HW_ARCH value in dietpi-obtain_hw_model
# 2D array (well, bash style)
declare -A aSOFTWARE_AVAIL_G_HW_MODEL
declare -A aSOFTWARE_AVAIL_G_HW_ARCH
#/////////////////////////////////////////////////////////////////////////////////////
# This function generates the array for all the software avaliable to be installed.
#
# Reference:
# - Adding new software to DietPi-Software
# https://github.com/Fourdee/DietPi/issues/490#issuecomment-244416570
#
# Adding Software to the Install List:
# ------------------------------------
# - index_current:
# This is the next number in the sequence. Each software install has a unique number,
# so it can be referenced in all arrays. This has to be the same for install, uninstall
# and setting up the service. Run "dietpi-software list | grep 'index Current'" to
# get the next number in the sequence. Ensure that you are running a testing build, as
# release may be behind the testing branch and avaliable software packages.
#
# - aSOFTWARE_WHIP_NAME:
# This is the name to display in the UI.
#
# - aSOFTWARE_WHIP_DESC:
# This is the description to place next to the name in the UI.
#
# - aSOFTWARE_CATEGORY_INDEX:
# If you are adding a new peice of software, first choose the category it belongs to
# (see aSOFTWARE_CATEGORIES_DIETPI and aSOFTWARE_CATEGORIES_LINUX below), which will
# give you the aSOFTWARE_CATEGORY_INDEX to set. In the example below this is 0.
#
# - aSOFTWARE_TYPE:
# If this is aSOFTWARE_CATEGORIES_DIETPI then aSOFTWARE_TYPE=0, if it is
# aSOFTWARE_CATEGORIES_LINUX then it is 1. In the example it is 0.
#
# - aSOFTWARE_ONLINEDOC_URL:
# This is appeneded to FP_ONLINEDOC_URL to make a URL for help on this software.
#
# Specifying other software as dependencies:
# If your software needs other software to be available, look under the 'Requires software
# to be installed' heading and then add that to the section you create. In the example
# below ALSA and XSERVERXORG are needed. The system will check their presence
# and install as needed.
#
# Dealing with Hardware types:
# If you have hardware requirements, like must not/only be installed on a Pi, then you need
# to add something like below. Look for other examples in the existing software
# installations. Full list of models can be found in 'dietpi-obtain_hw_model'.
#
# # - Disabled for All non-rpi
# for ((i=10; i<=$MAX_G_HW_MODEL; i++))
# do
# aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
# done
#
# Example:
# #------------------ Desktops: LXDE ------------------
# index_current=23
# aSOFTWARE_WHIP_NAME[$index_current]='LXDE'
# 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
# aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p42'
#
#/////////////////////////////////////////////////////////////////////////////////////
proc Software_Arrays_Init {
#--------------------------------------------------------------------------------
#Categories
#NB: Unique Indexs, do not re-arrange or re-order.
#--------------------------------------------------------------------------------
#DietPi software
setvar aSOFTWARE_CATEGORIES_DIETPI = ''(
"────Desktops──────────────────────────────────────────────" #0
"────Remote Desktop Access─────────────────────────────────" #1
"────Media Systems─────────────────────────────────────────" #2
"────BitTorrent / Download Tools───────────────────────────" #3
"────Cloud / Backups───────────────────────────────────────" #4
"────Emulation & Gaming────────────────────────────────────" #5
"────Social / Search───────────────────────────────────────" #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
"────Printing──────────────────────────────────────────────" #19
)
setvar MAX_SOFTWARE_CATEGORIES_DIETPI = ${#aSOFTWARE_CATEGORIES_DIETPI[@]}
#Linux software
setvar aSOFTWARE_CATEGORIES_LINUX = ''(
"────SSH Clients───────────────────────────────────────────" #0
"────Fileserver Clients────────────────────────────────────" #1
"────File Managers─────────────────────────────────────────" #2
"────System────────────────────────────────────────────────" #3
"────Shared Libraries──────────────────────────────────────" #4
"────Networking / Tools────────────────────────────────────" #5
"────Development / Programming─────────────────────────────" #6
"────Text Editors──────────────────────────────────────────" #7
"────Desktop Utilities─────────────────────────────────────" #8
)
setvar MAX_SOFTWARE_CATEGORIES_LINUX = ${#aSOFTWARE_CATEGORIES_LINUX[@]}
#--------------------------------------------------------------------------------
#Init | 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
for ((j=0; j<=$MAX_G_HW_MODEL; j++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$i,$j]=1
# ((debug_array_count++))
# echo -e "$debug_array_count ${aSOFTWARE_AVAIL_G_HW_MODEL[$i,$j]}"
done
done
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS_HARDLIMIT; i++))
do
for ((j=0; j<=$MAX_G_HW_ARCH; j++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$i,$j]=1
# ((debug_array_count++))
# echo -e "$debug_array_count ${aSOFTWARE_AVAIL_G_HW_ARCH[$i,$j]}"
done
done
#--------------------------------------------------------------------------------
#Int Online Docs
#--------------------------------------------------------------------------------
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS_HARDLIMIT; i++))
do
aSOFTWARE_ONLINEDOC_URL[$i]=''
done
#--------------------------------------------------------------------------------
#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
aSOFTWARE_REQUIRES_USERINPUT[$i]=0
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
done
#--------------------------------------------------------------------------------
#DietPi software items
#--------------------------------------------------------------------------------
#Assign UNIQUE index to each item
local index_current=0
#Desktops
#--------------------------------------------------------------------------------
setvar index_current = '23'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LXDE'
setvar aSOFTWARE_WHIP_DESC[$index_current]='ultra lightweight desktop'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p42'
#------------------
setvar index_current = '24'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MATE'
setvar aSOFTWARE_WHIP_DESC[$index_current]='desktop enviroment'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p2073'
#------------------
setvar index_current = '25'
setvar aSOFTWARE_WHIP_NAME[$index_current]='XFCE'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight desktop environment'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=70#p2203'
#------------------
setvar index_current = '26'
setvar aSOFTWARE_WHIP_NAME[$index_current]='GNUStep'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight based on OpenStep'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p2072'
#------------------
setvar index_current = '113'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Chromium'
setvar aSOFTWARE_WHIP_DESC[$index_current]='(Optional) web browser'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=3011#p3011'
# - ARMv6
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=0
# - VM
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,20]=0
#Remote Desktops
#--------------------------------------------------------------------------------
setvar index_current = '27'
setvar aSOFTWARE_WHIP_NAME[$index_current]='TightVNC Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='desktop for remote connection'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p408'
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
# - Disable for Stretch, replaced by tigervnc (vnc4)
if (( $G_DISTRO >= 4 )) {
for ((i=0; i<$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
}
#------------------
setvar index_current = '28'
setvar aSOFTWARE_WHIP_NAME[$index_current]='VNC4 Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='desktop for remote connection'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p408'
#------------------
setvar index_current = '29'
setvar aSOFTWARE_WHIP_NAME[$index_current]='XRDP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='remote desktop protocol (rdp) server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=70#p2074'
#------------------
setvar index_current = '30'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NoMachine'
setvar aSOFTWARE_WHIP_DESC[$index_current]='multi-platform server and client access'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p2071'
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '120'
setvar aSOFTWARE_WHIP_NAME[$index_current]='RealVNC Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='desktop for remote connection'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=4149#p4149'
# - License RPi only
for ((i=10; i<$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#Media Systems
#--------------------------------------------------------------------------------
setvar index_current = '31'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Kodi'
setvar aSOFTWARE_WHIP_DESC[$index_current]='the media centre for linux'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p43'
# - Disabled for All non-RPi/Odroid boards
for ((i=20; i<$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '32'
setvar aSOFTWARE_WHIP_NAME[$index_current]='YMPD'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight web interface music player for mpd'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p50'
#------------------
setvar index_current = '119'
setvar aSOFTWARE_WHIP_NAME[$index_current]='CAVA'
setvar aSOFTWARE_WHIP_DESC[$index_current]='optional: console audio vis for mpd'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=3928#p3928'
# - X86_64
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,10]=0
#------------------
setvar index_current = '33'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SubSonic 5'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface media streaming server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p213'
#------------------
setvar index_current = '34'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SubSonic 6'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface media streaming server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p213'
#------------------
setvar index_current = '35'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SqueezeBox'
setvar aSOFTWARE_WHIP_DESC[$index_current]='logitech media server (lms)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1009#p1009'
#------------------
setvar index_current = '36'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SqueezeLite'
setvar aSOFTWARE_WHIP_DESC[$index_current]='audio player for lms & squeezebox'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1009#p1009'
#------------------
setvar index_current = '37'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Shairport Sync'
setvar aSOFTWARE_WHIP_DESC[$index_current]='airplay audio player with multiroom sync'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1221#p1221'
# - x86_64
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,10]=0
#------------------
setvar index_current = '38'
setvar aSOFTWARE_WHIP_NAME[$index_current]='BruteFIR'
setvar aSOFTWARE_WHIP_DESC[$index_current]='eq and digital room correction via alsa'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=57#p57'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '39'
setvar aSOFTWARE_WHIP_NAME[$index_current]='ReadyMedia'
setvar aSOFTWARE_WHIP_DESC[$index_current]='(MiniDLNA) media streaming server (dlna, upnp)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p49'
#------------------
setvar index_current = '40'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Ampache'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface media streaming server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=40#p554'
#------------------
setvar index_current = '41'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Emby Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface media streaming server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1789#p1789'
#disable ARMv6: https://github.com/Fourdee/DietPi/issues/534
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=0
#disable ARMv8: https://github.com/Fourdee/DietPi/issues/1059#issuecomment-313661959
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '42'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Plex Media Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface media streaming server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1949#p1949'
#disable ARMv6: https://github.com/Fourdee/DietPi/issues/648
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=0
#------------------
setvar index_current = '43'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Murmur'
setvar aSOFTWARE_WHIP_DESC[$index_current]='mumble voip server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1691#p1691'
#------------------
setvar index_current = '118'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Mopidy'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface music & radio player'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=80#p3611'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
#------------------
setvar index_current = '121'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Roon Bridge'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Turns device into Roon capable audio player'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=80#p4153'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
# - Currently ARMv7/64 only, so disable all archs
for ((i=0; i<=$MAX_G_HW_ARCH; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=0
done
# renable for armv7/64
for ((i=2; i<=10; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=1
done
#------------------
setvar index_current = '124'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NAA daemon'
setvar aSOFTWARE_WHIP_DESC[$index_current]='signalyst network audio adaptor (naa)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=90#p4294'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
# - Currently ARMv7+ only, so disable all archs
for ((i=0; i<=$MAX_G_HW_ARCH; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=0
done
# renable for armv7+
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,2]=1
#------------------
setvar index_current = '128'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MPD'
setvar aSOFTWARE_WHIP_DESC[$index_current]='music player daemon'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=''
#------------------
setvar index_current = '129'
setvar aSOFTWARE_WHIP_NAME[$index_current]='O!MPD'
setvar aSOFTWARE_WHIP_DESC[$index_current]='feature-rich, web interface audio player for mpd'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=5171#p5171'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
# - VM
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,20]=0
#------------------
setvar index_current = '135'
setvar aSOFTWARE_WHIP_NAME[$index_current]='IceCast'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Shoutcast streaming server (+DarkIce)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6526#p6526'
# - VM
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,20]=0
#------------------
setvar index_current = '141'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Spotify Connect Web'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface for spotify premium'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7013#p7013'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
# - Currently ARMv7+ only, so disable all archs
for ((i=0; i<=$MAX_G_HW_ARCH; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=0
done
# renable for armv7+
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,2]=1
#------------------
setvar index_current = '143'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Koel'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface audio streamer'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7305#p7305'
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_REQUIRES_NODEJS[$index_current]=1
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
#------------------
setvar index_current = '146'
setvar aSOFTWARE_WHIP_NAME[$index_current]='PlexPy'
setvar aSOFTWARE_WHIP_DESC[$index_current]='monitoring and tracking tool for Plex'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7463#p7463'
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
# - Disabled for ARM64
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '148'
setvar aSOFTWARE_WHIP_NAME[$index_current]='JRiver MC'
setvar aSOFTWARE_WHIP_DESC[$index_current]='media centre'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=110#p7536'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '154'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Roon Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Roon capable audio player and core'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7966#p7966'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
# - x86_64
for ((i=0; i<=$MAX_G_HW_ARCH; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=0
done
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,10]=1
#------------------
setvar index_current = '159'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Allo'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=''
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
#------------------
setvar index_current = '160'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Allo_update'
setvar aSOFTWARE_WHIP_DESC[$index_current]='quick reinstall/update web only'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=''
#------------------
setvar index_current = '163'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Gmediarender'
setvar aSOFTWARE_WHIP_DESC[$index_current]='DLNA audio render/endpoint'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=9012#p9012'
#------------------
setvar index_current = '167'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Raspotify'
setvar aSOFTWARE_WHIP_DESC[$index_current]='spotify connect client'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=9368#p9368'
#disable ARMv8:
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#disable x86_64:
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,10]=0
#------------------
setvar index_current = '168'
setvar aSOFTWARE_WHIP_NAME[$index_current]='moOde'
setvar aSOFTWARE_WHIP_DESC[$index_current]='audiophile-quality music playback'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_SQLITE[$index_current]=1
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='xxxxxxxxxxxxxxxxx'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#BitTorrent
#--------------------------------------------------------------------------------
setvar index_current = '44'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Transmission'
setvar aSOFTWARE_WHIP_DESC[$index_current]='bittorrent server with web interface (c)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p46'
#------------------
setvar index_current = '45'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Deluge'
setvar aSOFTWARE_WHIP_DESC[$index_current]='bittorrent server with web interface (python)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p61'
#------------------
setvar index_current = '46'
setvar aSOFTWARE_WHIP_NAME[$index_current]='qBitTorrent'
setvar aSOFTWARE_WHIP_DESC[$index_current]='bittorrent server with web interface (c++)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=70#p2272'
#------------------
setvar index_current = '107'
setvar aSOFTWARE_WHIP_NAME[$index_current]='rTorrent'
setvar aSOFTWARE_WHIP_DESC[$index_current]='bittorrent server with rutorrent web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
#aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=2603#p2603'
#------------------
setvar index_current = '116'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SickRage'
setvar aSOFTWARE_WHIP_DESC[$index_current]='automatically download TV shows'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=3327#p3327'
#------------------
setvar index_current = '132'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Aria2'
setvar aSOFTWARE_WHIP_DESC[$index_current]='download manager with web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6177#p6177'
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_SQLITE[$index_current]=1
#------------------
setvar index_current = '139'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SABnzbd'
setvar aSOFTWARE_WHIP_DESC[$index_current]='nzb download manager'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6747#p6747'
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
#------------------
setvar index_current = '142'
setvar aSOFTWARE_WHIP_NAME[$index_current]='CouchPotato'
setvar aSOFTWARE_WHIP_DESC[$index_current]='automatically download movies'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6747#p6747'
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
#------------------
setvar index_current = '144'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Sonarr'
setvar aSOFTWARE_WHIP_DESC[$index_current]='automatically download TV shows'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7455#p7455'
#------------------
setvar index_current = '145'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Radarr'
setvar aSOFTWARE_WHIP_DESC[$index_current]='automatically download movies'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7457#p7457'
#------------------
setvar index_current = '147'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Jackett'
setvar aSOFTWARE_WHIP_DESC[$index_current]='api Support for your torrent trackers.'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7503#p7503'
#------------------
setvar index_current = '149'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NZBget'
setvar aSOFTWARE_WHIP_DESC[$index_current]='nzb download manager'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7575#p7575'
#------------------ BitTorrent: HTPC Manager ------------------
setvar index_current = '155'
setvar aSOFTWARE_WHIP_NAME[$index_current]='HTPC Manager'
setvar aSOFTWARE_WHIP_DESC[$index_current]='manage your HTPC from anywhere'
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=8043#p8043'
#Cloud / Backups
#--------------------------------------------------------------------------------
setvar index_current = '47'
setvar aSOFTWARE_WHIP_NAME[$index_current]='ownCloud'
setvar aSOFTWARE_WHIP_DESC[$index_current]='your very own cloud (eg: dropbox)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p47'
#------------------
setvar index_current = '114'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Nextcloud'
setvar aSOFTWARE_WHIP_DESC[$index_current]='A safe home for all your data'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=3026#p3026'
#------------------
setvar index_current = '48'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Pydio'
setvar aSOFTWARE_WHIP_DESC[$index_current]='feature-rich backup and sync server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1064#p1064'
#------------------
setvar index_current = '111'
setvar aSOFTWARE_WHIP_NAME[$index_current]='UrBackup server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='full system backup server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=65#p65'
#No deb packages for ARMv6:
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=0
#------------------
setvar index_current = '49'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Gogs'
setvar aSOFTWARE_WHIP_DESC[$index_current]='personal github server with web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=70#p2187'
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '50'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Syncthing'
setvar aSOFTWARE_WHIP_DESC[$index_current]='backup and sync server with web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=70#p2363'
#------------------
setvar index_current = '134'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Tonido'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight cloud based backup system'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6476#p6476'
# - ARMv6
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=0
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '158'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Minio'
setvar aSOFTWARE_WHIP_DESC[$index_current]='S3 compatible distributed object server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
#------------------
setvar index_current = '161'
setvar aSOFTWARE_WHIP_NAME[$index_current]='FuguHub'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Lightweight WebDAV cloud (eg: dropbox) with a CMS'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
# - x86_64
#aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,10]=0
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '165'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Gitea'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Git with a cup of tea'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=9863#p9863'
#Emulation / Gaming
#--------------------------------------------------------------------------------
setvar index_current = '108'
setvar aSOFTWARE_WHIP_NAME[$index_current]='AmiBerry'
setvar aSOFTWARE_WHIP_DESC[$index_current]='amiga emulator'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=64#p64'
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '51'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenTyrian'
setvar aSOFTWARE_WHIP_DESC[$index_current]='a classic retro game, addictive'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p45'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '112'
setvar aSOFTWARE_WHIP_NAME[$index_current]='DXX-Rebirth'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Descent 1/2'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=2963#p2963'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '52'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Cuberite'
setvar aSOFTWARE_WHIP_DESC[$index_current]='minecraft server with web interface (c++)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p2068'
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#------------------
setvar index_current = '53'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MineOS'
setvar aSOFTWARE_WHIP_DESC[$index_current]='minecraft servers with web interface (java)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
setvar aSOFTWARE_REQUIRES_NODEJS[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p2069'
#------------------
setvar index_current = '156'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Steam'
setvar aSOFTWARE_WHIP_DESC[$index_current]='client'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=8016#p8016'
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
#Native PC only
for ((i=0; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,21]=1
#------------------
setvar index_current = '164'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Nukkit'
setvar aSOFTWARE_WHIP_DESC[$index_current]='A nuclear-powered server for Minecraft Pocket Edition'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
#Social Media
#--------------------------------------------------------------------------------
setvar index_current = '54'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Forums'
setvar aSOFTWARE_WHIP_DESC[$index_current]='phpbb forums'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=5#p51'
#------------------
setvar index_current = '55'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Wordpress'
setvar aSOFTWARE_WHIP_DESC[$index_current]='website blog and publishing platform'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p395'
#------------------
setvar index_current = '56'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Image Gallery'
setvar aSOFTWARE_WHIP_DESC[$index_current]='website to host / browse your images'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=40#p480'
#------------------
setvar index_current = '57'
setvar aSOFTWARE_WHIP_NAME[$index_current]='BaiKal'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight caldav + carddav server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=50#p1502'
#------------------
setvar index_current = '58'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenBazaar'
setvar aSOFTWARE_WHIP_DESC[$index_current]='decentralized peer to peer bitcoin market'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1796#p1796'
#------------------
setvar index_current = '133'
setvar aSOFTWARE_WHIP_NAME[$index_current]='YaCy'
setvar aSOFTWARE_WHIP_DESC[$index_current]='decentralized open source search engine'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6202#p6202'
#------------------
#Camera
#--------------------------------------------------------------------------------
setvar index_current = '59'
setvar aSOFTWARE_WHIP_NAME[$index_current]='DietPi Cam'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface & controls for your rpi camera'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p48'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '136'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MotionEye'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface & surveillance for your camera'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6610#p6610'
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
#WiFi Hotspot
#--------------------------------------------------------------------------------
setvar index_current = '60'
setvar aSOFTWARE_WHIP_NAME[$index_current]='WiFi Hotspot'
setvar aSOFTWARE_WHIP_DESC[$index_current]='turn your device into a wifi hotspot'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=8
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1207#p1207'
# - VM
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,20]=0
#------------------
setvar index_current = '61'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Tor Hotspot'
setvar aSOFTWARE_WHIP_DESC[$index_current]='optional: route hotspot traffic through tor'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=8
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1529#p1529'
# - VM
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,20]=0
#------------------
#System stats
#--------------------------------------------------------------------------------
setvar index_current = '62'
setvar aSOFTWARE_WHIP_NAME[$index_current]='DietPi-Cloudshell'
setvar aSOFTWARE_WHIP_DESC[$index_current]='system stats displayed on lcd/panel'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p204'
#------------------
setvar index_current = '63'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LinuxDash'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface system stats'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p108'
#------------------
setvar index_current = '64'
setvar aSOFTWARE_WHIP_NAME[$index_current]='PhpSysInfo'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface system stats'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p451'
#------------------
setvar index_current = '65'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NetData'
setvar aSOFTWARE_WHIP_DESC[$index_current]='real-time performance monitoring'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_NODEJS[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=60#p1611'
#------------------
setvar index_current = '66'
setvar aSOFTWARE_WHIP_NAME[$index_current]='RPi-Monitor'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface system stats'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=50#p1503'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '106'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Raspcontrol'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface system stats'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p89'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '115'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Webmin'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface system management'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=80#p3047'
setvar aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1
#------------------
setvar index_current = '126'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenMediaVault'
setvar aSOFTWARE_WHIP_DESC[$index_current]='nas solution with web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=-1 #:https://github.com/Fourdee/DietPi/issues/851
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=4859#p4859'
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_USERINPUT[$index_current]=1
#------------------
setvar index_current = '162'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Docker'
setvar aSOFTWARE_WHIP_DESC[$index_current]='Build, ship, and run distributed applications'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=9
setvar aSOFTWARE_TYPE[$index_current]=0
# - ARMv8
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
#Remote Access
#--------------------------------------------------------------------------------
setvar index_current = '67'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NoIp'
setvar aSOFTWARE_WHIP_DESC[$index_current]='url website address for your device'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=10
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p58'
#------------------
setvar index_current = '68'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Remot3.it'
setvar aSOFTWARE_WHIP_DESC[$index_current]='(Weaved) access your device over the internet'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=10
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p188'
# - Currently ARMv7+ only, so disable all archs
for ((i=0; i<=$MAX_G_HW_ARCH; i++))
do
aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,$i]=0
done
# renable for armv6/7
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,1]=1
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,2]=1
#------------------
setvar index_current = '138'
setvar aSOFTWARE_WHIP_NAME[$index_current]='VirtualHere'
setvar aSOFTWARE_WHIP_DESC[$index_current]='server: share USB devices over the network'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=10
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6709#p6709'
#------------------
#Hardware projects
#--------------------------------------------------------------------------------
setvar index_current = '69'
setvar aSOFTWARE_WHIP_NAME[$index_current]='RPi.GPIO'
setvar aSOFTWARE_WHIP_DESC[$index_current]='gpio interface library for rpi (python)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=40#p1065'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '70'
setvar aSOFTWARE_WHIP_NAME[$index_current]='WiringPi'
setvar aSOFTWARE_WHIP_DESC[$index_current]='gpio interface library (c)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1066#p1066'
# - RPi / Odroids
for ((i=20; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#+ BPi Pro
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,51]=1
#------------------
setvar index_current = '71'
setvar aSOFTWARE_WHIP_NAME[$index_current]='WebIOPi'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface to control rpi.gpio'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p189'
# - Disabled for All non-rpi and RPi3
for ((i=3; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '72'
setvar aSOFTWARE_WHIP_NAME[$index_current]='I2c'
setvar aSOFTWARE_WHIP_DESC[$index_current]='enables support for i2c based hardware'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '122'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Node-Red'
setvar aSOFTWARE_WHIP_DESC[$index_current]='tool for wiring devices, APIs and online services'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_NODEJS[$index_current]=1
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=80#p4292'
#------------------
setvar index_current = '123'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Mosquitto '
setvar aSOFTWARE_WHIP_DESC[$index_current]='MQTT messaging broker'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=90#p4293'
#------------------
setvar index_current = '131'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Blynk Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]='msg controller for blynk mobile app and sbcs'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=5901#p5901'
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
setvar aSOFTWARE_REQUIRES_NODEJS[$index_current]=1
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
#------------------
setvar index_current = '166'
setvar aSOFTWARE_WHIP_NAME[$index_current]='PI-SPC'
setvar aSOFTWARE_WHIP_DESC[$index_current]='audiophonics pi-spc power control module'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=9359#p9359'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '169'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Google AIY'
setvar aSOFTWARE_WHIP_DESC[$index_current]='voice kit'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=11
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_ALSA[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=9486#p9486'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#System security
#--------------------------------------------------------------------------------
setvar index_current = '73'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Fail2Ban'
setvar aSOFTWARE_WHIP_DESC[$index_current]='prevents brute-force attacks with ip ban'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=12
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p452'
#------------------
#Webserver stacks
#--------------------------------------------------------------------------------
setvar index_current = '75'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LASP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='apache2 | sqlite | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p52'
#------------------
setvar index_current = '76'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LAAP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='apache2 | mariadb | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p52'
#------------------
setvar index_current = '78'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LESP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='nginx | sqlite | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p5'
#------------------
setvar index_current = '79'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LEAP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='nginx | mariadb | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p5'
#------------------
setvar index_current = '81'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LLSP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lighttpd | sqlite | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '82'
setvar aSOFTWARE_WHIP_NAME[$index_current]='LLAP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lighttpd | mariadb | php'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '83'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Apache2'
setvar aSOFTWARE_WHIP_DESC[$index_current]='webserver'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p52'
#------------------
setvar index_current = '84'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Lighttpd'
setvar aSOFTWARE_WHIP_DESC[$index_current]='webserver'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '85'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Nginx'
setvar aSOFTWARE_WHIP_DESC[$index_current]='webserver'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5#p5'
#------------------
setvar index_current = '87'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SQlite'
setvar aSOFTWARE_WHIP_DESC[$index_current]='database'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '88'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MariaDB'
setvar aSOFTWARE_WHIP_DESC[$index_current]='database'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '89'
setvar aSOFTWARE_WHIP_NAME[$index_current]='PHP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='webserver'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1335#p1335'
#------------------
setvar index_current = '90'
setvar aSOFTWARE_WHIP_NAME[$index_current]='phpMyAdmin'
setvar aSOFTWARE_WHIP_DESC[$index_current]='optional mysql admin tools'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_MYSQL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p54'
#------------------
setvar index_current = '91'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Redis'
setvar aSOFTWARE_WHIP_DESC[$index_current]='optional non-sql database store'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
#------------------
setvar index_current = '92'
setvar aSOFTWARE_WHIP_NAME[$index_current]='CertBot'
setvar aSOFTWARE_WHIP_DESC[$index_current]='free, ssl cert install allowing https://'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1061#p1062'
#------------------
setvar index_current = '125'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Tomcat8'
setvar aSOFTWARE_WHIP_DESC[$index_current]='apache tomcat server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=13
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=4316#p4316'
setvar aSOFTWARE_REQUIRES_ORACLEJAVA[$index_current]=1
#PiHole
#--------------------------------------------------------------------------------
setvar index_current = '93'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Pi-hole'
setvar aSOFTWARE_WHIP_DESC[$index_current]='block adverts for any device on your network'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=14
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p174'
setvar aSOFTWARE_REQUIRES_USERINPUT[$index_current]=1
#------------------
#File servers
#--------------------------------------------------------------------------------
setvar index_current = '94'
setvar aSOFTWARE_WHIP_NAME[$index_current]='ProFTP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='lightweight ftp server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=15
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p55'
#------------------
setvar index_current = '95'
setvar aSOFTWARE_WHIP_NAME[$index_current]='vsFTPD'
setvar aSOFTWARE_WHIP_DESC[$index_current]='alternative ftp server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=15
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='?f=8&t=5&p=2820#p2820'
#------------------
setvar index_current = '96'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Samba'
setvar aSOFTWARE_WHIP_DESC[$index_current]='feature-rich file server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=15
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p56'
#------------------
setvar index_current = '109'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NFS'
setvar aSOFTWARE_WHIP_DESC[$index_current]='network file system server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=15
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p56'
#------------------
#VPN servers
#--------------------------------------------------------------------------------
setvar index_current = '97'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenVPN'
setvar aSOFTWARE_WHIP_DESC[$index_current]='vpn server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=16
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=613#p613'
#------------------
setvar index_current = '117'
setvar aSOFTWARE_WHIP_NAME[$index_current]='PiVPN'
setvar aSOFTWARE_WHIP_DESC[$index_current]='openvpn installer & management tool'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=16
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=3469#p3469'
setvar aSOFTWARE_REQUIRES_USERINPUT[$index_current]=1
#------------------
#Advanced Networking
#--------------------------------------------------------------------------------
setvar index_current = '98'
setvar aSOFTWARE_WHIP_NAME[$index_current]='HaProxy'
setvar aSOFTWARE_WHIP_DESC[$index_current]='high performance tcp/http load balancer'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=17
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=30#p221'
#Home automation
#--------------------------------------------------------------------------------
setvar index_current = '99'
setvar aSOFTWARE_WHIP_NAME[$index_current]='EmonPi'
setvar aSOFTWARE_WHIP_DESC[$index_current]='energy usage addon board with web interface'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=18
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1529#p1525'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '100'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Grasshopper'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web app to control bticino myhome'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=18
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1
setvar aSOFTWARE_REQUIRES_SQLITE[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p70'
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------ Home Automation: Home Assistant ------------------
setvar index_current = '157'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Home Assistant'
setvar aSOFTWARE_WHIP_DESC[$index_current]='open-source home automation platform'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=18
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_SQLITE[$index_current]=1
setvar aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p70'
#------------------
#Printing
#--------------------------------------------------------------------------------
setvar index_current = '137'
setvar aSOFTWARE_WHIP_NAME[$index_current]='CloudPrint'
setvar aSOFTWARE_WHIP_DESC[$index_current]='print server for google cloud print'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=19
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=6630#p6630'
setvar aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1 #Not required, but comes in as package dep
#Disabled for ARMv8 on Jessie only: https://github.com/Fourdee/DietPi/issues/855#issuecomment-292712002
if (( $G_DISTRO == 3 )) {
setvar aSOFTWARE_AVAIL_G_HW_ARCH[$index_current,3]=0
}
#------------------
setvar index_current = '153'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OctoPrint'
setvar aSOFTWARE_WHIP_DESC[$index_current]='web interface for controlling 3d printers'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=19
setvar aSOFTWARE_TYPE[$index_current]=0
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=7958#p7958'
setvar aSOFTWARE_REQUIRES_BUILDESSENTIAL[$index_current]=1
setvar aSOFTWARE_REQUIRES_GIT[$index_current]=1 # Required for updates
#--------------------------------------------------------------------------------
#Additional linux software items
#--------------------------------------------------------------------------------
#SSH clients
#--------------------------------------------------------------------------------
setvar index_current = '0'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenSSH Client'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
#File server clients
#--------------------------------------------------------------------------------
setvar index_current = '1'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Samba Client'
setvar aSOFTWARE_WHIP_DESC[$index_current]='access network shares'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=' dietpi-config > Network Options: NAS/Misc'
#------------------
setvar index_current = '2'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Curlftpfs'
setvar aSOFTWARE_WHIP_DESC[$index_current]='ftp client with filesystem mount'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=' dietpi-config > Network Options: NAS/Misc'
#------------------
setvar index_current = '110'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NFS Client'
setvar aSOFTWARE_WHIP_DESC[$index_current]='network file system client'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=1
setvar aSOFTWARE_TYPE[$index_current]=1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]=' dietpi-config > Network Options: NAS/Misc'
#------------------
#File managers
#--------------------------------------------------------------------------------
setvar index_current = '3'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MC'
setvar aSOFTWARE_WHIP_DESC[$index_current]='midnight commander, powerful file manager'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '4'
setvar aSOFTWARE_WHIP_NAME[$index_current]='ViFM'
setvar aSOFTWARE_WHIP_DESC[$index_current]='file manager with vi bindings'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=2
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
#System
#--------------------------------------------------------------------------------
setvar index_current = '5'
setvar aSOFTWARE_WHIP_NAME[$index_current]='ALSA'
setvar aSOFTWARE_WHIP_DESC[$index_current]='linux sound system'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '6'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Xserver'
setvar aSOFTWARE_WHIP_DESC[$index_current]='linux display system'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '151'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Nvidia'
setvar aSOFTWARE_WHIP_DESC[$index_current]='display driver'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=1
setvar aSOFTWARE_REQUIRES_XSERVERXORG[$index_current]=1
for ((i=0; i<$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,21]=1
#------------------
setvar index_current = '170'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NTP'
setvar aSOFTWARE_WHIP_DESC[$index_current]='date and time sync'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=3
setvar aSOFTWARE_TYPE[$index_current]=-1 #Hidden, use dietpi-config > advanced > timesync to setup
#Shared Libs
#--------------------------------------------------------------------------------
setvar index_current = '7'
setvar aSOFTWARE_WHIP_NAME[$index_current]='FFmpeg'
setvar aSOFTWARE_WHIP_DESC[$index_current]='audio & visual libary'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '8'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Java'
setvar aSOFTWARE_WHIP_DESC[$index_current]='OpenJDK 8 + JRE libary'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '9'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Node.js'
setvar aSOFTWARE_WHIP_DESC[$index_current]='javascript runtime'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '130'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Python Pip'
setvar aSOFTWARE_WHIP_DESC[$index_current]='python pip package installer'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '140'
setvar aSOFTWARE_WHIP_NAME[$index_current]='SDL2'
setvar aSOFTWARE_WHIP_DESC[$index_current]='simple direct layer 2'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
# - Disabled for All non-rpi
for ((i=10; i<=$MAX_G_HW_MODEL; i++))
do
aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$i]=0
done
#------------------
setvar index_current = '150'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Mono'
setvar aSOFTWARE_WHIP_DESC[$index_current]='runtime libraries and repo'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=4
setvar aSOFTWARE_TYPE[$index_current]=1
#Networking
#--------------------------------------------------------------------------------
setvar index_current = '10'
setvar aSOFTWARE_WHIP_NAME[$index_current]='iftop'
setvar aSOFTWARE_WHIP_DESC[$index_current]='displays bandwidth usage information'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '11'
setvar aSOFTWARE_WHIP_NAME[$index_current]='IPTraf'
setvar aSOFTWARE_WHIP_DESC[$index_current]='interactive colorful ip lan monitor'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '12'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Iperf'
setvar aSOFTWARE_WHIP_DESC[$index_current]='internet protocol bandwidth measuring tool'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '13'
setvar aSOFTWARE_WHIP_NAME[$index_current]='MTR-Tiny'
setvar aSOFTWARE_WHIP_DESC[$index_current]='full screen ncurses traceroute tool'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '14'
setvar aSOFTWARE_WHIP_NAME[$index_current]='nLoad'
setvar aSOFTWARE_WHIP_DESC[$index_current]='realtime console network usage monitor'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '15'
setvar aSOFTWARE_WHIP_NAME[$index_current]='tcpdump'
setvar aSOFTWARE_WHIP_DESC[$index_current]='command-line network traffic analyzer'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '152'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Avahi-Daemon'
setvar aSOFTWARE_WHIP_DESC[$index_current]='hostname broadcast (mac, pc bonjour)'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=5
setvar aSOFTWARE_TYPE[$index_current]=1
#Development / Programming
#--------------------------------------------------------------------------------
setvar index_current = '16'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Build-Essentials'
setvar aSOFTWARE_WHIP_DESC[$index_current]='common packages for compile'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '17'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Git Client'
setvar aSOFTWARE_WHIP_DESC[$index_current]='git clone etc'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=6
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
#Text Editors
#--------------------------------------------------------------------------------
setvar index_current = '18'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Emacs'
setvar aSOFTWARE_WHIP_DESC[$index_current]='gnu emacs editor'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '19'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Jed'
setvar aSOFTWARE_WHIP_DESC[$index_current]='editor for programmers'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '20'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Vim'
setvar aSOFTWARE_WHIP_DESC[$index_current]='vi enhanced text editor'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '21'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Vim-Tiny'
setvar aSOFTWARE_WHIP_DESC[$index_current]='compact release of vim'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=1
#------------------
setvar index_current = '127'
setvar aSOFTWARE_WHIP_NAME[$index_current]='NeoVim'
setvar aSOFTWARE_WHIP_DESC[$index_current]='heavily refactored vim fork'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=7
setvar aSOFTWARE_TYPE[$index_current]=1
# - Stretch only
if (( $G_DISTRO < 4 )) {
setvar aSOFTWARE_AVAIL_G_HW_MODEL[$index_current,$G_HW_MODEL]=0
}
#------------------
#Desktop Utilities
#--------------------------------------------------------------------------------
setvar index_current = '22'
setvar aSOFTWARE_WHIP_NAME[$index_current]='QuiteRSS'
setvar aSOFTWARE_WHIP_DESC[$index_current]='cross-platform, free rss reader'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=8
setvar aSOFTWARE_TYPE[$index_current]=1
setvar aSOFTWARE_REQUIRES_DESKTOP[$index_current]=1
#------------------
#--------------------------------------------------------------------------------
#Logging (hidden)
#--------------------------------------------------------------------------------
setvar index_current = '101'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Log Rotate'
setvar aSOFTWARE_WHIP_DESC[$index_current]='rotates log files'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p68'
#------------------
setvar index_current = '102'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Rsyslog'
setvar aSOFTWARE_WHIP_DESC[$index_current]='system logging'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p68'
#------------------
setvar index_current = '103'
setvar aSOFTWARE_WHIP_NAME[$index_current]='DietPi-Ramlog'
setvar aSOFTWARE_WHIP_DESC[$index_current]='minimal, optimized logging'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=20#p68'
#------------------
#--------------------------------------------------------------------------------
#SSH servers (hidden from install menu)
#--------------------------------------------------------------------------------
setvar index_current = '104'
setvar aSOFTWARE_WHIP_NAME[$index_current]='Dropbear'
setvar aSOFTWARE_WHIP_DESC[$index_current]='ssh server'
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p62'
#------------------
setvar index_current = '105'
setvar aSOFTWARE_WHIP_NAME[$index_current]='OpenSSH Server'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=10#p63'
#------------------
#--------------------------------------------------------------------------------
#Free indexes (due to removal of MySQL)
#--------------------------------------------------------------------------------
setvar index_current = '74'
setvar aSOFTWARE_WHIP_NAME[$index_current]='free index'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar index_current = '77'
setvar aSOFTWARE_WHIP_NAME[$index_current]='free index'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar index_current = '80'
setvar aSOFTWARE_WHIP_NAME[$index_current]='free index'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
setvar index_current = '86'
setvar aSOFTWARE_WHIP_NAME[$index_current]='free index'
setvar aSOFTWARE_WHIP_DESC[$index_current]=''
setvar aSOFTWARE_CATEGORY_INDEX[$index_current]=0
setvar aSOFTWARE_TYPE[$index_current]=-1
#--------------------------------------------------------------------------------
#Total software installations
setvar TOTAL_SOFTWARE_INDEXS = ${#aSOFTWARE_TYPE[@]}
#--------------------------------------------------------------------------------
#Init Installed state - 0=not 1=to be 2=installed
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
aSOFTWARE_INSTALL_STATE[$i]=0
done
#Installed software on DietPi image by default.
setvar aSOFTWARE_INSTALL_STATE[103]=2
setvar aSOFTWARE_INSTALL_STATE[104]=2
#--------------------------------------------------------------------------------
}
proc 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_ONLINEDOC_URL
unset aSOFTWARE_INSTALL_STATE
unset aSOFTWARE_REQUIRES_USERINPUT
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_G_HW_MODEL
unset aSOFTWARE_AVAIL_G_HW_ARCH
}
#Disable software installation, if user input is required for automated installs
proc Install_Disable_Requires_UserInput {
if (( ! $G_USER_INPUTS )) {
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 &&
${aSOFTWARE_REQUIRES_USERINPUT[$i]} )); then
# - Disable
aSOFTWARE_INSTALL_STATE[$i]=0
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$i]}: Requires user input and can not be automated."
G_DIETPI-NOTIFY 1 "${aSOFTWARE_WHIP_NAME[$i]}: Will not be installed. Please run 'dietpi-software' to install."
fi
done
}
}
#Work out which additional software we need to install
proc Install_Flag_Prereq_Software {
G_DIETPI-NOTIFY 3 DietPi-Software "Checking for prerequisite software"
#-------------------------------------------------------------------------
#Pre-req software, for items that do not have their own array aSOFTWARE_REQUIRES_SOFTWARENAME
local index=0
#Additional software that requires WiringPi
# AudioPhonics Pi-SPC
if (( ${aSOFTWARE_INSTALL_STATE[166]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[70]=1
}
#Additional Software required by Allo Web Interface
if (( ${aSOFTWARE_INSTALL_STATE[159]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[36]=1 # Squeezelite
setvar aSOFTWARE_INSTALL_STATE[37]=1 # Shairport Sync
# if (( $G_HW_MODEL == 70 )); then
# aSOFTWARE_INSTALL_STATE[60]=1 # WiFi Hotspot
# fi
setvar aSOFTWARE_INSTALL_STATE[65]=1 # Netdata
setvar aSOFTWARE_INSTALL_STATE[96]=1 # Samba
setvar aSOFTWARE_INSTALL_STATE[121]=1 # Roon Bridge
setvar aSOFTWARE_INSTALL_STATE[124]=1 # NAA Daemon
#aSOFTWARE_INSTALL_STATE[128]=1 # MPD
setvar aSOFTWARE_INSTALL_STATE[129]=1 # O!MPD
#aSOFTWARE_INSTALL_STATE[152]=1 # Avahi (pulled in by O!MPD)
setvar aSOFTWARE_INSTALL_STATE[163]=1 # Gmrender
}
#Additional Software required by moOde
if (( ${aSOFTWARE_INSTALL_STATE[168]} == 1 )) {
#aSOFTWARE_INSTALL_STATE[36]=1 # Squeezelite # Disabled/optional
#aSOFTWARE_INSTALL_STATE[37]=1 # Shairport Sync # Disabled/optional
#aSOFTWARE_INSTALL_STATE[60]=1 # WiFi Hotspot # Installed as per moOde docs
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[128]} will be installed"
setvar aSOFTWARE_INSTALL_STATE[128]=1 # MPD
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[78]} will be installed"
setvar aSOFTWARE_INSTALL_STATE[78]=1 # LESP, override user choice for now.
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[1]} will be installed"
setvar aSOFTWARE_INSTALL_STATE[1]=1 # Samba Client
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[96]} will be installed"
setvar aSOFTWARE_INSTALL_STATE[96]=1 # Samba Server
}
#Additional Software required by Google AIY
if (( ${aSOFTWARE_INSTALL_STATE[169]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[69]=1 # RPi.GPIO
#aSOFTWARE_INSTALL_STATE[130]=1 # python-pip, enabled in #Software that requires Python-Pip
}
#Software that requires Avahi-Daemon
setvar index = '152'
if (( ${aSOFTWARE_INSTALL_STATE[31]} == 1 ||
${aSOFTWARE_INSTALL_STATE[37]} == 1 ||
${aSOFTWARE_INSTALL_STATE[128]} == 1 ||
${aSOFTWARE_INSTALL_STATE[138]} == 1 ||
${aSOFTWARE_INSTALL_STATE[163]} == 1 ||
${aSOFTWARE_INSTALL_STATE[168]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[$index]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[$index]=1
#aSOFTWARE_WHIP_NAME
G_DIETPI-NOTIFY 2 "${aSOFTWARE_WHIP_NAME[$index]} will be installed"
}
}
#Software that requires Mono
if (( ${aSOFTWARE_INSTALL_STATE[41]} == 1 ||
${aSOFTWARE_INSTALL_STATE[144]} == 1 ||
${aSOFTWARE_INSTALL_STATE[145]} == 1 ||
${aSOFTWARE_INSTALL_STATE[147]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[150]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[150]=1
G_DIETPI-NOTIFY 2 "Mono runtime libary will be installed"
}
}
#Software that requires SDL2:
if (( ${aSOFTWARE_INSTALL_STATE[108]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[140]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[140]=1
G_DIETPI-NOTIFY 2 "SDL2 will be installed"
}
}
#Software that requires Python-Pip: https://github.com/Fourdee/DietPi/issues/784
if (( ${aSOFTWARE_INSTALL_STATE[58]} == 1 ||
${aSOFTWARE_INSTALL_STATE[99]} == 1 ||
${aSOFTWARE_INSTALL_STATE[118]} == 1 ||
${aSOFTWARE_INSTALL_STATE[136]} == 1 ||
${aSOFTWARE_INSTALL_STATE[139]} == 1 ||
${aSOFTWARE_INSTALL_STATE[142]} == 1 ||
${aSOFTWARE_INSTALL_STATE[153]} == 1 ||
${aSOFTWARE_INSTALL_STATE[169]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[130]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[130]=1
G_DIETPI-NOTIFY 2 "Python-Pip will be installed"
}
}
#Software that requires MPD
# YMPD
# Cava
# OMPD
if (( ${aSOFTWARE_INSTALL_STATE[32]} == 1 ||
${aSOFTWARE_INSTALL_STATE[119]} == 1 ||
${aSOFTWARE_INSTALL_STATE[129]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[128]} == 0 )) {
# - Flag for install
setvar aSOFTWARE_INSTALL_STATE[128]=1
G_DIETPI-NOTIFY 2 "MPD will be installed"
}
}
#OMV (requires Samba, Proftpd)
if (( ${aSOFTWARE_INSTALL_STATE[126]} == 1 )) {
#Proftpd
if (( ${aSOFTWARE_INSTALL_STATE[94]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[94]=1
G_DIETPI-NOTIFY 2 "ProFTP will be installed"
}
#Samba
if (( ${aSOFTWARE_INSTALL_STATE[96]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[96]=1
G_DIETPI-NOTIFY 2 "Samba Server will be installed"
}
}
#Software that requires Redis
if (( ${aSOFTWARE_INSTALL_STATE[47]} == 1 ||
${aSOFTWARE_INSTALL_STATE[114]} == 1 )) {
if (( ${aSOFTWARE_INSTALL_STATE[91]} == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[91]=1
G_DIETPI-NOTIFY 2 "Redis will be installed"
}
}
#-------------------------------------------------------------------------
#Pre-req software, for items that do DO have their own array aSOFTWARE_REQUIRES_SOFTWARENAME
# WEBSERVER - Manual stack install
# - Define extra DietPi install flags for WEBSERVER_STACKS
#LLAP
if (( ${aSOFTWARE_INSTALL_STATE[82]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[84]=1
setvar aSOFTWARE_INSTALL_STATE[88]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#LLSP
if (( ${aSOFTWARE_INSTALL_STATE[81]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[84]=1
setvar aSOFTWARE_INSTALL_STATE[87]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#LEAP
if (( ${aSOFTWARE_INSTALL_STATE[79]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[85]=1
setvar aSOFTWARE_INSTALL_STATE[88]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#LESP
if (( ${aSOFTWARE_INSTALL_STATE[78]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[85]=1
setvar aSOFTWARE_INSTALL_STATE[87]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#LAAP
if (( ${aSOFTWARE_INSTALL_STATE[76]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[83]=1
setvar aSOFTWARE_INSTALL_STATE[88]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#LASP
if (( ${aSOFTWARE_INSTALL_STATE[75]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[83]=1
setvar aSOFTWARE_INSTALL_STATE[87]=1
setvar aSOFTWARE_INSTALL_STATE[89]=1
}
#WEBSERVER - Auto install via choice system
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - 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
# - None found, Select one for Install, based on user preference
if (( $INDEX_WEBSERVER_TARGET == 0 )); then
#WEBSERVER_APACHE
aSOFTWARE_INSTALL_STATE[83]=1
G_DIETPI-NOTIFY 2 "Apache2 will be installed"
elif (( $INDEX_WEBSERVER_TARGET == -1 )); then
#WEBSERVER_NGINX
aSOFTWARE_INSTALL_STATE[85]=1
G_DIETPI-NOTIFY 2 "Nginx will be installed"
elif (( $INDEX_WEBSERVER_TARGET == -2 )); then
#WEBSERVER_LIGHTTPD
aSOFTWARE_INSTALL_STATE[84]=1
G_DIETPI-NOTIFY 2 "Lighttpd will be installed"
fi
# - Always install WEBSERVER_PHP
aSOFTWARE_INSTALL_STATE[89]=1
G_DIETPI-NOTIFY 2 "PHP will be installed"
fi
break
fi
done
#WEBSERVER_MYSQL
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_MYSQL[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Check for existing MariaDB installations
if (( ! ${aSOFTWARE_INSTALL_STATE[88]} )); then
#WEBSERVER_MARIADB as new default
aSOFTWARE_INSTALL_STATE[88]=1
G_DIETPI-NOTIFY 2 "MariaDB will be installed"
fi
break
fi
done
#WEBSERVER_SQLITE
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_SQLITE[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
#WEBSERVER_SQLITE
aSOFTWARE_INSTALL_STATE[87]=1
G_DIETPI-NOTIFY 2 "SQlite will be installed"
break
fi
done
#WEBSERVER - Check for stacks and flag as installing
#WEBSERVER_APACHE
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
#SQLite
if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )) {
#WEBSERVER_LASP
setvar aSOFTWARE_INSTALL_STATE[75]=1
}
#MariaDB
if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )) {
#WEBSERVER_LAAP
setvar aSOFTWARE_INSTALL_STATE[76]=1
}
#WEBSERVER_NGINX
} elif (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
#SQLite
if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )) {
#WEBSERVER_LESP
setvar aSOFTWARE_INSTALL_STATE[78]=1
}
#MariaDB
if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )) {
#WEBSERVER_LEAP
setvar aSOFTWARE_INSTALL_STATE[79]=1
}
#WEBSERVER_LIGHTTPD
} elif (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 )) {
#SQLite
if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )) {
#WEBSERVER_LLSP
setvar aSOFTWARE_INSTALL_STATE[81]=1
}
#MariaDB
if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )) {
#WEBSERVER_LLAP
setvar aSOFTWARE_INSTALL_STATE[82]=1
}
}
#DESKTOP
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - 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
aSOFTWARE_INSTALL_STATE[23]=1
G_DIETPI-NOTIFY 2 "LXDE desktop will be installed"
fi
break
fi
done
#GIT
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_GIT[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[17]=1
G_DIETPI-NOTIFY 2 "Git will be installed"
break
fi
done
#BUILDESSENTIAL
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[16]=1
G_DIETPI-NOTIFY 2 "Build-Essential will be installed"
break
fi
done
#RSYSLOG
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[102]=1
G_DIETPI-NOTIFY 2 "Rsyslog will be installed"
break
fi
done
#FFMPEG
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[7]=1
G_DIETPI-NOTIFY 2 "FFmpeg will be installed"
break
fi
done
#ORACLEJAVA
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_ORACLEJAVA[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[8]=1
G_DIETPI-NOTIFY 2 "OpenJDK 8 will be installed"
break
fi
done
#NODEJS
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_NODEJS[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[9]=1
G_DIETPI-NOTIFY 2 "NodeJS will be installed"
break
fi
done
#ALSA
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_ALSA[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[5]=1
G_DIETPI-NOTIFY 2 "Alsa will be installed"
break
fi
done
#XSERVERXORG
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]} &&
${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
# - Flag for install
aSOFTWARE_INSTALL_STATE[6]=1
G_DIETPI-NOTIFY 2 "Xserver will be installed"
break
fi
done
}
proc Create_Desktop_Shared_Items {
#Copy DietPi favourite links
wget http://dietpi.com/downloads/conf/desktop/.gtk-bookmarks -O "$HOME"/.gtk-bookmarks
#Create Desktop SymLinks
mkdir -p "$HOME"/Desktop
ln -sf /usr/share/applications/htop.desktop "$HOME"/Desktop/htop.desktop
#DietPi Menu symlinks
mkdir -p /usr/share/applications
wget http://dietpi.com/downloads/conf/desktop/dietpi-software.desktop -O /usr/share/applications/dietpi-software.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-update.desktop -O /usr/share/applications/dietpi-update.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-config.desktop -O /usr/share/applications/dietpi-config.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-backup.desktop -O /usr/share/applications/dietpi-backup.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-sync.desktop -O /usr/share/applications/dietpi-sync.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-bugreport.desktop -O /usr/share/applications/dietpi-bugreport.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-process_tool.desktop -O /usr/share/applications/dietpi-process_tool.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-cleaner.desktop -O /usr/share/applications/dietpi-cleaner.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-cron.desktop -O /usr/share/applications/dietpi-cron.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-launcher.desktop -O /usr/share/applications/dietpi-launcher.desktop
wget http://dietpi.com/downloads/conf/desktop/dietpi-justboom.desktop -O /usr/share/applications/dietpi-justboom.desktop
#DietPi Desktop symlinks
ln -sf /usr/share/applications/dietpi-software.desktop "$HOME"/Desktop/dietpi-software.desktop
ln -sf /usr/share/applications/dietpi-config.desktop "$HOME"/Desktop/dietpi-config.desktop
ln -sf /usr/share/applications/dietpi-launcher.desktop "$HOME"/Desktop/dietpi-launcher.desktop
#Download icons
mkdir -p /var/lib/dietpi/dietpi-software/installed/desktop_icons
wget http://dietpi.com/downloads/conf/desktop/dietpi-icon.png -O /var/lib/dietpi/dietpi-software/installed/desktop_icons/dietpi-icon.png
wget http://dietpi.com/downloads/conf/desktop/grey_16x16.png -O /var/lib/dietpi/dietpi-software/installed/desktop_icons/grey_16x16.png
wget http://dietpi.com/downloads/conf/desktop/kodi-icon.png -O /var/lib/dietpi/dietpi-software/installed/desktop_icons/kodi-icon.png
wget http://dietpi.com/downloads/conf/desktop/justboom.png -O /var/lib/dietpi/dietpi-software/installed/desktop_icons/justboom.png
# - Replace icon dir in .desktop from /etc/dietpi/desktop_icons
sed -i 's#^Icon=/etc/dietpi/desktop_icons#Icon=/var/lib/dietpi/dietpi-software/installed/desktop_icons#g' /usr/share/applications/*.desktop
# - Set execute to prevent "untrusted" prompt in Mate, and possibily other desktops.
chmod +x /usr/share/applications/*
chmod +x "$HOME"/Desktop/*
}
proc Create_UserContent_Folders {
mkdir -p "$G_FP_DIETPI_USERDATA"/"$FOLDER_MUSIC"
mkdir -p "$G_FP_DIETPI_USERDATA"/"$FOLDER_PICTURES"
mkdir -p "$G_FP_DIETPI_USERDATA"/"$FOLDER_VIDEO"
mkdir -p "$G_FP_DIETPI_USERDATA"/"$FOLDER_DOWNLOADS"
}
proc Download_Test_Media {
if test ! -f "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/fourdee_tech.ogg {
#Grab My test music
wget http://dietpi.com/downloads/audio/fourdee_tech.ogg -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/fourdee_tech.ogg
#wget http://dietpi.com/downloads/audio/fourdee_space.mp3 -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/fourdee_space.mp3
#Grab Absolute Radio Streams
wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/Absolute-Radio.pls
wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8bb -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/Absolute-Radio-80s.pls
wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a9bb -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/Absolute-Radio-90s.pls
wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a0bb -O "$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"/Absolute-Radio-00s.pls
}
}
#Return optimization values for BitTorrent servers based on device and hardware capabilities.
proc Optimize_BitTorrent {
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 (( $G_HW_MODEL <= 3 || $G_HW_MODEL == 30 || $G_HW_MODEL == 32 || $G_HW_MODEL == 40 || $G_HW_MODEL == 60 || $G_HW_MODEL == 70 )) {
setvar gigabit_device = '0'
}
#Cache size (MB) 1/10th of total mem
if (( $1 == 0 )) {
setvar output = $(( $RAM_TOTAL / 10 ))
#Max active downloads
} elif (( $1 == 1 )) {
setvar output = '2'
# - Bump up for VM's
if (( $G_HW_MODEL == 20 || $G_HW_MODEL == 21 )) {
setvar output = '3'
}
#Max global connections
} elif (( $1 == 2 )) {
setvar output = '20'
# - Bump up for VM's
if (( $G_HW_MODEL == 20 || $G_HW_MODEL == 21 )) {
setvar output = '40'
# - 1Gbit SBC's
} elif (( $gigabit_device )) {
setvar output = '30'
# - 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 (( $G_HW_MODEL == 3 )) {
setvar output = '15'
# - RPi v2
} elif (( $G_HW_MODEL == 2 )) {
setvar output = '13'
# - RPi v1 256/512
} elif (( $G_HW_MODEL <= 1 )) {
setvar output = '7'
}
#Max upload slots
} elif (( $1 == 3 )) {
setvar output = '3'
# - Bump up for VM's
if (( $G_HW_MODEL == 20 || $G_HW_MODEL == 21 )) {
setvar output = '5'
# - 1Gbit devices
} elif (( $gigabit_device )) {
setvar output = '4'
# - Reduce for RPi's. This is due to the USB bus ethernet in the ARM SoC, which cripples network throughput/performance/latency.
} elif (( $G_HW_MODEL <= 3 )) {
setvar output = '2'
}
}
echo $output
}
#/////////////////////////////////////////////////////////////////////////////////////
# This function handles the installation of the selected software.
#
# Reference:
# - Adding new software to DietPi-Software
# https://github.com/Fourdee/DietPi/issues/490#issuecomment-244416570
#
# Installing the software:
# ------------------------------------
# - INSTALLING_INDEX:
# This has to be the same number as index_current for the software list above.
#
# - INSTALL_URL_ADDRESS:
# This can be used to check conectivity to items you need to download later.
# A good example would also be a git repo.
#
# Example:
# #------------------ Bittorrent: HTPC Manager ------------------
# INSTALLING_INDEX=155
# if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then
#
# Banner_Installing
#
# INSTALL_URL_ADDRESS='https://github.com/Hellowlol/HTPC-Manager.git'
#
# G_CHECK_URL "$INSTALL_URL_ADDRESS"
#
# #Install Python and PIP
# G_AGI python python-pip python-imaging
#
# cd "$HOME"
# git clone --depth=1 "$INSTALL_URL_ADDRESS"
#
# # - Move HTPC Manager to a 'better' location
# mkdir -p "$G_FP_DIETPI_USERDATA"/htpc-manager
# mv "$HOME"/HTPC-Manager/* "$G_FP_DIETPI_USERDATA"/htpc-manager/
# rm -R "$HOME"/HTPC-Manager
#
# fi
#
#/////////////////////////////////////////////////////////////////////////////////////
proc Install_Dietpi_Software {
#--------------------------------------------------------------
#Install Software
#Desktop LXDE
setvar INSTALLING_INDEX = '23'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - For desktop entries/icons hosted on dietpi.com
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/conf/desktop''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI lxde upower policykit-1 iceweasel p7zip-full --no-install-recommends
#upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ......
}
#Desktop MATE
setvar INSTALLING_INDEX = '24'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - For desktop entries/icons hosted on dietpi.com
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/conf/desktop''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full --no-install-recommends
}
#Desktop GNUStep
setvar INSTALLING_INDEX = '26'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - For desktop entries/icons hosted on dietpi.com
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/conf/desktop''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI x-window-system-core wmaker gnustep gnustep-devel gnustep-games libc-dbg upower policykit-1 iceweasel p7zip-full --no-install-recommends
}
#DESKTOP_XFCE
setvar INSTALLING_INDEX = '25'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - For desktop entries/icons hosted on dietpi.com
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/conf/desktop''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI xfce4 xfce4-terminal gnome-icon-theme tango-icon-theme iceweasel p7zip-full --no-install-recommends
}
#XRDP
setvar INSTALLING_INDEX = '29'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI xrdp
}
#NOMACHINE
setvar INSTALLING_INDEX = '30'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_DESCRIPTION = ""NoMachine (Secure RDP Server & Client)""
#x86_64
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/nomachine_5.1.44_1_amd64.deb''
#arm6 (RPi1)
} elif (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/nomachine_5.1.44_3_armv6hf.deb''
#arm7+ (RPi 2/3)
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/nomachine_5.1.44_armhf.deb''
}
# Now, check that the links are legitimate
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#BitTorrent Transmission
setvar INSTALLING_INDEX = '44'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI transmission-daemon
}
#ProFTPd
setvar INSTALLING_INDEX = '94'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
echo -e "proftpd-basic shared/proftpd/inetd_or_standalone select standalone" | debconf-set-selections
G_AGI proftpd-basic
}
#Samba Server
setvar INSTALLING_INDEX = '96'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI samba samba-common-bin --no-install-recommends
}
#vsFTPD
setvar INSTALLING_INDEX = '95'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI vsftpd --no-install-recommends
}
#NFS_SERVER
setvar INSTALLING_INDEX = '109'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI nfs-kernel-server nfs-common ucf rpcbind
}
#WEBSERVER_APACHE
setvar INSTALLING_INDEX = '83'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI apache2
}
#WEBSERVER_NGINX
setvar INSTALLING_INDEX = '85'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI nginx xml-core --no-install-recommends
}
#WEBSERVER_LIGHTTPD
setvar INSTALLING_INDEX = '84'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI lighttpd
}
#WEBSERVER_MARIADB
setvar INSTALLING_INDEX = '88'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# In case remove old symlink, created by DietPi MariaDB installation, otherwise installation will fail.
# This will not remove the folder in case, without "-R".
test $(readlink /var/lib/mysql) && test ! -d "$(readlink /var/lib/mysql)/mysql" && rm /var/lib/mysql
G_AGI mariadb-server
}
#WEBSERVER_SQLITE
setvar INSTALLING_INDEX = '87'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI sqlite3
}
#WEBSERVER_REDIS
setvar INSTALLING_INDEX = '91'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI redis-server
#Redis php module | == 2 to check for existing installs, if == 1, then module will be installed together with PHP, to prevent dependency installations
if (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) {
G_AGI "$PHP_APT_PACKAGE_NAME"-redis
}
}
#WEBSERVER_PHP
setvar INSTALLING_INDEX = '89'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Install base PHP packages/modules.
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
G_AGI $PHP_APT_PACKAGE_NAME libapache2-mod-"$PHP_APT_PACKAGE_NAME"
} else {
G_AGI "$PHP_APT_PACKAGE_NAME"-fpm "$PHP_APT_PACKAGE_NAME"-cgi
# 'php-xsl' does not exist for >= Stretch, 'php7.0-xsl' is just dummy for 'php7.0-xml': https://github.com/Fourdee/DietPi/issues/1286
(( $G_DISTRO < 4 )) && G_AGI php5-xsl
}
#php-common modules, used by most web software
G_AGI "$PHP_APT_PACKAGE_NAME"-curl "$PHP_APT_PACKAGE_NAME"-gd "$PHP_APT_PACKAGE_NAME"-apcu "$PHP_APT_PACKAGE_NAME"-mcrypt
# + stretch extras
if (( $G_DISTRO >= 4 )) {
G_AGI "$PHP_APT_PACKAGE_NAME"-mbstring "$PHP_APT_PACKAGE_NAME"-zip "$PHP_APT_PACKAGE_NAME"-xml
}
#php-SQL modules
if (( ${aSOFTWARE_INSTALL_STATE[86]} >= 1 )) {
G_AGI "$PHP_APT_PACKAGE_NAME"-mysql
}
if (( ${aSOFTWARE_INSTALL_STATE[88]} >= 1 )) {
if (( $G_DISTRO < 4 )) {
#For <= Jessie, php5-mysqlnd provides the newer mysql client libraries compared to php5-mysql.
G_AGI "$PHP_APT_PACKAGE_NAME"-mysqlnd
} else {
#For >= Stretch, php(7.X)-mysqlnd does not exist, thus php-mysql need to be installed: https://packages.debian.org/de/stretch/php-mysql
G_AGI "$PHP_APT_PACKAGE_NAME"-mysql
}
}
if (( ${aSOFTWARE_INSTALL_STATE[87]} >= 1 )) {
G_AGI "$PHP_APT_PACKAGE_NAME"-sqlite* #wildcard for version (eg:3)
}
#Redis php module
if (( ${aSOFTWARE_INSTALL_STATE[91]} >= 1 )) {
G_AGI "$PHP_APT_PACKAGE_NAME"-redis
}
}
#WEBSERVER_MYADMINPHP
setvar INSTALLING_INDEX = '90'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#MySQL must be running during install to allow debconf setup.
G_RUN_CMD systemctl start mysql
# Set password parameters before installing
debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $GLOBAL_PW"
debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $GLOBAL_PW"
if (( ${aSOFTWARE_INSTALL_STATE[83]} == 1 )) {
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"
} elif (( ${aSOFTWARE_INSTALL_STATE[84]} == 1 )) {
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd"
} else {
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none"
}
G_AGI phpmyadmin
}
#MPD
setvar INSTALLING_INDEX = '128'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Jessie
if (( $G_DISTRO == 3 )) {
#MPD not available in Jessie Repo for ARMv8
if (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/mpd_0.19.21_arm64.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
#libupnp6 for net discov with upnp/avahi
G_AGI libupnp6
G_AGI libmpdclient2 libao-common libao4 libasound2 libasound2-data libasyncns0 libaudiofile1 libavahi-client3 libavahi-common-data libavahi-common3 libavcodec56 libavformat56 libavresample2 libavutil54 libbinio1ldbl libcaca0 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcups2 libcurl3-gnutls libdirectfb-1.2-9 libdnet libfaad2 libflac8 libfluidsynth1 libgme0 libgomp1 libgsm1 libice6 libid3tag0 libiso9660-8 libjack-jackd2-0 libjson-c2 libldb1 libmad0 libmikmod3 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpg123-0 libnfs4 libntdb1 libogg0 libopenal-data libopenal1 libopenjpeg5 libopus0 liborc-0.4-0 libpulse0 libresid-builder0c2a libroar2 libsamplerate0 libschroedinger-1.0-0 libsdl1.2debian libshout3 libsidplay2 libsidutils0 libslp1 libsm6 libsmbclient libsndfile1 libsoxr0 libspeex1 libspeexdsp1 libsqlite3-0 libtalloc2 libtdb1 libtevent0 libtheora0 libupnp6 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx1 libwavpack1 libwbclient0 libwildmidi-config libwildmidi1 libx11-6 libx11-data libx11-xcb1 libx264-142 libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 libxvidcore4 libyajl2 libzzip-0-13 mime-support python python-talloc python2.7 samba-libs x11-common file --no-install-recommends
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
} else {
G_AGI mpd
}
#Stretch+
} else {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/mpd_0.20.11-1_''
#armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6''
#armv7+
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7''
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''armv8''
#x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''amd64''
}
setvar INSTALL_URL_ADDRESS = ''.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Prereqs
G_AGI libmpdclient2 libflac8 libyajl2 libavahi-client3 libvorbisfile3 libwavpack1 libmad0 libmpg123-0 libopus0 libavformat57 libfaad2 libcdio-paranoia1 libiso9660-8 libshout3 libid3tag0
apt-mark unhold mpd &> /dev/null #??? Not required for dpkg -i installs
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
apt-mark hold mpd # prevent repo updates from overwriting
}
}
#Forums PHPBB
setvar INSTALLING_INDEX = '54'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://www.phpbb.com/files/release/phpBB-3.2.1.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www
rm package.zip
}
#OPENBAZAAR
setvar INSTALLING_INDEX = '58'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/OpenBazaar/OpenBazaar-Server.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libsodium-dev automake autoconf pkg-config libtool libssl-dev libffi-dev python-dev openssl libzmq3-dev
#Not required.
#G_AGI software-properties-common
#add-apt-repository -y ppa:chris-lea/libsodium
#G_AGUP
pip install cryptography
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
# - compile
cd "$HOME"/libzmq
./autogen.sh && ./configure && make -j $G_HW_CPU_CORES
make check && make install && ldconfig
cd "$HOME"/pynacl
python setup.py build && python setup.py install
cd $HOME
# - Move OpenBazaar to a 'better' location
mkdir -p /etc/openbazaar-server
mv "$HOME"/OpenBazaar-Server/* /etc/openbazaar-server/
rm -R "$HOME"/OpenBazaar-Server
# - install OpenBazaar
cd /etc/openbazaar-server
pip install -r requirements.txt
cd $HOME
# - Clean up, remove source libraries
rm -R "$HOME"/libzmq
rm -R "$HOME"/pynacl
}
#YACY
setvar INSTALLING_INDEX = '133'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://yacy.net/release/yacy_v1.92_20161226_9000.tar.gz''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.tar.gz
tar xvf package.tar.gz -C /etc/
rm package.tar.gz
}
#ownCloud
setvar INSTALLING_INDEX = '47'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_DIETPI-NOTIFY 2 'Installing needed PHP modules: https://doc.owncloud.org/server/latest/admin_manual/installation/source_installation.html#php-extensions'
G_AGI "$PHP_APT_PACKAGE_NAME"-intl "$PHP_APT_PACKAGE_NAME"-redis
if test -f /var/www/owncloud/occ {
G_DIETPI-NOTIFY 2 'Existing ownCloud installation found, will NOT overwrite...'
} else {
local datadir="$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_DATADIR=' /DietPi/dietpi.txt | sed 's/^.*=//')"
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/owncloud_data""
if test -f "$datadir"/dietpi-owncloud-installation-backup/occ {
G_DIETPI-NOTIFY 2 'ownCloud installation backup found, starting recovery...'
G_RUN_CMD cp -a "$datadir"/dietpi-owncloud-installation-backup/. /var/www/owncloud
} else {
setvar INSTALL_URL_ADDRESS = ''https://download.owncloud.org/community/owncloud-latest.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_RUN_CMD wget $INSTALL_URL_ADDRESS -O package.zip
G_RUN_CMD unzip -o package.zip -d /var/www
rm package.zip
}
}
}
#Nextcloud
setvar INSTALLING_INDEX = '114'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_DIETPI-NOTIFY 2 'Installing needed PHP modules: https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation'
G_AGI "$PHP_APT_PACKAGE_NAME"-intl "$PHP_APT_PACKAGE_NAME"-redis
if test -f /var/www/nextcloud/occ {
G_DIETPI-NOTIFY 2 'Existing Nextcloud installation found, will NOT overwrite...'
} else {
local datadir="$(grep -m1 '^[[:blank:]]*SOFTWARE_NEXTCLOUD_DATADIR=' /DietPi/dietpi.txt | sed 's/^.*=//')"
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/nextcloudcloud_data""
if test -f "$datadir"/dietpi-nextcloud-installation-backup/occ {
G_DIETPI-NOTIFY 2 'Nextcloud installation backup found, starting recovery...'
G_RUN_CMD cp -a "$datadir"/dietpi-nextcloud-installation-backup/. /var/www/nextcloud
} else {
setvar INSTALL_URL_ADDRESS = ''https://download.nextcloud.com/server/releases/latest.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_RUN_CMD wget $INSTALL_URL_ADDRESS -O package.zip
G_RUN_CMD unzip -o package.zip -d /var/www
rm package.zip
}
}
}
#YMPD
setvar INSTALLING_INDEX = '32'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/ympd_1.2.3.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z
local binary_name='ympd_'
# - armv6
if (( $G_HW_ARCH == 1 )) {
setvar binary_name = ''armv6''
# - armv7
} elif (( $G_HW_ARCH == 2 )) {
setvar binary_name = ''armv7''
# - arm64
} elif (( $G_HW_ARCH == 3 )) {
setvar binary_name = ''armv8''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar binary_name = ''amd64''
}
setvar binary_name = ""_$G_DISTRO_NAME""
mv $binary_name /usr/bin/ympd
chmod +x /usr/bin/ympd
rm ympd_*
rm package.7z
}
#Roon Bridge
setvar INSTALLING_INDEX = '121'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#x86_64
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://download.roonlabs.com/builds/RoonBridge_linuxx64.tar.bz2''
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''http://download.roonlabs.com/builds/RoonBridge_linuxarmv8.tar.bz2''
#ARMv7
} else {
setvar INSTALL_URL_ADDRESS = ''http://download.roonlabs.com/builds/RoonBridge_linuxarmv7hf.tar.bz2''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.tar.bz2
tar xvf package.tar.bz2
rm package.tar.bz2
# - reinstall, clear dir, prevent mv fail on non-empty dir
rm -R /etc/roonbridge &> /dev/null
mkdir -p /etc/roonbridge
mv RoonBridge/* /etc/roonbridge
rm -R RoonBridge
}
#CAVA
setvar INSTALLING_INDEX = '119'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/cava_0.4.2_armv6.deb''
# - armv7
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/cava_0.4.2_armv7.deb''
# - arm64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/cava_0.4.2_arm64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libpulse0 libfftw3-3
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
# + Font for cava, nice bars
wget http://dietpi.com/downloads/binaries/all/cava.psf -O "$HOME"/cava.psf
}
#Mopidy
setvar INSTALLING_INDEX = '118'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://apt.mopidy.com/mopidy.gpg''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget -q -O - $INSTALL_URL_ADDRESS | apt-key add -
# No Buster list available yet, use stretch.list for testing:
if (( $G_DISTRO > 4 )) {
wget https://apt.mopidy.com/stretch.list -O /etc/apt/sources.list.d/mopidy.list
} else {
wget https://apt.mopidy.com/"$G_DISTRO_NAME".list -O /etc/apt/sources.list.d/mopidy.list
}
G_AGUP
G_AGI mopidy
#ARMv8
#NB: No ARM64 packages currently exist in mopidy repo. So it will throw a minor error when updating apt.
#Mopidy web client extensions not loading in webpage...
# if (( $G_HW_ARCH == 3 )); then
# G_AGI build-essential python-dev
# pip install mopidy #no effect, claims already upto date.
# fi
pip install Mopidy-MusicBox-Webclient Mopidy-Local-Images
}
#Kodi
setvar INSTALLING_INDEX = '31'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Odroids
if (( $G_HW_MODEL >= 10 )) && (( $G_HW_MODEL < 20 )) {
G_AGI kodi-odroid
#XU4 - requires pulse audio (fixes corrupt sound)
if (( $G_HW_MODEL == 11 )) {
G_AGI pulseaudio --no-install-recommends
}
#Everything else
} else {
G_AGI kodi
}
# - libcurl3-gnutls required for C2. But lets apply to all: https://github.com/Fourdee/DietPi/issues/446
G_AGI libcurl3-gnutls
# - NFS/CEC support
if (( $G_DISTRO >= 4 )) {
G_AGI libnfs8 libcec4
} else {
G_AGI libnfs4 libcec3v4
}
}
#MINIDLNA
setvar INSTALLING_INDEX = '39'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI minidlna
}
#NoIp
setvar INSTALLING_INDEX = '67'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#x32 x64
if (( $G_HW_MODEL == 20 || $G_HW_MODEL == 21 )) {
setvar INSTALL_URL_ADDRESS = ""http://dietpi.com/downloads/binaries/all/noip_x32_x64.zip""
#ARMv8
} elif (( ( $G_HW_MODEL == 12 ) || ( $G_HW_MODEL >=40 && $G_HW_MODEL < 50 ) )) {
setvar INSTALL_URL_ADDRESS = ""http://dietpi.com/downloads/binaries/all/noip_arm64.zip""
#armv6+
} else {
setvar INSTALL_URL_ADDRESS = ""http://dietpi.com/downloads/binaries/all/noip_armhf.zip""
}
G_CHECK_URL $INSTALL_URL_ADDRESS
#NoIp Binary install
wget $INSTALL_URL_ADDRESS -O dietpi-noip.zip
unzip -o dietpi-noip.zip
rm dietpi-noip.zip
mv noip_binary /usr/local/bin/noip2
chmod +x /usr/local/bin/noip2
}
#amiberry
setvar INSTALLING_INDEX = '108'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/amiberry-rpi_v2.1.1.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI alsa-oss joystick libsdl-image1.2 libsdl-ttf2.0-0 libsdl-gfx1.2-5 libguichan-0.8.1-1* libguichan-allegro-0.8.1-1* libguichan-sdl-0.8.1-1* libguichan-opengl-0.8.1-1* libjpgalleg4.4 libxml2 libmpg123-0
#libmpeg2-4 # Required for dev branch
# + SDL2
G_AGI libpng12-0 libflac8 libmpg123-0 libgoogle-perftools4 libfreetype6 libxxf86vm1
#Download binaries
# - Backup existing autostart.uae for user
mv "$G_FP_DIETPI_USERDATA"/amiberry/conf/autostart.uae "$G_FP_DIETPI_USERDATA"/amiberry/conf/autostart_pre-dietpi-update.uae &> /dev/null
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -o/etc
rm package.7z
}
#dxx-rebirth
setvar INSTALLING_INDEX = '112'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/rpi/dxx-rebirth.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libsdl-mixer1.2 libsdl1.2debian libphysfs1
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -o"$G_FP_DIETPI_USERDATA"
rm package.7z
}
#urbackup server
setvar INSTALLING_INDEX = '111'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://hndl.urbackup.org/Server/2.1.20/urbackup-server_2.1.20_amd64.deb''
} elif (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://hndl.urbackup.org/Server/2.1.20/urbackup-server_2.1.20_armhf.deb''
#ARMv8 sourcebuild
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''http://hndl.urbackup.org/Server/2.1.20/urbackup-server-2.1.20.tar.gz''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
#ARMv8 source build
if (( $G_HW_ARCH == 3 )) {
G_AGI build-essential zlib1g-dev libcurl4-openssl-dev libcrypto++-dev sqlite3
wget $INSTALL_URL_ADDRESS -O package.tar
tar xzvf package.tar
rm package.tar
cd urbackup-server-*
./configure
make -j $G_HW_CPU_CORES
make install
sed -i "/ExecStart=/c ExecStart=/usr/local/bin/urbackupsrv run --config /etc/default/urbackupsrv --no-consoletime" urbackup-server.service
cp urbackup-server.service /etc/systemd/system/urbackupsrv.service
cp defaults_server /etc/default/urbackupsrv
cp logrotate_urbackupsrv /etc/logrotate.d/urbackupsrv
cd ..
rm -R urbackup-server-*
#Deb
} else {
wget $INSTALL_URL_ADDRESS -O package.deb
echo -e "urbackup-server urbackup/backuppath string $G_FP_DIETPI_USERDATA/urbackup" | debconf-set-selections
dpkg -i package.deb
apt-get -f install -y
rm package.deb
}
}
#OpenTyrian
setvar INSTALLING_INDEX = '51'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ""http://dietpi.com/downloads/binaries/rpi/opentyrian_armhf.zip""
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI ibsdl1.2debian libsdl-net1.2 --no-install-recommends
#Download binaries
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /
rm package.zip
chmod +x /usr/local/games/opentyrian/opentyrian
}
#DietPi Cam
setvar INSTALLING_INDEX = '59'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/Fourdee/RPi_Cam_Web_Interface/archive/6.2.29.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Install pre-reqs
G_AGI gpac motion
#Get source/binaries and extract
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
cd RPi_Cam*
#Config /etc/motion
mkdir -p /etc/motion
cp etc/motion/motion.conf.1 /etc/motion/motion.conf
#Config /etc/raspimjpeg
cp etc/raspimjpeg/raspimjpeg.1 /etc/raspimjpeg
#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
#symlink cam preview and status
ln -sf /run/shm/mjpeg/cam.jpg /var/www/dietpicam/cam.jpg
ln -sf /run/shm/mjpeg/status_mjpeg.txt /var/www/dietpicam/status_mjpeg.txt
#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
#Cleanup / remove extracted source
cd $HOME
rm -R "$HOME"/RPi_Cam*
}
#DELUGE
setvar INSTALLING_INDEX = '45'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI deluged deluge-web deluge-webui deluge-console
}
#GRASSHOPPER
setvar INSTALLING_INDEX = '100'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI python
#Download Grasshopper
local grasshopper_directory='/var/www'
setvar INSTALL_URL_ADDRESS = ''http://sourceforge.net/projects/grasshopperwebapp/files/grasshopper_v5_application.zip/download''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O grasshopper.zip
unzip -o grasshopper.zip -d $grasshopper_directory
rm grasshopper.zip
#Install
chmod +x "$grasshopper_directory"/install/install.sh
"$grasshopper_directory"/install/install.sh
}
#RASPCONTROL
setvar INSTALLING_INDEX = '106'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/harmon25/raspcontrol/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mkdir -p /var/www/raspcontrol
mv raspcontrol-master/* /var/www/raspcontrol
rm -R raspcontrol-master
}
#WEBMIN
setvar INSTALLING_INDEX = '115'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://www.webmin.com/download/deb/webmin-current.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
G_AGF
rm package.deb
}
#OMV
setvar INSTALLING_INDEX = '126'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://packages.openmediavault.org/public''
G_CHECK_URL $INSTALL_URL_ADDRESS
echo -e "deb $INSTALL_URL_ADDRESS erasmus main" > /etc/apt/sources.list.d/openmediavault.list
G_AGUP
G_AGI openmediavault-keyring
debconf-set-selections <<< "openmediavault openmediavault/run-initsystem note"
debconf-set-selections <<< "postfix postfix/main_mailer_type select No configuration"
G_AGUP
G_AGI openmediavault postfix
}
#O!MPD
setvar INSTALLING_INDEX = '129'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/ArturSierzant/OMPD/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www/
rm -R /var/www/ompd &> /dev/null #Replace/upgrade existing installs
mv /var/www/OMPD* /var/www/ompd
rm package.zip
}
#IceCast + DarkIce
setvar INSTALLING_INDEX = '135'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI darkice icecast2
}
#LINUXDASH
setvar INSTALLING_INDEX = '63'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/afaqurk/linux-dash/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mkdir -p /var/www/linuxdash
mv linux-dash-master/* /var/www/linuxdash
rm -R linux-dash-master
}
#PIHOLE
setvar INSTALLING_INDEX = '93'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://install.pi-hole.net''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Pre-reqs: https://github.com/Fourdee/DietPi/issues/1282#issuecomment-350490524
G_AGI "$PHP_APT_PACKAGE_NAME"-cgi "$PHP_APT_PACKAGE_NAME"-sqlite*
# - Check free available memory. Increase swapfile size to prevent gravity running out of mem.
if (( $(free -m | grep -m1 'Mem:' | awk '{print $4}') < 512 )) {
if test -f /etc/dphys-swapfile &&
(( $(grep 'CONF_SWAPSIZE=' /etc/dphys-swapfile | sed 's/.*=//') < 512 )) {
G_DIETPI-NOTIFY 2 "Increasing swapfile size to 512MB before running gravity.sh, please wait...\n"
/DietPi/dietpi/func/dietpi-set_dphys-swapfile 512
}
}
# NB: PiHole currently replaces the lighttpd.conf file entirly and restricts webserver use to PiHole only. We dont want a limited webserver dedicated to PiHole, so lets avoid it.
mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bak &> /dev/null
# - Install
wget $INSTALL_URL_ADDRESS -O install.sh
chmod +x install.sh
./install.sh
local exit_code=$?
if (( $exit_code != 0 )) {
G_DIETPI-NOTIFY 1 "Pi-Hole exited with code ($exit_code) and is not installed."
setvar aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]=0
}
mv /etc/lighttpd/lighttpd.conf.bak /etc/lighttpd/lighttpd.conf &> /dev/null
}
#SUBSONIC 5
setvar INSTALLING_INDEX = '33'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://sourceforge.net/projects/subsonic/files/subsonic/5.3/subsonic-5.3.deb/download''
G_CHECK_URL $INSTALL_URL_ADDRESS
#G_AGI lame #conflicts with our ffmpeg package: https://github.com/Fourdee/DietPi/issues/946#issuecomment-300738228
#Install SubSonic 5.3
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#SUBSONIC 6
setvar INSTALLING_INDEX = '34'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://sourceforge.net/projects/subsonic/files/subsonic/6.1.3/subsonic-6.1.3.deb/download''
G_CHECK_URL $INSTALL_URL_ADDRESS
#G_AGI lame #conflicts with our ffmpeg package: https://github.com/Fourdee/DietPi/issues/946#issuecomment-300738228
#Install SubSonic 6.0
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#WEAVED
setvar INSTALLING_INDEX = '68'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/weaved/installer/raw/master/Raspbian%20deb/1.3-07/weavedconnectd_1.3-07v_armhf.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Install WEAVED
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#WEBIOPI requires RPIGPIO
if (( ${aSOFTWARE_INSTALL_STATE[71]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[69]=1
}
#RPIGPIO
setvar INSTALLING_INDEX = '69'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# >= v111 image
if test -f /etc/.dietpi_image_version {
G_AGI python-rpi.gpio python3-rpi.gpio
# - < 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 {
G_AGI python3-pip
pip3 install RPi.GPIO
}
}
#WIRINGPI
setvar INSTALLING_INDEX = '70'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - RPi
if (( $G_HW_MODEL < 10 )) {
# http://git.drogon.net/?p=wiringPi;a=shortlog;h=refs/heads/master snapshot
setvar INSTALL_URL_ADDRESS = ''http://git.drogon.net/?p=wiringPi;a=snapshot;h=HEAD;sf=tgz''
# - Odroid's
} elif (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/hardkernel/wiringPi/archive/master.zip''
# - BPiPro
} elif (( $G_HW_MODEL == 51 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/LeMaker/WiringBP/archive/bananapro.zip''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
# - RPi
if (( $G_HW_MODEL < 10 )) {
wget $INSTALL_URL_ADDRESS -O package.tar
tar xfz package.tar
rm package.tar
# - Odroid's / BPI
} else {
wget $INSTALL_URL_ADDRESS -O package.zip
unzip package.zip
rm package.zip
}
if (( $G_HW_MODEL == 51 )) {
mv WiringBP* wiringPi
}
cd wiringPi*
chmod +x build
./build
cd $HOME
#rm -R /root/wiringPi* #Also Contains example code for users.
}
#RPII2C
setvar INSTALLING_INDEX = '72'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
/DietPi/dietpi/func/dietpi-set_hardware i2c enable
}
#nodered
setvar INSTALLING_INDEX = '122'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI python python3
# - RPi, pre-reqs GPIO control for Node-Red
if (( $G_HW_MODEL < 10 )) {
G_AGI python-rpi.gpio
}
# - Serialport fails to build unless below flags are provided
npm install -g node-red --unsafe-perm
}
#mosquitto
setvar INSTALLING_INDEX = '123'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_DISTRO > 4 )) {
# On Buster, we can use current APT package from Debian repo
G_AGI mosquitto
} else {
# - ARMv8
if (( $G_HW_ARCH == 3 )) {
dpkg --add-architecture armhf
G_AGUP
}
#Pre-Req
# - libssl1.0.0 no longer available: https://github.com/Fourdee/DietPi/issues/1299
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/''
# - ARMv6/7/8
if (( $G_HW_ARCH >= 1 && $G_HW_ARCH <= 3 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/mosquitto_1.4.14-0mosquitto1_nows1_armhf.deb''
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/mosquitto_1.4.14-0mosquitto1_nows1_amd64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
#Install deb
# Allow error, so we can install additional required packages automatically
dpkg -i package.deb
G_AGF
rm package.deb
}
}
#Blynk Server
setvar INSTALLING_INDEX = '131'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Binary URL fails connection test, so we need to parent back a little: https://github.com/Fourdee/DietPi/issues/445#issuecomment-283400449
setvar INSTALL_URL_ADDRESS = ''https://github.com/blynkkk/blynk-server/releases''
G_CHECK_URL $INSTALL_URL_ADDRESS
mkdir -p /etc/blynkserver
setvar INSTALL_URL_ADDRESS = ''https://github.com/blynkkk/blynk-server/releases/download/v0.29.7/server-0.29.7-java8.jar''
wget $INSTALL_URL_ADDRESS -O /etc/blynkserver/server.jar
# - Install Blynk JS Libary
G_AGI python
npm install -g onoff
npm install -g blynk-library
}
#NAA Daemon
setvar INSTALLING_INDEX = '124'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - Skip license for NAA daemon if needed:
if (( ! $G_USER_INPUTS )) {
debconf-set-selections <<< "networkaudiod networkaudiod/license note false"
}
#Packages
local apackages=()
# Jessie - requires stretch packages
if (( $G_DISTRO == 3 )) {
setvar apackages = ''('http://dietpi.com/downloads/binaries/all/gcc-6-base_6.3.0-6_armhf.deb')
setvar apackages = ''('http://dietpi.com/downloads/binaries/all/libstdc++6_6.3.0-6_armhf.deb')
}
setvar apackages = ''('https://www.signalyst.eu/bins/naa/linux/stretch/networkaudiod_3.5.2-36_armhf.deb')
# - check online
for ((i=0; i<${#apackages[@]}; i++))
do
INSTALL_URL_ADDRESS="${apackages[$i]}"
G_CHECK_URL "$INSTALL_URL_ADDRESS"
done
# - Prereqs
G_AGI libasound2
# - Stretch, install additional packages
if (( $G_DISTRO >= 4 )) {
G_AGI gcc-6-base libstdc++6
}
for ((i=0; i<${#apackages[@]}; i++))
do
wget "${apackages[$i]}" -O package.deb
dpkg -i package.deb
rm package.deb
done
unset apackages
#Enable logging for NAA Daemon
#echo -e "NETWORKAUDIOD_LOGFILE='/var/log/naadaemon.log'" > /etc/default/networkaudiod
}
#Tomcat8
setvar INSTALLING_INDEX = '125'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI tomcat8
}
#WEBIOPI
setvar INSTALLING_INDEX = '71'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz/download''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Python dev, pre-reqs
G_AGI python-dev python-setuptools --no-install-recommends
#Install WEBIOPI
wget $INSTALL_URL_ADDRESS -O package.tar
tar xvzf package.tar
rm package.tar
cd WebIOPi*
#Automate Weaved prompt
sed -i '/read response/c\response="n"' setup.sh
#Run setup script
./setup.sh
clear
cd ..
#Cleanup
rm -R WebIOPi*
}
#DIETPICLOUDSHELL
setvar INSTALLING_INDEX = '62'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#LCD panels can be enabled in Dietpi-config > display options
# XU4 enable cloudshell
if (( $G_HW_MODEL == 11 )) {
/DietPi/dietpi/func/dietpi-set_hardware lcdpanel odroid-cloudshell
}
}
#HAPROXY
setvar INSTALLING_INDEX = '98'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://www.haproxy.org/download/1.8/src/haproxy-1.8.2.tar.gz''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Download HAPROXY
wget $INSTALL_URL_ADDRESS -O package.tar
tar -xvf package.tar
rm package.tar
cd haproxy-*
#Pre-reqs
G_AGI libpcre3-dev libssl-dev zlib1g-dev
#Compile and install
make -j $G_HW_CPU_CORES TARGET=linux2628 CPU=generic USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_SPLICE=1
make install
mkdir /etc/haproxy
#Exit directory
cd ..
#Clean up
rm -R haproxy-*
#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
}
#SQUEEZEBOXSERVER
setvar INSTALLING_INDEX = '35'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Stretch
if (( $G_DISTRO >= 4 )) {
#Untested ARMv8
if (( $G_HW_ARCH == 3 )) {
dpkg --add-architecture armhf
G_AGUP
}
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.1_armv7-(stretch).deb''
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
G_AGF
} else {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/logitechmediaserver_7.9.0_all.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
#https://github.com/Fourdee/DietPi/issues/736
G_AGF
#Stop service
service logitechmediaserver stop
# + ARMv6 cpan
if (( $G_HW_ARCH == 1 )) {
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
# + ARM64 cpan
} elif (( $G_HW_ARCH == 3 )) {
G_AGI libxml-parser-perl
G_AGI zlib1g-dev libjpeg-dev libpng-dev libjpeg62-turbo-dev # shared libs needed for Image::Scale@0.08
wget http://dietpi.com/downloads/binaries/all/DietPi-LMS7.9-CPAN_arm64.zip -O package.zip
unzip -o package.zip -d /usr/share/squeezeboxserver
rm package.zip
}
}
}
#WORDPRESS
setvar INSTALLING_INDEX = '55'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://wordpress.org/latest.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www/
rm package.zip
}
#TIGHTVNCSERVER
setvar INSTALLING_INDEX = '27'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI tightvncserver x11vnc --no-install-recommends
}
#VNC4SERVER
setvar INSTALLING_INDEX = '28'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI vnc4server x11vnc --no-install-recommends
# - Stretch+
if (( $G_DISTRO >= 4 )) {
G_AGI tigervnc-common
}
}
#REALVNCSERVER
setvar INSTALLING_INDEX = '120'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# INSTALL_URL_ADDRESS='https://www.realvnc.com/download/binary/latest/debian/arm/'
# G_CHECK_URL "$INSTALL_URL_ADDRESS"
# wget "$INSTALL_URL_ADDRESS" -O package.tar.gz
# tar xvf package.tar.gz
# rm package.tar.gz
# dpkg -i VNC*.deb
# rm VNC*.deb
# - Available in Raspbian apt
G_AGI realvnc-vnc-server
}
#FAIL2BAN
setvar INSTALLING_INDEX = '73'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
touch /var/log/auth.log #: https://github.com/Fourdee/DietPi/issues/475#issuecomment-310873879
G_AGI fail2ban --no-install-recommends
}
#PHPSYSINFO
setvar INSTALLING_INDEX = '64'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/phpsysinfo/phpsysinfo/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www/
rm package.zip
mv /var/www/phpsysinfo-* /var/www/phpsysinfo
}
#PHPIMAGEGALLERY
setvar INSTALLING_INDEX = '56'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/Single_File_PHP_Gallery_4.6.1.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www/gallery
rm package.zip
}
#AMPACHE
setvar INSTALLING_INDEX = '40'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/ampache/ampache/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mv ampache-* /var/www/ampache
#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');"
mv composer.phar /usr/local/bin/composer
cd /var/www/ampache
composer install --prefer-source --no-interaction
cd $HOME
}
#OPENVPNSERVER
setvar INSTALLING_INDEX = '97'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI openvpn easy-rsa iptables
}
#PiVPN
setvar INSTALLING_INDEX = '117'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://install.pivpn.io''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI lsb-release
# - Requires underpriv user: https://github.com/Fourdee/DietPi/issues/570#issuecomment-255588307
useradd pivpn
mkdir -p /home/pivpn
while true
{
wget $INSTALL_URL_ADDRESS -O pivpn_install.sh
chmod +x pivpn_install.sh
# - Disable reboot
sed -i '/shutdown[[:space:]]/d' pivpn_install.sh
./pivpn_install.sh
if (( $? != 0 )) {
whiptail --title "PiVPN failed/aborted" --yesno "The PiVPN installer was not successful and/or canceled prior to its completion.\n\nWould you like DietPi to run the PiVPN installer again?" --backtitle $WHIP_BACKTITLE --defaultno 12 70
if (( $? != 0 )) {
setvar aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]=0
break
}
} else {
rm pivpn_install.sh
break
}
}
}
#LETSENCRYPT
setvar INSTALLING_INDEX = '92'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_DISTRO >= 4 )) {
G_AGI certbot
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
G_AGI python-certbot-apache
}
if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
G_AGI python-certbot-nginx
}
} else {
setvar INSTALL_URL_ADDRESS = ''https://github.com/certbot/certbot/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /root
rm package.zip
mv certbot* /etc/certbot_scripts
# - Install packages
cd /etc/certbot_scripts
./certbot-auto -n --os-packages-only
cd ~/
}
}
#TORHOTSPOT requires WIFIHOTSPOT:
if (( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )) {
setvar aSOFTWARE_INSTALL_STATE[60]=1
}
#WIFIHOTSPOT
setvar INSTALLING_INDEX = '60'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/hostapd_2.5_all.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Prereqs
G_AGI hostapd isc-dhcp-server iptables libnl-3-200
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o 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') ||
$G_HW_MODEL == 70 )) { #Force RTL for allo provided WiFi dongle
setvar WIFIHOTSPOT_RTL8188C_DEVICE = '1'
}
#Which binary to install
local filename_hostapd=''
local filename_hostapd_cli=''
# - armv6
if (( $G_HW_ARCH == 1 )) {
setvar filename_hostapd = ''hostapd-nl80211-armv6''
setvar filename_hostapd_cli = ''hostapd_cli-armv6''
if (( $WIFIHOTSPOT_RTL8188C_DEVICE )) {
setvar filename_hostapd = ''hostapd-rtl8188c-armv6''
}
# - armv7+
} elif (( $G_HW_ARCH == 2 )) {
setvar filename_hostapd = ''hostapd-nl80211-armv7''
setvar filename_hostapd_cli = ''hostapd_cli-armv7''
if (( $WIFIHOTSPOT_RTL8188C_DEVICE )) {
setvar filename_hostapd = ''hostapd-rtl8188c-armv7''
}
# - arm64
} elif (( $G_HW_ARCH == 3 )) {
setvar filename_hostapd = ''hostapd-nl80211-arm64''
setvar filename_hostapd_cli = ''hostapd_cli-arm64''
if (( $WIFIHOTSPOT_RTL8188C_DEVICE )) {
setvar filename_hostapd = ''hostapd-rtl8188c-arm64''
}
}
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-*
#Enable wifi modules
/DietPi/dietpi/func/dietpi-set_hardware wifimodules enable
# - Stretch, libssl1.0.0 no longer available: https://github.com/Fourdee/DietPi/issues/1299
# Possibly only needed for RPi, however, no harm in installing, cover all bases.
if (( $G_DISTRO >= 4 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/''
# - ARMv6/7
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb''
# - ARM64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_arm64.deb''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
}
#TORHOTSPOT
setvar INSTALLING_INDEX = '61'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - Prereqs
G_AGI tor
}
#SHAIRPORTSYNC
setvar INSTALLING_INDEX = '37'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/shairport-sync_3.1.3_''
# - ARMv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6.7z''
# - ARMv7
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7.7z''
# - ARM64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''arm64.7z''
# - x86_64
# elif (( $G_HW_ARCH == 10 )); then
# INSTALL_URL_ADDRESS+='amd64.7z'
}
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Prereqs
G_AGI openssl libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 --no-install-recommends
# This occured on C2: shairport-sync : Depends: libpopt-dev but it is not installed
#G_AGI libpopt-dev
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -o/
rm package.7z
# - Stretch, libssl1.0.0 no longer available
if (( $G_DISTRO >= 4 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/''
# - ARMv6/7
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_armhf.deb''
# - ARM64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_arm64.deb''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
}
#BRUTEFIR
setvar INSTALLING_INDEX = '38'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check folder is online
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/conf/BruteFIR/''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Prereqs
G_AGI brutefir
wget -r -nH --cut-dirs=2 --no-parent --reject="index.htm*" -e robots=off $INSTALL_URL_ADDRESS
mv BruteFIR /etc/
}
#PYDIO
setvar INSTALLING_INDEX = '48'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check folder is online
setvar INSTALL_URL_ADDRESS = ''https://download.pydio.com/pub/core/archives/pydio-core-8.0.2.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www
mv /var/www/pydio-core-* /var/www/pydio
rm package.zip
}
#SQUEEZELITE
setvar INSTALLING_INDEX = '36'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/squeezelite-1.8_all.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Prereqs
G_AGI squeezelite
# - Overwrite binary with latest version:
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -o/usr/bin
rm package.7z
rm /usr/bin/squeezelite
local target_binary=''
if (( $G_HW_ARCH == 1 )) {
setvar target_binary = ''squeezelite_armv6''
# - ARMv7
} elif (( $G_HW_ARCH == 2 )) {
setvar target_binary = ''squeezelite_armv7''
# - ARM64
} elif (( $G_HW_ARCH == 3 )) {
setvar target_binary = ''squeezelite_arm64''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar target_binary = ''squeezelite_amd64''
}
ln -sf /usr/bin/"$target_binary" /usr/bin/squeezelite
chmod +x /usr/bin/squeezelite
}
#EMONHUB
setvar INSTALLING_INDEX = '99'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check, is online
setvar INSTALL_URL_ADDRESS = ''https://github.com/Fourdee/emonhub/archive/emon-pi.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Prereqs
G_AGI minicom python-serial python-configobj --no-install-recommends
pip install paho-mqtt pydispatcher
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o 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-*
}
#RPIMONITOR
setvar INSTALLING_INDEX = '66'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check, is online
setvar INSTALL_URL_ADDRESS = ''https://github.com/XavierBerger/RPi-Monitor-deb/raw/master/packages/rpimonitor_2.12-r0_all.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
# - Prereqs
apt-get -f -y install
}
#NETDATA
setvar INSTALLING_INDEX = '65'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/netdata_1.6.0_''
#armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6.deb''
#armv7+
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7.deb''
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''arm64.deb''
#amd64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''amd64.deb''
}
#check, is online
G_CHECK_URL $INSTALL_URL_ADDRESS
# - For compression
G_AGI --no-install-recommends zlib1g-dev
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#BAIKAL
setvar INSTALLING_INDEX = '57'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check folder is online
setvar INSTALL_URL_ADDRESS = ''https://github.com/fruux/Baikal/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip -d /var/www
rm package.zip
mv /var/www/Baikal* /var/www/baikal
}
#MUMBLESERVER
setvar INSTALLING_INDEX = '43'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI mumble-server
}
#EMBYSERVER
setvar INSTALLING_INDEX = '41'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#ARM packages only available in 14.04 repo: https://github.com/Fourdee/DietPi/issues/1059#issuecomment-313661959
setvar INSTALL_URL_ADDRESS = ''http://download.opensuse.org/repositories/home:/emby/xUbuntu_14.04/''
# x86_64, use Debian repos
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://download.opensuse.org/repositories/home:/emby/Debian_''
if (( $G_DISTRO == 3 )) {
setvar INSTALL_URL_ADDRESS = ''8.0''
} elif (( $G_DISTRO == 4 )) {
setvar INSTALL_URL_ADDRESS = ''9.0''
} elif (( $G_DISTRO == 5 )) {
# http://download.opensuse.org/repositories/home:/emby/Debian_Next/
setvar INSTALL_URL_ADDRESS = ''Next''
}
setvar INSTALL_URL_ADDRESS = ''/''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
echo -e "deb $INSTALL_URL_ADDRESS /" > /etc/apt/sources.list.d/emby-server.list
wget "$INSTALL_URL_ADDRESS"Release.key
apt-key add - < Release.key
rm Release.key
G_AGUP
#ARMv7, Grab required pre-reqs from various sources: https://github.com/Fourdee/DietPi/issues/1128#issuecomment-326743471 / https://github.com/Fourdee/DietPi/issues/1150#issuecomment-330291298
if (( $G_HW_ARCH == 2 )) {
wget http://ftp.us.debian.org/debian/pool/main/libj/libjpeg8/libjpeg8_8d-1+deb7u1_armhf.deb -O package.deb
dpkg -i package.deb
rm package.deb
wget http://ftp.us.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.50-2+deb8u3_armhf.deb -O package.deb
dpkg -i package.deb
rm package.deb
wget http://ftp.us.debian.org/debian/pool/main/libw/libwebp/libwebp5_0.4.1-1.2+b2_armhf.deb -O package.deb
dpkg -i package.deb
rm package.deb
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
wget http://ftp.us.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.50-2+deb8u3_arm64.deb -O package.deb
dpkg -i package.deb
rm package.deb
wget http://ftp.us.debian.org/debian/pool/main/libw/libwebp/libwebp5_0.4.1-1.2+b2_arm64.deb -O package.deb
dpkg -i package.deb
rm package.deb
wget https://mirror.i-novus.ru/ubuntu-ports/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_1.3.0-0ubuntu2_arm64.deb -O package.deb
dpkg -i package.deb
rm package.deb
wget http://turul.canonical.com/pool/main/libj/libjpeg8-empty/libjpeg8_8c-2ubuntu8_arm64.deb -O package.deb
dpkg -i package.deb
rm package.deb
}
G_AGI emby-server embymagick
}
#PLEXMEDIASERVER
setvar INSTALLING_INDEX = '42'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check folder is online
#x86_64
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''https://downloads.plex.tv/plex-media-server/1.10.1.4602-f54242b6b/plexmediaserver_1.10.1.4602-f54242b6b_amd64.deb''
#ARM
} else {
setvar INSTALL_URL_ADDRESS = ''http://dev2day.de/pms/''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
#x86_64
if (( $G_HW_ARCH == 10 )) {
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
#ARM
} else {
echo -e "deb [arch=armhf] $INSTALL_URL_ADDRESS $G_DISTRO_NAME main" > /etc/apt/sources.list.d/plex.list
wget -O - "$INSTALL_URL_ADDRESS"dev2day-pms.gpg.key | apt-key add -
G_AGUP
#ARMv8: Install 32bit binaries
if (( $G_HW_ARCH == 3 )) {
dpkg --add-architecture armhf
G_AGUP
G_AGI binutils:armhf plexmediaserver-installer:armhf
#ARM32
} else {
G_AGI plexmediaserver-installer
}
}
}
#CUBERITE
setvar INSTALLING_INDEX = '52'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#x86_64
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz''
#32bit ARM
} elif (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.tar
mkdir -p /etc/cubrite
tar xzvf package.tar -C /etc/cubrite
rm package.tar
# - Move everything into base directory (cuberite)
mv /etc/cubrite/Server/* /etc/cubrite/
rm -R /etc/cuberite/Server
}
#MINEOS
setvar INSTALLING_INDEX = '53'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check folder is online
setvar INSTALL_URL_ADDRESS = ''https://github.com/hexparrot/mineos-node.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
#prereqs
G_AGI python python3 supervisor rdiff-backup screen rsync
mkdir -p "$G_FP_DIETPI_USERDATA"/mineos
cd "$G_FP_DIETPI_USERDATA"/mineos
git clone https://github.com/hexparrot/mineos-node.git minecraft
cd minecraft
git config core.filemode false
chmod +x service.js mineos_console.js generate-sslcert.sh webui.js
npm install
cd $HOME
}
#GOGS
setvar INSTALLING_INDEX = '49'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/gogs_''
#armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6.zip''
#armv7+
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7.zip''
#x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''amd64.zip''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mv gogs* /etc/gogs
}
#QBITTORRENT
setvar INSTALLING_INDEX = '46'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI qbittorrent-nox
}
#RTORRENT
setvar INSTALLING_INDEX = '107'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://bintray.com/novik65/generic/download_file?file_path=ruTorrent-3.7.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI rtorrent screen #mediainfo
#Raspbian unrar free
if (( $G_HW_MODEL < 10 )) {
G_AGI unrar-free #https://github.com/Fourdee/DietPi/issues/176#issuecomment-240101365
} else {
G_AGI unrar #https://github.com/Fourdee/DietPi/issues/176#issuecomment-240101365
}
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mkdir -p /var/www/rutorrent
mv ruTorrent-*/* /var/www/rutorrent/
rm -R ruTorrent-*
}
#Aria2
setvar INSTALLING_INDEX = '132'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_DISTRO >= 4 )) {
G_AGI aria2
} else {
#aria2 binary
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/aria2_''
# - armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6.7z''
# - armv7+
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7.7z''
# - arm64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''arm64.7z''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''x86_64.7z''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
# - prereqs
G_AGI libc-ares2
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z
rm package.7z
mv aria2_* /usr/local/bin/aria2c
chmod +x /usr/local/bin/aria2c
}
#Web interface
setvar INSTALL_URL_ADDRESS = ''https://github.com/ziahamza/webui-aria2/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
cp -R webui-aria2* /var/www/aria2
rm -R webui-aria2*
}
#SICKRAGE
setvar INSTALLING_INDEX = '116'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/SickRage/SickRage/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI python libxslt1.1 libxml2 python-openssl python-xmltodict
#Raspbian unrar free
if (( $G_HW_MODEL < 10 )) {
G_AGI unrar-free
} else {
G_AGI unrar
}
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mkdir -p /etc/sickrage
mv SickRage-*/* /etc/sickrage/
rm -R SickRage-*
}
#SYNCTHING
setvar INSTALLING_INDEX = '50'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# - armv6+
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/syncthing/syncthing/releases/download/v0.14.42/syncthing-linux-arm-v0.14.42.tar.gz''
# - arm64
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/syncthing/syncthing/releases/download/v0.14.42/syncthing-linux-arm64-v0.14.42.tar.gz''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/syncthing/syncthing/releases/download/v0.14.42/syncthing-linux-amd64-v0.14.42.tar.gz''
}
#??
#For some reason checking connection (spider) against the files above fails.
#G_CHECK_URL "$INSTALL_URL_ADDRESS"
G_CHECK_URL https://github.com/syncthing/syncthing
wget $INSTALL_URL_ADDRESS -O package.tar
tar xzvf package.tar
rm package.tar
mkdir -p /etc/syncthing
cp -R syncthing-*/syncthing /etc/syncthing/
rm -R syncthing-*
}
#TONIDO
setvar INSTALLING_INDEX = '134'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
### Pre-reqs
## libjpeg8, libpng12, libssl1.0.0
# https://github.com/Fourdee/DietPi/issues/1428#issuecomment-361099496
# - armv6/7
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS1 = ''http://dietpi.com/downloads/binaries/all/libjpeg8_8d1-2_armhf.deb''
(( $G_DISTRO > 3 )) && setvar INSTALL_URL_ADDRESS2 = ''http://dietpi.com/downloads/binaries/all/libssl1.0.0_1.0.2l-1_bpo8+1_armhf.deb''
G_AGI libpng12-0
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS1 = ''http://dietpi.com/downloads/binaries/all/libjpeg8_8d1-2_amd64.deb''
(( $G_DISTRO > 3 )) && setvar INSTALL_URL_ADDRESS2 = ''http://dietpi.com/downloads/binaries/all/libpng12-0_1.2.50-2+deb8u3_amd64.deb'' || AGI libpng12-0
}
G_CHECK_URL $INSTALL_URL_ADDRESS1
wget $INSTALL_URL_ADDRESS1 -O package.deb
dpkg -i package.deb
rm package.deb
if (( $G_DISTRO > 3 )) {
G_CHECK_URL $INSTALL_URL_ADDRESS2
wget $INSTALL_URL_ADDRESS2 -O package.deb
dpkg -i package.deb
rm package.deb
}
## libfontconfig1
G_AGI libfontconfig1
### Tonido
# - armv6+
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://patch.codelathe.com/tonido/live/installer/armv6l-rpi/tonido.tar.gz''
# - x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://www.tonido.com/download.php?tonido64.tar.gz''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.tar
mkdir /etc/tonido
tar xvf package.tar -C /etc/tonido
rm package.tar
}
#CHROMIUM
setvar INSTALLING_INDEX = '113'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Stretch via apt
if (( $G_DISTRO >= 4 )) {
if (( $G_HW_MODEL < 10 )) {
G_AGI chromium-browser
} else {
G_AGI chromium
}
} else {
#armv6+
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/chromium_52.0.2743.116-1-deb8u1.1_armhf.deb''
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/chromium_52.0.2743.116-1-deb8u1.1_arm64.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
# - Odroid's, 'apt-get install -f' removes chromium package, rather than install required deps...
if (( $G_HW_MODEL >= 10 && $G_HW_MODEL < 20 )) {
G_AGI libgnome-keyring0 libnspr4 libnss3 libnss3-1d libspeechd2 libxslt1.1 libxss1 xdg-utils libgnome-keyring-common libltdl7
} else {
G_AGF
}
wget http://dietpi.com/downloads/binaries/all/chromium-l10n_52.0.2743.116-1-deb8u1.1_all.deb -O package.deb
dpkg -i package.deb
# armv6+
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
wget http://dietpi.com/downloads/binaries/all/chromedriver_52.0.2743.116-1-deb8u1.1_armhf.deb -O package.deb
dpkg -i package.deb
# arm64
} elif (( $G_HW_ARCH == 3 )) {
wget http://dietpi.com/downloads/binaries/all/chromedriver_52.0.2743.116-1-deb8u1.1_arm64.deb -O package.deb
dpkg -i package.deb
}
rm package.deb
# - Prevent Debian repo from replacing our chromium packages: https://github.com/Fourdee/DietPi/issues/658
apt-mark hold chromium chromedriver
}
}
#MotionEye
setvar INSTALLING_INDEX = '136'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Jessie, prefer latest motion release.
if (( $G_DISTRO == 3 )) {
setvar INSTALL_URL_ADDRESS = ''https://github.com/Motion-Project/motion/releases/download/release-4.1.1/pi_jessie_motion_4.1.1-1_armhf.deb''
#url/redireect always fails wget spider test...
G_CHECK_URL "http://github.com/Motion-Project/motion"
# - Prereqs
G_AGI v4l-utils python python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev zlib1g-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5
# - Motion
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
# - Motioneye
pip install motioneye
#Stretch
} else {
# - Prereqs
G_AGI v4l-utils python python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev zlib1g-dev
G_AGI motion
# - Motioneye
pip install motioneye
}
}
#CloudPrint
setvar INSTALLING_INDEX = '137'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_DISTRO == 3 )) { #https://github.com/Fourdee/DietPi/issues/855#issuecomment-292712002
setvar INSTALL_URL_ADDRESS = ''http://davesteele.github.io/cloudprint-service''
#url/redirect fails wget spider test...
G_CHECK_URL $INSTALL_URL_ADDRESS
setvar INSTALL_URL_ADDRESS = ''/repo''
echo -e "deb $INSTALL_URL_ADDRESS cloudprint-jessie main" > /etc/apt/sources.list.d/cloudprint.list
wget -q -O - https://davesteele.github.io/key-366150CE.pub.txt | apt-key add -
G_AGUP
G_AGI cloudprint-service
} else {
G_AGI cloudprint-service
}
}
#VirtualHere
setvar INSTALLING_INDEX = '138'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://virtualhere.com/sites/default/files/usbserver/vhusbd''
#armv6+
if (( $G_HW_ARCH == 1 || $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''arm''
#ARMv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''arm64''
#x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''x86_64''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
mkdir -p /etc/vhusbd
wget $INSTALL_URL_ADDRESS -O /etc/vhusbd/vhusbd
chmod +x /etc/vhusbd/vhusbd
}
#sabnzbd
setvar INSTALLING_INDEX = '139'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
local version='2.3.2'
setvar INSTALL_URL_ADDRESS = ""https://github.com/sabnzbd/sabnzbd/archive/$version.zip""
G_CHECK_URL $INSTALL_URL_ADDRESS
#prereqs
G_AGI par2 python-dev libffi-dev libssl-dev
if (( $G_HW_MODEL < 10 )) {
G_AGI unrar-free
} else {
G_AGI unrar
}
wget $INSTALL_URL_ADDRESS -O package.zip
mkdir -p /etc/sabnzbd
unzip -o package.zip -d /etc/sabnzbd
rm package.zip
mv /etc/sabnzbd/sabnzbd-"$version"/* /etc/sabnzbd/
rm -R /etc/sabnzbd/sabnzbd-"$version"
pip install cheetah cryptography sabyenc
}
#spotifyconnectweb
setvar INSTALLING_INDEX = '141'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/Fornoth/spotify-connect-web/releases'' #full path fails wget spider test...
G_CHECK_URL $INSTALL_URL_ADDRESS
setvar INSTALL_URL_ADDRESS = ''/download/0.0.3-alpha/spotify-connect-web_0.0.3-alpha.tar.gz''
wget $INSTALL_URL_ADDRESS -O package.tar
tar zxvf package.tar -C "$G_FP_DIETPI_USERDATA"/
rm package.tar
}
#couchpotato
setvar INSTALLING_INDEX = '142'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/CouchPotato/CouchPotatoServer/archive/master.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libffi-dev libssl-dev python-lxml python3-lxml
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
rm -R /etc/couchpotato &> /dev/null
mv CouchPotato* /etc/couchpotato
pip install --upgrade pyopenssl
}
#Koel
setvar INSTALLING_INDEX = '143'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/phanan/koel/archive/v3.7.0.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI python
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
rm package.zip
mv koel-* /var/www/koel
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/koel
npm install yarn -g --unsafe-perm
composer install
npm install
cd $HOME
}
#Sonarr
setvar INSTALLING_INDEX = '144'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
if (( $G_HW_ARCH == 3 )) {
echo -e "deb [arch=armhf] https://apt.sonarr.tv/ master main" > /etc/apt/sources.list.d/sonarr.list
dpkg --add-architecture armhf
} else {
echo -e "deb https://apt.sonarr.tv/ master main" > /etc/apt/sources.list.d/sonarr.list
}
G_AGUP
G_AGI nzbdrone
}
#Radarr
setvar INSTALLING_INDEX = '145'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://api.github.com/repos/Radarr/Radarr/releases''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI mono-devel mediainfo sqlite3 libmono-cil-dev
wget $( curl -s "$INSTALL_URL_ADDRESS" | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 ) -O package.tar
tar -xf package.tar -C /opt/
rm package.tar
}
#PlexPy
setvar INSTALLING_INDEX = '146'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/JonnyWong16/plexpy.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI python
git clone --depth=1 $INSTALL_URL_ADDRESS
mv plexpy /opt/
}
#Jackett
setvar INSTALLING_INDEX = '147'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://api.github.com/repos/Jackett/Jackett/releases''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI mono-devel
wget $( curl -s "$INSTALL_URL_ADDRESS" | grep Jackett.Binaries.Mono.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4 ) -O package.tar
tar -xvf package.tar
rm package.tar
mkdir /opt/jackett
mv Jackett/* /opt/jackett
rm -R Jackett
}
#JRiver
setvar INSTALLING_INDEX = '148'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dist.jriver.com/latest/mediacenter/mediacenter22native.list''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget -q -O - http://dist.jriver.com/mediacenter@jriver.com.gpg.key | apt-key add -
wget $INSTALL_URL_ADDRESS -O /etc/apt/sources.list.d/mediacenter22.list
G_AGUP
G_AGI mediacenter22
}
#NZBget
setvar INSTALLING_INDEX = '149'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://nzbget.net''
G_CHECK_URL $INSTALL_URL_ADDRESS
setvar INSTALL_URL_ADDRESS = ''/download/nzbget-latest-bin-linux.run''
wget $INSTALL_URL_ADDRESS -O package.run
mkdir -p "$G_FP_DIETPI_USERDATA"/nzbget
sh package.run --destdir "$G_FP_DIETPI_USERDATA"/nzbget
rm package.run
}
#------------------ Bittorrent: HTPC Manager ------------------
setvar INSTALLING_INDEX = '155'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/Hellowlol/HTPC-Manager.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
#Install Python and PIP
G_AGI python python-pip python-imaging python-dev
cd $HOME
git clone --depth=1 $INSTALL_URL_ADDRESS
# - Move HTPC Manager to a 'better' location
mkdir -p "$G_FP_DIETPI_USERDATA"/htpc-manager
mv "$HOME"/HTPC-Manager/* "$G_FP_DIETPI_USERDATA"/htpc-manager/
rm -R "$HOME"/HTPC-Manager
# - psutil for system stats
pip install psutil
}
#OctoPrint
setvar INSTALLING_INDEX = '153'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/foosel/OctoPrint.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI python python-dev
git clone $INSTALL_URL_ADDRESS
mv OctoPrint* "$G_FP_DIETPI_USERDATA"/octoprint
cd "$G_FP_DIETPI_USERDATA"/octoprint
python setup.py install
cd $HOME
}
#RoonServer
setvar INSTALLING_INDEX = '154'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://download.roonlabs.com/builds/RoonServer_linuxx64.tar.bz2''
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libav-tools cifs-utils
wget $INSTALL_URL_ADDRESS -O package.tar
tar xvf package.tar
rm package.tar
mv RoonServer "$G_FP_DIETPI_USERDATA"/roonserver
}
#Steam
setvar INSTALLING_INDEX = '156'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
debconf-set-selections <<< "steam steam/question select I AGREE"
G_AGI steam
}
#Minio
setvar INSTALLING_INDEX = '158'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# Download the proper Minio executable and put it in the proper location
# Check to see if this is a n x86 or x64 box. If so download the x86 Minio if not download 32bit ARM linux version
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''https://dl.minio.io/server/minio/release/linux-amd64/minio''
} else {
setvar INSTALL_URL_ADDRESS = ''https://dl.minio.io/server/minio/release/linux-arm/minio''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
#Download executable
wget -O /usr/local/bin/minio $INSTALL_URL_ADDRESS
chmod +x /usr/local/bin/minio
# Check, Download, Install startup script
setvar INSTALL_URL_ADDRESS = ''https://github.com/minio/minio-service/raw/master/linux-systemd/minio.service''
G_CHECK_URL $INSTALL_URL_ADDRESS
# Download the systemd service script
wget -O /etc/systemd/system/minio.service $INSTALL_URL_ADDRESS
# Create no login, with home directory, with group of same name, user to run Minio in
adduser --system --group minio-user
# Create default data directory & grant minio-user proper access
mkdir "$G_FP_DIETPI_USERDATA"/minio-data
}
#Docker
setvar INSTALLING_INDEX = '162'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://get.docker.com''
G_CHECK_URL $INSTALL_URL_ADDRESS
# Offical Docker recommended install command
wget -O DockerInstall.sh $INSTALL_URL_ADDRESS
chmod +x DockerInstall.sh
./DockerInstall.sh
#rm DockerInstall.sh
}
#FuguHub
setvar INSTALLING_INDEX = '161'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://FuguHub.com/install/FuguHub.linux.install''
} else {
setvar INSTALL_URL_ADDRESS = ''http://FuguHub.com/releases/raspberrypi/install.sh''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
wget -O FHinstall.sh $INSTALL_URL_ADDRESS
chmod +x FHinstall.sh
./FHinstall.sh
rm FHinstall.sh
wget http://fuguhub.com/box.zip -O /home/bd/applications/box.zip
}
#Nukkit
setvar INSTALLING_INDEX = '164'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://ci.mengcraft.com:8080/job/nukkit/lastStableBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar''
G_CHECK_URL $INSTALL_URL_ADDRESS
mkdir /usr/local/bin/nukkit
wget -O /usr/local/bin/nukkit/nukkit.jar $INSTALL_URL_ADDRESS
}
#GITEA
setvar INSTALLING_INDEX = '165'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://dl.gitea.io/gitea/1.3.2/gitea-1.3.2-''
#armv6
if (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''linux-arm-6''
#armv7
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''linux-arm-7''
#armv8
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''linux-arm64''
#x86_64
} elif (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''linux-amd64''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Data storage / user data
mkdir -p "$G_FP_DIETPI_USERDATA"/gitea/gitea-repositories
wget $INSTALL_URL_ADDRESS -O "$G_FP_DIETPI_USERDATA"/gitea/gitea
chmod +x "$G_FP_DIETPI_USERDATA"/gitea/gitea
}
#Allo Web Interface
setvar INSTALLING_INDEX = '159' #160 for quick reinstall
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 ||
${aSOFTWARE_INSTALL_STATE[160]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/allo_web_interface_v5.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -o/var/www/
rm package.7z
}
#Gmediarender
setvar INSTALLING_INDEX = '163'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/gmrender_1_''
if (( $G_HW_ARCH == 10 )) {
setvar INSTALL_URL_ADDRESS = ''amd64.deb''
} elif (( $G_HW_ARCH == 3 )) {
setvar INSTALL_URL_ADDRESS = ''arm64.deb''
} elif (( $G_HW_ARCH == 2 )) {
setvar INSTALL_URL_ADDRESS = ''armv7.deb''
} elif (( $G_HW_ARCH == 1 )) {
setvar INSTALL_URL_ADDRESS = ''armv6.deb''
}
G_CHECK_URL $INSTALL_URL_ADDRESS
G_AGI libupnp6 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-alsa
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
}
#AudioPhonics Pi-SPC
setvar INSTALLING_INDEX = '166'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#NB: Please see configuration section
}
#Raspotify
setvar INSTALLING_INDEX = '167'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://dtcooper.github.io/raspotify/key.asc''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget -O - $INSTALL_URL_ADDRESS | apt-key add -
echo -e "deb https://dtcooper.github.io/raspotify jessie main" > /etc/apt/sources.list.d/raspotify.list
G_AGUP
G_AGI raspotify
}
#moOde
setvar INSTALLING_INDEX = '168'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/moode/rel-stretch-r40b9.zip''
G_CHECK_URL $INSTALL_URL_ADDRESS
cd $HOME
wget $INSTALL_URL_ADDRESS -O package.zip
unzip -o package.zip
#Pre-Reqs -----------------------------------------------------------------------
# Core packages
G_AGI rpi-update mpc memcached $PHP_APT_PACKAGE_NAME-memcache \
bs2b-ladspa libbs2b0 libasound2-plugin-equal telnet automake sysstat tcpdump shellinabox \
udisks-glue exfat-fuse inotify-tools libav-tools
#php5-memcached
# WiFi Hotspot
G_AGI dnsmasq hostapd
# BT
G_AGI bluez bluez-firmware \
dh-autoreconf expect libortp-dev libbluetooth-dev libasound2-dev \
libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev
if (( $G_HW_MODEL < 10 )) {
G_AGI pi-bluetooth
}
#Disable Shell in box --------------------------------------------------------------------
systemctl stop shellinabox
systemctl disable shellinabox
#HostAPD/BT -------------------------------------------------------------------------------
systemctl disable hostapd
systemctl disable dnsmasq
cd $HOME
git clone https://github.com/Arkq/bluez-alsa.git --depth=1
cd bluez-alsa
autoreconf --install
mkdir build
cd build
../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
make -j $(nproc --all)
make install
cd $HOME
rm -rf bluez-alsa
systemctl daemon-reload
systemctl disable bluetooth.service
systemctl disable bluealsa.service
systemctl disable hciuart.service
mkdir -p /var/run/bluealsa
#Wiring Pi -------------------------------------------------------------------------------
#??? Use/test with DietPi WP install
cd $HOME
cp ./rel-stretch/other/wiringpi/wiringPi-*.tar.gz ./
tar xfz ./wiringPi-*.tar.gz
cd wiringPi-96344ff
./build
cd $HOME
rm -rf ./wiringPi-*
#Rotary encoder driver --------------------------------------------------------------------
cp ./rel-stretch/other/rotenc/rotenc.c ./
gcc -std=c99 rotenc.c -orotenc -lwiringPi
cp ./rotenc /usr/local/bin
rm ./rotenc*
#Compile and install MPD ------------------------------------------------------------------
# Installed via DietPi pre-built binaries.
}
#Google AIY
setvar INSTALLING_INDEX = '169'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://github.com/google/aiyprojects-raspbian.git''
G_CHECK_URL $INSTALL_URL_ADDRESS
git clone -b voicekit $INSTALL_URL_ADDRESS "$G_FP_DIETPI_USERDATA"/voice-recognizer-raspi
cd "$G_FP_DIETPI_USERDATA"/voice-recognizer-raspi
pip3 install --upgrade pip virtualenv
virtualenv --system-site-packages -p python3 env
env/bin/pip install -r requirements.txt
#??? ARMv7 only
if (( $G_HW_ARCH == 2 )) {
env/bin/pip install google-assistant-library==0.0.3
}
# - Services
sed -i "s#/home/pi#$G_FP_DIETPI_USERDATA#g" systemd/voice-recognizer.service
sed -i "/^User=/c\User=dietpi" systemd/voice-recognizer.service
cp systemd/voice-recognizer.service /etc/systemd/system/
cp systemd/alsa-init.service /etc/systemd/system/
#cp systemd/ntpdate.service /etc/systemd/system/
source env/bin/activate
# - Enable default app for service start
cp src/assistant_library_with_button_demo.py src/main.py
cd $HOME
}
#-------------------------------------------------------------------
#Reset error handler (eg: for usermsg clear set in Banner_Installing)
G_ERROR_HANDLER_RESET
#-------------------------------------------------------------------
}
proc Install_Linux_Software {
setvar INSTALLING_INDEX = '5'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI alsa-utils
#Apply soundcard
local soundcard=$(cat /DietPi/dietpi.txt | grep -m1 '^CONFIG_SOUNDCARD=' | sed 's/.*=//')
# - RPi enable internal HDMI+Analogue if currently set to 'none'
if (( $G_HW_MODEL < 10 )) &&
test $soundcard = "none" || test $soundcard = "default" {
setvar soundcard = ''rpi-bcm2835''
}
# - Apply
/DietPi/dietpi/func/dietpi-set_hardware soundcard $soundcard
}
setvar INSTALLING_INDEX = '6'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Xserver Prereqs (ALL)
G_AGI xcompmgr xterm xinit xauth xserver-xorg dbus-x11 xfonts-base x11-xserver-utils x11-common x11-utils --no-install-recommends
#Improve performance on all desktops and devices (eg: removes window lag in desktops) by limiting compositions
mkdir -p /etc/xdg/autostart
cat <<< """ > /etc/xdg/autostart/xcompmgr.desktop
[Desktop Entry]
Type=Application
Name=xcompmgr
NoDisplay=true
Exec=xcompmgr -a
"""
> /etc/xdg/autostart/xcompmgr.desktop
[Desktop Entry]
Type=Application
Name=xcompmgr
NoDisplay=true
Exec=xcompmgr -a
_EOF_
#RPI
if (( $G_HW_MODEL < 10 )) {
sleep 1
#Odroid C2
} elif (( $G_HW_MODEL == 12 )) {
G_AGI aml-libs-odroid mali450-odroid xf86-video-mali-odroid libump-odroid --no-install-recommends
#cp /DietPi/dietpi/conf/xorg_c2.conf /etc/X11/xorg.conf
# FBTURBO C2, provides much better desktop performance over Mali DDX: http://forum.odroid.com/viewtopic.php?f=138&t=19948&p=169808#p169808
G_AGI xf86-video-fbturbo-odroid
cat <<< """ > /etc/X11/xorg.conf
Section "Device"
Identifier "FBTurbo"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
#Option "Rotate" "CCW"
EndSection
"""
> /etc/X11/xorg.conf
Section "Device"
Identifier "FBTurbo"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
#Option "Rotate" "CCW"
EndSection
_EOF_
#Odroid XU4
} elif (( $G_HW_MODEL == 11 )) {
G_AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid --no-install-recommends
cp /DietPi/dietpi/conf/xorg_xu4.conf /etc/X11/xorg.conf
#Odroid C1
} elif (( $G_HW_MODEL == 10 )) {
G_AGI aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid --no-install-recommends
cp /DietPi/dietpi/conf/xorg_c1.conf /etc/X11/xorg.conf
#Pine64
} elif (( $G_HW_MODEL == 40 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.deb
dpkg -i package.deb
rm package.deb
wget http://dietpi.com/downloads/binaries/all/xf86-video-fbturbo_1-1_arm64.deb -O package.deb
dpkg -i package.deb
rm package.deb
cat <<< """ > /etc/X11/xorg.conf
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
"""
> /etc/X11/xorg.conf
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
_EOF_
#Asus TB
# elif (( $G_HW_MODEL == 52 )); then
# cat << _EOF_ > /etc/X11/xorg.conf
# Section "Device"
# Identifier "Rockchip Graphics"
# Driver "modesetting"
# Option "AccelMethod" "glamor"
# Option "DRI" "2"
# EndSection
# _EOF_
}
}
#Nvidia driver
setvar INSTALLING_INDEX = '151'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Install
G_AGI nvidia-driver nvidia-xconfig
# + i386 OpenGL
G_AGI libgl1-nvidia-glx:i386
}
#Avahi-Daemon
setvar INSTALLING_INDEX = '152'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI avahi-daemon
}
setvar INSTALLING_INDEX = '16'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI build-essential make autoconf automake --no-install-recommends
}
setvar INSTALLING_INDEX = '170'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI ntp
# Remove service, as DietPi ntpd-mode launches the binary with custom commands
systemctl stop ntp
rm /etc/init.d/ntp
Reset_NTPD
}
setvar INSTALLING_INDEX = '17'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI git --no-install-recommends
}
setvar INSTALLING_INDEX = '4'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI vifm
}
setvar INSTALLING_INDEX = '20'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI vim
}
setvar INSTALLING_INDEX = '21'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI vim-tiny
}
setvar INSTALLING_INDEX = '127'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI neovim
}
setvar INSTALLING_INDEX = '18'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI emacs
}
setvar INSTALLING_INDEX = '12'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI iperf
}
setvar INSTALLING_INDEX = '3'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI mc
}
setvar INSTALLING_INDEX = '19'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI jed
}
setvar INSTALLING_INDEX = '10'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI iftop
}
setvar INSTALLING_INDEX = '11'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI iptraf
}
setvar INSTALLING_INDEX = '13'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI mtr-tiny
}
setvar INSTALLING_INDEX = '14'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI nload
}
setvar INSTALLING_INDEX = '15'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI tcpdump
}
setvar INSTALLING_INDEX = '0'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI openssh-client
}
setvar INSTALLING_INDEX = '1'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Remove Information file
rm /mnt/samba/readme.txt &> /dev/null
G_AGI smbclient cifs-utils --no-install-recommends
}
setvar INSTALLING_INDEX = '2'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Remove information file
rm /mnt/ftp_client/readme.txt &> /dev/null
G_AGI curlftpfs
}
setvar INSTALLING_INDEX = '110'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#Remove information file
rm /mnt/nfs_client/readme.txt &> /dev/null
G_AGI nfs-common
}
setvar INSTALLING_INDEX = '104'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI dropbear
#set to start on next boot
sed -i '/NO_START=1/c\NO_START=0' /etc/default/dropbear
}
setvar INSTALLING_INDEX = '105'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI openssh-server --no-install-recommends
# - Remove all references before adding the entry: https://github.com/Fourdee/DietPi/issues/604
sed -i '/PermitRootLogin[[:space:]]/d' /etc/ssh/sshd_config
echo -e "\n\n#Allow root login over SSH\nPermitRootLogin yes" >> /etc/ssh/sshd_config
#Generate host keys
# - remove all previous
rm /etc/ssh/ssh_host_key
rm /etc/ssh/ssh_host_rsa_key
rm /etc/ssh/ssh_host_dsa_key
# - Generate
ssh-keygen -f /etc/ssh/ssh_host_key -N '' -t rsa1
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
# - Set permissions
chmod -R 700 /etc/ssh/
#Restart ssh server now so root users can login during setup.
systemctl restart ssh
#SSH server package also installs client.
setvar aSOFTWARE_INSTALL_STATE[0]=2
}
setvar INSTALLING_INDEX = '103'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
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
}
setvar INSTALLING_INDEX = '101'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI logrotate --no-install-recommends
}
setvar INSTALLING_INDEX = '102'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
G_AGI rsyslog --no-install-recommends
}
setvar INSTALLING_INDEX = '7'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#RPi + OpenMAX HW Encoding: https://github.com/Fourdee/DietPi/issues/869
if (( $G_HW_MODEL < 10 )) {
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/rpi/ffmpeg_rpi.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -offmpeg_rpi
dpkg -i ffmpeg_rpi/*.deb
rm -R ffmpeg_rpi
rm package.7z
#Everything else
} else {
G_AGI ffmpeg
}
}
setvar INSTALLING_INDEX = '8'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
# On Jessie use backports repo:
if (( $G_DISTRO == 3 )) {
cat <<< """ > /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk
Package: openjdk-8-jdk
Pin: release a=jessie-backports
Pin-Priority: 990
"""
> /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk
Package: openjdk-8-jdk
Pin: release a=jessie-backports
Pin-Priority: 990
_EOF_
G_AGI openjdk-8-jdk -t jessie-backports
} else {
G_AGI openjdk-8-jdk
}
}
setvar INSTALLING_INDEX = '9'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
#check, is online
setvar INSTALL_URL_ADDRESS = ''http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Preqs
wget $INSTALL_URL_ADDRESS -O node_install.sh
chmod +x node_install.sh
./node_install.sh
rm node_install.sh
}
setvar INSTALLING_INDEX = '130'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''https://bootstrap.pypa.io/get-pip.py''
G_CHECK_URL $INSTALL_URL_ADDRESS
# - Preqs
G_AGI python python-dev
wget $INSTALL_URL_ADDRESS -O install.py
python ./install.py
rm install.py
G_AGI python-pip python3-pip
}
#SDL2
setvar INSTALLING_INDEX = '140'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar INSTALL_URL_ADDRESS = ''http://dietpi.com/downloads/binaries/rpi/sdl2_rpi.7z''
G_CHECK_URL $INSTALL_URL_ADDRESS
#G_AGI libxss1 #if using SDL2+rpi5
wget $INSTALL_URL_ADDRESS -O package.7z
7z x -y package.7z -osdl2_rpi
rm package.7z
dpkg -i sdl2_rpi/no_opengl_x11/*.deb
rm -R sdl2_rpi
}
#Mono repo
setvar INSTALLING_INDEX = '150'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
#ARMv6 only available in raspbian repo: https://github.com/Fourdee/DietPi/issues/1023
if (( $G_HW_ARCH == 1 )) {
echo -e "deb http://download.mono-project.com/repo/debian raspbian$G_DISTRO_NAME main" > /etc/apt/sources.list.d/mono-xamarin.list
} else {
echo -e "deb http://download.mono-project.com/repo/debian $G_DISTRO_NAME main" > /etc/apt/sources.list.d/mono-xamarin.list
}
G_AGUP
G_AGI mono-runtime
}
#------------------ Home Automation: Home Assistant ------------------
setvar INSTALLING_INDEX = '157'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Installing
setvar HA_USER = ""homeassistant""
setvar HA_USERROOT = ""/home/$HA_USER""
setvar HA_SRVROOT = ""/srv/homeassistant""
setvar HA_PYENV_ACTIVATION = ""export PATH=\"$HA_USERROOT/.pyenv/bin:\$PATH\"; eval \"\$(pyenv init -)\"; eval \"\$(pyenv virtualenv-init -)"\""
setvar HA_PYTHON_VERSION = ""3.6.3""
G_DIETPI-NOTIFY 2 "HA_USER: $HA_USER"
G_DIETPI-NOTIFY 2 "HA_USERROOT: $HA_USERROOT"
G_DIETPI-NOTIFY 2 "HA_SRVROOT: $HA_SRVROOT"
G_DIETPI-NOTIFY 2 "HA_PYENV_ACTIVATION: $HA_PYENV_ACTIVATION"
G_DIETPI-NOTIFY 2 "HA_PYTHON_VERSION: $HA_PYTHON_VERSION"
# Install needed libraries
G_AGI libssl-dev git cmake libc-ares-dev uuid-dev daemon curl libgnutls28-dev libgnutlsxx28 nmap net-tools sudo libglib2.0-dev libudev-dev swig libssl-dev libusb-1.0-0 gcc libssl-dev libffi-dev libbz2-dev zlib1g-dev libreadline-dev libsqlite3-dev libncurses5-dev libncursesw5-dev
if (( $G_DISTRO < 4 )) {
G_AGI libmysqlclient-dev
} else {
G_AGI libmariadbclient-dev
}
# Setup the user account information
adduser --system $HA_USER
addgroup $HA_USER
usermod -G dialout -a $HA_USER
# this allows the dietpi user to edit the files along with HA.
usermod -G dietpi -a $HA_USER
mkdir $HA_SRVROOT
chown $HA_USER:$HA_USER $HA_SRVROOT
# Install pyenv
su --shell /bin/bash --command "cd $HA_USERROOT; curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash" $HA_USER
# Install Python which is needed for HA.
su --shell /bin/bash --command "cd $HA_USERROOT; $HA_PYENV_ACTIVATION; pyenv install $HA_PYTHON_VERSION" $HA_USER
# Make the virtual environment.
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv virtualenv $HA_PYTHON_VERSION homeassistant-$HA_PYTHON_VERSION" $HA_USER
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv local homeassistant-$HA_PYTHON_VERSION" $HA_USER
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv local" $HA_USER
# Install Home Assistant and extra modules.
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv activate homeassistant-$HA_PYTHON_VERSION; pip3 install colorlog PyMySQL mysqlclient" $HA_USER
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv activate homeassistant-$HA_PYTHON_VERSION; pip3 install --upgrade homeassistant" $HA_USER
# Generate the scripts to launch HA using pyenv.
echo '#!/bin/bash' > $HA_SRVROOT/homeassistant-start.sh
echo "cd $HA_SRVROOT" >> $HA_SRVROOT/homeassistant-start.sh
echo $HA_PYENV_ACTIVATION >> $HA_SRVROOT/homeassistant-start.sh
echo "pyenv activate homeassistant-$HA_PYTHON_VERSION" >> $HA_SRVROOT/homeassistant-start.sh
echo "hass -c \"$HA_USERROOT/.homeassistant\"" >> $HA_SRVROOT/homeassistant-start.sh
#su --shell /bin/bash --command "/srv/homeassistant/homeassistant-start.sh" homeassistant
chmod +x /srv/homeassistant/homeassistant-start.sh
}
#-------------------------------------------------------------------
#Reset error handler (eg: for usermsg clear set in Banner_Installing)
G_ERROR_HANDLER_RESET
#-------------------------------------------------------------------
}
proc Uninstall_NonSelected_Choices {
#Uninstall software using our temp uninstall list
if test -f $UNINSTALL_FILE {
#Run the temp uninstall script
while read -r line
{
Uninstall_Software $line
} < $UNINSTALL_FILE
rm $UNINSTALL_FILE
}
}
proc Apply_SSHServer_Choices {
#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 )) {
# - No SSH server
if (( $INDEX_SSHSERVER_TARGET == 0 )) {
echo -e "104" >> "$UNINSTALL_FILE"
echo -e "105" >> "$UNINSTALL_FILE"
# - Dropbear
} elif (( $INDEX_SSHSERVER_TARGET == -1 )) {
setvar aSOFTWARE_INSTALL_STATE[104]=1
echo -e "105" >> "$UNINSTALL_FILE"
# - Openssh
} elif (( $INDEX_SSHSERVER_TARGET == -2 )) {
setvar aSOFTWARE_INSTALL_STATE[105]=1
echo -e "104" >> "$UNINSTALL_FILE"
}
#Inform user (From testing, stopping SSH server services does not disconnect user, however, just incase it does in the future)
G_DIETPI-NOTIFY 3 DietPi-Software "Stopping SSH servers"
#stop all SSH server services
service ssh stop &> /dev/null
service dropbear stop &> /dev/null
#Update Current SSHSERVER index
setvar INDEX_SSHSERVER_CURRENT = "$INDEX_SSHSERVER_TARGET"
}
}
proc Apply_FileServer_Choices {
#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 )) {
#No File server
if (( $INDEX_FILESERVER_TARGET == 0 )) {
echo -e "96" >> "$UNINSTALL_FILE"
echo -e "94" >> "$UNINSTALL_FILE"
#echo -e "95" >> "$UNINSTALL_FILE"
#ProFTP
} elif (( $INDEX_FILESERVER_TARGET == -1 )) {
setvar aSOFTWARE_INSTALL_STATE[94]=1
echo -e "96" >> "$UNINSTALL_FILE"
#Samba
} elif (( $INDEX_FILESERVER_TARGET == -2 )) {
setvar aSOFTWARE_INSTALL_STATE[96]=1
echo -e "94" >> "$UNINSTALL_FILE"
}
#Update Current SSHSERVER index
setvar INDEX_FILESERVER_CURRENT = "$INDEX_FILESERVER_TARGET"
}
}
proc Apply_Logging_Choices {
#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 )) {
#None
if (( $INDEX_LOGGING_TARGET == 0 )) {
echo -e "101" >> "$UNINSTALL_FILE"
echo -e "103" >> "$UNINSTALL_FILE"
echo -e "102" >> "$UNINSTALL_FILE"
#Ramlog - clear every 24H
} elif (( $INDEX_LOGGING_TARGET == -1 )) {
setvar aSOFTWARE_INSTALL_STATE[103]=1
echo -e "101" >> "$UNINSTALL_FILE"
echo -e "102" >> "$UNINSTALL_FILE"
#Ramlog - backup every 1H to $HOME/logfile_storage, then clear.
} elif (( $INDEX_LOGGING_TARGET == -2 )) {
setvar aSOFTWARE_INSTALL_STATE[103]=1
echo -e "101" >> "$UNINSTALL_FILE"
echo -e "102" >> "$UNINSTALL_FILE"
#Logrotate + rsyslog - logs to disk
} elif (( $INDEX_LOGGING_TARGET == -3 )) {
setvar aSOFTWARE_INSTALL_STATE[101]=1
setvar aSOFTWARE_INSTALL_STATE[102]=1
echo -e "103" >> "$UNINSTALL_FILE"
}
#Update Current Logging index
setvar INDEX_LOGGING_CURRENT = "$INDEX_LOGGING_TARGET"
}
}
proc Apply_Webserver_Preference {
if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )) {
#Update Current to Target
setvar INDEX_WEBSERVER_CURRENT = "$INDEX_WEBSERVER_TARGET"
}
}
proc Install_Apply_Permissions {
#Not all permissions are listed here.
# - Only ones which are shared across programs, and/or located inside G_FP_DIETPI_USERDATA that require non-root permissions.
#- /var/www / www-data
chown -R www-data:www-data /var/www
chmod -R 775 /var/www
# - O!MPD, requires write permissions
chmod -R 777 /var/www/ompd/tmp #(required for database update)
chmod -R 777 /var/www/ompd/stream #(required for streaming files)
chmod -R 777 /var/www/ompd/cache #(required for downloading files)
#Apply non-root permissions for files and folders in G_FP_DIETPI_USERDATA
# - dietpi user
chown -R dietpi:dietpi /home/dietpi
chown -R dietpi:dietpi $G_FP_DIETPI_USERDATA
chmod -R 775 $G_FP_DIETPI_USERDATA
# + for symlinked locations
chown -R dietpi:dietpi "$G_FP_DIETPI_USERDATA"/*
chmod -R 775 "$G_FP_DIETPI_USERDATA"/*
# - MPD
chown -R mpd:audio "$G_FP_DIETPI_USERDATA"/.mpd_cache
# - MySQL data store
chown -R mysql:mysql "$G_FP_DIETPI_USERDATA"/mysql
chmod -R 770 "$G_FP_DIETPI_USERDATA"/mysql
chown -R mineos:mineos "$G_FP_DIETPI_USERDATA"/mineos/serverdata
chown -R urbackup:urbackup "$G_FP_DIETPI_USERDATA"/urbackup
#chown -R couchpotato:couchpotato "$G_FP_DIETPI_USERDATA"/couchpotato
# - www-data
chown -R www-data:www-data "$G_FP_DIETPI_USERDATA"/dietpicam
chown -R www-data:www-data "$G_FP_DIETPI_USERDATA"/pydio_data
local datadir=$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_OWNCLOUD_DATADIR=' | sed 's/.*=//')
test ! -n $datadir && setvar datadir = ""$G_FP_DIETPI_USERDATA/owncloud_data""
chown -R www-data:www-data $datadir
setvar datadir = $(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_NEXTCLOUD_DATADIR=' | sed 's/.*=//')
test ! -n $datadir && setvar datadir = ""$G_FP_DIETPI_USERDATA/nextcloud_data""
chown -R www-data:www-data $datadir
# - Home Assistant Permissions
#chown -R homeassistant:dietpi /home/homeassistant/.homeassistant
#chown -R dietpi:dietpi "$G_FP_DIETPI_USERDATA"/homeassistant
# - Minio
chown -R minio-user:minio-user "$G_FP_DIETPI_USERDATA"/minio-data
# - FuguHub
chown -R bd:bd "$G_FP_DIETPI_USERDATA"/fuguhub-data/
# - Nodered
chown -R nodered:nodered "$G_FP_DIETPI_USERDATA"/node-red
}
#/////////////////////////////////////////////////////////////////////////////////////
# Configuration post installation goes here.
#
# Reference:
# - Adding new software to DietPi-Software
# https://github.com/Fourdee/DietPi/issues/490#issuecomment-244416570
#
# Adding post installation steps.
# ------------------------------------
# - INSTALLING_INDEX:
# This has to be the same number as index_current for the software list above.
#
# Here you can add any configuration changes or addtions to systemd. After this
# has run it will reload the systemd environment and start any services installed
# and referenced in 'dietpi-services'
#
# Example:
# #------------------ Desktop: MATE ------------------
# INSTALLING_INDEX=24
# if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then
#
# # - file manager desktop icon
# ln -sf /usr/share/applications/caja.desktop "$HOME"/Desktop/caja.desktop
#
# Create_Desktop_Shared_Items
#
# #Odroid C2, define default pulseaudio sink: https://github.com/Fourdee/DietPi/issues/415
# if (( $G_HW_MODEL == 12 &&
# ! $(cat /etc/pulse/default.pa | grep -ci -m1 '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo') )); then
#
# echo -e "set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo" >> /etc/pulse/default.pa
#
# fi
#
# fi
#
#/////////////////////////////////////////////////////////////////////////////////////
proc Install_Apply_Configs {
# Copy/Set optimised Software settings.
# Set install states to 2 (installed).
#DESKTOP_LXDE
setvar INSTALLING_INDEX = '23'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Remove Lxrandr Menu item (monitor configuration tool as we set res in dietpi-config)
rm /usr/share/applications/lxrandr.desktop &> /dev/null
#Copy PCmanFM configs
mkdir -p "$HOME"/.config/pcmanfm/LXDE
wget http://dietpi.com/downloads/conf/desktop/pcmanfm.conf -O "$HOME"/.config/pcmanfm/LXDE/pcmanfm.conf
wget http://dietpi.com/downloads/conf/desktop/pcmanfm-desktopitems.conf -O "$HOME"/.config/pcmanfm/LXDE/desktop-items-0.conf
#Disable Trash
sed -i '/use_trash=/c\use_trash=0' /etc/xdg/libfm/libfm.conf
#Copy DietPi Panel config
mkdir -p "$HOME"/.config/lxpanel/LXDE/panels
wget http://dietpi.com/downloads/conf/desktop/panel -O "$HOME"/.config/lxpanel/LXDE/panels/panel
#Openbox config
mkdir -p "$HOME"/.config/openbox
wget http://dietpi.com/downloads/conf/desktop/lxde-rc.xml -O "$HOME"/.config/openbox/lxde-rc.xml
# - file manager desktop icon
ln -sf /usr/share/applications/pcmanfm.desktop "$HOME"/Desktop/pcmanfm.desktop
Create_Desktop_Shared_Items
}
#Desktop MATE
setvar INSTALLING_INDEX = '24'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - file manager desktop icon
ln -sf /usr/share/applications/caja.desktop "$HOME"/Desktop/caja.desktop
Create_Desktop_Shared_Items
#Odroid C2, define default pulseaudio sink: https://github.com/Fourdee/DietPi/issues/415
if (( $G_HW_MODEL == 12 &&
! $(cat /etc/pulse/default.pa | grep -ci -m1 '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo') )) {
echo -e "set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo" >> /etc/pulse/default.pa
}
}
#Desktop GNUStep
setvar INSTALLING_INDEX = '26'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Create_Desktop_Shared_Items
}
#DESKTOP_XFCE
setvar INSTALLING_INDEX = '25'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Create_Desktop_Shared_Items
}
#WEBSERVER_APACHE
setvar INSTALLING_INDEX = '83'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#create www directory
mkdir -p /var/www
#Apache2 confs
cp /DietPi/dietpi/conf/apache2_jessie.conf /etc/apache2/apache2.conf
cat <<< """ > /etc/apache2/sites-available/000-default.conf
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
"""
> /etc/apache2/sites-available/000-default.conf
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
_EOF_
cat <<< """ > /etc/apache2/mods-available/mpm_event.conf
StartServers $G_HW_CPU_CORES
MinSpareThreads 1
MaxSpareThreads 8
ThreadLimit 16
ThreadsPerChild 4
MaxRequestWorkers 50
MaxConnectionsPerChild 0
"""
> /etc/apache2/mods-available/mpm_event.conf
StartServers $G_HW_CPU_CORES
MinSpareThreads 1
MaxSpareThreads 8
ThreadLimit 16
ThreadsPerChild 4
MaxRequestWorkers 50
MaxConnectionsPerChild 0
_EOF_
cat <<< """ > /etc/apache2/mods-available/mpm_prefork.conf
StartServers $G_HW_CPU_CORES
MinSpareServers 1
MaxSpareServers $G_HW_CPU_CORES
MaxRequestWorkers 50
MaxConnectionsPerChild 0
"""
> /etc/apache2/mods-available/mpm_prefork.conf
StartServers $G_HW_CPU_CORES
MinSpareServers 1
MaxSpareServers $G_HW_CPU_CORES
MaxRequestWorkers 50
MaxConnectionsPerChild 0
_EOF_
cat <<< """ > /etc/apache2/mods-available/mpm_worker.conf
StartServers $G_HW_CPU_CORES
MinSpareThreads 1
MaxSpareThreads 8
ThreadLimit 16
ThreadsPerChild 4
MaxRequestWorkers 50
MaxConnectionsPerChild 0
"""
> /etc/apache2/mods-available/mpm_worker.conf
StartServers $G_HW_CPU_CORES
MinSpareThreads 1
MaxSpareThreads 8
ThreadLimit 16
ThreadsPerChild 4
MaxRequestWorkers 50
MaxConnectionsPerChild 0
_EOF_
#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
#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/*
}
#WEBSERVER_NGINX
setvar INSTALLING_INDEX = '85'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#create www directory
mkdir -p /var/www
#Nginx confs
mkdir /etc/nginx/sites-dietpi
cp /DietPi/dietpi/conf/nginx.conf /etc/nginx/nginx.conf
# - Stretch , set php7.0
if (( $G_DISTRO >= 4 )) {
sed -i "s#/run/php5-fpm.sock#/run/php/php7.0-fpm.sock#g" /etc/nginx/nginx.conf
}
# - CPU core count
sed -i "/worker_processes/c\worker_processes $G_HW_CPU_CORES;" /etc/nginx/nginx.conf
#Default site
cp /DietPi/dietpi/conf/nginx.site-available-default /etc/nginx/sites-available/default
# - Stretch , set php7.0
if (( $G_DISTRO >= 4 )) {
sed -i "s#/run/php5-fpm.sock#/run/php/php7.0-fpm.sock#g" /etc/nginx/sites-available/default
}
# - Nginx index page
cp /usr/share/nginx/html/index.html /var/www/index.html
}
#WEBSERVER_LIGHTTPD
setvar INSTALLING_INDEX = '84'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#create www directory
mkdir -p /var/www
#www path
sed -i '/^server.document-root/c\server.document-root = "/var/www"' /etc/lighttpd/lighttpd.conf
#Configure fastcgi for PHP-FPM
local fp_php_fpm_sock='/var/run/php/php7.0-fpm.sock'
if (( $G_DISTRO == 3 )) {
setvar fp_php_fpm_sock = ''/var/run/php5-fpm.sock''
}
cat <<< """ > /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
## Start an FastCGI server using php-fpm
fastcgi.server += ( ".php" =>
((
"socket" => "$fp_php_fpm_sock",
"broken-scriptfilename" => "enable"
))
)
"""
> /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
## Start an FastCGI server using php-fpm
fastcgi.server += ( ".php" =>
((
"socket" => "$fp_php_fpm_sock",
"broken-scriptfilename" => "enable"
))
)
_EOF_
#enable cgi/php
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php
#Move default page
mv /var/www/html/index.lighttpd.html /var/www/
service lighttpd force-reload
}
#WEBSERVER_PHP
setvar INSTALLING_INDEX = '89'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Apache2 has its own PHP module
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
# https://github.com/Fourdee/DietPi/issues/1144
local php_service='/lib/systemd/system/apache2.service'
# - All other webservers (eg: Nginx/Lighttpd) use PHP-FPM
} else {
local php_service='/lib/systemd/system/php*-fpm.service'
# - PHP-FPM confs
sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=1' "$FP_PHP_BASE_DIR"/fpm/php.ini
# - PHP-FPM optimizations based on total cores
sed -i "/pm.max_children = /c\pm.max_children = $(( $G_HW_CPU_CORES * 3 ))" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/pm.start_servers = /c\pm.start_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/pm.min_spare_servers = /c\pm.min_spare_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/pm.max_spare_servers = /c\pm.max_spare_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
# - Enviroment PHP settings:
sed -i "/env\[HOSTNAME\]/c\env\[HOSTNAME\] = \$HOSTNAME" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/env\[PATH\]/c\env\[PATH\] = /usr/local/bin:/usr/bin:/bin" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
# /tmp is mounted to RAM, so use DISK (/var/tmp) instead
sed -i "/env\[TMP\]/c\env\[TMP\] = /var/tmp" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/env\[TMPDIR\]/c\env\[TMPDIR\] = /var/tmp" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
sed -i "/env\[TEMP\]/c\env\[TEMP\] = /var/tmp" "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
}
# PHP cache settings
local target_php_ini=0
local target_php_cachesize=$(( $RAM_TOTAL / 30 ))
if (( $target_php_cachesize < 10 )) {
setvar target_php_cachesize = '10'
}
# - OPcache
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
setvar target_php_ini = ""$FP_PHP_BASE_DIR/apache2/php.ini""
} else {
setvar target_php_ini = ""$FP_PHP_BASE_DIR/fpm/php.ini""
}
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
# - APCu
setvar target_php_ini = ""$FP_PHP_BASE_DIR/mods-available/apcu.ini""
# - - apc.shm_size= requires M at end to prevent warning: https://github.com/Fourdee/DietPi/issues/218
setvar target_php_cachesize = ""M""
# - - 3days TTL
local target_apc_ttl='259200'
cat <<< """ > "$target_php_ini"
extension=apcu.so
apc.shm_size=$target_php_cachesize
apc.ttl=$target_apc_ttl
"""
> "$target_php_ini"
extension=apcu.so
apc.shm_size=$target_php_cachesize
apc.ttl=$target_apc_ttl
_EOF_
# We create our own PHP mod to add DietPi specific configs.
local dietpi_php_ini="$FP_PHP_BASE_DIR/mods-available/dietpi.ini"
touch $dietpi_php_ini
# - Set tmp_upload_dir to sd. Can't be /tmp as its ramdisk and limited size. Also used by ownCloud/Nextcloud uploads
# - If PHP uses PrivateTmp, we must not use own subfolder: https://github.com/Fourdee/DietPi/issues/1144
if grep -q '^\s*PrivateTmp=true' $php_service &> /dev/null {
local tmp_upload_dir="/var/tmp"
} else {
local tmp_upload_dir="/var/tmp/php_upload_tmp"
mkdir -p $tmp_upload_dir
chown -R www-data:www-data $tmp_upload_dir
}
grep -q 'upload_tmp_dir' $dietpi_php_ini &&
sed -i "/upload_tmp_dir/c\upload_tmp_dir = $tmp_upload_dir" $dietpi_php_ini ||
echo "upload_tmp_dir = $tmp_upload_dir" >> $dietpi_php_ini
# - max upload size
local php_max_upload_size="$(( $(php -r 'print(PHP_INT_MAX);') / 1024 / 1024))M"
# - - upload_max_filesize
grep -q 'upload_max_filesize' $dietpi_php_ini &&
sed -i "/upload_max_filesize/c\upload_max_filesize = $php_max_upload_size" $dietpi_php_ini ||
echo "upload_max_filesize = $php_max_upload_size" >> $dietpi_php_ini
# - - post_max_size
grep -q 'post_max_size' $dietpi_php_ini &&
sed -i "/post_max_size/c\post_max_size = $php_max_upload_size" $dietpi_php_ini ||
echo "post_max_size = $php_max_upload_size" >> $dietpi_php_ini
# - - Nginx - Set client_max_body_size to avoid 2MB upload error: https://github.com/Fourdee/DietPi/issues/546
if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
sed -i "/client_max_body_size/c\ client_max_body_size $php_max_upload_size;" /etc/nginx/nginx.conf
}
# - Set UTF-8
grep -q 'default_charset' $dietpi_php_ini &&
sed -i '/default_charset/c\default_charset = "UTF-8"' $dietpi_php_ini ||
echo 'default_charset = "UTF-8"' >> $dietpi_php_ini
# Enable all installed and available PHP modules.
local modules_to_enable=$(ls "$FP_PHP_BASE_DIR"/mods-available | grep '.ini' | sed 's/.ini//')
${PHP_APT_PACKAGE_NAME}enmod $modules_to_enable
# PHP info page
echo "" > /var/www/phpinfo.php
# OPcache info page
wget https://raw.githubusercontent.com/rlerdorf/opcache-status/master/opcache.php -O /var/www/opcache.php
# APC info page
wget https://github.com/krakjoe/apcu/raw/master/apc.php -O /var/www/apc.php
}
#WEBSERVER_MARIADB
setvar INSTALLING_INDEX = '88'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Move SQL store to userdata location: https://github.com/Fourdee/DietPi/issues/672
if test $(readlink /var/lib/mysql) != "$G_FP_DIETPI_USERDATA/mysql/" {
G_RUN_CMD systemctl stop mysql
# - Create target dir
mkdir -p "$G_FP_DIETPI_USERDATA"/mysql
# - copy
cp -a /var/lib/mysql/* "$G_FP_DIETPI_USERDATA"/mysql/
if (( $? != 0 )) {
G_DIETPI-NOTIFY 1 "Moving of MySQL data store failed to $G_FP_DIETPI_USERDATA/mysql. DietPi-Software will now exit"
Exit_Destroy
}
rm -R /var/lib/mysql &> /dev/null || rm /var/lib/mysql &> /dev/null
# - Symlink
ln -sf "$G_FP_DIETPI_USERDATA"/mysql /var/lib/mysql
chown mysql:mysql /var/lib/mysql
# - Set permissions on data store directory NOW.
Install_Apply_Permissions &> /dev/null
}
# On Jessie assure unix_socket authentication:
if (( $G_DISTRO < 4 )) {
G_RUN_CMD systemctl start mysql
mysql -e "install plugin unix_socket soname 'auth_socket';" &> /dev/null
mysql -e "grant all privileges on *.* to 'root'@'localhost' identified via unix_socket with grant option;flush privileges"
# Drop unnecessary root user children.
mysql -e "drop user 'root'@'dietpi';drop user 'root'@'127.0.0.1';drop user 'root'@'::1'" &> /dev/null
}
### Also for MariaDB?
# Optimize for reduced memory use: https://github.com/Fourdee/DietPi/issues/605#issue-188930987
#cat << _EOF_ > /etc/mysql/conf.d/reduce_resources.cnf
#[mysqld]
#key_buffer_size=8M
#max_connections=30
#query_cache_size=8M
#query_cache_limit=512K
#thread_stack=128K
#_EOF_
}
#WEBSERVER_MYADMINPHP
setvar INSTALLING_INDEX = '90'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#NGINX LIGHTTPD symlink to var www
if (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 ||
${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
ln -sf /usr/share/phpmyadmin /var/www
}
# Due to MariaDB unix_socket authentication, "root" cannot be used to login the web ui.
# Thus default "phpmyadmin" user need to be used, who on Jessie does not have all privileges:
# http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=54#p54
mysql -e "grant all privileges on *.* to phpmyadmin@localhost with grant option"
}
#WEBSERVER_REDIS
setvar INSTALLING_INDEX = '91'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Enable redis php module, if installed:
"$PHP_APT_PACKAGE_NAME"enmod redis 2> /dev/null
}
#OPENBAZAAR
setvar INSTALLING_INDEX = '58'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - service
cat <<< """ > /etc/systemd/system/openbazaar.service
[Unit]
Description=openbazaar
[Service]
Type=simple
WorkingDirectory=/etc/openbazaar-server
ExecStart=$(which python) openbazaard.py start -a 0.0.0.0
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/openbazaar.service
[Unit]
Description=openbazaar
[Service]
Type=simple
WorkingDirectory=/etc/openbazaar-server
ExecStart=$(which python) openbazaard.py start -a 0.0.0.0
[Install]
WantedBy=multi-user.target
_EOF_
}
#YaCy
setvar INSTALLING_INDEX = '133'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
chmod +x -R /etc/yacy
cat <<< """ > /etc/systemd/system/yacy.service
[Unit]
Description=DietPi YaCy Service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/bash -c '/etc/yacy/startYACY.sh'
ExecStop=/bin/bash -c '/etc/yacy/stopYACY.sh'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/yacy.service
[Unit]
Description=DietPi YaCy Service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/bash -c '/etc/yacy/startYACY.sh'
ExecStop=/bin/bash -c '/etc/yacy/stopYACY.sh'
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
# Create admin login account:
/etc/yacy/bin/passwd.sh $GLOBAL_PW
}
#ownCloud
setvar INSTALLING_INDEX = '47'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
G_DIETPI-NOTIFY 2 'Enabling needed PHP modules: https://doc.owncloud.org/server/latest/admin_manual/installation/source_installation.html#php-extensions'
"$PHP_APT_PACKAGE_NAME"enmod curl gd intl json pdo_mysql opcache apcu redis
# Following modules are switchable since Stretch:
if (( $G_DISTRO > 3 )) {
phpenmod ctype dom fileinfo iconv mbstring posix simplexml xmlwriter xmlreader zip exif
}
# APCu configuration: To prevent cli (cron.php) producing ownCloud log entries.
grep -q 'apc.enable_cli=' $FP_PHP_BASE_DIR/mods-available/apcu.ini && sed -i '/apc.enable_cli=/c\apc.enable_cli=1' $FP_PHP_BASE_DIR/mods-available/apcu.ini || echo 'apc.enable_cli=1' >> $FP_PHP_BASE_DIR/mods-available/apcu.ini
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
G_DIETPI-NOTIFY 2 'Apache webserver found, enable ownCloud specific configuration: "https://doc.owncloud.org/server/latest/admin_manual/installation/source_installation.html#configure-apache-web-server"'
a2enmod rewrite headers env dir mime 1> /dev/null
local owncloud_conf='/etc/apache2/sites-available/owncloud.conf'
if test -f $owncloud_conf {
G_DIETPI-NOTIFY 2 'Existing ownCloud configuration found, will save the new one for review and comparison to: /etc/apache2/sites-available/owncloud.conf.dietpi-new'
setvar owncloud_conf = ''/etc/apache2/sites-available/owncloud.conf.dietpi-new''
}
cp /DietPi/dietpi/conf/apache.ownnextcloud.conf $owncloud_conf
sed -i 's/nextcloud/owncloud/g' $owncloud_conf
# OPcache adjustment is just needed by Nextcloud
sed -i 's/php_admin_value/#php_admin_value/' $owncloud_conf
a2ensite owncloud 1> /dev/null
}
if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
G_DIETPI-NOTIFY 2 'Nginx webserver found, enable ownCloud specific configuration: "https://doc.owncloud.org/server/latest/admin_manual/installation/nginx_configuration.html#owncloud-in-a-subdir-of-nginx"'
local owncloud_config='/etc/nginx/sites-dietpi/owncloud.config'
if test -f $owncloud_config {
G_DIETPI-NOTIFY 2 'Existing ownCloud configuration found, will save the new one for review and comparison to: /etc/nginx/sites-dietpi/owncloud.config.dietpi-new'
setvar owncloud_config = ''/etc/nginx/sites-dietpi/owncloud.config.dietpi-new''
}
cp /DietPi/dietpi/conf/nginx.sites-dietpi.owncloud.config $owncloud_config
# Stretch: Use PHP7.0 socket and set 'fastcgi_request_buffering off';
if (( $G_DISTRO > 3 )) {
sed -i 's|/run/php5-fpm.sock|/run/php/php7.0-fpm.sock|g' $owncloud_config
sed -i 's/#fastcgi_request_buffering off;/fastcgi_request_buffering off;/g' $owncloud_config
}
# Set HTTPS on, if SSL connection is available, even with self-signed/untrusted certificate.
wget -q --spider --timeout=10 --tries=2 https://localhost &> /dev/null
if (( $? == 0 || $? == 5)) {
sed -i 's/#fastcgi_param HTTPS on;/fastcgi_param HTTPS on;/g' $owncloud_config
}
}
# Enable 4-byte support for MariaDB: https://doc.owncloud.org/server/latest/admin_manual/configuration/database/linux_database_configuration.html#configure-mysql-for-4-byte-unicode-support
cat <<< """ > /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf
[mysqld]
innodb_large_prefix=1
innodb_file_format=barracuda
innodb_file_per_table=1
"""
> /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf
[mysqld]
innodb_large_prefix=1
innodb_file_format=barracuda
innodb_file_per_table=1
_EOF_
G_RUN_CMD systemctl restart mysql
# Reload dietpi-globals to enable occ command shortcut:
source /DietPi/dietpi/func/dietpi-globals
# Adjusting config file:
local config_php='/var/www/owncloud/config/config.php'
local datadir="$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_DATADIR=' /DietPi/dietpi.txt | sed 's/^.*=//')"
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/owncloud_data""
mkdir -p $datadir
Install_Apply_Permissions &> /dev/null
if test -d "$G_FP_DIETPI_USERDATA"/mysql/owncloud {
G_DIETPI-NOTIFY 2 'ownCloud database found, will NOT overwrite.'
} else {
if test -f "$datadir"/dietpi-owncloud-database-backup.sql {
G_DIETPI-NOTIFY 2 'ownCloud database backup found, starting recovery...'
local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | awk '{print $3}' | sed "s/[',]//g")
local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | awk '{print $3}' | sed "s/[',]//g")
/DietPi/dietpi/func/create_mysql_db owncloud $dbuser $dbpass
mysql -uroot owncloud < "$datadir"/dietpi-owncloud-database-backup.sql
} else {
local username="$(cat /DietPi/dietpi.txt | grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=' | sed 's/^.*=//')"
test -n $username || setvar username = ''admin''
# For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data.
mysql -e "grant all privileges on *.* to 'tmp_root'@'localhost' identified by '$GLOBAL_PW' with grant option"
grep -q "'installed' => true," $config_php 2>/dev/null || occ maintenance:install --no-interaction --database "mysql" --database-name "owncloud" --database-user "tmp_root" --database-pass $GLOBAL_PW --admin-user $username --admin-pass $GLOBAL_PW --data-dir $datadir
mysql -e "drop user 'tmp_root'@'localhost'"
}
}
# Enable ownCloud to use 4-byte database
grep -q "^[[:blank:]]*'mysql.utf8mb4'" $config_php || sed -i "/^[[:blank:]]*'dbpassword'/a \ \ 'mysql.utf8mb4' => true," $config_php
# Add local IP and hostname to trusted domains.
# If "1 => '" does not exist, the config.php is not copied e.g. from older instance, so we add entries.
if (( ! $(cat $config_php | grep -ci -m1 "1 => '") )) {
sed -i "/0 => 'localhost'/a 1 => '$(sed -n 4p /DietPi/dietpi/.network)'," $config_php
sed -i "/1 => '/a 2 => '$(cat /etc/hostname)'," $config_php
}
# Set CLI URL to ownCloud sub directory:
sed -i "s|'http://localhost'|'http://localhost/owncloud'|g" $config_php
# Set pretty URLs (without /index.php/) on Apache:
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
grep -q "^[[:blank:]]*'htaccess.RewriteBase'" $config_php || sed -i "/^[[:blank:]]*'overwrite.cli.url'/a \ \ 'htaccess.RewriteBase' => '/owncloud'," $config_php
occ maintenance:update:htaccess
}
# APCu Memcache
grep -q "^[[:blank:]]*'memcache.local'" $config_php || sed -i "/^[[:blank:]]*'version'/a \ \ 'memcache.local' => '\\\OC\\\Memcache\\\APCu'," $config_php
# Redis for transactional file locking:
# https://doc.owncloud.org/server/latest/admin_manual/configuration/server/caching_configura$
# - Enable Redis socket and grant www-data access to it:
local redis_conf="/etc/redis/redis*.conf"
grep -q "^[[:blank:]]*unixsocket /" $redis_conf || grep -q '^[[:blank:]]*#unixsocket /' $redis_conf && sed -i 's|^[[:blank:]]*#unixsocket /|unixsocket /|' $redis_conf || echo 'unixsocket /var/run/redis/redis.sock' >> $redis_conf
grep -q "^[[:blank:]]*#?unixsocketperm " $redis_conf && sed -i "/^[[:blank:]]*#?unixsocketperm /c\unixsocketperm 770" $redis_conf || echo 'unixsocketperm 770' >> $redis_conf
local redis_sock=$(grep "^[[:blank:]]*unixsocket /" $redis_conf | sed "s/^[[:blank:]]*unixsocket //")
usermod -a -G redis www-data
# - Enable ownCloud to use Redis socket:
if (( ! $(cat $config_php | grep -ci -m1 "'memcache.locking'") )) {
sed -i "\#'memcache.local'#a \ \ 'filelocking.enabled' => true,\n\
'memcache.locking' => '\\\OC\\\Memcache\\\Redis',\n\
'redis' => [\n\
'host' => '$redis_sock',\n\
'port' => 0,\n\
]," $config_php
}
# Enable ownCloud background cron job:
crontab -u www-data -l 2>/dev/null | grep -q '/var/www/owncloud/cron.php' || shell { crontab -u www-data -l 2>/dev/null ; echo "*/15 * * * * php /var/www/owncloud/cron.php" } | crontab -u www-data -
occ background:cron
# Enable maintenance mode to allow handling by dietpi-services:
grep -q "^[[:blank:]]*'maintenance' => true," $config_php || occ maintenance:mode --on
}
#Nextcloud
setvar INSTALLING_INDEX = '114'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
G_DIETPI-NOTIFY 2 'Enabling needed PHP modules: https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation'
"$PHP_APT_PACKAGE_NAME"enmod curl gd intl json pdo_mysql opcache apcu redis
# Following modules are switchable since Stretch:
if (( $G_DISTRO > 3 )) {
phpenmod ctype dom fileinfo iconv mbstring posix simplexml xmlwriter xmlreader zip exif
}
# APCu configuration: To prevent cli (cron.php) producing Nextcloud log [info] entries.
grep -q 'apc.enable_cli=' $FP_PHP_BASE_DIR/mods-available/apcu.ini && sed -i '/apc.enable_cli=/c\apc.enable_cli=1' $FP_PHP_BASE_DIR/mods-available/apcu.ini || echo 'apc.enable_cli=1' >> $FP_PHP_BASE_DIR/mods-available/apcu.ini
# OPCache configuration: https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html?highlight=opcache#enable-php-opcache
grep -q 'opcache.enable=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.enable=/c\opcache.enable=1' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.enable=1' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
grep -q 'opcache.enable_cli=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.enable_cli=/c\opcache.enable_cli=1' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.enable_cli=1' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
grep -q 'opcache.interned_strings_buffer=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.interned_strings_buffer=/c\opcache.interned_strings_buffer=8' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.interned_strings_buffer=8' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
grep -q 'opcache.max_accelerated_files=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.max_accelerated_files=/c\opcache.max_accelerated_files=10000' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.max_accelerated_files=10000' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
grep -q 'opcache.save_comments=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.save_comments=/c\opcache.save_comments=1' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.save_comments=1' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
grep -q 'opcache.revalidate_freq=' $FP_PHP_BASE_DIR/mods-available/opcache.ini && sed -i '/opcache.revalidate_freq=/c\opcache.revalidate_freq=1' $FP_PHP_BASE_DIR/mods-available/opcache.ini || echo 'opcache.revalidate_freq=1' >> $FP_PHP_BASE_DIR/mods-available/opcache.ini
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
G_DIETPI-NOTIFY 2 'Apache webserver found, enable Nextcloud specific configuration: "https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html#apache-web-server-configuration"'
a2enmod rewrite headers env dir mime 1> /dev/null
local nextcloud_conf='/etc/apache2/sites-available/nextcloud.conf'
if test -f $nextcloud_conf {
G_DIETPI-NOTIFY 2 'Existing Nextcloud configuration found, will save the new one for review and comparison to: /etc/apache2/sites-available/nextcloud.conf.dietpi-new'
setvar nextcloud_conf = ''/etc/apache2/sites-available/nextcloud.conf.dietpi-new''
}
cp /DietPi/dietpi/conf/apache.ownnextcloud.conf $nextcloud_conf
a2ensite nextcloud 1> /dev/null
}
if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
G_DIETPI-NOTIFY 2 'Nginx webserver found, enable Nextcloud specific configuration: "https://docs.nextcloud.com/server/12/admin_manual/installation/nginx.html#nextcloud-in-a-subdir-of-nginx"'
local nextcloud_config='/etc/nginx/sites-dietpi/nextcloud.config'
if test -f $nextcloud_config {
G_DIETPI-NOTIFY 2 'Existing Nextcloud configuration found, will save the new one for review and comparison to: /etc/nginx/sites-dietpi/nextcloud.config.dietpi-new'
setvar nextcloud_config = ''/etc/nginx/sites-dietpi/nextcloud.config.dietpi-new''
}
cp /DietPi/dietpi/conf/nginx.sites-dietpi.nextcloud.config $nextcloud_config
# Stretch: Use PHP7.0 socket and set 'fastcgi_request_buffering off';
if (( $G_DISTRO > 3 )) {
sed -i 's|/run/php5-fpm.sock|/run/php/php7.0-fpm.sock|g' $nextcloud_config
sed -i 's/#fastcgi_request_buffering off;/fastcgi_request_buffering off;/g' $nextcloud_config
}
# Set HTTPS on, if SSL connection is available, even with self-signed/untrusted certificate.
wget -q --spider --timeout=10 --tries=2 https://localhost &> /dev/null
if (( $? == 0 || $? == 5)) {
sed -i 's/#fastcgi_param HTTPS on;/fastcgi_param HTTPS on;/g' $nextcloud_config
}
}
if (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 )) {
G_DIETPI-NOTIFY 2 'Lighttpd webserver found, enable Nextcloud specific configuration.'
local lighttpd_conf='/etc/lighttpd/lighttpd.conf'
# Enable mod_setenv
grep -q '^[[:blank:]]*"mod_setenv",' $lighttpd_conf ||
grep -q '^[[:blank:]#;]*"mod_setenv",' $lighttpd_conf &&
sed -i '/^[[:blank:]#;]*"mod_setenv",/c\ "mod_setenv",' $lighttpd_conf ||
sed -i '/^[[:blank:]]*server.modules = (/a\ "mod_setenv",' $lighttpd_conf
# Move Nextcloud configuration file in place and activate it
test ! -f /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf && cp /DietPi/dietpi/conf/lighttpd.nextcloud.conf /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf
lighttpd-enable-mod dietpi-nextcloud
service lighttpd force-reload
}
# Enable 4-byte support for MariaDB: https://docs.nextcloud.com/server/12/admin_manual/configuration_database/mysql_4byte_support.html
cat <<< """ > /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf
[mysqld]
innodb_large_prefix=1
innodb_file_format=barracuda
innodb_file_per_table=1
"""
> /etc/mysql/mariadb.conf.d/99-dietpi-4byte.cnf
[mysqld]
innodb_large_prefix=1
innodb_file_format=barracuda
innodb_file_per_table=1
_EOF_
G_RUN_CMD systemctl restart mysql
# Reload dietpi-globals to enable ncc command shortcut:
source /DietPi/dietpi/func/dietpi-globals
# Adjusting config file:
local config_php='/var/www/nextcloud/config/config.php'
local datadir="$(grep -m1 '^[[:blank:]]*SOFTWARE_NEXTCLOUD_DATADIR=' /DietPi/dietpi.txt | sed 's/^.*=//')"
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/nextcloud_data""
mkdir -p $datadir
Install_Apply_Permissions &> /dev/null
if test -d "$G_FP_DIETPI_USERDATA"/mysql/nextcloud {
G_DIETPI-NOTIFY 2 'Nextcloud database found, will NOT overwrite.'
} else {
if test -f "$datadir"/dietpi-nextcloud-database-backup.sql {
G_DIETPI-NOTIFY 2 'Nextcloud database backup found, starting recovery...'
local dbuser=$(grep -m1 "^[[:blank:]]*'dbuser'" $config_php | awk '{print $3}' | sed "s/[',]//g")
local dbpass=$(grep -m1 "^[[:blank:]]*'dbpassword'" $config_php | awk '{print $3}' | sed "s/[',]//g")
/DietPi/dietpi/func/create_mysql_db nextcloud $dbuser $dbpass
mysql -uroot nextcloud < "$datadir"/dietpi-nextcloud-database-backup.sql
} else {
local username="$(grep -m1 '^[[:blank:]]*SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=' /DietPi/dietpi.txt | sed 's/^.*=//')"
test -n $username || setvar username = ''admin''
# For MariaDB, temporary database admin user needs to be created, as 'root' uses unix_socket login, which cannot be accessed by sudo -u www-data.
mysql -e "grant all privileges on *.* to 'tmp_root'@'localhost' identified by '$GLOBAL_PW' with grant option"
grep -q "'installed' => true," $config_php 2>/dev/null || ncc maintenance:install --no-interaction --database "mysql" --database-name "nextcloud" --database-user "tmp_root" --database-pass $GLOBAL_PW --admin-user $username --admin-pass $GLOBAL_PW --data-dir $datadir
mysql -e "drop user 'tmp_root'@'localhost'"
}
}
# Enable Nextcloud to use 4-byte database
grep -q "^[[:blank:]]*'mysql.utf8mb4'" $config_php || sed -i "/^[[:blank:]]*'dbpassword'/a \ \ 'mysql.utf8mb4' => true," $config_php
# Disable trusted_domains.
if (( ! $(cat $config_php | grep -ci -m1 "1 => '*'") )) {
sed -i "/0 => 'localhost'/a 1 => '*'," $config_php
}
# Set CLI URL to Nextcloud sub directory:
sed -i "s|'http://localhost'|'http://localhost/nextcloud'|g" $config_php
# Set pretty URLs (without /index.php/) on Apache:
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
grep -q "^[[:blank:]]*'htaccess.RewriteBase'" $config_php || sed -i "/^[[:blank:]]*'overwrite.cli.url'/a \ \ 'htaccess.RewriteBase' => '/nextcloud'," $config_php
ncc maintenance:update:htaccess
}
# APCu Memcache
grep -q "^[[:blank:]]*'memcache.local'" $config_php || sed -i "/^[[:blank:]]*'version'/a \ \ 'memcache.local' => '\\\OC\\\Memcache\\\APCu'," $config_php
# Redis for transactional file locking:
# https://docs.nextcloud.com/server/12/admin_manual/configuration_files/files_locking_transactional.html
# - Enable Redis socket and grant www-data access to it:
local redis_conf="/etc/redis/redis*.conf"
grep -q "^[[:blank:]]*unixsocket /" $redis_conf || grep -q '^[[:blank:]]*#unixsocket /' $redis_conf && sed -i 's|^[[:blank:]]*#unixsocket /|unixsocket /|' $redis_conf || echo 'unixsocket /var/run/redis/redis.sock' >> $redis_conf
grep -q "^[[:blank:]]*#?unixsocketperm " $redis_conf && sed -i "/^[[:blank:]]*#?unixsocketperm /c\unixsocketperm 770" $redis_conf || echo 'unixsocketperm 770' >> $redis_conf
local redis_sock=$(grep "^[[:blank:]]*unixsocket /" $redis_conf | sed "s/^[[:blank:]]*unixsocket //")
usermod -a -G redis www-data
# - Enable Nextloud to use Redis socket:
if (( ! $(cat $config_php | grep -ci -m1 "'memcache.locking'") )) {
sed -i "\#'memcache.local'#a \ \ 'filelocking.enabled' => true,\n\
'memcache.locking' => '\\\OC\\\Memcache\\\Redis',\n\
'redis' => array(\n\
'host' => '$redis_sock',\n\
'port' => 0,\n\
)," $config_php
}
# Enable Nextcloud background cron job:
crontab -u www-data -l 2>/dev/null | grep -q '/var/www/nextcloud/cron.php' || shell { crontab -u www-data -l 2>/dev/null ; echo "*/15 * * * * php /var/www/nextcloud/cron.php" } | crontab -u www-data -
ncc background:cron
# Enable maintenance mode to allow handling by dietpi-services:
grep -q "^[[:blank:]]*'maintenance' => true," $config_php || ncc maintenance:mode --on
}
# Transmission
setvar INSTALLING_INDEX = '44'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#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 <<< """ > /etc/systemd/system/transmission-daemon.service
[Unit]
Description=Barebones transmission-daemon service
DefaultDependencies=no
[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]
WantedBy=multi-user.target
"""
> /etc/systemd/system/transmission-daemon.service
[Unit]
Description=Barebones transmission-daemon service
DefaultDependencies=no
[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]
WantedBy=multi-user.target
_EOF_
cat <<< """ > /etc/transmission-daemon/settings.json
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 48,
"dht-enabled": true,
"download-dir": "$G_FP_DIETPI_USERDATA/downloads",
"download-limit": 100,
"download-limit-enabled": false,
"download-queue-enabled": true,
"download-queue-size": 2,
"encryption": 2,
"idle-seeding-limit": 1,
"idle-seeding-limit-enabled": true,
"incomplete-dir": "$G_FP_DIETPI_USERDATA/bt-inprogress",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"max-peers-global": 8,
"message-level": 0,
"peer-congestion-algorithm": "",
"peer-limit-global": 8,
"peer-limit-per-torrent": 5,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": 1,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 1.1,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "$GLOBAL_PW",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "root",
"rpc-whitelist": "192.*.*.*",
"rpc-whitelist-enabled": false,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 100,
"speed-limit-down-enabled": false,
"speed-limit-up": 100,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": true,
"umask": 18,
"upload-limit": 100,
"upload-limit-enabled": false,
"upload-slots-per-torrent": 2,
"utp-enabled": true
}
"""
> /etc/transmission-daemon/settings.json
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 48,
"dht-enabled": true,
"download-dir": "$G_FP_DIETPI_USERDATA/downloads",
"download-limit": 100,
"download-limit-enabled": false,
"download-queue-enabled": true,
"download-queue-size": 2,
"encryption": 2,
"idle-seeding-limit": 1,
"idle-seeding-limit-enabled": true,
"incomplete-dir": "$G_FP_DIETPI_USERDATA/bt-inprogress",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"max-peers-global": 8,
"message-level": 0,
"peer-congestion-algorithm": "",
"peer-limit-global": 8,
"peer-limit-per-torrent": 5,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": 1,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 1.1,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "$GLOBAL_PW",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "root",
"rpc-whitelist": "192.*.*.*",
"rpc-whitelist-enabled": false,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 100,
"speed-limit-down-enabled": false,
"speed-limit-up": 100,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": true,
"umask": 18,
"upload-limit": 100,
"upload-limit-enabled": false,
"upload-slots-per-torrent": 2,
"utp-enabled": true
}
_EOF_
#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
}
#PHPBB
setvar INSTALLING_INDEX = '54'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
/DietPi/dietpi/func/create_mysql_db phpbb3 phpbb3 $GLOBAL_PW
}
#MPD
setvar INSTALLING_INDEX = '128'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Create MPD env (based on moOde)
#useradd mpd
useradd -r -M mpd -G audio -s /usr/bin/nologin
mkdir -p /var/lib/mpd
mkdir -p /var/run/mpd
mkdir -p /var/lib/mpd/music
mkdir -p /var/lib/mpd/playlists
touch /var/lib/mpd/state
# Link /mnt to MPD defaults: https://github.com/Fourdee/DietPi/issues/1223#issuecomment-346955040
rm /var/lib/mpd/music/MNT &> /dev/null # Always recreate (reinstalls), else, mnt -> /mnt
ln -sf /mnt /var/lib/mpd/music/MNT
chown -R mpd:audio /var/lib/mpd
mkdir -p /var/log/mpd
touch /var/log/mpd/mpd.log
chmod 644 /var/log/mpd/mpd.log
chown -R mpd:audio /var/log/mpd
# cache
mkdir -p "$G_FP_DIETPI_USERDATA"/.mpd_cache
#MPD service/confs
cat <<< """ > /etc/default/mpd
#Even though we declare the conf location in our service, MPD will fail to start if this file does not exist.
## The configuration file location for mpd:
MPDCONF=/etc/mpd.conf
"""
> /etc/default/mpd
#Even though we declare the conf location in our service, MPD will fail to start if this file does not exist.
## The configuration file location for mpd:
MPDCONF=/etc/mpd.conf
_EOF_
cat <<< """ > /lib/systemd/system/mpd.service
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
User=root
EnvironmentFile=/etc/default/mpd
ExecStartPre=/bin/mkdir -p /var/run/mpd
ExecStartPre=/bin/chown -R mpd:audio /var/run/mpd
ExecStart=$(which mpd) --no-daemon /etc/mpd.conf
[Install]
WantedBy=multi-user.target
"""
> /lib/systemd/system/mpd.service
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
User=root
EnvironmentFile=/etc/default/mpd
ExecStartPre=/bin/mkdir -p /var/run/mpd
ExecStartPre=/bin/chown -R mpd:audio /var/run/mpd
ExecStart=$(which mpd) --no-daemon /etc/mpd.conf
[Install]
WantedBy=multi-user.target
_EOF_
#Copy default config
cp /DietPi/dietpi/conf/mpd.conf /etc/mpd.conf
chown mpd:audio /etc/mpd.conf
chmod 0666 /etc/mpd.conf
#JustBoom specials
if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^CONFIG_SOUNDCARD=justboom') )) {
# - Name displayed in YMPD sound button
local justboom_soundcard_desc='JustBoom DietPi'
sed -i "/^name \"/c\name \"$justboom_soundcard_desc\"" /etc/mpd.conf
sed -i "/^zeroconf_name \"/c\zeroconf_name \"$justboom_soundcard_desc\"" /etc/mpd.conf
# - Output (192khz 32bit)
local target_bitdepth=32
local target_rate=192000
sed -i '/^format "/c\format "'$target_rate':'$target_bitdepth':2"' /etc/mpd.conf
sed -i '/audio_output_format "/c\audio_output_format "'$target_rate':'$target_bitdepth':2"' /etc/mpd.conf
# - Set SOXR quality
# All RPi's can handle SOXR VH @ 192khz 32bit: https://github.com/Fourdee/DietPi/issues/581#issuecomment-256643079
sed -i '/samplerate_converter "/c\samplerate_converter "soxr very high"' /etc/mpd.conf #highest
}
#Grab our test music for the user.
Download_Test_Media
}
# Proftpd
setvar INSTALLING_INDEX = '94'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i "/root/c\#root" /etc/ftpusers
cp /DietPi/dietpi/conf/proftpd.conf /etc/proftpd/proftpd.conf
sed -i "/DefaultRoot /c\DefaultRoot $G_FP_DIETPI_USERDATA" /etc/proftpd/proftpd.conf
}
#Samba Server
setvar INSTALLING_INDEX = '96'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
echo -e "dietpi\ndietpi" | smbpasswd -s -a root
cp /DietPi/dietpi/conf/smb.conf /etc/samba/smb.conf
sed -i "/path = /c\path = $G_FP_DIETPI_USERDATA" /etc/samba/smb.conf
}
#vsFTPD
setvar INSTALLING_INDEX = '95'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i '/root/c\#root' /etc/ftpusers
cp /DietPi/dietpi/conf/vsftpd.conf /etc/vsftpd.conf
sed -i "/^local_root=/c\local_root=$G_FP_DIETPI_USERDATA" /etc/vsftpd.conf
}
#NFS_SERVER
setvar INSTALLING_INDEX = '109'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/exports
$G_FP_DIETPI_USERDATA *(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)
"""
> /etc/exports
$G_FP_DIETPI_USERDATA *(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)
_EOF_
}
#YMPD
setvar INSTALLING_INDEX = '32'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#YMPD service
cat <<< """ > /etc/systemd/system/ympd.service
[Unit]
Description=YMPD
After=mpd.service
[Service]
Type=simple
User=root
ExecStart=/usr/bin/ympd --user root --webport 1337
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/ympd.service
[Unit]
Description=YMPD
After=mpd.service
[Service]
Type=simple
User=root
ExecStart=/usr/bin/ympd --user root --webport 1337
[Install]
WantedBy=multi-user.target
_EOF_
}
#Roon Bridge
setvar INSTALLING_INDEX = '121'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/roon
cp /DietPi/dietpi/conf/roonbridge.service /etc/systemd/system/roonbridge.service
# - Move logfiles to /var/log/ (dietpi-ramlog)
# Remove any previous folders to clear for symlink
rm -R "$G_FP_DIETPI_USERDATA"/roon/RoonBridge/Logs &> /dev/null
rm -R "$G_FP_DIETPI_USERDATA"/roon/RAATServer/Logs &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/roon/RoonBridge
mkdir -p "$G_FP_DIETPI_USERDATA"/roon/RAATServer
ln -sf /var/log "$G_FP_DIETPI_USERDATA"/roon/RoonBridge/Logs
ln -sf /var/log "$G_FP_DIETPI_USERDATA"/roon/RAATServer/Logs
}
#NodeRed
setvar INSTALLING_INDEX = '122'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/node-red
adduser nodered --system --group --no-create-home --shell=/bin/nologin
cat <<< """ > /etc/systemd/system/node-red.service
[Unit]
Description=Node-Red
[Service]
Type=simple
User=nodered
ExecStart=/usr/local/bin/node-red -u $G_FP_DIETPI_USERDATA/node-red
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/node-red.service
[Unit]
Description=Node-Red
[Service]
Type=simple
User=nodered
ExecStart=/usr/local/bin/node-red -u $G_FP_DIETPI_USERDATA/node-red
[Install]
WantedBy=multi-user.target
_EOF_
#Symlink to home dir: https://github.com/Fourdee/DietPi/issues/1256
ln -sf "$G_FP_DIETPI_USERDATA"/node-red "$HOME"/.node-red
}
#Tomcat8
setvar INSTALLING_INDEX = '125'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i "/JAVA_HOME=/c\JAVA_HOME=$(find \/usr\/lib\/jvm\/ -name java-8-openjdk*)" /etc/default/tomcat8
}
#CAVA
setvar INSTALLING_INDEX = '119'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Cava conf
mkdir -p "$HOME"/.config/cava
cp /DietPi/dietpi/conf/cava.conf "$HOME"/.config/cava/config
# - lower MPD buffer size to reduce latency of spectrum:
sed -i '/audio_buffer_size /c\audio_buffer_size "384"' /etc/mpd.conf
# - fifo stream for mpd
if (( ! $(cat /etc/mpd.conf | grep -ci -m1 '/tmp/mpd.fifo') )) {
cat <<< """ >> /etc/mpd.conf
#Cava fifo stream
audio_output {
type "fifo"
enabled "yes"
name "CAVA"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
"""
>> /etc/mpd.conf
#Cava fifo stream
audio_output {
type "fifo"
enabled "yes"
name "CAVA"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
_EOF_
}
}
#Mopidy
setvar INSTALLING_INDEX = '118'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i "/User=/c\User=root" /lib/systemd/system/mopidy.service
# - conf
mkdir -p "$G_FP_DIETPI_USERDATA"/mopidy/cache
mkdir -p "$G_FP_DIETPI_USERDATA"/mopidy/data
mkdir -p ~/.config/mopidy
cat <<< """ > ~/.config/mopidy/mopidy.conf
[core]
cache_dir = $G_FP_DIETPI_USERDATA/mopidy/cache
config_dir = /etc/mopidy
data_dir = $G_FP_DIETPI_USERDATA/mopidy/data
[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy.log
[local]
library = images
media_dir = /mnt
enabled = true
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.png
.txt
[file]
enabled = true
media_dirs = /mnt
[m3u]
playlists_dir = /mnt
[http]
enabled = true
hostname = ::
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname
"""
> ~/.config/mopidy/mopidy.conf
[core]
cache_dir = $G_FP_DIETPI_USERDATA/mopidy/cache
config_dir = /etc/mopidy
data_dir = $G_FP_DIETPI_USERDATA/mopidy/data
[logging]
config_file = /etc/mopidy/logging.conf
debug_file = /var/log/mopidy.log
[local]
library = images
media_dir = /mnt
enabled = true
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.png
.txt
[file]
enabled = true
media_dirs = /mnt
[m3u]
playlists_dir = /mnt
[http]
enabled = true
hostname = ::
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname
_EOF_
# NB: mopidy uses both config locations, so lets make sure we match them
cp ~/.config/mopidy/mopidy.conf /etc/mopidy/mopidy.conf
Download_Test_Media
}
#Kodi
setvar INSTALLING_INDEX = '31'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Remove Kodi user (Whilst waving)
userdel -r kodi &> /dev/null
#Run Kodi as root
sed -i '/USER=/c\USER=root' /etc/default/kodi &> /dev/null
#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
#Create .desktop SymLinks
mkdir -p "$HOME"/Desktop
rm /usr/share/applications/kodi.desktop &> /dev/null
wget http://dietpi.com/downloads/conf/desktop/kodi.desktop -O /usr/share/applications/kodi.desktop
ln -sf /usr/share/applications/kodi.desktop "$HOME"/Desktop/kodi.desktop
}
#MINIDLNA
setvar INSTALLING_INDEX = '39'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#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
#Copy Config
cp /DietPi/dietpi/conf/minidlna.conf /etc/minidlna.conf
#Setup data directories
mkdir -p "$G_FP_DIETPI_USERDATA"/.MiniDLNA_Cache
}
#NoIp
setvar INSTALLING_INDEX = '67'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#noip2 service file
cat <<< """ > /etc/systemd/system/noip2.service
[Unit]
Description=noip2
After=network.target network-online.target rsyslog.service
[Service]
Type=forking
RemainAfterExit=yes
ExecStart=/usr/local/bin/noip2
ExecStop=/usr/bin/killall -w noip2
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/noip2.service
[Unit]
Description=noip2
After=network.target network-online.target rsyslog.service
[Service]
Type=forking
RemainAfterExit=yes
ExecStart=/usr/local/bin/noip2
ExecStop=/usr/bin/killall -w noip2
[Install]
WantedBy=multi-user.target
_EOF_
}
#amiberry
setvar INSTALLING_INDEX = '108'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Allow binary execution
chmod -R +x /etc/amiberry
#Create userdata/rom directories and symlink from /etc/amiberry/
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry
#Copy default configs, then setup symlinks from Uae4ARM folders to userdata.
# - Conf
cp -R /etc/amiberry/conf "$G_FP_DIETPI_USERDATA"/amiberry/
rm -R /etc/amiberry/conf &> /dev/null
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/conf /etc/amiberry/conf
# - Disks
rm -R /etc/amiberry/disks &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/disks
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/disks /etc/amiberry/disks
# - floppy_images
rm -R /etc/amiberry/floppy_images &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/floppy_images
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/floppy_images /etc/amiberry/floppy_images
cat <<< """ > "$G_FP_DIETPI_USERDATA"/amiberry/floppy_images/dir.txt
Put your Amiga floopy images (*.adf) in this directory.
"""
> "$G_FP_DIETPI_USERDATA"/amiberry/floppy_images/dir.txt
Put your Amiga floopy images (*.adf) in this directory.
_EOF_
# - HDF
rm -R /etc/amiberry/hdf &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/hdf
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/hdf /etc/amiberry/hdf
# - Kickstarts
rm -R /etc/amiberry/kickstarts &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/kickstarts
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/kickstarts /etc/amiberry/kickstarts
cat <<< """ > "$G_FP_DIETPI_USERDATA"/amiberry/kickstarts/dir.txt
Put your Kickstart Roms (*.rom) in this directory.
They should be named accordingly depending on version: kick12.rom , kick13.rom , kick20.rom, kick31.rom
"""
> "$G_FP_DIETPI_USERDATA"/amiberry/kickstarts/dir.txt
Put your Kickstart Roms (*.rom) in this directory.
They should be named accordingly depending on version: kick12.rom , kick13.rom , kick20.rom, kick31.rom
_EOF_
# - Savestates
rm -R /etc/amiberry/savestates &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/savestates
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/savestates /etc/amiberry/savestates
cat <<< """ > "$G_FP_DIETPI_USERDATA"/amiberry/savestates/dir.txt
Saved states will be stored here.
"""
> "$G_FP_DIETPI_USERDATA"/amiberry/savestates/dir.txt
Saved states will be stored here.
_EOF_
# - Screenshots
rm -R /etc/amiberry/screenshots &> /dev/null
mkdir -p "$G_FP_DIETPI_USERDATA"/amiberry/screenshots
ln -sf "$G_FP_DIETPI_USERDATA"/amiberry/screenshots /etc/amiberry/screenshots
cat <<< """ > "$G_FP_DIETPI_USERDATA"/amiberry/screenshots/dir.txt
Screenshots will be stored here.
"""
> "$G_FP_DIETPI_USERDATA"/amiberry/screenshots/dir.txt
Screenshots will be stored here.
_EOF_
#Uae4arm does not support browsing symlinks (https://github.com/Fourdee/DietPi/issues/474#issuecomment-242973839)
# So we need to change config file default paths to actual userdata location:
local fp_userdata_actual=$(readlink "$G_FP_DIETPI_USERDATA") # Only returns a value if symlink exists (eg: off SDcard)
if test -n $fp_userdata_actual {
sed -i "s:$G_FP_DIETPI_USERDATA:$fp_userdata_actual:g" "$G_FP_DIETPI_USERDATA"/amiberry/conf/adfdir.conf
sed -i "s:$G_FP_DIETPI_USERDATA:$fp_userdata_actual:g" "$G_FP_DIETPI_USERDATA"/amiberry/conf/autostart.uae
}
#Symlink HW specific binary for this system to /etc/amiberry/amiberry
local amiberry_filename='amiberry-rpi'
# - RPi 3
if (( $G_HW_MODEL == 3 )) {
setvar amiberry_filename = ''3''
# - RPi 2
} elif (( $G_HW_MODEL == 2 )) {
setvar amiberry_filename = ''2''
# - Assume RPi 1 (ARMv6)
} else {
setvar amiberry_filename = ''1''
}
ln -sf /etc/amiberry/"$amiberry_filename" /etc/amiberry/amiberry
# + SDL2
setvar amiberry_filename = ''-sdl2''
ln -sf /etc/amiberry/"$amiberry_filename" /etc/amiberry/amiberry-sdl2
#service SDL1
cat <<< """ > /etc/systemd/system/amiberry.service
[Unit]
Description=AmiBerry Amiga Emulator
DefaultDependencies=no
[Service]
Type=simple
User=root
WorkingDirectory=/etc/amiberry
ExecStart=/bin/bash -c ./amiberry_run.sh
[Install]
WantedBy=local-fs.target
"""
> /etc/systemd/system/amiberry.service
[Unit]
Description=AmiBerry Amiga Emulator
DefaultDependencies=no
[Service]
Type=simple
User=root
WorkingDirectory=/etc/amiberry
ExecStart=/bin/bash -c ./amiberry_run.sh
[Install]
WantedBy=local-fs.target
_EOF_
systemctl daemon-reload
cat <<< """ > /etc/amiberry/amiberry_run.sh
#!/bin/bash
if (( '$'(ps aux | grep -ci -m1 '[X]11') )); then
./amiberry -f conf/autostart.uae
else
xinit ./amiberry -f conf/autostart.uae
fi
"""
> /etc/amiberry/amiberry_run.sh
#!/bin/bash
if (( \$(ps aux | grep -ci -m1 '[X]11') )); then
./amiberry -f conf/autostart.uae
else
xinit ./amiberry -f conf/autostart.uae
fi
_EOF_
chmod +x /etc/amiberry/amiberry_run.sh
#service SDL2
cat <<< """ > /etc/systemd/system/amiberry-sdl2.service
[Unit]
Description=AmiBerry Amiga Emulator
[Service]
Type=simple
User=root
WorkingDirectory=/etc/amiberry
ExecStart=/bin/bash -c ./amiberry_run_sdl2.sh
[Install]
WantedBy=local-fs.target
"""
> /etc/systemd/system/amiberry-sdl2.service
[Unit]
Description=AmiBerry Amiga Emulator
[Service]
Type=simple
User=root
WorkingDirectory=/etc/amiberry
ExecStart=/bin/bash -c ./amiberry_run_sdl2.sh
[Install]
WantedBy=local-fs.target
_EOF_
systemctl daemon-reload
#DEBUG
#systemctl restart amiberry-sdl2
cat <<< """ > /etc/amiberry/amiberry_run_sdl2.sh
#!/bin/bash
xinit ./amiberry-sdl2 -f conf/autostart.uae
"""
> /etc/amiberry/amiberry_run_sdl2.sh
#!/bin/bash
xinit ./amiberry-sdl2 -f conf/autostart.uae
_EOF_
chmod +x /etc/amiberry/amiberry_run_sdl2.sh
}
#dxx-rebirth
setvar INSTALLING_INDEX = '112'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Symlink savegames to root
# - Remove existing syslinks
rm -R "$HOME"/.d1x-rebirth &> /dev/null
rm -R "$HOME"/.d2x-rebirth &> /dev/null
ln -sf "$G_FP_DIETPI_USERDATA"/dxx-rebirth/descent_1_profiles "$HOME"/.d1x-rebirth
ln -sf "$G_FP_DIETPI_USERDATA"/dxx-rebirth/descent_2_profiles "$HOME"/.d2x-rebirth
#+exe
chmod +x -R "$G_FP_DIETPI_USERDATA"/dxx-rebirth/*
#Create .Desktop SymLinks
mkdir -p "$HOME"/Desktop
mkdir -p /usr/share/applications
ln -s "$G_FP_DIETPI_USERDATA"/dxx-rebirth/dxx-rebirth.desktop "$HOME"/Desktop/dxx-rebirth.desktop
ln -s "$G_FP_DIETPI_USERDATA"/dxx-rebirth/dxx-rebirth.desktop /usr/share/applications/dxx-rebirth.desktop
}
#OpenTyrian
setvar INSTALLING_INDEX = '51'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#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
#Create .Desktop SymLinks
mkdir -p "$HOME"/Desktop
rm /usr/share/applications/opentyrian.desktop &> /dev/null
wget http://dietpi.com/downloads/conf/desktop/pcmanfm.conf -O /usr/share/applications/opentyrian.desktop
ln -s /usr/share/applications/opentyrian.desktop "$HOME"/Desktop/opentyrian.desktop
}
#DIETPICAM
setvar INSTALLING_INDEX = '59'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - raspimjpeg conf
chmod +x /etc/raspimjpeg
ln -s /etc/raspimjpeg /var/www/dietpicam/raspimjpeg
# - Motion conf
chgrp www-data /etc/motion/motion.conf
chmod 777 /etc/motion/motion.conf
usermod -a -G video www-data
# - raspimjpeg/php schedule startup and control script
cp /DietPi/dietpi/conf/raspimjpeg.service /var/lib/dietpi/dietpi-software/services/raspimjpeg.service
# - Setup Data directory
local dietpicam_media_directory=$G_FP_DIETPI_USERDATA
mkdir -p "$dietpicam_media_directory"/dietpicam
rm -R /var/www/dietpicam/media
ln -s "$dietpicam_media_directory"/dietpicam /var/www/dietpicam/media
# - Enable RPi camera
/DietPi/dietpi/func/dietpi-set_hardware rpi-camera enable
}
#Deluge
setvar INSTALLING_INDEX = '45'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#copy init
cp /DietPi/dietpi/conf/deluge.service /var/lib/dietpi/dietpi-software/services/deluge.service
#Generate deluge default config
deluged
killall -w deluged
#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
#Set remote access login details
cat <<< """ > "$HOME"/.config/deluge/auth
root:$GLOBAL_PW:10
"""
> "$HOME"/.config/deluge/auth
root:$GLOBAL_PW:10
_EOF_
#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
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
}
#RaspControl
setvar INSTALLING_INDEX = '106'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Setup login file
mkdir -p /etc/raspcontrol
cat <<< """ > /etc/raspcontrol/database.aptmnt
{
"user": "root",
"password": "$GLOBAL_PW"
}
"""
> /etc/raspcontrol/database.aptmnt
{
"user": "root",
"password": "$GLOBAL_PW"
}
_EOF_
chown -R www-data:www-data /etc/raspcontrol
chmod -R 750 /etc/raspcontrol
}
#PIHOLE
setvar INSTALLING_INDEX = '93'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Create a symlink so users can use http://ip/pihole
ln -sf /var/www/html/admin /var/www/pihole
# - Create a symlink so users can use http://ip/admin
ln -sf /var/www/html/admin /var/www/admin
# - Generate index page that replaces adverts and prevents popups
cat <<< """ > /var/www/index.html
Blocked by Pi-hole.
"""
> /var/www/index.html
Blocked by Pi-hole.
_EOF_
# - Generate pihole.log , set permissions to www-data
echo -e "" > /var/log/pihole.log
chown www-data:www-data /var/log/pihole.log
chmod 775 /var/log/pihole.log
# - Generate web interface PW: https://github.com/Fourdee/DietPi/issues/662
pihole -a -p $GLOBAL_PW
# - PiHole now generates a password, inform user of the correct one:
whiptail --title "PiHole: Web interface" --msgbox "DietPi has changed the PiHole web interface password to:\n- $GLOBAL_PW\n\nPlease use this password when logging into the web interface:\n - http://ip/pihole\n\nThis password can be changed, please see pihole binary for info:\n - pihole --help" --backtitle $WHIP_BACKTITLE 16 70
}
#SUBSONIC 5/6
setvar INSTALLING_INDEX = '34'
if (( ${aSOFTWARE_INSTALL_STATE[33]} == 1 ||
${aSOFTWARE_INSTALL_STATE[34]} == 1 )) {
Banner_Configuration
#Optimize memory limit
local subsonic_memory_max=$(( $RAM_TOTAL / 5 ))
#Minimum cap 150mb
if (( $subsonic_memory_max < 150 )) {
setvar subsonic_memory_max = '150'
}
cat <<< """ > /etc/default/subsonic
SUBSONIC_USER=root
SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-podcast-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-playlist-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"
"""
> /etc/default/subsonic
SUBSONIC_USER=root
SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-podcast-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC --default-playlist-folder=$G_FP_DIETPI_USERDATA/$FOLDER_MUSIC"
_EOF_
#Grab our test media for user
Download_Test_Media
#Symlink ffmpeg to subsonic transcoder
#rpi armv6 jessie (using compiled ffmpeg)
if (( $G_HW_MODEL < 2 )) {
ln -fs /usr/local/bin/ffmpeg /var/subsonic/transcode
#ARMv7
} else {
ln -fs /usr/bin/ffmpeg /var/subsonic/transcode
}
}
#WEBIOPI
setvar INSTALLING_INDEX = '71'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#auto start
update-rc.d webiopi defaults
setvar WEBIOPI = '2'
}
#DIETPICLOUDSHELL
setvar INSTALLING_INDEX = '62'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Enable DietPi-Cloudshell autostart
/DietPi/dietpi/dietpi-autostart 5
#Service
cat <<< """ > /etc/systemd/system/dietpi-cloudshell.service
[Unit]
Description=dietpi-cloudshell on main screen
[Service]
Type=simple
StandardOutput=tty
TTYPath=/dev/tty1
ExecStartPre=/usr/bin/setterm --term linux --blank 0 --powersave off --cursor off
ExecStart=/bin/bash -c '/DietPi/dietpi/dietpi-cloudshell 1'
ExecStop=/usr/bin/setterm --reset
ExecStop=/bin/bash -c 'G_DIETPI-NOTIFY 0 DietPi-Cloudshell terminated, have a nice day!'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/dietpi-cloudshell.service
[Unit]
Description=dietpi-cloudshell on main screen
[Service]
Type=simple
StandardOutput=tty
TTYPath=/dev/tty1
ExecStartPre=/usr/bin/setterm --term linux --blank 0 --powersave off --cursor off
ExecStart=/bin/bash -c '/DietPi/dietpi/dietpi-cloudshell 1'
ExecStop=/usr/bin/setterm --reset
ExecStop=/bin/bash -c 'G_DIETPI-NOTIFY 0 DietPi-Cloudshell terminated, have a nice day!'
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
}
#HAPROXY
setvar INSTALLING_INDEX = '98'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Create jail directory
mkdir -p /var/lib/haproxy
cat <<< """ > /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
bind *:1338
stats enable
stats uri /
stats hide-version
stats auth admin:dietpi
"""
> /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
bind *: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
setvar errorcode = '400'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '403'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '408'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '500'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '502'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '503'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
setvar errorcode = '504'; echo -e "[html]$errorcode[/html]" > /etc/haproxy/errors/"$errorcode".http
}
#SQUEEZEBOXSERVER
setvar INSTALLING_INDEX = '35'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Remove service
update-rc.d logitechmediaserver remove
rm /etc/init.d/logitechmediaserver
#DietPi-Services init
cp /DietPi/dietpi/conf/squeezeboxserver.service /var/lib/dietpi/dietpi-software/services/squeezeboxserver.service
#Grab our test media for user
Download_Test_Media
}
#WORDPRESS
setvar INSTALLING_INDEX = '55'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Create mysql DB
/DietPi/dietpi/func/create_mysql_db wordpress wordpress $GLOBAL_PW
}
#TIGHTVNCSERVER / VNC4SERVER / RealVNC - Shared setup
#INSTALLING_INDEX=27/28/120
if (( ${aSOFTWARE_INSTALL_STATE[27]} == 1 ||
${aSOFTWARE_INSTALL_STATE[28]} == 1 ||
${aSOFTWARE_INSTALL_STATE[120]} == 1 )) {
#Banner_Configuration
#User, enter PW
if (( $G_USER_INPUTS )) {
local entering_pw=1
local loop_count=0
# - RealVNC uses Unix account
if (( ${aSOFTWARE_INSTALL_STATE[120]} == 1 )) {
setvar entering_pw = '0'
} else {
setvar 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
} {
vncpasswd
((loop_count++))
# - Password file created
if test -f "$HOME"/.vnc/passwd {
setvar entering_pw = '0'
# - Endless loop
} elif (( $loop_count >= 30 )) {
setvar entering_pw = '0'
}
}
}
cat <<< """ > /etc/systemd/system/vncserver.service
[Unit]
Description=Manage VNC Server
After=dietpi-service.service
After=rc.local.service
[Service]
Type=idle
RemainAfterExit=yes
ExecStart=/bin/bash /usr/local/bin/vncserver start
ExecStop=/bin/bash /usr/local/bin/vncserver stop
User=root
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/vncserver.service
[Unit]
Description=Manage VNC Server
After=dietpi-service.service
After=rc.local.service
[Service]
Type=idle
RemainAfterExit=yes
ExecStart=/bin/bash /usr/local/bin/vncserver start
ExecStop=/bin/bash /usr/local/bin/vncserver stop
User=root
[Install]
WantedBy=multi-user.target
_EOF_
systemctl enable vncserver.service
systemctl daemon-reload
cat <<< """ > /usr/local/bin/vncserver
#!/bin/bash
#Globals
VNC_INSTALLED=0
BINARY_FP=0
SHARED_MODE=0
WIDTH='$'(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_WIDTH=' | sed 's/.*=//')
HEIGHT='$'(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_HEIGHT=' | sed 's/.*=//')
DEPTH='$'(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_DEPTH=' | sed 's/.*=//')
DISPLAY='$'(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_DISPLAY_INDEX=' | sed 's/.*=//')
SHARED_MODE='$'(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_SHARE_DESKTOP=' | sed 's/.*=//')
#RealVNC | Slightly different launch method to VNC4server
REALVNC=0
if (( '$'(dpkg --get-selections | grep -ci -m1 '^realvnc-vnc-server') )); then
REALVNC=1
#Set shared desktop mode if autostart is enabled for desktops. This prevents another VNC server being launched on :1.
if (( '$'(cat /DietPi/dietpi/.dietpi-autostart_index) == 2 )); then
SHARED_MODE=1
fi
fi
#Find binary FP to use
if [ -f /usr/bin/tigervncserver ]; then
BINARY_FP='/usr/bin/tigervncserver'
VNC_INSTALLED=1
elif [ -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)
if (( '$'SHARED_MODE )); then
# - excluding RealVNC as it has its own services
if (( ! '$'REALVNC )); then
#wait for X to start
while (( ! '$'(ps aux | grep -ci -m1 '[/]usr/bin/X') ))
do
sleep 3
done
xset dpms force on #disable screen blanking
x11vnc -display :0 -usepw -forever &
fi
else
'$'BINARY_FP :'$'DISPLAY -geometry '$'WIDTH'x''$'HEIGHT -depth '$'DEPTH
fi
;;
stop)
'$'BINARY_FP -kill :'$'DISPLAY &> /dev/null
killall -w x11vnc &> /dev/null
killall -w Xtigervnc &> /dev/null
;;
esac
exit 0
"""
> /usr/local/bin/vncserver
#!/bin/bash
#Globals
VNC_INSTALLED=0
BINARY_FP=0
SHARED_MODE=0
WIDTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_WIDTH=' | sed 's/.*=//')
HEIGHT=\$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_HEIGHT=' | sed 's/.*=//')
DEPTH=\$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_DEPTH=' | sed 's/.*=//')
DISPLAY=\$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_DISPLAY_INDEX=' | sed 's/.*=//')
SHARED_MODE=\$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_VNCSERVER_SHARE_DESKTOP=' | sed 's/.*=//')
#RealVNC | Slightly different launch method to VNC4server
REALVNC=0
if (( \$(dpkg --get-selections | grep -ci -m1 '^realvnc-vnc-server') )); then
REALVNC=1
#Set shared desktop mode if autostart is enabled for desktops. This prevents another VNC server being launched on :1.
if (( \$(cat /DietPi/dietpi/.dietpi-autostart_index) == 2 )); then
SHARED_MODE=1
fi
fi
#Find binary FP to use
if [ -f /usr/bin/tigervncserver ]; then
BINARY_FP='/usr/bin/tigervncserver'
VNC_INSTALLED=1
elif [ -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)
if (( \$SHARED_MODE )); then
# - excluding RealVNC as it has its own services
if (( ! \$REALVNC )); then
#wait for X to start
while (( ! \$(ps aux | grep -ci -m1 '[/]usr/bin/X') ))
do
sleep 3
done
xset dpms force on #disable screen blanking
x11vnc -display :0 -usepw -forever &
fi
else
\$BINARY_FP :\$DISPLAY -geometry \$WIDTH'x'\$HEIGHT -depth \$DEPTH
fi
;;
stop)
\$BINARY_FP -kill :\$DISPLAY &> /dev/null
killall -w x11vnc &> /dev/null
killall -w Xtigervnc &> /dev/null
;;
esac
exit 0
_EOF_
chmod +x /usr/local/bin/vncserver
# + RealVNC | enable services
if (( ${aSOFTWARE_INSTALL_STATE[120]} == 1 )) {
systemctl enable vncserver-x11-serviced.service
systemctl enable vncserver-virtuald.service
}
# - Stretch + TigerVNC: Disable Localhost only by default
if (( $G_DISTRO >= 4 )) {
echo -e '$localhost = "no";' >> /etc/vnc.conf
}
}
#VNC4SERVER / RealVNC
setvar INSTALLING_INDEX = '28'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} >= 1 ||
${aSOFTWARE_INSTALL_STATE[120]} >= 1 )) {
Banner_Configuration
local cmd_launch_desktop=''
#DESKTOP_LXDE
if (( ${aSOFTWARE_INSTALL_STATE[23]} >= 1 )) {
setvar cmd_launch_desktop = ''/usr/bin/lxsession -s LXDE &''
#DESKTOP_MATE
} elif (( ${aSOFTWARE_INSTALL_STATE[24]} >= 1 )) {
setvar cmd_launch_desktop = ''x-window-manager &''
#DESKTOP_GNUSTEP
} elif (( ${aSOFTWARE_INSTALL_STATE[26]} >= 1 )) {
setvar cmd_launch_desktop = ''x-window-manager &''
#DESKTOP_XFCE
} elif (( ${aSOFTWARE_INSTALL_STATE[25]} >= 1 )) {
setvar cmd_launch_desktop = ''/usr/bin/xfce4-session &''
}
mkdir -p "$HOME"/.vnc
cat <<< """ > "$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
"""
> "$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
}
#FAIL2BAN
setvar INSTALLING_INDEX = '73'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Generate log
echo 0 > /var/log/auth.log
cat <<< """ > /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
"""
> /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_
cat <<< """ > /etc/fail2ban/jail.conf
[DEFAULT]
enabled = true
ignoreip = 127.0.0.1/8
ignorecommand =
backend = auto
bantime = 600
findtime = 600
maxretry = 3
banaction = route
action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s"]
action = %(action_)s
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 6
[dropbear]
enabled = true
port = ssh
filter = dropbear
logpath = /var/log/auth.log
maxretry = 6
"""
> /etc/fail2ban/jail.conf
[DEFAULT]
enabled = true
ignoreip = 127.0.0.1/8
ignorecommand =
backend = auto
bantime = 600
findtime = 600
maxretry = 3
banaction = route
action_ = %(banaction)s[name=%(__name__)s, bantime="%(bantime)s", port="%(port)s"]
action = %(action_)s
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 6
[dropbear]
enabled = true
port = ssh
filter = dropbear
logpath = /var/log/auth.log
maxretry = 6
_EOF_
}
#PHPSYSINFO
setvar INSTALLING_INDEX = '64'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#conf
cp /DietPi/dietpi/conf/phpsysinfo.ini /var/www/phpsysinfo/phpsysinfo.ini
}
#PHPIMAGEGALLERY
setvar INSTALLING_INDEX = '56'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#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
#enable (Some type of security trigger)
sed -i "/define('SECURITY_PHRASE'/c\define('SECURITY_PHRASE', 'true');" /var/www/gallery/index.php
}
#AMPACHE
setvar INSTALLING_INDEX = '40'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Download_Test_Media
#create/insert our pre-made ampache sql db
G_RUN_CMD wget http://dietpi.com/downloads/mysql_databases/ampache_mysql_3.8.2-v6.0.zip -O sql.zip
unzip -o sql.zip
rm sql.zip
/DietPi/dietpi/func/create_mysql_db ampache ampache $GLOBAL_PW
mysql ampache < ampache.sql
rm ampache.sql
#Grab config
G_RUN_CMD wget http://dietpi.com/downloads/conf/ampache.cfg.php_3.8.2-v6.0 -O /var/www/ampache/config/ampache.cfg.php
}
#OPENVPNSERVER
setvar INSTALLING_INDEX = '97'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
local key_size=1024
#Start Cert/Key generation.
cp -R /usr/share/easy-rsa/ /etc/openvpn
mkdir -p /etc/openvpn/easy-rsa/keys
cat <<< """ >> /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"
"""
>> /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_
#Create Server Cert Auth
G_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
source ./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 <<< """ > /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"
"""
> /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 <<< """ > /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
"""
> /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 userdata location
cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn "$G_FP_DIETPI_USERDATA"/
# - 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
}
#WIFIHOTSPOT
setvar INSTALLING_INDEX = '60'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
local eth_index=$(sed -n 1p /DietPi/dietpi/.network)
local wifi_index=$(sed -n 2p /DietPi/dietpi/.network)
# - DHCPD Config
cat <<< """ > /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;
}
"""
> /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 <<< """ > /etc/default/isc-dhcp-server
INTERFACES="wlan$wifi_index"
"""
> /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 <<< """ >> /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-power off
#dns-nameservers 8.8.8.8 8.8.4.4
# IP tables
up iptables-restore < /etc/iptables.ipv4.nat
"""
>> /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-power off
#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 <<< """ > /etc/hostapd/hostapd.conf
interface=wlan$wifi_index
driver=nl80211
ssid=$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_WIFI_HOTSPOT_SSID=' | sed 's/.*=//')
hw_mode=g
channel=$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_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 '^SOFTWARE_WIFI_HOTSPOT_KEY=' | sed 's/.*=//')
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
"""
> /etc/hostapd/hostapd.conf
interface=wlan$wifi_index
driver=nl80211
ssid=$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_WIFI_HOTSPOT_SSID=' | sed 's/.*=//')
hw_mode=g
channel=$(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_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 '^SOFTWARE_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 )) {
sed -i "/^driver=/c\driver=rtl871xdrv" /etc/hostapd/hostapd.conf
}
# - Enable access point config
cat <<< """ > /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
"""
> /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 (( $G_HW_MODEL == 3 && ! $WIFIHOTSPOT_RTL8188C_DEVICE )) {
# - Add Wireless N support
echo -e "ieee80211n=1" >> /etc/hostapd/hostapd.conf
}
}
#TORHOTSPOT
setvar INSTALLING_INDEX = '61'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Tor config
cat <<< """ > /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
"""
> /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
}
#SHAIRPORTSYNC
setvar INSTALLING_INDEX = '37'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Enable SOXR by default:
cat <<< """ > /usr/local/etc/shairport-sync.conf
general =
{
name = "%H";
interpolation = "soxr";
};
metadata =
{
enabled = "yes";
include_cover_art = "no";
pipe_name = "/tmp/shairport-sync-metadata";
pipe_timeout = 5000;
socket_address = "226.0.0.1";
socket_port = 5555;
socket_msglength = 65000;
};
alsa =
{
// mixer_control_name = "PCM";
// output_rate = 44100; // can be 44100, 88200, 176400 or 352800
// output_format = "S16"; // can be "U8", "S8", "S16", "S24", "S24_3LE", "S24_3BE" or "S32"
};
"""
> /usr/local/etc/shairport-sync.conf
general =
{
name = "%H";
interpolation = "soxr";
};
metadata =
{
enabled = "yes";
include_cover_art = "no";
pipe_name = "/tmp/shairport-sync-metadata";
pipe_timeout = 5000;
socket_address = "226.0.0.1";
socket_port = 5555;
socket_msglength = 65000;
};
alsa =
{
// mixer_control_name = "PCM";
// output_rate = 44100; // can be 44100, 88200, 176400 or 352800
// output_format = "S16"; // can be "U8", "S8", "S16", "S24", "S24_3LE", "S24_3BE" or "S32"
};
_EOF_
#Create shairport user
groupadd -r shairport-sync &> /dev/null
useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync &> /dev/null
chmod +x /usr/local/bin/shairport-sync
}
#BRUTEFIR
setvar INSTALLING_INDEX = '38'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Copy configs and services
cp /DietPi/dietpi/conf/brutefir_config /etc/BruteFIR/
cp /DietPi/dietpi/conf/brutefir.service /var/lib/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 <<< """ > /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"
}
"""
> /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_
}
#PYDIO
setvar INSTALLING_INDEX = '48'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Configure apache2
# - Disable php output_buffering =
sed -i '/output_buffering = /c\output_buffering = Off/' "$FP_PHP_BASE_DIR"/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
#Create Mysql DB
/DietPi/dietpi/func/create_mysql_db pydio pydio $GLOBAL_PW
#Setup Data directory
local target_data_dir="$G_FP_DIETPI_USERDATA/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
}
#SQUEEZELITE
setvar INSTALLING_INDEX = '36'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Replace Sysinit service with SystemD
echo -e "#This file is no longer used as service has been upgraded to SystemD.\n#Please see /etc/systemd/system/squeezelite.service to set start options" > /etc/default/squeezelite
rm /etc/init.d/squeezelite
cp /DietPi/dietpi/conf/squeezelite.service /etc/systemd/system/squeezelite.service
Download_Test_Media
}
#EMONHUB
setvar INSTALLING_INDEX = '99'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - 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 (( $G_HW_MODEL == 3 )) {
# - Add DToverlay to disable bluetooth
if (( $(cat /DietPi/config.txt | grep -ci -m1 '=pi3-disable-bt') == 0 )) {
echo -e "\ndtoverlay=pi3-disable-bt" >> /DietPi/config.txt
# - Enable
} else {
sed -i '/pi3-disable-bt/c\dtoverlay=pi3-disable-bt' /DietPi/config.txt
}
# - Disable bluetooth service
systemctl stop hciuart
systemctl disable hciuart
}
#RPi - Disable serial tty that emonPi uses.
/DietPi/dietpi/func/dietpi-set_hardware serialconsole disable
# - Apply user API KEY
setvar USER_EMONHUB_APIKEY_CURRENT = $(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_EMONHUB_APIKEY=' | sed 's/.*=//')
sed -i "/apikey/c\ apikey = $USER_EMONHUB_APIKEY_CURRENT" /etc/emonhub/conf/emonhub.conf
}
#RPIMONITOR
setvar INSTALLING_INDEX = '66'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Update apt package stats
/usr/share/rpimonitor/scripts/updatePackagesStatus.pl
# - USBdrive stats implimentation by Rich
if (( $USBDRIVE )) {
sed -i '\/include=\/etc\/rpimonitor\/template\/sdcard.conf/a include=\/etc\/rpimonitor\/template\/usb_hdd.conf' /etc/rpimonitor/data.conf
cat <<< """ > /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"
"""
> /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_
}
}
#NETDATA
setvar INSTALLING_INDEX = '65'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - service
cp /DietPi/dietpi/conf/netdata.service /etc/systemd/system/netdata.service
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 /var/lib/netdata {
chown -R netdata.netdata $x
chmod 0775 -R $x
}
}
#BAIKAL
setvar INSTALLING_INDEX = '57'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Install_Apply_Permissions &> /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');"
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 baikal $GLOBAL_PW
}
#MUMBLESERVER
setvar INSTALLING_INDEX = '43'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Cap total connections
local max_users=$(( $G_HW_CPU_CORES * 8 ))
sed -i "/users=/c\users=$max_users" /etc/mumble-server.ini
#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
#Set Superuser passwd: http://dietpi.com/phpbb/viewtopic.php?f=11&t=2024#p8084
murmurd -ini /etc/mumble-server.ini -supw $GLOBAL_PW
}
#EMBYSERVER
setvar INSTALLING_INDEX = '41'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Download_Test_Media
}
#PLEXMEDIASERVER
setvar INSTALLING_INDEX = '42'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
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 (( $G_USER_INPUTS &&
$G_HW_ARCH < 10 && ! $(locale | grep -ci -m1 'en_US.UTF-8') )) {
sed -i '/en_US.UTF-8 UTF-8/c\en_US.UTF-8 UTF-8' /etc/locale.gen
locale-gen
setvar 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
}
}
#CUBERITE
setvar INSTALLING_INDEX = '52'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /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
"""
> /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 <<< """ > /etc/cubrite/webadmin.ini
[User:root]
Password=$GLOBAL_PW
[WebAdmin]
Ports=1339
Enabled=1
"""
> /etc/cubrite/webadmin.ini
[User:root]
Password=$GLOBAL_PW
[WebAdmin]
Ports=1339
Enabled=1
_EOF_
}
#MINEOS
setvar INSTALLING_INDEX = '53'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#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 "$G_FP_DIETPI_USERDATA"/mineos/minecraft/mineos_console.js /usr/local/bin/mineos
cp "$G_FP_DIETPI_USERDATA"/mineos/minecraft/mineos.conf /etc/mineos.conf
# - setup SSL cert
cd "$G_FP_DIETPI_USERDATA"/mineos/minecraft
./generate-sslcert.sh
# - Supervisor service
cp "$G_FP_DIETPI_USERDATA"/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 "$G_FP_DIETPI_USERDATA"/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/* "$G_FP_DIETPI_USERDATA"/mineos/serverdata/ #Folder does not exist during installation, as of 18/09/16
rm -R /var/games/minecraft
ln -sf "$G_FP_DIETPI_USERDATA"/mineos/serverdata /var/games/minecraft
chown -R mineos:mineos /var/games/minecraft
# - 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 G_FP_DIETPI_USERDATA
sed -i "/^directory=/c\directory=$G_FP_DIETPI_USERDATA/mineos/minecraft" /etc/supervisor/conf.d/mineos.conf
supervisorctl reload
}
#GOGS
setvar INSTALLING_INDEX = '49'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Data storage / user data
mkdir -p "$G_FP_DIETPI_USERDATA"/gogs-repo
# - sqldb
/DietPi/dietpi/func/create_mysql_db gogs gogs $GLOBAL_PW
# - service (couldnt get this to run as a new thread with systemD (&). so bash script ftw.
cat <<< """ > /etc/gogs/start.sh
#!/bin/bash
#Simple script to start gogs for DietPi systems
/etc/gogs/gogs web &> /var/log/gogs_daemon.log &
exit
"""
> /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 <<< """ > /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
"""
> /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_
}
#QBITTORRENT
setvar INSTALLING_INDEX = '46'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - conf.
mkdir -p "$HOME"/.config/qBittorrent
cat <<< """ > "$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=$G_FP_DIETPI_USERDATA/downloads
Downloads\TempPathEnabled=false
Downloads\TempPath=$G_FP_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($(echo -ne "$GLOBAL_PW" | md5sum | awk '{print $1}'))
[LegalNotice]
Accepted=true
[AutoRun]
enabled=false
program=
"""
> "$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=$G_FP_DIETPI_USERDATA/downloads
Downloads\TempPathEnabled=false
Downloads\TempPath=$G_FP_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($(echo -ne "$GLOBAL_PW" | md5sum | awk '{print $1}'))
[LegalNotice]
Accepted=true
[AutoRun]
enabled=false
program=
_EOF_
# - service
cat <<< """ > /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
"""
> /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
}
#RTORRENT
setvar INSTALLING_INDEX = '107'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Create username/password for rutorrent based on webserver type.
# - Apache2
if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )) {
# - Allow overrides redirects and .htaccess
sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/sites-enabled/000-default*
sed -i "/AllowOverride /c\ AllowOverride All" /etc/apache2/apache2.conf
a2enmod rewrite
#install scgi module
G_AGI libapache2-mod-scgi
htpasswd -cb /etc/.rutorrent-htaccess root $GLOBAL_PW
cat <<< """ > /var/www/rutorrent/.htaccess
AuthUserFile /etc/.rutorrent-htaccess
AuthName "ruTorrent_login"
AuthType Basic
require user root
"""
> /var/www/rutorrent/.htaccess
AuthUserFile /etc/.rutorrent-htaccess
AuthName "ruTorrent_login"
AuthType Basic
require user root
_EOF_
cat <<< """ > /etc/apache2/sites-available/rutorrent.conf
SCGIMount /RPC2 127.0.0.1:5000
AuthName "rTorrent secure access"
AuthType Basic
AuthBasicProvider file
AuthUserFile /etc/.rutorrent-htaccess
Require user root
"""
> /etc/apache2/sites-available/rutorrent.conf
SCGIMount /RPC2 127.0.0.1:5000
AuthName "rTorrent secure access"
AuthType Basic
AuthBasicProvider file
AuthUserFile /etc/.rutorrent-htaccess
Require user root
_EOF_
ln -s /etc/apache2/sites-available/rutorrent.conf /etc/apache2/sites-enabled/rutorrent.conf
# - Lighttpd
} elif (( ${aSOFTWARE_INSTALL_STATE[84]} >= 1 )) {
echo -e "root:rtorrent:$(echo -n "root:rtorrent:dietpi" | md5sum | cut -b -32)" > /etc/.rutorrent-htaccess
# - add to /etc/lighttpd/lighttpd.conf
if (( ! $(cat /etc/lighttpd/lighttpd.conf | grep -ci -m1 '^#RUTORRENT_DIETPI') )) {
cat <<< """ >> /etc/lighttpd/lighttpd.conf
#RUTORRENT_DIETPI
server.modules += ( "mod_fastcgi" )
server.modules += ( "mod_scgi" )
server.modules += ( "mod_auth" )
auth.debug = 0
auth.backend = "htdigest"
auth.backend.htdigest.userfile = "/etc/.rutorrent-htaccess"
auth.require = ( "/rutorrent/" => (
"method" => "digest",
"realm" => "rtorrent",
"require" => "valid-user"
))
scgi.server = ( "/RPC2" =>
( "127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 5000,
"check-local" => "disable"
)
)
)
#RUTORRENT_DIETPI
"""
>> /etc/lighttpd/lighttpd.conf
#RUTORRENT_DIETPI
server.modules += ( "mod_fastcgi" )
server.modules += ( "mod_scgi" )
server.modules += ( "mod_auth" )
auth.debug = 0
auth.backend = "htdigest"
auth.backend.htdigest.userfile = "/etc/.rutorrent-htaccess"
auth.require = ( "/rutorrent/" => (
"method" => "digest",
"realm" => "rtorrent",
"require" => "valid-user"
))
scgi.server = ( "/RPC2" =>
( "127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 5000,
"check-local" => "disable"
)
)
)
#RUTORRENT_DIETPI
_EOF_
}
# - Nginx
} elif (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )) {
echo "root:$(openssl passwd -crypt dietpi)" > /etc/.rutorrent-htaccess
cat <<< """ > /etc/nginx/sites-dietpi/rutorrent.config
location /rutorrent {
auth_basic "Restricted Content";
auth_basic_user_file /etc/.rutorrent-htaccess;
}
location /RPC2 {
include scgi_params;
scgi_pass 127.0.0.1:5000;
}
"""
> /etc/nginx/sites-dietpi/rutorrent.config
location /rutorrent {
auth_basic "Restricted Content";
auth_basic_user_file /etc/.rutorrent-htaccess;
}
location /RPC2 {
include scgi_params;
scgi_pass 127.0.0.1:5000;
}
_EOF_
}
# - Define curl location in config.php (for lighttpd and nginx)
sed -i '/"curl"[[:space:]]/c\ "curl" => "/usr/bin/curl",' /var/www/rutorrent/conf/config.php
chown www-data:www-data /etc/.rutorrent-htaccess
chmod 400 /etc/.rutorrent-htaccess
# - Session folder
mkdir -p "$G_FP_DIETPI_USERDATA"/downloads/.session
# - Service using screen | '/usr/bin/rtorrent &> /var/log/rtorrent.log &' doesnt work, hangs program after 5 seconds
cat <<< """ > /etc/systemd/system/rtorrent.service
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=%h
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/rtorrent.service
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=%h
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
#Default conf
cat <<< """ > "$HOME"/.rtorrent.rc
#Attempt to reduce disk throttling/abuse | 0.9.2 command does not exist
#max_open_files = 50
#Max queue
scheduler.max_active.set = 3
#byte value
max_memory_usage = $(( $(Optimize_BitTorrent 0) * 1024 * 1024 ))
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = $(( $(Optimize_BitTorrent 2) / 2 + 1 ))
# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = -1
max_peers_seed = -1
# Maximum number of simultaneous downloads
max_downloads_global = $(Optimize_BitTorrent 2)
# Maximum number of simultaneous uploads
max_uploads_global = $(Optimize_BitTorrent 3)
# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0
# Default directory to save the downloaded torrents.
directory = $G_FP_DIETPI_USERDATA/downloads
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = $G_FP_DIETPI_USERDATA/downloads/.session
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=1000M
# Periodically save session data
schedule = session_save,240,300,session_save=
# Enable the default ratio group.
ratio.enable=yes
# Change the limits, the defaults should be sufficient.
# Upload to a minimum ratio of 1.01
ratio.min.set=101
# Upload to a maximum ratio of 1.25
ratio.max.set=125
# Upload a minimum of x MB
ratio.upload.set=1M
# When seeding ratio is reached close the torrent
system.method.set = group.seeding.ratio.command, d.close=
# Move files to ./unsorted when download completes
system.method.set_key = event.download.finished,move_complete,"execute=mv,-n,$d.get_base_path=,./unsorted/;d.set_directory=./unsorted/"
# Port range to use for listening.
port_range = 33101-33199
# Start opening ports at a random position within the port range.
port_random = yes
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = require
# Sort the main view by ratio
view.sort_current = main,greater=d.get_ratio=
view.sort_new = main,less=d.get_ratio=
view.sort = main
# Sort the seeding view by the upload rate and only show torrents with peers
view.sort_current = seeding,greater=d.get_up_rate=
view.filter = seeding,"and=d.get_complete=,d.get_peers_connected="
view.sort_new = seeding,less=d.get_up_rate=
view.sort = seeding
# Sort the leeching view by name
view.sort_current = leeching,greater=d.get_name=
view.sort_new = leeching,greater=d.get_name=
view.sort = leeching
# Filter the active view by connected peers
view.sort_current = active,less=d.get_name=
view.sort_new = leeching,less=d.get_name=
view.filter = active,d.get_peers_connected=
view.sort = active
schedule = sort_main,11,5,view.sort=main
schedule = sort_seeding,12,5,view.sort=seeding
schedule = sort_leeching,13,5,view.sort=leeching
schedule = sort_active,14,5,view.sort=active
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
dht = auto
# UDP port to use for DHT.
#
#dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
peer_exchange = yes
#Enable remote access (eg: webui)
scgi_port = localhost:5000
"""
> "$HOME"/.rtorrent.rc
#Attempt to reduce disk throttling/abuse | 0.9.2 command does not exist
#max_open_files = 50
#Max queue
scheduler.max_active.set = 3
#byte value
max_memory_usage = $(( $(Optimize_BitTorrent 0) * 1024 * 1024 ))
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = $(( $(Optimize_BitTorrent 2) / 2 + 1 ))
# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = -1
max_peers_seed = -1
# Maximum number of simultaneous downloads
max_downloads_global = $(Optimize_BitTorrent 2)
# Maximum number of simultaneous uploads
max_uploads_global = $(Optimize_BitTorrent 3)
# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0
# Default directory to save the downloaded torrents.
directory = $G_FP_DIETPI_USERDATA/downloads
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = $G_FP_DIETPI_USERDATA/downloads/.session
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=1000M
# Periodically save session data
schedule = session_save,240,300,session_save=
# Enable the default ratio group.
ratio.enable=yes
# Change the limits, the defaults should be sufficient.
# Upload to a minimum ratio of 1.01
ratio.min.set=101
# Upload to a maximum ratio of 1.25
ratio.max.set=125
# Upload a minimum of x MB
ratio.upload.set=1M
# When seeding ratio is reached close the torrent
system.method.set = group.seeding.ratio.command, d.close=
# Move files to ./unsorted when download completes
system.method.set_key = event.download.finished,move_complete,"execute=mv,-n,$d.get_base_path=,./unsorted/;d.set_directory=./unsorted/"
# Port range to use for listening.
port_range = 33101-33199
# Start opening ports at a random position within the port range.
port_random = yes
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = require
# Sort the main view by ratio
view.sort_current = main,greater=d.get_ratio=
view.sort_new = main,less=d.get_ratio=
view.sort = main
# Sort the seeding view by the upload rate and only show torrents with peers
view.sort_current = seeding,greater=d.get_up_rate=
view.filter = seeding,"and=d.get_complete=,d.get_peers_connected="
view.sort_new = seeding,less=d.get_up_rate=
view.sort = seeding
# Sort the leeching view by name
view.sort_current = leeching,greater=d.get_name=
view.sort_new = leeching,greater=d.get_name=
view.sort = leeching
# Filter the active view by connected peers
view.sort_current = active,less=d.get_name=
view.sort_new = leeching,less=d.get_name=
view.filter = active,d.get_peers_connected=
view.sort = active
schedule = sort_main,11,5,view.sort=main
schedule = sort_seeding,12,5,view.sort=seeding
schedule = sort_leeching,13,5,view.sort=leeching
schedule = sort_active,14,5,view.sort=active
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
dht = auto
# UDP port to use for DHT.
#
#dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
peer_exchange = yes
#Enable remote access (eg: webui)
scgi_port = localhost:5000
_EOF_
}
#Aria2
setvar INSTALLING_INDEX = '132'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/aria2.service
[Unit]
Description=DietPi Aria2
[Service]
Type=simple
ExecStart=$(which aria2c) --enable-rpc --rpc-listen-all --rpc-secret=$GLOBAL_PW --dir=$G_FP_DIETPI_USERDATA/$FOLDER_DOWNLOADS
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/aria2.service
[Unit]
Description=DietPi Aria2
[Service]
Type=simple
ExecStart=$(which aria2c) --enable-rpc --rpc-listen-all --rpc-secret=$GLOBAL_PW --dir=$G_FP_DIETPI_USERDATA/$FOLDER_DOWNLOADS
[Install]
WantedBy=multi-user.target
_EOF_
}
#SYNCTHING
setvar INSTALLING_INDEX = '50'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Generate dir's
mkdir -p "$G_FP_DIETPI_USERDATA"/syncthing
mkdir -p "$G_FP_DIETPI_USERDATA"/syncthing_data
# Logs/Binary
mkdir -p /var/log/syncthing
echo '' > /var/log/syncthing/syncthing.log
chown -R dietpi:dietpi /var/log/syncthing
chown -R dietpi:dietpi /etc/syncthing
# - run syncthing to create cert/config and exit
/etc/syncthing/syncthing -generate="$G_FP_DIETPI_USERDATA"/syncthing
# - Disable automatic upgrades
sed -i '/<\/autoUpgradeIntervalH>/c\ 0<\/autoUpgradeIntervalH>' "$G_FP_DIETPI_USERDATA"/syncthing/config.xml
# - Allow external access (LAN).
sed -i '/:8384<\/address>/c\ 0.0.0.0:8384<\/address>' "$G_FP_DIETPI_USERDATA"/syncthing/config.xml
# - Set default folder
sed -i '/label=\"Default Folder/c\ ' "$G_FP_DIETPI_USERDATA"/syncthing/config.xml
# - Disable browser starting
sed -i '/<\/startBrowser>/c\ false<\/startBrowser>' "$G_FP_DIETPI_USERDATA"/syncthing/config.xml
# - Enable filesystem watcher (previously inotify)
sed -i 's/fsWatcherEnabled=\"false\"/fsWatcherEnabled=\"true\"/g' "$G_FP_DIETPI_USERDATA"/syncthing/config.xml
#services
cat <<< """ > /etc/systemd/system/syncthing.service
[Unit]
Description=Syncthing
After=network.target
[Service]
Type=simple
ExecStart=/etc/syncthing/syncthing -logfile=/var/log/syncthing/syncthing.log -logflags=3 -home=$G_FP_DIETPI_USERDATA/syncthing
User=dietpi
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/syncthing.service
[Unit]
Description=Syncthing
After=network.target
[Service]
Type=simple
ExecStart=/etc/syncthing/syncthing -logfile=/var/log/syncthing/syncthing.log -logflags=3 -home=$G_FP_DIETPI_USERDATA/syncthing
User=dietpi
[Install]
WantedBy=multi-user.target
_EOF_
# - Increase open file limit:
echo -e "fs.inotify.max_user_watches=204800" | tee -a /etc/sysctl.conf
}
#Urbackup server
setvar INSTALLING_INDEX = '111'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/urbackup/urbackup_tmp_files
#As we have /tmp mounted to RAM, change tmp locations
sed -i '/DAEMON_TMPDIR=/c\DAEMON_TMPDIR="/var/tmp"' /etc/default/urbackupsrv
#https://github.com/Fourdee/DietPi/issues/545#issuecomment-252419739
#sqlite3 /usr/local/var/urbackup/backup_server_settings.db "UPDATE settings SET value = '/mnt/dietpi_userdata/urbackup/' WHERE key = 'backupfolder'"
}
#SICKRAGE
setvar INSTALLING_INDEX = '116'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/sickrage
cat <<< """ > /etc/systemd/system/sickrage.service
[Unit]
Description=SickRage
After=dietpi-service.service
[Service]
User=root
Group=root
Type=forking
GuessMainPID=no
ExecStart=/usr/bin/python /etc/sickrage/SickBeard.py -q --daemon --nolaunch --datadir=$G_FP_DIETPI_USERDATA/sickrage
#ExecStop=/usr/bin/killall -w SickBeard.py
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/sickrage.service
[Unit]
Description=SickRage
After=dietpi-service.service
[Service]
User=root
Group=root
Type=forking
GuessMainPID=no
ExecStart=/usr/bin/python /etc/sickrage/SickBeard.py -q --daemon --nolaunch --datadir=$G_FP_DIETPI_USERDATA/sickrage
#ExecStop=/usr/bin/killall -w SickBeard.py
[Install]
WantedBy=multi-user.target
_EOF_
#Grab our premade config:
# SickRage must be run at least once, or it will simply overwrite our config
G_DIETPI-NOTIFY 2 "Configuring SickRage, please wait..."
systemctl start sickrage
# Wait for SickRage to generate its default config.ini, else, it will just overwrite our config.ini.
local max_loops=10
local current_loop=0
while [ ! -f "$G_FP_DIETPI_USERDATA/sickrage/config.ini" ]
{
G_DIETPI-NOTIFY 2 "Waiting for SickRage to finish 1st run prep, please wait..."
sleep 1
((current_loop++))
if (( $current_loop >= $max_loops )) {
G_DIETPI-NOTIFY 1 "Timed-out waiting for SickRage to generate config.ini"
break
}
}
systemctl stop sickrage
cp "$G_FP_DIETPI_USERDATA"/sickrage/config.ini "$G_FP_DIETPI_USERDATA"/sickrage/config.ini.default
wget http://dietpi.com/downloads/conf/sickrage_dietpi_config.ini -O "$G_FP_DIETPI_USERDATA"/sickrage/config.ini
}
#TONIDO
setvar INSTALLING_INDEX = '134'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#service
cat <<< """ > /etc/systemd/system/tonido.service
[Unit]
Description=Tonido - DietPi
[Service]
Type=simple
User=root
WorkingDirectory=/etc/tonido
ExecStart=/bin/bash -c 'export LD_LIBRARY_PATH=/etc/tonido; export TONIDODIR=/etc/tonido; ./tonidoconsole'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/tonido.service
[Unit]
Description=Tonido - DietPi
[Service]
Type=simple
User=root
WorkingDirectory=/etc/tonido
ExecStart=/bin/bash -c 'export LD_LIBRARY_PATH=/etc/tonido; export TONIDODIR=/etc/tonido; ./tonidoconsole'
[Install]
WantedBy=multi-user.target
_EOF_
# - userdirs
mkdir -p "$G_FP_DIETPI_USERDATA"/tonido/sync
mkdir -p "$G_FP_DIETPI_USERDATA"/tonido/syncdata
# symlink
cp -R "$HOME"/tonido "$G_FP_DIETPI_USERDATA"/ &> /dev/null
rm -R "$HOME"/tonido &> /dev/null
ln -sf "$G_FP_DIETPI_USERDATA"/tonido "$HOME"/tonido
ln -sf "$G_FP_DIETPI_USERDATA"/tonido/sync "$HOME"/TonidoSync
ln -sf "$G_FP_DIETPI_USERDATA"/tonido/syncdata "$HOME"/TonidoSyncData
# - armv7 switch
if (( $G_HW_ARCH == 2 )) {
sed -i 's/armv6l/armv7l/' /etc/tonido/manifest.xml
sed -i 's/armv6l/armv7l/' /etc/tonido/plugins/*/manifest.xml
}
}
#Chromium
setvar INSTALLING_INDEX = '113'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Allow root, start maximized and disable sandbox under root (blank screen without)
local export_options="export CHROMIUM_FLAGS=\"\$CHROMIUM_FLAGS --no-sandbox --temp-profile --start-maximized --user-data-dir "
#RPi
if (( $G_HW_MODEL < 10 )) {
# OpenGL
if (( $G_HW_MODEL >= 2 )) {
#Hangs xinit: https://github.com/Fourdee/DietPi/issues/834
#/DietPi/dietpi/func/dietpi-set_hardware rpi-opengl enable
echo 0
}
#OpenGL
} elif (( $G_HW_MODEL == 21 )) {
echo 0 &> /dev/null
#GLES
} else {
setvar export_options = ''--use-gl=egl''
}
setvar export_options = """\""
mkdir -p /etc/chromium.d
cat <<< """ > /etc/chromium.d/custom_flags
$export_options
"""
> /etc/chromium.d/custom_flags
$export_options
_EOF_
# Chromium 60+
cp /etc/chromium.d/custom_flags "$HOME"/.chromium-browser.init
#Symlink to desktop
# * for RPi Stretch due to chromium-browser.desktop
ln -sf /usr/share/applications/chromium*.desktop "$HOME"/Desktop/chromium.desktop
}
#OMV
setvar INSTALLING_INDEX = '126'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
omv-initsystem
}
#O!MPD
setvar INSTALLING_INDEX = '129'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i "/'mysqli_user'/c \$cfg[\'mysqli_user\'] = \'ompd\';" /var/www/ompd/include/config.inc.php
sed -i "/'mysqli_password'/c \$cfg[\'mysqli_password\'] = \'$GLOBAL_PW\';" /var/www/ompd/include/config.inc.php
sed -i "/'media_dir'/c \$cfg[\'media_dir\'] = \'/var/lib/mpd/music/\';" /var/www/ompd/include/config.inc.php
sed -i "/'ignore_media_dir_access_error'/c \$cfg[\'ignore_media_dir_access_error\'] = \'true';" /var/www/ompd/include/config.inc.php
/DietPi/dietpi/func/create_mysql_db ompd ompd $GLOBAL_PW
}
#IceCast + DarkIce
setvar INSTALLING_INDEX = '135'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#icecast set passwords:
sed -i '/\/c\\dietpi\<\/source-password\>' /etc/icecast2/icecast.xml
sed -i '/\/c\\dietpi\<\/relay-password\>' /etc/icecast2/icecast.xml
# Create random password
local admin_password=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w10 | head -n1)
sed -i "/\/c\\$admin_password\<\/admin-password\>" /etc/icecast2/icecast.xml
sed -i '/ENABLE=/c\ENABLE=true' /etc/default/icecast2
#Configure for ALSA loopback?
# echo -e "options snd_aloop pcm_substreams=2 #index=10# breaks module loading..." > /etc/modprobe.d/snd_aloop_index.conf
# modprobe snd-aloop
# if (( ! $(cat /etc/modules | grep -ci -m1 '^snd-aloop') )); then
# echo -e "snd-aloop" >> /etc/modules
# fi
#Darkice
local input_device_index=$(arecord -l | grep -m1 'card' | awk '{print $2}' | sed 's/://')
cat <<< """ > /etc/darkice.cfg
[general]
duration = 0
bufferSecs = 3
reconnect = yes
[input]
device = hw:$input_device_index,0
sampleRate = 44100
bitsPerSample = 16
channel = 1
[icecast2-0]
bitrateMode = vbr
format = vorbis
quality = 0.8
server = dietpi
port = 8000
password = dietpi
mountPoint = DietPi
name = DietPi
description = DarkIce on DietPi
url = http://localhost
genre = none
public = no
#localDumpFile = $G_FP_DIETPI_USERDATA/darkice_recording.ogg
"""
> /etc/darkice.cfg
[general]
duration = 0
bufferSecs = 3
reconnect = yes
[input]
device = hw:$input_device_index,0
sampleRate = 44100
bitsPerSample = 16
channel = 1
[icecast2-0]
bitrateMode = vbr
format = vorbis
quality = 0.8
server = dietpi
port = 8000
password = dietpi
mountPoint = DietPi
name = DietPi
description = DarkIce on DietPi
url = http://localhost
genre = none
public = no
#localDumpFile = $G_FP_DIETPI_USERDATA/darkice_recording.ogg
_EOF_
#SystemD service for Darkice
rm /etc/init.d/darkice
cat <<< """ > /etc/systemd/system/darkice.service
[Unit]
Description=DarkIce - DietPi
After=icecast2.service
Requires=icecast2.service
[Service]
Type=simple
ExecStart=$(which darkice)
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/darkice.service
[Unit]
Description=DarkIce - DietPi
After=icecast2.service
Requires=icecast2.service
[Service]
Type=simple
ExecStart=$(which darkice)
[Install]
WantedBy=multi-user.target
_EOF_
}
#Blynk
setvar INSTALLING_INDEX = '131'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - service
local fp_java_binary=$(which java)
mkdir -p "$G_FP_DIETPI_USERDATA"/blynk
setvar CONFIG_FILE_URL_ADDRESS = ''https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/server.properties''
wget $CONFIG_FILE_URL_ADDRESS -O "$G_FP_DIETPI_USERDATA"/blynk/server.properties
sed -i "/data.folder=/c\data.folder=$G_FP_DIETPI_USERDATA/blynk" "$G_FP_DIETPI_USERDATA"/blynk/server.properties
cat <<< """ > /etc/systemd/system/blynkserver.service
[Unit]
Description=Blynk Server
After=network.target
[Service]
Type=simple
ExecStart=$fp_java_binary -jar /etc/blynkserver/server.jar -serverConfig $G_FP_DIETPI_USERDATA/blynk/server.properties
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/blynkserver.service
[Unit]
Description=Blynk Server
After=network.target
[Service]
Type=simple
ExecStart=$fp_java_binary -jar /etc/blynkserver/server.jar -serverConfig $G_FP_DIETPI_USERDATA/blynk/server.properties
[Install]
WantedBy=multi-user.target
_EOF_
}
#MotionEye
setvar INSTALLING_INDEX = '136'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Enable RPi cam
if (( $G_HW_MODEL < 10 )) {
/DietPi/dietpi/func/dietpi-set_hardware rpi-camera enable
}
mkdir -p /etc/motioneye
cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
mkdir -p "$G_FP_DIETPI_USERDATA"/motioneye
sed -i "/^media_path/c\media_path $G_FP_DIETPI_USERDATA/motioneye" /etc/motioneye/motioneye.conf
# service
cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
}
#CloudPrint
setvar INSTALLING_INDEX = '137'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Enable web admin
cupsctl --remote-admin
usermod -a -G lpadmin root
}
#VirtualHere
setvar INSTALLING_INDEX = '138'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/virtualhere.service
[Unit]
Description=VirtualHere DietPi service
After=local-fs.target
[Service]
Type=simple
ExecStart=/etc/vhusbd/vhusbd -r /var/log/virtualhere.log
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/virtualhere.service
[Unit]
Description=VirtualHere DietPi service
After=local-fs.target
[Service]
Type=simple
ExecStart=/etc/vhusbd/vhusbd -r /var/log/virtualhere.log
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
echo -e "ServerName='DietPi'" > /etc/vhusbd/config.ini
}
#SABnzbd
setvar INSTALLING_INDEX = '139'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/sabnzbd.service
[Unit]
Description=sabnzbd DietPi
[Service]
Type=simple
ExecStart=/usr/bin/python /etc/sabnzbd/SABnzbd.py -f /etc/sabnzbd/sabnzbd.ini
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/sabnzbd.service
[Unit]
Description=sabnzbd DietPi
[Service]
Type=simple
ExecStart=/usr/bin/python /etc/sabnzbd/SABnzbd.py -f /etc/sabnzbd/sabnzbd.ini
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
#Create config:
# API keys and intial config are only generated during 1st run of sabnzbd
# We need to launch program, then apply our config tweaks, else, wizard setup in web interface simply loops without API keys.
rm /etc/sabnzbd/sabnzbd.ini &> /dev/null
systemctl start sabnzbd
G_DIETPI-NOTIFY 2 "Generating initial config, please wait..."
while [ ! -f /etc/sabnzbd/sabnzbd.ini ]
{
sleep 1
}
sleep 2
systemctl stop sabnzbd
sleep 2 #additional wait, config being overwritten after below changes: http://dietpi.com/phpbb/viewtopic.php?f=11&t=1848&p=7085#p7082
sed -i "/^download_dir =/c\download_dir = $G_FP_DIETPI_USERDATA/downloads/incomplete" /etc/sabnzbd/sabnzbd.ini
sed -i "/^complete_dir =/c\complete_dir = $G_FP_DIETPI_USERDATA/downloads/complete" /etc/sabnzbd/sabnzbd.ini
sed -i "/^nzb_backup_dir =/c\nzb_backup_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_nzb_backup" /etc/sabnzbd/sabnzbd.ini
sed -i "/^admin_dir =/c\admin_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_admin" /etc/sabnzbd/sabnzbd.ini
sed -i "/^log_dir =/c\log_dir = /var/log" /etc/sabnzbd/sabnzbd.ini
sed -i "/^log_level =/c\log_level = 0" /etc/sabnzbd/sabnzbd.ini #err only
sed -i "/^refresh_rate =/c\refresh_rate = 2" /etc/sabnzbd/sabnzbd.ini
sed -i "/^host =/c\host = 0.0.0.0" /etc/sabnzbd/sabnzbd.ini
}
#spotifyconnectweb
setvar INSTALLING_INDEX = '141'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/spotify-connect-web.service
[Unit]
Description=spotify-connect-web
After=sound.target
[Service]
Type=simple
WorkingDirectory=$G_FP_DIETPI_USERDATA/spotify-connect-web
ExecStart=$G_FP_DIETPI_USERDATA/spotify-connect-web/spotify-connect-web
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/spotify-connect-web.service
[Unit]
Description=spotify-connect-web
After=sound.target
[Service]
Type=simple
WorkingDirectory=$G_FP_DIETPI_USERDATA/spotify-connect-web
ExecStart=$G_FP_DIETPI_USERDATA/spotify-connect-web/spotify-connect-web
[Install]
WantedBy=multi-user.target
_EOF_
}
#couchpotato
setvar INSTALLING_INDEX = '142'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cp /etc/couchpotato/init/ubuntu.default /etc/default/couchpotato
sed -i "/CP_USER=/c\CP_USER=root" /etc/default/couchpotato
sed -i "/CP_HOME=/c\CP_HOME=/etc/couchpotato" /etc/default/couchpotato
sed -i "/CP_DATA=/c\CP_DATA=$G_FP_DIETPI_USERDATA/couchpotato" /etc/default/couchpotato
mkdir -p "$G_FP_DIETPI_USERDATA"/couchpotato
#useradd -d "$G_FP_DIETPI_USERDATA"/couchpotato couchpotato
cp /etc/couchpotato/init/ubuntu /etc/init.d/couchpotato
}
#Koel
setvar INSTALLING_INDEX = '143'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
Download_Test_Media
/DietPi/dietpi/func/create_mysql_db koel koel $GLOBAL_PW
cd /var/www/koel
sed -i '/DB_CONNECTION=/c\DB_CONNECTION=mysql' .env
sed -i '/DB_HOST=/c\DB_HOST=127.0.0.1' .env
sed -i '/DB_DATABASE=/c\DB_DATABASE=koel' .env
sed -i '/DB_USERNAME=/c\DB_USERNAME=koel' .env
sed -i "/DB_PASSWORD=/c\DB_PASSWORD=$GLOBAL_PW" .env
sed -i '/ADMIN_EMAIL=/c\ADMIN_EMAIL=dietpi@dietpi.com' .env
sed -i '/ADMIN_NAME=/c\ADMIN_NAME=admin' .env
sed -i "/ADMIN_PASSWORD=/c\ADMIN_PASSWORD=$GLOBAL_PW" .env
sed -i "/FFMPEG_PATH=/c\FFMPEG_PATH=$(which ffmpeg)" .env
php artisan koel:init
#php artisan db:seed --force
cd $HOME
cat <<< """ > /etc/systemd/system/koel.service
[Unit]
Description=Koel
[Service]
Type=simple
User=root
WorkingDirectory=/var/www/koel
ExecStart=$(which php) /var/www/koel/artisan serve --host 0.0.0.0
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/koel.service
[Unit]
Description=Koel
[Service]
Type=simple
User=root
WorkingDirectory=/var/www/koel
ExecStart=$(which php) /var/www/koel/artisan serve --host 0.0.0.0
[Install]
WantedBy=multi-user.target
_EOF_
}
#Sonarr
setvar INSTALLING_INDEX = '144'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/sonarr.service
[Unit]
Description=Sonarr (NzbDrone) Daemon
After=network.target
[Service]
User=root
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/sonarr.service
[Unit]
Description=Sonarr (NzbDrone) Daemon
After=network.target
[Service]
User=root
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/NzbDrone/NzbDrone.exe -nobrowser
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
_EOF_
}
#Radarr
setvar INSTALLING_INDEX = '145'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/radarr.service
[Unit]
Description=Radarr Daemon
After=network.target
[Service]
User=root
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/Radarr/Radarr.exe -nobrowser
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/radarr.service
[Unit]
Description=Radarr Daemon
After=network.target
[Service]
User=root
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/Radarr/Radarr.exe -nobrowser
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
_EOF_
}
#PlexPy
setvar INSTALLING_INDEX = '146'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/plexpy
cat <<< """ > /etc/systemd/system/plexpy.service
[Unit]
Description=PlexPy - Stats for Plex Media Server usage
[Service]
ExecStart=/opt/plexpy/PlexPy.py --quiet --daemon --nolaunch --config /opt/plexpy/config.ini --datadir $G_FP_DIETPI_USERDATA/plexpy
GuessMainPID=no
Type=forking
User=root
Group=root
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/plexpy.service
[Unit]
Description=PlexPy - Stats for Plex Media Server usage
[Service]
ExecStart=/opt/plexpy/PlexPy.py --quiet --daemon --nolaunch --config /opt/plexpy/config.ini --datadir $G_FP_DIETPI_USERDATA/plexpy
GuessMainPID=no
Type=forking
User=root
Group=root
[Install]
WantedBy=multi-user.target
_EOF_
}
#Jackett
setvar INSTALLING_INDEX = '147'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/jackett.service
[Unit]
Description=Jackett Daemon
After=network.target
[Service]
User=root
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/jackett/JackettConsole.exe
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/jackett.service
[Unit]
Description=Jackett Daemon
After=network.target
[Service]
User=root
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono --debug /opt/jackett/JackettConsole.exe
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
_EOF_
}
#NZBget
setvar INSTALLING_INDEX = '149'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
sed -i "/MainDir=/c\MainDir=$G_FP_DIETPI_USERDATA/downloads" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/DestDir=/c\DestDir=$G_FP_DIETPI_USERDATA/downloads/complete" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/LogFile=/c\LogFile=/var/log/nzbget.log" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ControlUsername=/c\ControlUsername=root" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ControlPassword=/c\ControlPassword=$GLOBAL_PW" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
# Optimizations
sed -i "/Server1.Cipher=/c\Server1.Cipher=RC4-MD5" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/CrcCheck=/c\CrcCheck=no" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ParScan=/c\ParScan=limited" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ParThreads=/c\ParThreads=$G_HW_CPU_CORES" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/DebugTarget=/c\DebugTarget=none" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/CrashTrace=/c\CrashTrace=no" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/DetailTarget=/c\DetailTarget=none" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ParBuffer=/c\ParBuffer=$(Optimize_BitTorrent 0)" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/ArticleCache=/c\ArticleCache=$(Optimize_BitTorrent 0)" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
sed -i "/WriteBuffer=/c\WriteBuffer=$(Optimize_BitTorrent 0)" "$G_FP_DIETPI_USERDATA"/nzbget/nzbget.conf
cat <<< """ > /etc/systemd/system/nzbget.service
[Unit]
Description=NZBget
[Service]
Type=forking
User=root
WorkingDirectory=$G_FP_DIETPI_USERDATA/nzbget
ExecStart=$G_FP_DIETPI_USERDATA/nzbget/nzbget -D
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/nzbget.service
[Unit]
Description=NZBget
[Service]
Type=forking
User=root
WorkingDirectory=$G_FP_DIETPI_USERDATA/nzbget
ExecStart=$G_FP_DIETPI_USERDATA/nzbget/nzbget -D
[Install]
WantedBy=multi-user.target
_EOF_
}
#HTPC Manager
setvar INSTALLING_INDEX = '155'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/htpc-manager.service
[Unit]
Description=HTPC Manager
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python $G_FP_DIETPI_USERDATA/htpc-manager/Htpc.py
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/htpc-manager.service
[Unit]
Description=HTPC Manager
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python $G_FP_DIETPI_USERDATA/htpc-manager/Htpc.py
[Install]
WantedBy=multi-user.target
_EOF_
}
#OctoPrint
setvar INSTALLING_INDEX = '153'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/octoprint.service
[Unit]
Description=OctoPrint
[Service]
Type=simple
User=root
ExecStart=$(which octoprint) serve --iknowwhatimdoing
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/octoprint.service
[Unit]
Description=OctoPrint
[Service]
Type=simple
User=root
ExecStart=$(which octoprint) serve --iknowwhatimdoing
[Install]
WantedBy=multi-user.target
_EOF_
}
#RoonServer
setvar INSTALLING_INDEX = '154'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/roonserver.service
[Unit]
Description=Roon Server
After=network.target
[Service]
Type=simple
User=root
Environment=ROON_DATAROOT=$G_FP_DIETPI_USERDATA/roonserver
ExecStart=$G_FP_DIETPI_USERDATA/roonserver/start.sh
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/roonserver.service
[Unit]
Description=Roon Server
After=network.target
[Service]
Type=simple
User=root
Environment=ROON_DATAROOT=$G_FP_DIETPI_USERDATA/roonserver
ExecStart=$G_FP_DIETPI_USERDATA/roonserver/start.sh
[Install]
WantedBy=multi-user.target
_EOF_
}
#Steam
setvar INSTALLING_INDEX = '156'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p "$G_FP_DIETPI_USERDATA"/steam
mv "$HOME"/.steam/* "$G_FP_DIETPI_USERDATA"/steam/
rm -R "$HOME"/.steam
ln -sf "$G_FP_DIETPI_USERDATA"/steam "$HOME"/.steam
}
#------------------ Home Automation: Home Assistant ------------------
setvar INSTALLING_INDEX = '157'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cat <<< """ > /etc/systemd/system/home-assistant.service
[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=homeassistant
ExecStart=/srv/homeassistant/homeassistant-start.sh
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/home-assistant.service
[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=homeassistant
ExecStart=/srv/homeassistant/homeassistant-start.sh
[Install]
WantedBy=multi-user.target
_EOF_
# Link to the default ha location for the homeassistant user, this makes
# the configuration avaliable for the user to edit. Configuration generated
# when service is started at /home/homeassistant/.homeassistant
mkdir "$G_FP_DIETPI_USERDATA"/homeassistant
ln -sf "$G_FP_DIETPI_USERDATA"/homeassistant /home/homeassistant/.homeassistant
}
#-------------------------------------------------------------------
#Minio Config
setvar INSTALLING_INDEX = '158'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Create simple mandatory default configuration file
cat <<< """ >> /etc/default/minio
# Default file path
MINIO_VOLUMES="$G_FP_DIETPI_USERDATA/minio-data"
# Use if you want to run Minio on a custom port.
# MINIO_OPTS="--address :9199"
# Access Key of the server.
# MINIO_ACCESS_KEY=Server-Access-Key
# Secret key of the server.
# MINIO_SECRET_KEY=Server-Secret-Key
"""
>> /etc/default/minio
# Default file path
MINIO_VOLUMES="$G_FP_DIETPI_USERDATA/minio-data"
# Use if you want to run Minio on a custom port.
# MINIO_OPTS="--address :9199"
# Access Key of the server.
# MINIO_ACCESS_KEY=Server-Access-Key
# Secret key of the server.
# MINIO_SECRET_KEY=Server-Secret-Key
_EOF_
# Enable startup on boot by default
systemctl enable minio.service
}
#Docker Config
setvar INSTALLING_INDEX = '162'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Create directory for docker containers
mkdir "$G_FP_DIETPI_USERDATA"/docker-data
# stop service
systemctl stop docker.service
# Set container(s) locations in /lib/systemd/system/docker.service
sed -i "/ExecStart=\/usr\/bin\/dockerd/c\ExecStart=\/usr\/bin\/dockerd -g $G_FP_DIETPI_USERDATA\/docker-data -H fd:\/\/" /lib/systemd/system/docker.service
}
#-------------------------------------------------------------------
#FuguHub Config
setvar INSTALLING_INDEX = '161'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Setup Filestore DietPi appropriate
# IF already present just create symlink
if test ! -f "$G_FP_DIETPI_USERDATA"/fuguhub-data/ {
# Move installed filestore to dietpi folder
mkdir "$G_FP_DIETPI_USERDATA"/fuguhub-data/
mv /home/bd/disk/* "$G_FP_DIETPI_USERDATA"/fuguhub-data/
# Removed 'actual' folder to make way for symlink
rm -r /home/bd/disk
# Create symlink
ln -s "$G_FP_DIETPI_USERDATA"/fuguhub-data /home/bd/disk
# Set permissions
# setfacl -R -m u:bd:rwx "$G_FP_DIETPI_USERDATA"/fuguhub-data/
} else {
# Removed 'actual' folder to make way for symlink
rm -r /home/bd/disk
# Create symlink
ln -s "$G_FP_DIETPI_USERDATA"/fuguhub-data /home/bd/disk
}
}
#-------------------------------------------------------------------
#Nukkit Config
setvar INSTALLING_INDEX = '164'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# Conig file to autostart -- english default
wget -O /usr/local/bin/nukkit/nukkit.yml https://github.com/Nukkit/Languages/raw/master/eng/nukkit.yml
# create systemd file
cat <<< """ > /etc/systemd/system/nukkit.service
[Unit]
Description=nukkit
[Service]
WorkingDirectory=/usr/local/bin/nukkit
ExecStart=/bin/bash -c 'java -jar /usr/local/bin/nukkit/nukkit.jar'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/nukkit.service
[Unit]
Description=nukkit
[Service]
WorkingDirectory=/usr/local/bin/nukkit
ExecStart=/bin/bash -c 'java -jar /usr/local/bin/nukkit/nukkit.jar'
[Install]
WantedBy=multi-user.target
_EOF_
}
#GITEA Config
setvar INSTALLING_INDEX = '165'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - service
cat <<< """ > /etc/systemd/system/gitea.service
[Unit]
Description=Gitea (Git with a cup of tea)
[Service]
Type=simple
User=dietpi
WorkingDirectory=$G_FP_DIETPI_USERDATA/gitea/gitea-repositories
ExecStart=$G_FP_DIETPI_USERDATA/gitea/gitea web
Environment=USER=dietpi HOME=$G_FP_DIETPI_USERDATA/gitea
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/gitea.service
[Unit]
Description=Gitea (Git with a cup of tea)
[Service]
Type=simple
User=dietpi
WorkingDirectory=$G_FP_DIETPI_USERDATA/gitea/gitea-repositories
ExecStart=$G_FP_DIETPI_USERDATA/gitea/gitea web
Environment=USER=dietpi HOME=$G_FP_DIETPI_USERDATA/gitea
[Install]
WantedBy=multi-user.target
_EOF_
# - Logs
mkdir -p /var/log/gitea
chown -R dietpi:dietpi /var/log/gitea
# - sqldb
/DietPi/dietpi/func/create_mysql_db gitea gitea $GLOBAL_PW
}
#Allo Config
setvar INSTALLING_INDEX = '159' #160 for quick reinstall/update
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 ||
${aSOFTWARE_INSTALL_STATE[160]} == 1 )) {
Banner_Configuration
/DietPi/dietpi/func/create_mysql_db allo_db allo_db $GLOBAL_PW
mysql allo_db < /var/www/allo_db.sql
rm /var/www/allo_db.sql
# - Redirect to web interface by default:
rm /var/www/index.htm*
cat <<< """ > /var/www/index.php
"""
> /var/www/index.php
_EOF_
#HW specific changes
# - SPARKY ONLY - Auto detect eth adapter
if (( $G_HW_MODEL == 70 )) {
# - Disable onboard ETH if adapter found
cat <<< """ > /etc/systemd/system/sparky_eth_controller.service
[Unit]
Description=Sparky auto detect and set onboard ETH/USB ETH
After=network.target networking.service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/bash -c '/usr/local/bin/sparky_eth_controller.sh'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/sparky_eth_controller.service
[Unit]
Description=Sparky auto detect and set onboard ETH/USB ETH
After=network.target networking.service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/bash -c '/usr/local/bin/sparky_eth_controller.sh'
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
systemctl enable sparky_eth_controller.service
cat <<< """ > /usr/local/bin/sparky_eth_controller.sh
#!/bin/bash
#We need to wait until USB eth is established on USB bus. This takes much longer than onboard init and network.target network-pre.target
sleep 20
# - Set USB ETH if found
if (( '$'(ifconfig -a | grep -ci -m1 'eth1') )); then
echo -e "blacklist ethernet" > /etc/modprobe.d/disable_sparkysbc_ethernet.conf
rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null
rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null
reboot
# - Enable onboard ETH if no adapter found
elif (( ! '$'(ifconfig -a | grep -ci -m1 'eth0') )); then
rm /etc/modprobe.d/disable_sparkysbc_ethernet.conf &> /dev/null
rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null
rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null
reboot
fi
"""
> /usr/local/bin/sparky_eth_controller.sh
#!/bin/bash
#We need to wait until USB eth is established on USB bus. This takes much longer than onboard init and network.target network-pre.target
sleep 20
# - Set USB ETH if found
if (( \$(ifconfig -a | grep -ci -m1 'eth1') )); then
echo -e "blacklist ethernet" > /etc/modprobe.d/disable_sparkysbc_ethernet.conf
rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null
rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null
reboot
# - Enable onboard ETH if no adapter found
elif (( ! \$(ifconfig -a | grep -ci -m1 'eth0') )); then
rm /etc/modprobe.d/disable_sparkysbc_ethernet.conf &> /dev/null
rm /etc/udev/rules.d/70-persistent-net.rules &> /dev/null
rm /etc/udev/rules.d/70-persistant-net.rules &> /dev/null
reboot
fi
_EOF_
chmod +x /usr/local/bin/sparky_eth_controller.sh
}
# - Allow for quick updates with 160 reinstall
setvar aSOFTWARE_INSTALL_STATE[160]=2
}
#Gmediarender
setvar INSTALLING_INDEX = '163'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
cp /DietPi/dietpi/conf/gmrender.service /etc/systemd/system/gmrender.service
}
#AudioPhonics Pi-SPC
setvar INSTALLING_INDEX = '166'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
mkdir -p /var/lib/dietpi/dietpi-software/installed/pi-spc
cat <<< """ > /var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh
#!/bin/bash
#DietPi version
PATH=/usr/bin:/home/pi/wiringPi/gpio:/usr/local/bin
TICKRATE=0.25
echo -e "Audiophonics Shutdown script starting..."
echo -e "Asserting pins : "
echo -e "ShutDown : GPIO17=in, Low"
echo -e "BootOK : GPIO22=out, High"
echo -e "SoftSD : GPIO04=out, Low"
gpio -g mode 04 out
gpio -g write 04 0
gpio -g mode 17 in
gpio -g write 17 0
gpio -g mode 22 out
gpio -g write 22 1
while true
do
if (( '$'(gpio -g read 17) == 1 )); then
G_DIETPI-NOTIFY 0 "AudioPhonics Pi-SPC: Power off requested. Shutting down system."
sudo poweroff
#sudo shutdown -h -P now
break
fi
sleep '$'TICKRATE
done
exit 0
"""
> /var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh
#!/bin/bash
#DietPi version
PATH=/usr/bin:/home/pi/wiringPi/gpio:/usr/local/bin
TICKRATE=0.25
echo -e "Audiophonics Shutdown script starting..."
echo -e "Asserting pins : "
echo -e "ShutDown : GPIO17=in, Low"
echo -e "BootOK : GPIO22=out, High"
echo -e "SoftSD : GPIO04=out, Low"
gpio -g mode 04 out
gpio -g write 04 0
gpio -g mode 17 in
gpio -g write 17 0
gpio -g mode 22 out
gpio -g write 22 1
while true
do
if (( \$(gpio -g read 17) == 1 )); then
G_DIETPI-NOTIFY 0 "AudioPhonics Pi-SPC: Power off requested. Shutting down system."
sudo poweroff
#sudo shutdown -h -P now
break
fi
sleep \$TICKRATE
done
exit 0
_EOF_
chmod +x /var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh
cat <<< """ > /etc/systemd/system/pi-spc.service
[Unit]
Description=AudioPhonics Pi-SPC
[Service]
Type=simple
StandardOutput=tty
User=root
ExecStart=/bin/bash -c '/var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh'
[Install]
WantedBy=multi-user.target
"""
> /etc/systemd/system/pi-spc.service
[Unit]
Description=AudioPhonics Pi-SPC
[Service]
Type=simple
StandardOutput=tty
User=root
ExecStart=/bin/bash -c '/var/lib/dietpi/dietpi-software/installed/pi-spc/sds.sh'
[Install]
WantedBy=multi-user.target
_EOF_
}
#moOde Configuration
setvar INSTALLING_INDEX = '168'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
#Create moOde runtime environment ---------------------------------------------------------
# Create Pi user, does not exist on DietPi systems.
# - Required for some moOde bash scripts which live in /home/pi
/DietPi/dietpi/func/dietpi-set_software useradd pi
# Priv
#echo -e 'pi\tALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers # Completed with /DietPi/dietpi/func/dietpi-set_software useradd pi
echo -e 'www-data\tALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Dirs
mkdir -p /var/local/www/commandw
mkdir -p /var/local/www/cssw
mkdir -p /var/local/www/jsw
mkdir -p /var/local/www/imagesw
mkdir -p /var/local/www/imagesw/toggle
mkdir -p /var/local/www/db
mkdir -p /var/local/www/templatesw
chmod -R 0755 /var/local/www
mkdir -p /var/lib/mpd/music/RADIO
mkdir -p /mnt/NAS
mkdir -p /mnt/SDCARD
mkdir -p /mnt/UPNP
mkdir /media
# Symlinks
ln -s /mnt/NAS /var/lib/mpd/music/NAS
ln -s /mnt/SDCARD /var/lib/mpd/music/SDCARD
ln -s /media /var/lib/mpd/music/USB
ln -s /var/lib/mpd/music /var/www/mpdmusic
# Logs
touch /var/log/moode.log
chmod 0666 /var/log/moode.log
touch /var/log/php_errors.log
chmod 0666 /var/log/php_errors.log
# Files
cp ./rel-stretch/mpd/sticker.sql /var/lib/mpd
cp -r "./rel-stretch/other/sdcard/Stereo Test/" /var/lib/mpd/music/SDCARD
#cp ./rel-stretch/network/interfaces.default /etc/network/interfaces #Disabled as overwrites DietPi network conf. As DietPi does not use/set /etc/dhcpcd.conf, this will render no connection after reboot.
cp ./rel-stretch/network/wpa_supplicant.conf.default /etc/wpa_supplicant/wpa_supplicant.conf
cp ./rel-stretch/network/dhcpcd.conf.default /etc/dhcpcd.conf
cp ./rel-stretch/network/hostapd.conf.default /etc/hostapd/hostapd.conf
cp ./rel-stretch/var/local/www/db/moode-sqlite3.db.default /var/local/www/db/moode-sqlite3.db
# Permissions
chmod 0777 /var/lib/mpd/music/RADIO
chmod -R 0777 /var/local/www/db
# Deletes
rm /etc/update-motd.d/10-uname
#Install moOde sources and configs ---------------------------------------------------------
# Application sources and configs
rm /var/lib/mpd/music/RADIO/*
rm /var/www/images/radio-logos/*
cp ./rel-stretch/mpd/RADIO/* /var/lib/mpd/music/RADIO
cp ./rel-stretch/mpd/playlists/* /var/lib/mpd/playlists
cp -r ./rel-stretch/etc/* /etc/
cp -r ./rel-stretch/home/* /home/pi/
cp -r ./rel-stretch/home/.dircolors /home/pi/
cp -r ./rel-stretch/lib/* /lib/
cp -r ./rel-stretch/usr/* /usr/
cp -r ./rel-stretch/var/* /var/
cp -r ./rel-stretch/www/* /var/www/
# Prep SQL DB
chmod 0755 /var/www/command/*
/var/www/command/util.sh "emerald" "2ecc71" "27ae60"
sqlite3 /var/local/www/db/moode-sqlite3.db "update cfg_system set value='Emerald' where param='themecolor'"
# Enabled moOde features
# sqlite3 /var/local/www/db/moode-sqlite3.db "update cfg_system set value='254' where param='feat_bitmask'"
# // features availability bitmask settings
# const FEAT_ADVKERNELS = 0b00000001; // 1
# const FEAT_AIRPLAY = 0b00000010; // 2
# const FEAT_MINIDLNA = 0b00000100; // 4
# const FEAT_MPDAS = 0b00001000; // 8
# const FEAT_SQUEEZELITE = 0b00010000; // 16
# const FEAT_UPMPDCLI = 0b00100000; // 32
# const FEAT_SQSHCHK = 0b01000000; // 64
# const FEAT_GMUSICAPI = 0b10000000; // 128
# Permissions for service files
# - MPD
chmod 0755 /etc/init.d/mpd
chmod 0644 /lib/systemd/system/mpd.service
chmod 0644 /lib/systemd/system/mpd.socket
# - Bluetooth
chmod 0666 /etc/bluealsaaplay.conf
chmod 0644 /etc/systemd/system/bluealsa-aplay@.service
chmod 0644 /etc/systemd/system/bluealsa.service
chmod 0644 /lib/systemd/system/bluetooth.service
chmod 0755 /usr/local/bin/a2dp-autoconnect
# - Rotenc
chmod 0644 /lib/systemd/system/rotenc.service
# - Udev
chmod 0644 /etc/udev/rules.d/*
# Services are started by moOde Worker so lets disable them here.
systemctl daemon-reload
#systemctl disable mpd.service #dietpi-services
systemctl disable mpd.socket
systemctl disable rotenc.service
# Following binaries will not have been installed yet, but let's disable the services here
chmod 0644 /lib/systemd/system/squeezelite-armv6l.service
chmod 0644 /lib/systemd/system/squeezelite-armv7l.service
systemctl disable squeezelite-armv6l
systemctl disable squeezelite-armv7l
chmod 0644 /lib/systemd/system/upmpdcli.service
systemctl disable upmpdcli.service
# Initial permissions for certain files. These also get set during moOde Worker startup.
chmod 0777 /var/local/www/playhistory.log
chmod 0777 /var/local/www/currentsong.txt
touch /var/local/www/libcache.json
chmod 0777 /var/local/www/libcache.json
#ALSAEQ ------------------------------------------------------------------------------------
#alsamixer -D alsaequal # Disabled, need to automate alsaequal.bin generation.
chmod 0755 /usr/local/bin/alsaequal.bin
chown mpd:audio /usr/local/bin/alsaequal.bin
rm /usr/share/alsa/alsa.conf.d/equal.conf
mpc enable only 1
#DietPi - Post steps START -----------------------------------------------------------------
# PHP-FPM set to v5 if Jessie
# /etc/nginx/nginx.conf
# fastcgi_pass unix:/run/php5-fpm.sock;
# ??? Support for all webserver types with global site conf? (eg: lighttpd/nginx/apache2)
# Need to also look at fastcgi_parms in /etc/nginx
# ln -sf /var/local/www/cssw /var/www/cssw
# ln -sf /var/local/www/imagesw /var/www/imagesw
# ln -sf /var/local/www/jsw /var/www/jsw
# ln -sf /var/local/www/templatesw /var/www/templatesw
# chown -R www-data:www-data /var/local/www
#Remove default .html site
rm /var/www/index.h*
# Combined /etc/rc.local
cat <<< """ > /etc/rc.local
#!/bin/bash
#Precaution: Wait for DietPi Ramdisk to finish
while [ ! -f /DietPi/.ramdisk ]
do
G_DIETPI-NOTIFY 2 "Waiting for DietPi-RAMDISK to finish mounting DietPi to RAM..."
sleep 1
done
echo -e "'$'(cat /proc/uptime | awk '{print '$'1}') Seconds" > /var/log/boottime
if (( '$'(cat /DietPi/dietpi/.install_stage) == 1 )); then
/DietPi/dietpi/dietpi-services start
fi
/DietPi/dietpi/dietpi-banner 0
echo -e " Default Login:\n Username = root\n Password = dietpi\n"
#moOde additions
SQLDB=/var/local/www/db/moode-sqlite3.db
# set cpu govenor
RESULT='$'(sqlite3 '$'SQLDB "select value from cfg_system where param='cpugov'")
echo "'$'RESULT" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/usr/bin/udisks-glue > /dev/null 2>&1
/var/www/command/worker.php > /dev/null 2>&1
exit 0
"""
> /etc/rc.local
#!/bin/bash
#Precaution: Wait for DietPi Ramdisk to finish
while [ ! -f /DietPi/.ramdisk ]
do
G_DIETPI-NOTIFY 2 "Waiting for DietPi-RAMDISK to finish mounting DietPi to RAM..."
sleep 1
done
echo -e "\$(cat /proc/uptime | awk '{print \$1}') Seconds" > /var/log/boottime
if (( \$(cat /DietPi/dietpi/.install_stage) == 1 )); then
/DietPi/dietpi/dietpi-services start
fi
/DietPi/dietpi/dietpi-banner 0
echo -e " Default Login:\n Username = root\n Password = dietpi\n"
#moOde additions
SQLDB=/var/local/www/db/moode-sqlite3.db
# set cpu govenor
RESULT=\$(sqlite3 \$SQLDB "select value from cfg_system where param='cpugov'")
echo "\$RESULT" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/usr/bin/udisks-glue > /dev/null 2>&1
/var/www/command/worker.php > /dev/null 2>&1
exit 0
_EOF_
# moOde worker service
# ??? Hangs on /bin/systemd-tty-ask-password-agent --watch
# cat << _EOF_ > /etc/systemd/system/moode-worker.service
# [Unit]
# Description=moOde worker.php service
# After=php7.0-fpm.service php5-fpm.service apache2.service lighttpd.service nginx.service
# [Service]
# Type=forking
# StandardOutput=tty
# StandardInput=tty
# User=root
# ExecStart=/bin/bash -c '/var/www/command/worker.php'
# [Install]
# WantedBy=multi-user.target
# _EOF_
sqlite3 /var/local/www/db/moode-sqlite3.db "update cfg_system set value='/DietPi/config.txt' where param='res_boot_config_txt'"
Download_Test_Media
#DietPi - Post steps END -------------------------------------------------------------------
}
#Google AIY
setvar INSTALLING_INDEX = '169'
if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )) {
Banner_Configuration
# - Symlink userdata location for assistant.json
ln -sf "$G_FP_DIETPI_USERDATA"/voice-recognizer-raspi/assistant.json /home/dietpi/assistant.json
# - Generate cache dir
mkdir -p /home/dietpi/.cache/voice-recognizer
#Setup soundcard
/DietPi/dietpi/func/dietpi-set_hardware soundcard googlevoicehat-soundcard
}
}
proc Install_Apply_GPU_Settings {
local gpu_enabled=0
local gpu_memory=0
#Define Memory Split Modes with installed software
#Mode 4 RPI ONLY (Descent HIGH GPU RAM / 192MB)
if (( ${aSOFTWARE_INSTALL_STATE[112]} == 2 )) {
setvar gpu_enabled = '1'
setvar gpu_memory = '192'
#Define Memory Split Modes with installed software
#Mode 3 (KODI / DIETPICAM / UAE4ARM / JRiver / MED GPU RAM / 128MB)
} elif (( ${aSOFTWARE_INSTALL_STATE[31]} == 2 ||
${aSOFTWARE_INSTALL_STATE[59]} == 2 ||
${aSOFTWARE_INSTALL_STATE[108]} == 2 ||
${aSOFTWARE_INSTALL_STATE[148]} == 2 )) {
setvar gpu_enabled = '1'
setvar gpu_memory = '128'
#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 )) {
setvar gpu_enabled = '1'
setvar gpu_memory = '64'
#Mode 1 - DIETPICLOUDSHELL (forces display output)
} elif (( ${aSOFTWARE_INSTALL_STATE[62]} == 2 )) {
setvar gpu_enabled = '1'
}
#Apply
if (( $gpu_memory > 0 )) {
#RPi
if (( $G_HW_MODEL < 10 )) {
/DietPi/dietpi/func/dietpi-set_hardware gpumemsplit $gpu_memory
}
}
if (( $gpu_enabled )) {
#RPi
if (( $G_HW_MODEL < 10 )) {
sed -i "/CONFIG_HDMI_OUTPUT=/c\CONFIG_HDMI_OUTPUT=1" /DietPi/dietpi.txt
#odroid C1
} elif (( $G_HW_MODEL == 10 )) {
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
#Odroid C2
} elif (( $G_HW_MODEL == 12 )) {
sed -i '/setenv nographics /c\setenv nographics "0"' /DietPi/boot.ini
}
}
}
proc Check_USB_Drive_Installed {
setvar USBDRIVE = '0'
setvar FP_DIETPI_DEDICATED_USBDRIVE = $(df -P | grep -m1 '^/dev/sda1' | awk '{print $6}')
#Only enable if mounted
if test -n $FP_DIETPI_DEDICATED_USBDRIVE &&
(( $(df -P | grep -ci -m1 "$FP_DIETPI_DEDICATED_USBDRIVE") )) {
setvar USBDRIVE = '1'
}
}
proc Uninstall_Software {
#NB: systemctl daemon-reload is executed after this func in Uninstall_Software_Finalize()
local index=$1
#----------------------------------------------------------------------
#Inform User
G_DIETPI-NOTIFY 3 DietPi-Software "Uninstall"
echo -e ""
G_DIETPI-NOTIFY 0 "Uninstalling ${aSOFTWARE_WHIP_NAME[$index]}: ${aSOFTWARE_WHIP_DESC[$index]}\n"
#Was a uninstall event trigged?
local valid_input=1
#----------------------------------------------------------------------
#DIETPI SOFTWARE
if (( $index == 100 )) {
setvar 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 (( $index == 23 )) {
G_AGP lxde lxde-* upower policykit-1 iceweasel p7zip-full
} elif (( $index == 24 )) {
G_AGP mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full
} elif (( $index == 26 )) {
G_AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games upower policykit-1 iceweasel p7zip-full
} elif (( $index == 25 )) {
G_AGP xfce4 gnome-icon-theme tango-icon-theme iceweasel p7zip-full
} elif (( $index == 22 )) {
G_AGP quiterss
} elif (( $index == 30 )) {
G_RUN_CMD dpkg -P nomachine
} elif (( $index == 29 )) {
G_AGP xrdp
} elif (( $index == 44 )) {
G_AGP transmission-daemon
rm /etc/init.d/transmission-daemon &> /dev/null
rm /etc/systemd/system/transmission-daemon.service &> /dev/null
} elif (( $index == 47 )) {
#ownCloud
# Remove background cron job
crontab -u www-data -l | grep -v '/var/www/owncloud/cron.php' | crontab -u www-data -
# Disable and remove webserver configs
a2dissite owncloud 2>/dev/null
rm /etc/apache2/sites-available/owncloud.conf 2>/dev/null
rm /etc/nginx/sites-dietpi/owncloud.config 2>/dev/null
# Find datadir for backups
G_DIETPI-NOTIFY 2 "DietPi will perform an automated backup of your ownCloud database and installation directory, which will be stored inside your ownCloud data directory.\nThe data directory won't be removed. So you can at any time recover your whole ownCloud instance.\nRemove the data directory manually, if you don't need it anymore."
local datadir=$(grep -m1 "'datadirectory'" /var/www/owncloud/config/config.php | awk '{print $3}' | sed "s/[',]//g")
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/owncloud_data""
# Drop MariaDB user and database
systemctl start mysql
mysql -e "drop user $(grep -m1 "'dbuser'" /var/www/owncloud/config/config.php | awk '{print $3}' | sed "s/,//")@$(grep -m1 "'dbhost'" /var/www/owncloud/config/config.php | awk '{print $3}' | sed "s/,//")"
mysql -e "drop user $(grep -m1 "'dbuser'" /var/www/owncloud/config/config.php | awk '{print $3}' | sed "s/,//")" 2> /dev/null
test -d "$G_FP_DIETPI_USERDATA"/mysql/owncloud && mysqldump owncloud > "$datadir"/dietpi-owncloud-database-backup.sql
mysqladmin drop owncloud -f
# Backup ownCloud installation folder
cp -a /var/www/owncloud/. "$datadir"/dietpi-owncloud-installation-backup
# Remove ownCloud installation folder
rm -R /var/www/owncloud
} elif (( $index == 114 )) {
#Nextcloud
crontab -u www-data -l | grep -v '/var/www/nextcloud/cron.php' | crontab -u www-data -
# Disable and remove webserver configs
a2dissite nextcloud 2>/dev/null
rm /etc/apache2/sites-available/nextcloud.conf 2>/dev/null
rm /etc/nginx/sites-dietpi/nextcloud.config 2>/dev/null
lighttpd-disable-mod dietpi-nextcloud 2>/dev/null
rm /etc/lighttpd/conf-available/99-dietpi-nextcloud.conf 2>/dev/null
# Find datadir for backups
G_DIETPI-NOTIFY 2 "DietPi will perform an automated backup of your Nextcloud database and installation directory, which will be stored inside your Nextcloud data directory.\nThe data directory won't be removed. So you can at any time recover your whole Nextcloud instance.\nRemove the data directory manually, if you don't need it anymore."
local datadir=$(grep -m1 "'datadirectory'" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/[',]//g")
test -n $datadir || setvar datadir = ""$G_FP_DIETPI_USERDATA/nextcloud_data""
# Drop MariaDB user and database
systemctl start mysql
mysql -e "drop user $(grep -m1 "'dbuser'" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/,//")@$(grep -m1 "'dbhost'" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/,//")"
mysql -e "drop user $(grep -m1 "'dbuser'" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/,//")" 2> /dev/null
test -d "$G_FP_DIETPI_USERDATA"/mysql/nextcloud && mysqldump nextcloud > "$datadir"/dietpi-nextcloud-database-backup.sql
mysqladmin drop nextcloud -f
# Backup Nextcloud installation folder
cp -a /var/www/nextcloud/. "$datadir"/dietpi-nextcloud-installation-backup
# Remove Nextcloud installation folder
rm -R /var/www/nextcloud
} elif (( $index == 83 )) {
G_AGP apache2
} elif (( $index == 85 )) {
G_AGP nginx
} elif (( $index == 84 )) {
G_AGP lighttpd
} elif (( $index == 88 )) {
G_AGP mariadb-server
### Also for MariaDB?
# - custom confs
#rm /etc/mysql/conf.d/reduce_resources.cnf
# - SQL store
rm /var/lib/mysql &> /dev/null || rm -R /var/lib/mysql &> /dev/null #in case of symlink or folder
rm -R "$G_FP_DIETPI_USERDATA"/mysql
} elif (( $index == 87 )) {
G_AGP sqlite3
} elif (( $index == 91 )) {
G_AGP "$PHP_APT_PACKAGE_NAME"-redis redis-server redis-tools
} elif (( $index == 89 )) {
rm "$FP_PHP_BASE_DIR"/fpm/pool.d/www.conf
rm "$FP_PHP_BASE_DIR"/mods-available/dietpi.ini 2> /dev/null
G_AGP "$PHP_APT_PACKAGE_NAME"-* libapache2-mod-"$PHP_APT_PACKAGE_NAME"
rm /var/www/phpinfo.php
rm /var/www/apc.php
rm /var/www/opcache.php
# temp php uploads, if it was created
rm -R /var/tmp/php_upload_tmp 2> /dev/null
} elif (( $index == 90 )) {
systemctl start mysql
mysqladmin drop phpmyadmin -f
mysql -e "drop user 'phpmyadmin'@'localhost'"
G_AGP phpmyadmin
} elif (( $index == 54 )) {
systemctl start mysql
mysqladmin drop phpbb3 -f
mysql -e "drop user phpbb3@localhost"
rm -R /var/www/phpBB3
} elif (( $index == 115 )) {
G_RUN_CMD dpkg -P webmin
} elif (( $index == 32 )) {
rm /usr/bin/ympd
rm /etc/systemd/system/ympd.service
} elif (( $index == 128 )) {
#apt-mark auto libavformat57 libupnp6 libao-common libao4 libasound2 libasound2-data libasyncns0 libaudiofile1 libavahi-client3 libavahi-common-data libavahi-common3 libavcodec56 libavformat56 libavresample2 libavutil54 libbinio1ldbl libcaca0 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcups2 libcurl3-gnutls libdirectfb-1.2-9 libdnet libfaad2 libflac8 libfluidsynth1 libgme0 libgomp1 libgsm1 libice6 libid3tag0 libiso9660-8 libjack-jackd2-0 libjson-c2 libldb1 libmad0 libmikmod3 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpg123-0 libnfs4 libntdb1 libogg0 libopenal-data libopenal1 libopenjpeg5 libopus0 liborc-0.4-0 libpulse0 libresid-builder0c2a libroar2 libsamplerate0 libschroedinger-1.0-0 libsdl1.2debian libshout3 libsidplay2 libsidutils0 libslp1 libsm6 libsmbclient libsndfile1 libsoxr0 libspeex1 libspeexdsp1 libsqlite3-0 libtalloc2 libtdb1 libtevent0 libtheora0 libupnp6 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx1 libwavpack1 libwbclient0 libwildmidi-config libwildmidi1 libx11-6 libx11-data libx11-xcb1 libx264-142 libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxtst6 libxvidcore4 libyajl2 libzzip-0-13 mime-support python python-talloc python2.7 samba-libs x11-common file &> /dev/null
apt-mark unhold mpd 1> /dev/null
(( $G_DISTRO == 3 && $G_HW_ARCH != 3 )) && G_AGP mpd libmpdclient2 || G_RUN_CMD dpkg -P mpd libmpdclient2
userdel -f mpd &> /dev/null
rm /lib/systemd/system/mpd.service
rm -R "$G_FP_DIETPI_USERDATA"/.mpd_cache
} elif (( $index == 121 )) {
rm /etc/systemd/system/roonbridge.service
rm -R /etc/roonbridge
} elif (( $index == 122 )) {
rm /etc/systemd/system/node-red.service
rm "$HOME"/.node-red
rm -R "$G_FP_DIETPI_USERDATA"/node-red
userdel -f nodered
} elif (( $index == 123 )) {
if (( $G_DISTRO > 4 )) {
G_AGP mosquitto
} else {
#apt-mark auto libssl1.0.0
dpkg -P mosquitto
}
} elif (( $index == 124 )) {
#apt-mark auto gcc-6-base libstdc++6 &> /dev/null
G_RUN_CMD dpkg -P networkaudiod
} elif (( $index == 125 )) {
G_AGP tomcat8
} elif (( $index == 126 )) {
G_AGP openmediavault
rm /etc/apt/sources.list.d/openmediavault.list
} elif (( $index == 129 )) {
rm -R /var/www/ompd
systemctl start mysql
mysqladmin drop ompd -f
mysql -e "drop user ompd@localhost"
} elif (( $index == 130 )) {
G_AGP python-pip python3-pip
} elif (( $index == 131 )) {
rm /etc/systemd/system/blynkserver.service
rm -R /etc/blynkserver
} elif (( $index == 132 )) {
rm /etc/systemd/system/aria2.service
rm /usr/local/bin/aria2c
rm -R /var/www/aria2
G_AGP aria2
} elif (( $index == 133 )) {
rm /etc/systemd/system/yacy.service
rm -R /etc/yacy
} elif (( $index == 134 )) {
#apt-mark auto libjpeg8 libpng12-0 libfontconfig1 libssl1.0.0 &> /dev/null
rm /etc/systemd/system/tonido.service
rm -R /etc/tonido
rm "$HOME"/tonido
rm "$HOME"/TonidoSync
rm "$HOME"/TonidoSyncData
} elif (( $index == 135 )) {
G_AGP darkice icecast2
rm /etc/systemd/system/darkice.service
} elif (( $index == 136 )) {
#apt-mark auto v4l-utils python python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev zlib1g-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5 &> /dev/null
(( $G_DISTRO > 3 )) && G_AGP motion || G_RUN_CMD dpkg -P motion
rm -R /etc/motioneye
rm /etc/systemd/system/motioneye.service
pip uninstall -y motioneye
} elif (( $index == 137 )) {
G_AGP cloudprint-service
if (( $G_DISTRO == 3 )) {
rm /etc/apt/sources.list.d/cloudprint.list
G_AGUP
}
} elif (( $index == 138 )) {
rm -R /etc/vhusbd
rm /etc/systemd/system/virtualhere.service
} elif (( $index == 139 )) {
rm -R /etc/sabnzbd
rm /etc/systemd/system/sabnzbd.service
} elif (( $index == 140 )) {
G_RUN_CMD dpkg -P libsdl2 libsdl2-image libsdl2-mixer libsdl2-net libsdl2-ttf libsmpeg2
} elif (( $index == 141 )) {
rm -R "$G_FP_DIETPI_USERDATA"/spotify-connect-web
rm /etc/systemd/system/spotify-connect-web.service
} elif (( $index == 142 )) {
rm -R /etc/couchpotato
rm -R "$G_FP_DIETPI_USERDATA"/couchpotato
rm /etc/init.d/couchpotato
#userdel -f couchpotato
} elif (( $index == 143 )) {
systemctl start mysql
mysqladmin drop koel -f
mysql -e "drop user koel@localhost"
rm -R /var/www/koel
rm /etc/systemd/system/koel.service
} elif (( $index == 144 )) {
G_AGP nzbdrone
rm /etc/systemd/system/sonarr.service
rm /etc/apt/sources.list.d/sonarr.list
G_AGUP
} elif (( $index == 145 )) {
rm -R /opt/Radarr
rm /etc/systemd/system/radarr.service
} elif (( $index == 146 )) {
rm -R /opt/plexpy
rm -R "$G_FP_DIETPI_USERDATA"/plexpy
rm /etc/systemd/system/plexpy.service
} elif (( $index == 147 )) {
rm -R /opt/jackett
rm /etc/systemd/system/jackett.service
} elif (( $index == 148 )) {
G_AGP mediacenter22
} elif (( $index == 149 )) {
rm -R "$G_FP_DIETPI_USERDATA"/nzbget
rm /etc/systemd/system/nzbget.service
} elif (( $index == 155 )) {
rm -R "$G_FP_DIETPI_USERDATA"/htpc-manager
rm /etc/systemd/system/htpc-manager.service
} elif (( $index == 150 )) {
#G_AGP mono-runtime #shared lib
rm /etc/apt/sources.list.d/mono-xamarin.list
G_AGUP
} elif (( $index == 151 )) {
G_AGP nvidia-driver nvidia-xconfig libgl1-nvidia-glx:i386
} elif (( $index == 152 )) {
G_AGP avahi-daemon
} elif (( $index == 153 )) {
rm -R "$G_FP_DIETPI_USERDATA"/octoprint
rm $(which octoprint)
rm -R "$HOME"/.octoprint
rm /etc/systemd/system/octoprint.service
} elif (( $index == 154 )) {
rm -R "$G_FP_DIETPI_USERDATA"/roonserver
rm /etc/systemd/system/roonserver.service
} elif (( $index == 156 )) {
G_AGP steam
rm -R "$HOME"/.steam
rm -R "$G_FP_DIETPI_USERDATA"/steam
} elif (( $index == 119 )) {
G_AGP cava
rm "$HOME/.config/cava/config"
rm "$HOME/cava.psf"
} elif (( $index == 118 )) {
G_AGP mopidy
rm /etc/apt/sources.list.d/mopidy.list
pip uninstall -y Mopidy-MusicBox-Webclient Mopidy-Local-Images
} elif (( $index == 31 )) {
G_AGP kodi
#+Odroids
G_AGP kodi-odroid
rm /usr/share/applications/kodi.desktop
rm ~/Desktop/kodi.desktop
} elif (( $index == 39 )) {
G_AGP minidlna
} elif (( $index == 51 )) {
G_AGP ibsdl1.2debian libsdl-net1.2
rm -R /usr/local/games/opentyrian
rm /usr/share/applications/opentyrian.desktop
rm ~/Desktop/opentyrian.desktop
} elif (( $index == 59 )) {
G_AGP gpac
rm -R /var/www/dietpicam
rm /opt/vc/bin/raspimjpeg
rm /usr/bin/raspimjpeg
rm /var/lib/dietpi/dietpi-software/services/raspimjpeg.service
rm /etc/raspimjpeg
} elif (( $index == 45 )) {
G_AGP deluged deluge-web deluge-webui deluge-console
rm /var/lib/dietpi/dietpi-software/services/deluge.service
rm -R ~/.config/deluge
} elif (( $index == 94 )) {
G_AGP proftpd-basic
} elif (( $index == 96 )) {
G_AGP samba samba-common-bin
} elif (( $index == 95 )) {
G_AGP vsftpd
} elif (( $index == 109 )) {
G_AGP nfs-kernel-server
} elif (( $index == 67 )) {
rm /usr/local/bin/noip2
rm /etc/systemd/system/noip2.service
} elif (( $index == 106 )) {
rm -R /var/www/raspcontrol
rm -R /etc/raspcontrol
} elif (( $index == 63 )) {
rm -R /var/www/linuxdash
} elif (( $index == 93 )) {
G_AGP dnsmasq
pihole uninstall
#https://github.com/Fourdee/DietPi/issues/753
chmod 774 /etc/lighttpd/lighttpd.conf &> /dev/null
rm -R /etc/pihole
rm -R /etc/.pihole
rm -R /var/www/html/admin
# - symlinks
rm /var/www/pihole
rm /var/www/admin
} elif (( $index == 33 || $index == 34 )) {
G_RUN_CMD dpkg -P subsonic
rm -R /var/subsonic
} elif (( $index == 71 )) {
update-rc.d webiopi remove
rm -R /etc/webiopi
rm -R /usr/share/webiopi
rm /usr/bin/webiopi
rm /etc/init.d/webiopi
} elif (( $index == 68 )) {
# <= v150 (weaved)
rm -R /etc/weaved
rm -R "$HOME"/weaved_software
rm "$HOME"/weaved_setup.bin
# Remot3.it
G_RUN_CMD dpkg -P weavedconnectd
} elif (( $index == 62 )) {
#Kill
systemctl stop dietpi-cloudshell
rm /etc/systemd/system/dietpi-cloudshell.service
# - For old version of dietpi-cloudshell, without service.
killall -w dietpi-cloudshell
#Disable auto login, revert boot index to console
/DietPi/dietpi/dietpi-autostart 0
} elif (( $index == 98 )) {
update-rc.d haproxy remove
rm /etc/init.d/haproxy
rm -r /etc/haproxy
#Shared dev libraries. Leave these installed
#G_AGP libpcre3-dev libssl-dev
} elif (( $index == 35 )) {
#apt-mark auto libxml-parser-perl zlib1g-dev libjpeg-dev libpng-dev libjpeg62-turbo-dev &> /dev/null
G_RUN_CMD dpkg -P logitechmediaserver
rm /var/lib/dietpi/dietpi-software/services/squeezeboxserver.service
rm -R /var/lib/squeezeboxserver
rm -R /usr/share/squeezeboxserver
} elif (( $index == 55 )) {
systemctl start mysql
mysqladmin drop wordpress -f
mysql -e "drop user wordpress@localhost"
rm -R /var/www/wordpress
} elif (( $index == 27 || $index == 28 || $index == 120 )) {
G_AGP tightvncserver
G_AGP vnc4server
G_AGP x11vnc
G_AGP realvnc-vnc-server
G_AGP tigervnc-*
rm /etc/systemd/system/vncserver.service
rm /etc/init.d/vncserver
rm /usr/local/bin/vncserver
rm -R "$HOME"/.vnc
# + RealVNC services
systemctl disable vncserver-x11-serviced.service
systemctl disable vncserver-virtuald.service
} elif (( $index == 73 )) {
G_AGP fail2ban
} elif (( $index == 64 )) {
rm -R /var/www/phpsysinfo
} elif (( $index == 56 )) {
rm /var/www/gallery/index.php
rm -R /var/www/gallery/_sfpg_data
} elif (( $index == 40 )) {
rm -R /var/www/ampache
#drop database
systemctl start mysql
mysqladmin drop ampache -f
mysql -e "drop user ampache@localhost"
} elif (( $index == 117 )) {
rm /etc/apt/sources.list.d/swupdate.openvpn.net.list
pivpn -u
userdel -f pivpn
} elif (( $index == 97 )) {
G_AGP openvpn
rm -R /etc/openvpn &> /dev/null
} elif (( $index == 92 )) {
if (( $G_DISTRO >= 4 )) {
G_AGP python-certbot-apache python-certbot-nginx certbot
}
rm -R /etc/letsencrypt_scripts &>/dev/null
rm -R /etc/certbot_scripts &>/dev/null
} elif (( $index == 69 )) {
G_AGP python-rpi.gpio python3-rpi.gpio
} elif (( $index == 72 )) {
G_AGP i2c-tools
#Disable
/DietPi/dietpi/func/dietpi-set_hardware i2c disable
} elif (( $index == 70 )) {
rm -R /root/wiringPi* &> /dev/null
} elif (( $index == 60 )) {
#apt-mark auto libssl1.0.0 &> /dev/null
G_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 <<< """ >> /etc/network/interfaces
iface wlan$wifi_index inet dhcp
address 192.168.0.101
netmask 255.255.255.0
gateway 192.168.0.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#dns-nameservers 8.8.8.8 8.8.4.4
"""
>> /etc/network/interfaces
iface wlan$wifi_index inet dhcp
address 192.168.0.101
netmask 255.255.255.0
gateway 192.168.0.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#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 (( $index == 61 )) {
G_AGP tor
# - uninstall WIFIHOTSPOT ALSO. Due to IPtables needing reset.
Uninstall_Software 60
} elif (( $index == 37 )) {
#apt-mark auto libssl1.0.0 openssl libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 &> /dev/null
#No package is installed anymore, files are directly extracted into places, need to remove them manually?
#https://github.com/Fourdee/DietPi/blob/testing/dietpi/dietpi-software#L5968
#G_RUN_CMD dpkg -P shairport-sync
rm /lib/systemd/system/shairport-sync.service /usr/local/bin/shairport-sync /usr/local/etc/shairport-sync.conf* /usr/local/share/man/man7/shairport-sync.7.gz &> /dev/null
userdel -f shairport-sync
} elif (( $index == 38 )) {
G_AGP brutefir
rm -R /etc/BruteFIR
rm /var/lib/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 (( $index == 48 )) {
rm -R /var/www/pydio
#drop database
systemctl start mysql
mysqladmin drop pydio -f
mysql -e "drop user pydio@localhost"
} elif (( $index == 36 )) {
G_AGP squeezelite
rm -R /usr/bin/squeezelite*
rm /etc/systemd/system/squeezelite.service
} elif (( $index == 99 )) {
rm -R /etc/emonhub
rm /etc/init.d/emonhub
rm /etc/default/emonhub
} elif (( $index == 66 )) {
G_RUN_CMD dpkg -P rpimonitor
} elif (( $index == 57 )) {
rm -R /var/www/baikal
#drop database
systemctl start mysql
mysqladmin drop baikal -f
mysql -e "drop user baikal@localhost"
} elif (( $index == 65 )) {
#apt-mark auto zlib1g-dev &> /dev/null
#all
rm /etc/systemd/system/netdata.service
userdel -f netdata
groupdel netdata
#1.2.0+
G_RUN_CMD dpkg -P 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 (( $index == 43 )) {
G_AGP mumble-server
} elif (( $index == 41 )) {
G_AGP emby-server embymagick
rm /etc/apt/sources.list.d/emby-server.list
G_AGUP
} elif (( $index == 58 )) {
rm -R /etc/openbazaar-server
rm /etc/systemd/system/openbazaar.service
} elif (( $index == 42 )) {
(( $G_HW_ARCH == 10 )) && G_RUN_CMD dpkg -P plexmediaserver plexmediaserver-installer || G_AGP plexmediaserver*
rm -R /var/lib/plexmediaserver
rm /etc/apt/sources.list.d/plex.list &> /dev/null
G_AGUP
} elif (( $index == 52 )) {
rm -R /etc/cuberite
rm /etc/systemd/system/cuberite.service
} elif (( $index == 53 )) {
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 (( $index == 49 )) {
rm -R /etc/gogs
rm /etc/systemd/system/gogs.service
rm /var/log/gogs_daemon.log
rm /var/log/gogs.log
systemctl start mysql
mysqladmin drop gogs -f
mysql -e "drop user gogs@localhost"
} elif (( $index == 46 )) {
G_AGP qbittorrent-nox
rm /etc/systemd/system/qbittorrent.service
rm -R "$HOME"/.config/qBittorrent
} elif (( $index == 50 )) {
rm -R /etc/syncthing
rm /usr/bin/syncthing &> /dev/null # DietPi v158 <=
rm /etc/systemd/system/syncthing.service
rm -R "$G_FP_DIETPI_USERDATA"/syncthing
} elif (( $index == 116 )) {
rm /etc/systemd/system/sickrage.service
rm -R /etc/sickrage
} elif (( $index == 107 )) {
G_AGP rtorrent
rm -R /var/www/rutorrent
rm "$HOME"/.rtorrent.rc
rm /etc/systemd/system/rtorrent.service
# - webserver rutorrent user/pw settings
rm /etc/.rutorrent-htaccess
# lighttpd
#Remove from
#RUTORRENT_DIETPI to #RUTORRENT_DIETPI in /etc/lighttpd/lighttpd.conf
# nginx
rm /etc/nginx/sites-dietpi/rutorrent.config
# apache2
rm /etc/apache2/sites-available/rutorrent.conf
} elif (( $index == 108 )) {
rm -R /etc/amiberry
rm /etc/systemd/system/amiberry.service
rm /etc/systemd/system/amiberry-sdl2.service
#Disable autostart, revert boot index to console
/DietPi/dietpi/dietpi-autostart 0
} elif (( $index == 112 )) {
rm "$G_FP_DIETPI_USERDATA"/dxx-rebirth/*
rm -R "$G_FP_DIETPI_USERDATA"/dxx-rebirth/descent_1_game
rm -R "$G_FP_DIETPI_USERDATA"/dxx-rebirth/descent_2_game
#Remove symlinks
rm "$HOME"/.d1x-rebirth
rm "$HOME"/.d2x-rebirth
rm "$HOME"/Desktop/dxx-rebirth.desktop
rm /usr/share/applications/dxx-rebirth.desktop
} elif (( $index == 113 )) {
#apt-mark auto libgnome-keyring0 libnspr4 libnss3 libnss3-1d libspeechd2 libxslt1.1 libxss1 xdg-utils libgnome-keyring-common libltdl7 &> /dev/null
apt-mark unhold chromium chromedriver
rm /etc/chromium.d/custom_flags
rm "$HOME"/.chromium-browser.init
(( $G_DISTRO >=4 )) && G_AGP chromium* || G_RUN_CMD dpkg -P chromium chromedriver
} elif (( $index == 157)) {
# Remove installationof HA.
rm -R /srv/homeassistant
# Remove the user and all files. This removed pyenv for this user as well.
userdel -r -f homeassistant
groupdel homeassistant
# Remove the service.
rm /etc/systemd/system/home-assistant.service
} elif (( $index == 165 )) {
# Delete systemd files
rm /etc/systemd/system/gitea.service
# Delete data
rm -R "$G_FP_DIETPI_USERDATA"/gitea
rm -R /var/log/gitea
# drop/delete database
systemctl start mysql
mysqladmin drop gitea -f
mysql -e "drop user gitea@localhost"
} elif (( $index == 166 )) {
rm /etc/systemd/system/pi-spc.service
rm -R /var/lib/dietpi/dietpi-software/installed/pi-spc
} elif (( $index == 167 )) {
G_AGP raspotify
rm /etc/apt/sources.list.d/raspotify.list
G_AGUP
} elif (( $index == 168 )) {
echo -e "pending"
} elif (( $index == 169 )) {
rm -R "$G_FP_DIETPI_USERDATA"/voice-recognizer-raspi
rm /etc/systemd/system/voice-recognizer.service
rm /etc/systemd/system/alsa-init.service
rm -R /home/dietpi/assistant.json
} elif (( $index == 170 )) {
Reset_NTPD
G_AGP ntp
} elif (( $index == 158 )) {
# Remove service
systemctl stop minio.service
systemctl disable minio.service
# Remove files
rm /usr/local/bin/minio
rm /etc/systemd/system/minio.service
rm /etc/default/minio
# Remove userdel
userdel -r -f minio-user
} elif (( $index == 161 )) {
/etc/init.d/bdd stop
sleep 2
killall --user bd
sleep 2
rm /etc/rc3.d/S99bdd
rm /etc/rc4.d/S99bdd
rm /etc/rc2.d/S99bdd
rm /etc/rc5.d/S99bdd
rm /etc/init.d/bdd
userdel -r bd
} elif (( $index == 162 )) {
if (( $G_HW_ARCH == 10 )) {
# remove docker and all its unused dependencies - x86_64 package name is different
G_AGP docker-ce
} else {
# remove docker and all its unused dependencies - ARM package name
G_AGP docker-engine
}
# delete data files - dietpi
rm -r "$G_FP_DIETPI_USERDATA"/docker-data
# remove default unused folder
rm -r /var/lib/docker
} elif (( $index == 164 )) {
# Remove Service file
rm /etc/systemd/system/nukkit.service
# remove nukkit java file/folder
rm -r /usr/local/bin/nukkit
} elif (( $index == 163 )) {
#apt-mark auto libupnp6 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-alsa &> /dev/null
G_RUN_CMD dpkg -P gmrender
rm /etc/systemd/system/gmrender.service
} elif (( $index == 159 || $index == 160 )) {
rm -R /var/www/allo
systemctl start mysql
mysqladmin drop allo_db -f
mysql -e "drop user allo_db@localhost"
#----------------------------------------------------------------------
#LINUX SOFTWARE
} elif (( $index == 15 )) {
G_AGP tcpdump
} elif (( $index == 14 )) {
G_AGP nload
} elif (( $index == 13 )) {
G_AGP mtr-tiny
} elif (( $index == 11 )) {
G_AGP iptraf
} elif (( $index == 10 )) {
G_AGP iftop
} elif (( $index == 19 )) {
G_AGP jed
} elif (( $index == 3 )) {
G_AGP mc
} elif (( $index == 18 )) {
G_AGP emacs
} elif (( $index == 20 || $i == 21 )) {
G_AGP vim vim-tiny
} elif (( $index == 127 )) {
G_AGP neovim
} elif (( $index == 0 )) {
#This also removes OpenSSH server. So lets check OpenSSH server isnt installed before hand.
if (( $(dpkg -l | grep -ci -m1 'openssh-server') == 0 )) {
G_AGP openssh-client
}
} elif (( $index == 1 )) {
umount -f /mnt/samba
G_AGP smbclient
#Disable in fstab
sed -i '/\/mnt\/samba/c\#\/mnt\/samba . Please use dietpi-config and the Networking Options: NAS 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 and select the Networking Options: NAS/Misc menu" > /mnt/samba/readme.txt
} elif (( $index == 111 )) {
G_RUN_CMD dpkg -P urbackup-server
#+sourcebuild
rm /etc/systemd/system/urbackupsrv.service
rm /etc/default/urbackupsrv
rm /etc/logrotate.d/urbackupsrv
rm /usr/sbin/urbackupsrv
rm /usr/bin/urbackup_snapshot_helper
rm /usr/bin/urbackupsrv
rm -R /usr/share/urbackup
} elif (( $index == 110 )) {
umount -f /mnt/nfs_client
#nfs-kernel-server depends on nfs-common
if (( ${aSOFTWARE_INSTALL_STATE[109]} == 0 )) {
G_AGP nfs-common
}
#Disable in fstab
sed -i '/\/mnt\/nfs_client/c\#\/mnt\/nfs_client . Please use dietpi-config and the Networking Options: NAS menu to setup this mount' /etc/fstab
#Add info file for installation method.
echo -e "NFS client can be installed and setup by DietPi-Config.\nSimply run: dietpi-config and select the Networking Options: NAS/Misc menu" > /mnt/nfs_client/readme.txt
} elif (( $index == 16 )) {
G_AGP build-essential
} elif (( $index == 17 )) {
G_AGP git
} elif (( $index == 5 )) {
G_AGP alsa-utils
} elif (( $index == 6 )) {
#apt-mark auto aml-libs-odroid mali450-odroid xf86-video-mali-odroid libump* xf86-video-fbturbo* firmware-samsung xf86-video-armsoc-odroid malit628-odroid &> /dev/null
G_AGP xcompmgr xterm xinit xauth xserver-xorg dbus-x11 xfonts-base x11-xserver-utils x11-common x11-utils
rm /etc/xdg/autostart/xcompmgr.desktop /etc/X11/xorg.conf &> /dev/null
} elif (( $index == 2 )) {
umount -f /mnt/ftp_client
G_AGP curlftpfs
#Disable in fstab
sed -i '/\/mnt\/ftp_client/c\#\/mnt\/ftp_client . Please use dietpi-config and the Networking Options: NAS 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 and select the Networking Options: NAS/Misc menu" > /mnt/ftp_client/readme.txt
} elif (( $index == 7 )) {
G_AGP ffmpeg
# + RPi, use dpkg -P as packages were installed via dpkg -i and APT can produce error/terminate dietpi-software:
# https://github.com/Fourdee/DietPi/issues/1352#issuecomment-354552622
(( $G_HW_MODEL < 10 )) && G_RUN_CMD dpkg -P libx264 libmp3lame libfdk-aac
} elif (( $index == 8 )) {
G_AGP openjdk-8-jdk
rm /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk &> /dev/null
} elif (( $index == 104 )) {
G_AGP dropbear* #stretch | dropbear-initramfs dropbear-run
} elif (( $index == 105 )) {
G_AGP openssh-*
# This also clears Openssh-client
setvar aSOFTWARE_INSTALL_STATE[0]=0
} elif (( $index == 103 )) {
sed -i '/\/var\/log/c\#\/var\/log DietPi Ramlog Disabled' /etc/fstab
} elif (( $index == 101 )) {
G_AGP logrotate
} elif (( $index == 102 )) {
G_AGP rsyslog
} elif (( $index == 9 )) {
G_AGP nodejs
# - old install via repo
if test -f /etc/apt/sources.list.d/nodesource_nodejs.list {
rm /etc/apt/sources.list.d/nodesource_nodejs.list
G_AGUP
}
rm /usr/local/bin/node
} elif (( $index == 4 )) {
G_AGP vifm
} else {
G_DIETPI-NOTIFY 2 "Software index $index is unknown, or, has no removal code."
setvar valid_input = '0'
}
#----------------------------------------------------------------------
#log to .uninstalled file
if test ! -f /DietPi/dietpi/.uninstalled {
echo -e "DietPi Uninstall Software Log\n----------------------\n" > /DietPi/dietpi/.uninstalled
}
echo -e "$index | $(date)" >> /DietPi/dietpi/.uninstalled
#Update array installed state
setvar aSOFTWARE_INSTALL_STATE[$index]=0
#----------------------------------------------------------------------
#Reset error handler (eg: for usermsg clear)
G_ERROR_HANDLER_RESET
#----------------------------------------------------------------------
}
proc Uninstall_Software_Finalize {
#Purge
G_DIETPI-NOTIFY 3 DietPi-Software "Removing packages that are no longer required"
apt-get autoremove --purge -y
#Check if we need to clear DietPi choices
local fp_temp='/tmp/.dietpi-uninstall_dpkg'
dpkg --get-selections | awk '{print $1}' > "$fp_temp"
if (( ! $(grep -ci -m1 '^openssh-server' "$fp_temp") &&
! $(grep -ci -m1 '^dropbear' "$fp_temp") )) {
setvar INDEX_SSHSERVER_CURRENT = '0'
setvar INDEX_SSHSERVER_TARGET = '0'
}
if (( ! $(grep -ci -m1 '^samba$' "$fp_temp") &&
! $(grep -ci -m1 '^proftpd-basic' "$fp_temp") )) {
setvar INDEX_FILESERVER_CURRENT = '0'
setvar INDEX_FILESERVER_TARGET = '0'
}
if (( $(grep -ci -m1 '#/var/log' /etc/fstab) &&
! $(grep -ci -m1 '^rsyslog' "$fp_temp") &&
! $(grep -ci -m1 '^logrotate' "$fp_temp") )) {
setvar INDEX_LOGGING_CURRENT = '0'
setvar INDEX_LOGGING_TARGET = '0'
}
rm $fp_temp
systemctl daemon-reload
}
proc Run_Installations {
#------------------------------------------------------------
#Abort if time sync is incomplete
Check_NTPD_Status
#------------------------------------------------------------
#Disable powersaving on Main screen during installation
setterm -blank 0 -powersave off 2> /dev/null
#------------------------------------------------------------
# Unmask all services: https://github.com/Fourdee/DietPi/issues/1320
/DietPi/dietpi/dietpi-services unmask all
# Stop Services
/DietPi/dietpi/dietpi-services stop
#------------------------------------------------------------
#Generate Swapfile during 1st run (moved from boot: https://github.com/Fourdee/DietPi/issues/1270#issue-278797206)
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
/DietPi/dietpi/func/dietpi-set_dphys-swapfile $(grep -m1 '^AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/.*=//')
}
#------------------------------------------------------------
#Generate userdata folders:
Create_UserContent_Folders
#------------------------------------------------------------
#Set current path to home folder
cd $HOME
#Update Apt
Banner_Apt_Update
#Always clean and update apt, before running installs.
apt-get clean
G_AGUP
#Simluated apt installation to check for failures related to apt-cache.
G_DIETPI-NOTIFY 2 "Running apt simulation to check for errors, please wait..."
local package_to_test='bash-doc'
G_AGI $package_to_test -s
#Upgrade Apt
Banner_Setup
Banner_Apt_Update
G_AGUG
#Generate dir for dietpi-software installed "non-service" based control scripts
mkdir -p /var/lib/dietpi/dietpi-software/services
chmod -R +x /var/lib/dietpi/dietpi-software/services
#Disable software installation, if user input is required for automated installs
Install_Disable_Requires_UserInput
#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
/DietPi/dietpi/dietpi-services stop
Install_Linux_Software
#Install DietPi Optimized Software
/DietPi/dietpi/dietpi-services stop
Install_Dietpi_Software
#Apply Uninstall script created by DietPi choice system
Uninstall_NonSelected_Choices
#Apply DietPi configurations and optimizations
/DietPi/dietpi/dietpi-services stop
Banner_Configs
Install_Apply_Configs
Install_Apply_Permissions &> /dev/null
#Apply autostart index
local autostart_current=$(cat /DietPi/dietpi/.dietpi-autostart_index)
/DietPi/dietpi/dietpi-autostart $autostart_current
#Disable services so DietPi-services can take control (DietPi will start all services from rc.local)
/DietPi/dietpi/dietpi-services dietpi_controlled
#Install finished, set all installed software to state 2 (installed)
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
aSOFTWARE_INSTALL_STATE[$i]=2
fi
done
#Apply GPU Memory Splits: NB, this only checks for installed state '=2'
Install_Apply_GPU_Settings
#Write to .install File
Write_InstallFileList
#DietPi-Automation
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
#Apply Timezone
if test $AUTOINSTALL_TIMEZONE != "Europe/London" {
echo -e "\nDietPi: Setting Timezone = $AUTOINSTALL_TIMEZONE"
rm /etc/timezone
rm /etc/localtime
ln -fs /usr/share/zoneinfo/$AUTOINSTALL_TIMEZONE /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
}
#Apply Language (Locale)
if test $AUTOINSTALL_LANGUAGE != "en_GB.UTF-8" {
G_DIETPI-NOTIFY 2 "Setting Locale $AUTOINSTALL_LANGUAGE. Please wait"
# Sanity, No result, revert back to default
if test -z $AUTOINSTALL_LANGUAGE {
setvar AUTOINSTALL_LANGUAGE = ''en_GB.UTF-8''
}
# - Re-apply locale + auto install en_GB.UTF-8 alongside
/DietPi/dietpi/func/dietpi-set_software locale $AUTOINSTALL_LANGUAGE
}
#Apply Keyboard
if test $AUTOINSTALL_KEYBOARD != "gb" {
G_DIETPI-NOTIFY 2 "Setting Keyboard $AUTOINSTALL_KEYBOARD. Please wait...\n"
sed -i '/XKBLAYOUT=/c XKBLAYOUT="'"$AUTOINSTALL_KEYBOARD"'"' /etc/default/keyboard
#systemctl restart keyboard-setup
}
#Apply & Mount Network drives if installed
if (( ${aSOFTWARE_INSTALL_STATE[1]} == 2 )) {
/DietPi/dietpi/func/dietpi-set_smbclient 1
}
if (( ${aSOFTWARE_INSTALL_STATE[2]} == 2 )) {
/DietPi/dietpi/func/dietpi-set_curlftpfs 1
}
#Custom 1st run Script (Local file)
local run_custom_script=0
if test -f /boot/Automation_Custom_Script.sh {
setvar INSTALL_DESCRIPTION = ''Automation - Local Custom Script''
Banner_Installing
cp /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh
setvar run_custom_script = '1'
#Custom 1st run Script (Online file)
} elif test $AUTOINSTALL_CUSTOMSCRIPTURL != "0" {
setvar INSTALL_DESCRIPTION = ''Automation - Online Custom Script''
Banner_Installing
setvar INSTALL_URL_ADDRESS = "$AUTOINSTALL_CUSTOMSCRIPTURL"
G_CHECK_URL $INSTALL_URL_ADDRESS
#Install
if (( $? == 0 )) {
#Get script and execute
wget $INSTALL_URL_ADDRESS -O /root/AUTO_CustomScript.sh
setvar run_custom_script = '1'
} else {
echo -e "Automated Custom Script URL Error:\n $AUTOINSTALL_CUSTOMSCRIPTURL is offline and/or unreachable" >> "$FP_DIETPIAUTOMATION_LOG"
}
}
if (( $run_custom_script )) {
chmod +x /root/AUTO_CustomScript.sh
/root/AUTO_CustomScript.sh
local result=$?
if (( $result == 0 )) {
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"
}
}
#Apply AutoStart
/DietPi/dietpi/dietpi-autostart $AUTOINSTALL_AUTOSTARTTARGET
}
#Set Install Stage to Finished
echo 1 > /DietPi/dietpi/.install_stage
}
#/////////////////////////////////////////////////////////////////////////////////////
# First Run / Automation functions Vars (eg: on a fresh install)
#/////////////////////////////////////////////////////////////////////////////////////
setvar AUTOINSTALL_ENABLED = '0'
setvar AUTOINSTALL_SSHINDEX = '0'
setvar AUTOINSTALL_FILESERVERINDEX = '0'
setvar AUTOINSTALL_LOGGINGINDEX = '0'
setvar AUTOINSTALL_WEBSERVERINDEX = '0'
setvar AUTOINSTALL_AUTOSTARTTARGET = '0'
setvar AUTOINSTALL_TIMEZONE = '0'
setvar AUTOINSTALL_LANGUAGE = '0'
setvar AUTOINSTALL_KEYBOARD = '0'
setvar AUTOINSTALL_CUSTOMSCRIPTURL = '0'
proc FirstRun_Automation_Init {
#Get settings
setvar AUTOINSTALL_ENABLED = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_AUTOMATED=' | sed 's/.*=//')
setvar AUTOINSTALL_AUTOSTARTTARGET = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_AUTOSTART_TARGET_INDEX=' | sed 's/.*=//' )
setvar AUTOINSTALL_SSHINDEX = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_SSH_SERVER_INDEX=' | sed 's/.*=//')
setvar AUTOINSTALL_FILESERVERINDEX = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_FILE_SERVER_INDEX=' | sed 's/.*=//')
setvar AUTOINSTALL_LOGGINGINDEX = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_LOGGING_INDEX=' | sed 's/.*=//')
setvar AUTOINSTALL_WEBSERVERINDEX = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_WEB_SERVER_INDEX=' | sed 's/.*=//')
setvar AUTOINSTALL_TIMEZONE = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_TIMEZONE=' | sed 's/.*=//' )
setvar AUTOINSTALL_LANGUAGE = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_LOCALE=' | sed 's/.*=//' )
setvar AUTOINSTALL_KEYBOARD = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_KEYBOARD_LAYOUT=' | sed 's/.*=//' )
setvar AUTOINSTALL_CUSTOMSCRIPTURL = $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_SETUP_CUSTOM_SCRIPT_EXEC=' | sed 's/AUTO_SETUP_CUSTOM_SCRIPT_EXEC=//')
}
proc FirstRun_Automation_Set {
#Automated install
if (( $AUTOINSTALL_ENABLED >= 1 )) {
G_DIETPI-NOTIFY 3 DietPi-Software "Running automated installation"
#Skip dietpi-software menu
setvar TARGETMENUID = '-1'
#Set start install
setvar GOSTARTINSTALL = '1'
#Find all software entires of AUTO_SETUP_INSTALL_SOFTWARE_ID= in dietpi.txt. Then set to state 1 for installation.
while read -r line
{
local index=$( echo -e "$line" | grep '^AUTO_SETUP_INSTALL_SOFTWARE_ID=' | sed 's/[^0-9]*//g' )
# - Flag for installation
if [[ $index =~ ^-?[0-9]+$ ]] {
setvar aSOFTWARE_INSTALL_STATE[$index]=1
G_DIETPI-NOTIFY 2 "Automation: ${aSOFTWARE_WHIP_NAME[$index]}. Flagged for installation."
}
} < /DietPi/dietpi.txt
}
#Further Automated options. (Applied regardless of AUTOINSTALL_ENABLED)
setvar INDEX_SSHSERVER_TARGET = "$AUTOINSTALL_SSHINDEX"
setvar INDEX_FILESERVER_TARGET = "$AUTOINSTALL_FILESERVERINDEX"
setvar INDEX_LOGGING_TARGET = "$AUTOINSTALL_LOGGINGINDEX"
setvar INDEX_WEBSERVER_TARGET = "$AUTOINSTALL_WEBSERVERINDEX"
# - IPversion preference: https://github.com/Fourdee/DietPi/issues/472
/DietPi/dietpi/func/dietpi-set_hardware preferipversion $(cat /DietPi/dietpi.txt | grep -m1 '^CONFIG_PREFER_IPVERSION=' | sed 's/.*=//')
}
proc 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
#Update APT
G_AGUP
#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 )) {
#Update .update_stage file to completed
echo 1 > /DietPi/dietpi/.update_stage
#Prompt user for reboot
if (( $G_USER_INPUTS )) {
setvar 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
}
#Reboot required NOW
reboot
Exit_Destroy
}
}
#/////////////////////////////////////////////////////////////////////////////////////
# Internet Connection Test Vars
#/////////////////////////////////////////////////////////////////////////////////////
#Use /etc/apt/sources.list for connection test
setvar INTERNET_URL_TEST = $(grep -m1 'deb ' /etc/apt/sources.list | awk '{print $2}')
proc Check_Internet_Connection {
G_CHECK_URL $INTERNET_URL_TEST #will exit on failure here
}
#/////////////////////////////////////////////////////////////////////////////////////
# Globals
#/////////////////////////////////////////////////////////////////////////////////////
proc Input_Modes {
# - Skip menu
setvar TARGETMENUID = '-1'
setvar DISABLE_REBOOT = '1'
local ainput=("$@")
#Install software and exit.
if test $1 = "install" || test $1 = "reinstall" || test $1 = "uninstall" {
G_DIETPI-NOTIFY 3 DietPi-Software "Automated $1"
sleep 1
# - Make sure we have at least one entry
if test -z $2 {
G_DIETPI-NOTIFY 1 "Please enter a software index ID, or, choice system INDEX_*_TARGET=-?"
} else {
# - Uninstall | Stop services prior
if test $1 = "uninstall" {
# - stop services
/DietPi/dietpi/dietpi-services stop
}
# - Process inputs
for i in "${ainput[@]}"
{
#Valid int means input is unique ID for software index to be installed
if [[ $i =~ ^-?[0-9]+$ ]] {
if test $1 = "uninstall" {
Uninstall_Software $i
} elif test $1 = "reinstall" {
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )) {
# - We cant uninstall, may remove additional packages. eg: remove Xserver = Remove every Xserver depandant program like Kodi.
#Uninstall_Software $i
# - So lets flag to be installed
setvar aSOFTWARE_INSTALL_STATE[$i]=1
setvar GOSTARTINSTALL = '1'
G_DIETPI-NOTIFY 0 "Reinstalling ${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}"
sleep 1
} else {
G_DIETPI-NOTIFY 2 "$i: ${aSOFTWARE_WHIP_NAME[$i]} is not currently installed"
G_DIETPI-NOTIFY 2 "The program must be installed, before reinstall can be used"
G_DIETPI-NOTIFY 0 "No changes applied for: ${aSOFTWARE_WHIP_NAME[$i]}"
}
} elif test $1 = "install" {
if (( ${aSOFTWARE_INSTALL_STATE[$i]} != 2 )) {
setvar aSOFTWARE_INSTALL_STATE[$i]=1
setvar GOSTARTINSTALL = '1'
G_DIETPI-NOTIFY 0 "Installing ${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}"
sleep 0.5
} else {
G_DIETPI-NOTIFY 2 "$i: ${aSOFTWARE_WHIP_NAME[$i]} is already installed"
G_DIETPI-NOTIFY 0 "No changes applied for: ${aSOFTWARE_WHIP_NAME[$i]}"
}
}
}
}
# - Uninstall | Finish up and clear non-required packages
if test $1 = "uninstall" {
Uninstall_Software_Finalize
#Save
Write_InstallFileList
# - Start services
/DietPi/dietpi/dietpi-services start
}
}
#Apply permissions
} elif test $1 = "setpermissions" {
Install_Apply_Permissions &> /dev/null
G_DIETPI-NOTIFY 0 "Set permissions completed"
#List unique software names and ID's
} elif test $1 = "list" {
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
local string=''
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 2 )); then
string="\e[32mID $i | "
else
string="\e[0mID $i | "
fi
string+="=${aSOFTWARE_INSTALL_STATE[$i]} | ${aSOFTWARE_WHIP_NAME[$i]}: \e[90m${aSOFTWARE_WHIP_DESC[$i]}\e[0m |"
if (( ${aSOFTWARE_REQUIRES_ALSA[$i]} == 1 )); then
string+=' +ALSA'
fi
if (( ${aSOFTWARE_REQUIRES_XSERVERXORG[$i]} == 1 )); then
string+=' +XSERVER'
fi
if (( ${aSOFTWARE_REQUIRES_DESKTOP[$i]} == 1 )); then
string+=' +DESKTOP'
fi
if (( ${aSOFTWARE_REQUIRES_RSYSLOG[$i]} == 1 )); then
string+=' +RSYSLOG'
fi
if (( ${aSOFTWARE_REQUIRES_FFMPEG[$i]} == 1 )); then
string+=' +FFMPEG'
fi
if (( ${aSOFTWARE_REQUIRES_ORACLEJAVA[$i]} == 1 )); then
string+=' +ORACLEJAVA'
fi
if (( ${aSOFTWARE_REQUIRES_NODEJS[$i]} == 1 )); then
string+=' +NODEJS'
fi
if (( ${aSOFTWARE_REQUIRES_BUILDESSENTIAL[$i]} == 1 )); then
string+=' +BUILDESSENTIAL'
fi
if (( ${aSOFTWARE_REQUIRES_GIT[$i]} == 1 )); then
string+=' +GIT'
fi
if (( ${aSOFTWARE_REQUIRES_WEBSERVER[$i]} == 1 )); then
string+=' +WEBSERVER'
fi
if (( ${aSOFTWARE_REQUIRES_MYSQL[$i]} == 1 )); then
string+=' +MYSQL'
fi
if (( ${aSOFTWARE_REQUIRES_SQLITE[$i]} == 1 )); then
string+=' +SQLITE'
fi
# - Available for G_HW_ARCH?
if (( ! ${aSOFTWARE_AVAIL_G_HW_ARCH[$i,$G_HW_ARCH]} )); then
string+=" \e[31mDISABLED for G_HW_ARCH\e[0m"
fi
# - Available for G_HW_MODEL?
if (( ! ${aSOFTWARE_AVAIL_G_HW_MODEL[$i,$G_HW_MODEL]} )); then
string+=" \e[31mDISABLED for G_HW_MODEL\e[0m"
fi
# - Online docs
if [ -n "${aSOFTWARE_ONLINEDOC_URL[$i]}" ]; then
string+=" | \e[90m$FP_ONLINEDOC_URL${aSOFTWARE_ONLINEDOC_URL[$i]}\e[0m"
fi
#Convert string to lowercase (easier to | grep stuff)
echo -e "${string,,}" #Much faster than echo -e $(echo -e "$string" | tr '[:upper:]' '[:lower:]')
done
echo -e "Total Software index HARD limit : $TOTAL_SOFTWARE_INDEXS_HARDLIMIT"
echo -e "Total Software index Current : $TOTAL_SOFTWARE_INDEXS"
#List unique software names and ID's
} elif test $1 = "weblist_export" {
local fp_export_dir='/tmp/dietpi-software/weblist_export'
rm -R $fp_export_dir
mkdir -p $fp_export_dir
# - Category desc | Remove '─' before saving.
local fp_target="$fp_export_dir/category_dietpi_total"
echo -e $MAX_SOFTWARE_CATEGORIES_DIETPI > "$fp_target"
local fp_target="$fp_export_dir/category_linux_total"
echo -e $MAX_SOFTWARE_CATEGORIES_LINUX > "$fp_target"
setvar fp_target = ""$fp_export_dir/category_dietpi_desc""
for ((i=0; i<$MAX_SOFTWARE_CATEGORIES_DIETPI; i++))
do
local output=
echo -e "$( echo ${aSOFTWARE_CATEGORIES_DIETPI[$i]} | sed 's/─//g')" >> "$fp_target"
done
setvar fp_target = ""$fp_export_dir/category_linux_desc""
for ((i=0; i<$MAX_SOFTWARE_CATEGORIES_LINUX; i++))
do
echo -e "$( echo ${aSOFTWARE_CATEGORIES_LINUX[$i]} | sed 's/─//g')" >> "$fp_target"
done
# - Software list
local fp_target="$fp_export_dir/total_software_index"
echo -e $TOTAL_SOFTWARE_INDEXS > "$fp_target"
setvar fp_target = ""$fp_export_dir/software_installed_state""
printf "%i\n" ${aSOFTWARE_INSTALL_STATE[@]} > "$fp_target"
setvar fp_target = ""$fp_export_dir/software_name""
printf "%s\n" ${aSOFTWARE_WHIP_NAME[@]} > "$fp_target"
setvar fp_target = ""$fp_export_dir/software_desc""
printf "%s\n" ${aSOFTWARE_WHIP_DESC[@]} > "$fp_target"
setvar fp_target = ""$fp_export_dir/category_index""
printf "%i\n" ${aSOFTWARE_CATEGORY_INDEX[@]} > "$fp_target"
setvar fp_target = ""$fp_export_dir/software_urldocs""
printf "%s\n" ${aSOFTWARE_ONLINEDOC_URL[@]} > "$fp_target"
# - Available for device?
setvar fp_target = ""$fp_export_dir/software_available_hw_model""
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
printf "%i\n" "${aSOFTWARE_AVAIL_G_HW_MODEL[$i,$G_HW_MODEL]}" >> "$fp_target"
done
setvar fp_target = ""$fp_export_dir/software_available_hw_arch""
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
printf "%i\n" "${aSOFTWARE_AVAIL_G_HW_ARCH[$i,$G_HW_ARCH]}" >> "$fp_target"
done
# - Flagged Prereqs for installation
# fp_target="$fp_export_dir/installs_alsa"
# printf "%s\n" "${aSOFTWARE_REQUIRES_ALSA[@]}" > "$fp_target"
# fp_target="$fp_export_dir/installs_xserver"
# printf "%s\n" "${aSOFTWARE_REQUIRES_XSERVERXORG[@]}" > "$fp_target"
# fp_target="$fp_export_dir/installs_desktop"
# printf "%s\n" "${aSOFTWARE_REQUIRES_DESKTOP[@]}" > "$fp_target"
} else {
G_DIETPI-NOTIFY 2 "Unknown command $1"
}
unset ainput
}
proc Exit_Destroy {
Software_Arrays_Destroy
exit
}
#/////////////////////////////////////////////////////////////////////////////////////
# Error Functions
#/////////////////////////////////////////////////////////////////////////////////////
setvar ERROR_TEXT = """"
proc Error_Display {
#Automation | Save to logfile
if (( $G_USER_INPUTS )) {
whiptail --title "Error" --msgbox $ERROR_TEXT 18 70
} else {
echo -e "Error: $ERROR_TEXT" >> "$FP_DIETPIAUTOMATION_LOG"
}
}
#/////////////////////////////////////////////////////////////////////////////////////
# Whip menus
#/////////////////////////////////////////////////////////////////////////////////////
setvar WHIP_BACKTITLE = ''DietPi-Software''
setvar WHIP_TITLE = '0'
setvar WHIP_QUESTION = '0'
setvar MENU_MAIN_LASTITEM = ''Help!''
setvar TARGETMENUID = '0'
proc Menu_CreateSoftwareList {
#software type for this menu
local software_type=$1 #0=dietpi 1=linux
local max_categories=$MAX_SOFTWARE_CATEGORIES_DIETPI
if (( $1 == 1 )) {
setvar max_categories = "$MAX_SOFTWARE_CATEGORIES_LINUX"
}
#-----------------------------------------------------------------------------
#Generate Whiptail menu list based on category
local whiptail_list=()
for ((i=0; i<$max_categories; i++))
do
#Only add the category if we have software for it.
local category_enabled=0
#Now run through all available software
for ((j=0; j<$TOTAL_SOFTWARE_INDEXS; j++))
do
#Check if this software matches the current category and sofware type for this menu.
# - I originally had "aSOFTWARE_AVAIL_G_HW_MODEL" and "aSOFTWARE_AVAIL_G_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
# + is available for hardware?
# + is available for distro?
if (( ${aSOFTWARE_AVAIL_G_HW_MODEL[$j,$G_HW_MODEL]} &&
${aSOFTWARE_AVAIL_G_HW_ARCH[$j,$G_HW_ARCH]} )); then
local selected="off"
if (( ${aSOFTWARE_INSTALL_STATE[$j]} > 0 )); then
selected="on"
if (( ${aSOFTWARE_INSTALL_STATE[$j]} == 1 )); then
#Reset to 0. Menu checklists will apply back to 1
aSOFTWARE_INSTALL_STATE[$j]=0
fi
fi
#Add category
if (( $category_enabled == 0 )); then
# - dietpi
if (( $1 == 0 )); then
whiptail_list+=("" "${aSOFTWARE_CATEGORIES_DIETPI[$i]}" "off")
# - linux
elif (( $1 == 1 )); then
whiptail_list+=("" "${aSOFTWARE_CATEGORIES_LINUX[$i]}" "off")
fi
category_enabled=1
fi
#Add this option to whiptail list
whiptail_list+=("$j" "${aSOFTWARE_WHIP_NAME[$j]}: ${aSOFTWARE_WHIP_DESC[$j]}" "$selected")
fi
fi
done
done
#-----------------------------------------------------------------------------
setvar WHIP_TITLE = ''DietPi 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_BACKTITLE 22 78 14 ${whiptail_list[@]} 2>/tmp/dietpi-software_results
#delete[]
unset whiptail_list
#Reset Choices made flag
# - dietpi
if (( $1 == 0 )) {
setvar INSTALL_DIETPI_CHOICESMADE = '0'
# - linux
} elif (( $1 == 1 )) {
setvar INSTALL_LINUX_CHOICESMADE = '0'
}
#Check for matching results (selected items)
while read choice
{
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
#enable
if (( $choice == $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
fi
aSOFTWARE_INSTALL_STATE[$i]=1
break
fi
done
} < /tmp/dietpi-software_results
rm /tmp/dietpi-software_results &> /dev/null
}
proc Menu_Main {
#Data for storing SSH server index info
local index_sshserver_text="None"
if (( $INDEX_SSHSERVER_TARGET == -1 )) {
setvar index_sshserver_text = ""Dropbear""
} elif (( $INDEX_SSHSERVER_TARGET == -2 )) {
setvar index_sshserver_text = ""OpenSSH""
}
#Data for storing Fileserver index info
local index_fileserver_text="None"
if (( $INDEX_FILESERVER_TARGET == -1 )) {
setvar index_fileserver_text = ""ProFTP""
} elif (( $INDEX_FILESERVER_TARGET == -2 )) {
setvar index_fileserver_text = ""Samba""
}
#Data for storing Logging index info
local index_logging_text="None"
if (( $INDEX_LOGGING_TARGET == -1 )) {
setvar index_logging_text = ""DietPi-Ramlog #1""
} elif (( $INDEX_LOGGING_TARGET == -2 )) {
setvar index_logging_text = ""DietPi-Ramlog #2""
} elif (( $INDEX_LOGGING_TARGET == -3 )) {
setvar index_logging_text = ""Full""
}
#Hold our string that tells the user what software will be removed when using Index based choice systems
local toberemoved_text=''
#Check status of USB drive
Check_USB_Drive_Installed
#Where is userdata stored?
local user_data_location_current=$(readlink -f $G_FP_DIETPI_USERDATA)
local user_data_location_description=''
if test $user_data_location_current = $FP_DIETPI_DEDICATED_USBDRIVE {
setvar user_data_location_description = ""USB Drive | $user_data_location_current""
} elif test $user_data_location_current = $G_FP_DIETPI_USERDATA {
setvar user_data_location_description = ""SD/EMMC | $user_data_location_current""
} else {
setvar user_data_location_description = ""Custom | $user_data_location_current""
}
# - Webserver preference system
local index_webserver_text='Apache2'
if (( $INDEX_WEBSERVER_TARGET == -1 )) {
setvar index_webserver_text = ''Nginx''
} elif (( $INDEX_WEBSERVER_TARGET == -2 )) {
setvar index_webserver_text = ''Lighttpd''
}
setvar WHIP_TITLE = ''DietPi-Software''
setvar WHIP_BACKTITLE = ""DietPi-Software | IP: $(sed -n 4p /DietPi/dietpi/.network) | Device: $G_HW_MODEL_DESCRIPTION""
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "" --default-item "$MENU_MAIN_LASTITEM" --cancel-button "Exit" 20 100 13 \
"Help!" "Links to online guides, docs and information" \
"DietPi-Config" "Feature-rich configuration tool for your device" \
"" "─── Select Software ─────────────────────────" \
"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_location_description" \
"" "─── Install or Remove Software ──────────────" \
"Uninstall" "Select installed software for removal" \
"Install" "Go >> Start installation for selected software" 3>&1 1>&2 2>&3)
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
setvar MENU_MAIN_LASTITEM = "$OPTION"
case (OPTION) {
"Uninstall" {
setvar TARGETMENUID = '3'
}
"Software Optimized" {
setvar TARGETMENUID = '1'
}
"Software Additional"* {
setvar TARGETMENUID = '2'
}
"SSH Server" {
setvar WHIP_TITLE = ''SSH Server Choices''
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --menu "> None\nSelecting this option will uninstall all SSH servers. This reduces system resources and improves performance. Useful for users who do NOT require networked/remote terminal access.\n\n> Dropbear (Recommended)\nLightweight SSH server, installed by default on DietPi systems.\n\n> OpenSSH\nA feature rich SSH server with SFTP/SCP support, at the cost of increased resource usage." --cancel-button "Back" --default-item "$index_sshserver_text" 21 75 3 \
"None" "Not required / manual setup." \
"Dropbear" "Lightweight SSH Server (Recommended)." \
"OpenSSH" "Feature Rich SSH Server with SFTP/SCP support." 3>&1 1>&2 2>&3)
#Assign target index
if test $OPTION = "None" {
setvar INDEX_SSHSERVER_TARGET = '0'
setvar toberemoved_text = ""Dropbear and OpenSSH Server""
} elif test $OPTION = "Dropbear" {
setvar INDEX_SSHSERVER_TARGET = '-1'
setvar toberemoved_text = ""OpenSSH Server""
} elif test $OPTION = "OpenSSH" {
setvar INDEX_SSHSERVER_TARGET = '-2'
setvar toberemoved_text = ""Dropbear""
#Reset to current
} else {
setvar INDEX_SSHSERVER_TARGET = "$INDEX_SSHSERVER_CURRENT"
}
#Check for changes
setvar INSTALL_SSHSERVER_CHOICESMADE = '0'
if (( $INDEX_SSHSERVER_TARGET != $INDEX_SSHSERVER_CURRENT )) {
setvar INSTALL_SSHSERVER_CHOICESMADE = '1'
#Inform user
setvar WHIP_TITLE = ""SSH Server Change""
setvar WHIP_QUESTION = ""$OPTION has been selected:\n- Your choice will be applied when 'Install Go >> Start installation' is selected.\n- $toberemoved_text installations will be automatically uninstalled.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 75
}
}
"File Server" {
setvar WHIP_TITLE = ''Fileserver Choices''
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --menu "> None\nSelect this option if you do NOT require a method of accessing files and folders on this device, over a network.\n\n> ProFTP (Recommended for RPi v1)\nAllows you to access/share files on this device efficiently with minimal cpu usage. Uses FTP protocol.\n\n> Samba (Recommended for RPi v2)\nAllows you to easily access/share files on this device, at the cost of higher cpu usage.\n\nMore info: http://dietpi.com/phpbb/viewtopic.php?f=8&t=15#p19" --cancel-button "Back" --default-item "$index_fileserver_text" 23 75 3 \
"None" "Not required / manual setup." \
"ProFTP" "Efficient, lightweight fileserver (recommended)." \
"Samba" "Feature-rich fileserver." 3>&1 1>&2 2>&3)
#Assign target index
if test $OPTION = "None" {
setvar INDEX_FILESERVER_TARGET = '0'
setvar toberemoved_text = ""ProFTP and Samba Server""
} elif test $OPTION = "ProFTP" {
setvar INDEX_FILESERVER_TARGET = '-1'
setvar toberemoved_text = ""Samba Server""
} elif test $OPTION = "Samba" {
setvar INDEX_FILESERVER_TARGET = '-2'
setvar toberemoved_text = ""ProFTP""
#Reset to current
} else {
setvar INDEX_FILESERVER_TARGET = "$INDEX_FILESERVER_CURRENT"
}
#Check for changes
setvar INSTALL_FILESERVER_CHOICESMADE = '0'
if (( $INDEX_FILESERVER_TARGET != $INDEX_FILESERVER_CURRENT )) {
setvar INSTALL_FILESERVER_CHOICESMADE = '1'
#Inform user
setvar WHIP_TITLE = ""Fileserver Choice Change""
setvar WHIP_QUESTION = ""$OPTION has been selected:\n- Your choice will be applied when 'Install Go >> Start installation' is selected.\n- $toberemoved_text installations will be automatically uninstalled.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 75
}
}
"Log System" {
setvar WHIP_TITLE = ''Logging System Choices''
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --menu "> None\nSelecting this option will uninstall DietPi-Ramlog, Logrotate, Rsyslog.\n\n> DietPi-Ramlog #1 (Max performance)\nMounts /var/log to RAM, reducing filesystem IO. Logfiles are cleared every hour. Does NOT save logfiles to disk.\n\n> DietPi-Ramlog #2\nSame as #1, with the added feature of saving logfile contents to disk ($HOME/logfile_storage/*), before being cleared.\n\n> Full (Reduces performance)\nMounts /var/log to DISK, reduces SDcard lifespan. Full logging system with Logrotate and Rsyslog." --cancel-button "Back" --default-item "$index_logging_text" 25 75 4 \
"None" " Not required / manual setup." \
"DietPi-Ramlog #1" " Hourly clear (recommended)." \
"DietPi-Ramlog #2" " Hourly save, then clear." \
"Full" " Logrotate and Rsyslog." 3>&1 1>&2 2>&3)
#Assign target index
if test $OPTION = "None" {
setvar INDEX_LOGGING_TARGET = '0'
setvar toberemoved_text = ""DietPi-Ramlog, Logrotate, Rsyslog""
} elif test $OPTION = "DietPi-Ramlog #1" {
setvar INDEX_LOGGING_TARGET = '-1'
setvar toberemoved_text = ""Logrotate, Rsyslog""
} elif test $OPTION = "DietPi-Ramlog #2" {
setvar INDEX_LOGGING_TARGET = '-2'
setvar toberemoved_text = ""Logrotate, Rsyslog""
} elif test $OPTION = "Full" {
setvar INDEX_LOGGING_TARGET = '-3'
setvar toberemoved_text = ""DietPi-Ramlog""
#Reset to current
} else {
setvar INDEX_LOGGING_TARGET = "$INDEX_LOGGING_CURRENT"
}
#Check for changes
setvar INSTALL_LOGGING_CHOICESMADE = '0'
if (( $INDEX_LOGGING_TARGET != $INDEX_LOGGING_CURRENT )) {
setvar INSTALL_LOGGING_CHOICESMADE = '1'
#Inform user
setvar WHIP_TITLE = ""Logging System Change""
setvar WHIP_QUESTION = ""$OPTION has been selected:\n- Your choice will be applied when 'Install Go >> Start installation' is selected.\n- $toberemoved_text installations will be automatically uninstalled.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 75
}
}
"User Data Location" {
setvar WHIP_TITLE = ''User Data Location''
# - Vars if we need to move data.
local move_data_target=$user_data_location_current
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --menu "Choose where to store your user data. User data includes software such as Owncloud data store, BitTorrent downloads etc\n\nMore information on user data in DietPi:\n - http://dietpi.com/phpbb/viewtopic.php?f=8&t=478&p=2087\n\n> DietPi-Drive Manager\nLaunch DietPi-Drive Manager to setup external drives, and, move user data to different locations." --cancel-button "Back" 20 85 3 \
"Drive Manager" "Launches DietPi-Drive Manager" \
"List" "Select from a list of available mounts/drives, to move user data" \
"Custom" "Input a manual location to move user data" 3>&1 1>&2 2>&3)
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
# - DriveMan
if test $OPTION = "Drive Manager" {
/DietPi/dietpi/dietpi-drive_manager
# - List
} elif test $OPTION = "List" {
/DietPi/dietpi/dietpi-drive_manager 1
local return_value="$(cat /tmp/dietpi-drive_manager_selmnt)"
if test -n $return_value {
if test $return_value = "/" {
setvar return_value = ''/mnt''
}
setvar move_data_target = "$return_value"
setvar move_data_target = ''/dietpi_userdata''
}
# - Manual filepath entry
} elif test $OPTION = "Custom" {
setvar OPTION = $(whiptail --inputbox "Please input a location. Your user data will be stored inside this location.\n - eg: /mnt/MyDrive/MyData" 11 60 "$user_data_location_current" --title "User/Personal Data Directory" --backtitle "$WHIP_BACKTITLE" 3>&1 1>&2 2>&3)
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
setvar move_data_target = "$OPTION"
}
}
# - Move data if the new entry has changed
if test $user_data_location_current != $move_data_target {
# - Ask before we begin
whiptail --title "User data transfer" --yesno "DietPi will now attempt to transfer your existing user data to the new location:\n\n - From: $user_data_location_current\n - To: $move_data_target\n\nWould you like to begin?" --backtitle $WHIP_BACKTITLE --defaultno 14 70
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
# - Move data, setup symlinks
/DietPi/dietpi/func/dietpi-set_userdata $user_data_location_current $move_data_target
if (( $? == 0 )) {
whiptail --title "User data transfer: Completed" --msgbox "Your user data has been sucessfuly moved:\n\n - From: $user_data_location_current\n - To: $move_data_target" 12 70
} else {
whiptail --title "User data transfer: Failed" --msgbox "$(cat /var/log/dietpi-move_userdata.log)\nNo changes have been applied." 12 70
}
}
}
}
}
"Webserver Preference" {
setvar WHIP_TITLE = ''Webserver Preference''
setvar OPTION = $(whiptail --title "$WHIP_TITLE" --menu "More Info: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=1549#p1549\n\n> Apache2\nFeature-rich and popular. Recommended for beginners and users who are looking to follow Apache2 based guides.\n\n> Nginx\nLightweight alternative to Apache2. Nginx claims faster webserver performance compared to Apache2.\n\n> Lighttpd\nExtremely lightweight and is generally considered to offer the \"best\" webserver performance for SBC's. Recommended for users who expect low webserver traffic." --cancel-button "Back" --default-item "$index_webserver_text" 24 75 3 \
"Apache2" "Popular webserver." \
"Nginx" "Lightweight webserver." \
"Lighttpd" "Extremely lightweight webserver." 3>&1 1>&2 2>&3)
#Assign target index
if test $OPTION = "Apache2" {
setvar INDEX_WEBSERVER_TARGET = '0'
} elif test $OPTION = "Nginx" {
setvar INDEX_WEBSERVER_TARGET = '-1'
} elif test $OPTION = "Lighttpd" {
setvar INDEX_WEBSERVER_TARGET = '-2'
#Reset to current
} else {
setvar INDEX_WEBSERVER_TARGET = "$INDEX_WEBSERVER_CURRENT"
}
#Check for changes
if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )) {
# - Check for existing and compatible installed stacks before allowing the change
local incompatible_webserver_preference=0
local info_currently_installed_webserver='None'
if (( $(dpkg -l | awk '{print $2}' | grep -ci -m1 'apache2'))) {
setvar INDEX_WEBSERVER_CURRENT = '0'
setvar info_currently_installed_webserver = ''Apache2''
if (( $INDEX_WEBSERVER_TARGET != 0 )) {
setvar incompatible_webserver_preference = '1'
}
} elif (( $(dpkg -l | awk '{print $2}' | grep -ci -m1 'nginx') )) {
setvar INDEX_WEBSERVER_CURRENT = '-1'
setvar info_currently_installed_webserver = ''Nginx''
if (( $INDEX_WEBSERVER_TARGET != -1 )) {
setvar incompatible_webserver_preference = '1'
}
} elif (( $(dpkg -l | awk '{print $2}' | grep -ci -m1 'lighttpd') )) {
setvar INDEX_WEBSERVER_CURRENT = '-2'
setvar info_currently_installed_webserver = ''Lighttpd''
if (( $INDEX_WEBSERVER_TARGET != -2 )) {
setvar incompatible_webserver_preference = '1'
}
}
# - Reset preference selection
if (( $incompatible_webserver_preference == 1 )) {
setvar INDEX_WEBSERVER_TARGET = "$INDEX_WEBSERVER_CURRENT"
# - inform user
setvar WHIP_TITLE = ""Error: Incompatible Webserver Preference""
setvar WHIP_QUESTION = ""Unable to change your webserver preference to $OPTION.\n\nThis is due to an existing and incompatible webserver installation on your system ($info_currently_installed_webserver). Please remove all webserver based software (using dietpi-software > uninstall), before trying again.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 75
# - Apply preference selection
} else {
# - Inform user
setvar WHIP_TITLE = ""Webserver Preference Changed""
setvar WHIP_QUESTION = ""$OPTION has been selected as your webserver preference.\n\nWhen you select any software for install that requires a webserver, DietPi will automatically install your prefered choice ($OPTION).""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 75
# - NB: INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET | is applied during installation with func Apply_Webserver_Preference().
}
}
}
"DietPi-Config" {
/DietPi/dietpi/dietpi-config
}
"Help!" {
#Populate help to text file so we can read it back to whiptail, as a scrollbox.
cat <<< """ > /tmp/dietpi-software_help_onlinedoc_url_list
───────────────────────────────────────────────────────────────
Welcome to DietPi:
───────────────────────────────────────────────────────────────
Use PageUp/Down or Arrow Up/Down to scroll this help screen.
Press ESC, or TAB then enter to exit this help screen.
Easy to follow, step by step guides for installing DietPi:
http://dietpi.com/phpbb/viewtopic.php?f=8&t=9
For a list of all installation options and their details:
http://dietpi.com/software
───────────────────────────────────────────────────────────────
List of installed software and their URL links for online docs:
───────────────────────────────────────────────────────────────
"""
> /tmp/dietpi-software_help_onlinedoc_url_list
───────────────────────────────────────────────────────────────
Welcome to DietPi:
───────────────────────────────────────────────────────────────
Use PageUp/Down or Arrow Up/Down to scroll this help screen.
Press ESC, or TAB then enter to exit this help screen.
Easy to follow, step by step guides for installing DietPi:
http://dietpi.com/phpbb/viewtopic.php?f=8&t=9
For a list of all installation options and their details:
http://dietpi.com/software
───────────────────────────────────────────────────────────────
List of installed software and their URL links for online docs:
───────────────────────────────────────────────────────────────
_EOF_
# - Installed software
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_INSTALL_STATE[$i]} > 0 )); then
if [ -n "${aSOFTWARE_ONLINEDOC_URL[$i]}" ]; then
cat << _EOF_ >> /tmp/dietpi-software_help_onlinedoc_url_list
${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_NAME[$i]}
$FP_ONLINEDOC_URL${aSOFTWARE_ONLINEDOC_URL[$i]}
_EOF_
fi
fi
done
whiptail --title "DietPi - Help" --backtitle $WHIP_BACKTITLE --textbox /tmp/dietpi-software_help_onlinedoc_url_list $(( $(tput lines) - 3 )) $(( $(tput cols) - 3 )) --scrolltext
}
Install {
Menu_StartInstall
}
}
#Exit/Abort Setup
} else {
Menu_Exit
}
}
proc Menu_Exit {
#1st run install
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
setvar WHIP_TITLE = ''Exit Setup?''
setvar WHIP_QUESTION = '' DietPi has not fully been installed.\n This must be completed prior to using DietPi by selecting:\n - Go Start Install. \n \n Would you like to exit and abort the installation?''
whiptail --title $WHIP_TITLE --yesno $WHIP_QUESTION --backtitle $WHIP_BACKTITLE --yes-button "Ok" --no-button "Back" --defaultno 13 65
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
Banner_Aborted
#Exit script NOW
Exit_Destroy
} else {
#Return to Main Menu
setvar TARGETMENUID = '0'
}
#Standard exit
} elif (( $G_DIETPI_INSTALL_STAGE == 1 )) {
setvar WHIP_TITLE = ''Exit DietPi-Software?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
Banner_Aborted
#Exit script NOW
Exit_Destroy
} else {
#Return to Main Menu
setvar TARGETMENUID = '0'
}
}
}
proc Menu_ConfirmInstall {
#Obtain list of pending software installation:
local string_output=''
for ((i=0; i<$TOTAL_SOFTWARE_INDEXS; i++))
do
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 1 )); then
string_output+="\n - ${aSOFTWARE_WHIP_NAME[$i]}: ${aSOFTWARE_WHIP_DESC[$i]}"
fi
done
#Confirm Software install
setvar WHIP_TITLE = ''DietPi - Start Installation?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
#exit menu system
setvar TARGETMENUID = '-1'
#Enable installation start flag
setvar GOSTARTINSTALL = '1'
} else {
#Return to Main Menu
setvar TARGETMENUID = '0'
}
}
proc 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 )) {
# Confirm install with user
Menu_ConfirmInstall
} else {
#1st run install
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
setvar WHIP_TITLE = ''No Software Selected. Continue?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
#exit menu system
setvar TARGETMENUID = '-1'
#Enable installation start flag
setvar GOSTARTINSTALL = '1'
} else {
#Return to Main Menu
setvar TARGETMENUID = '0'
}
#Not 1st run
} elif (( $G_DIETPI_INSTALL_STAGE == 1 )) {
setvar WHIP_TITLE = ''No Changes to Software Selection''
whiptail --title $WHIP_TITLE --msgbox "No changes have been detected. Unable to start installation." 8 65
}
}
}
#TARGETMENUID=1
proc Menu_Dietpi_Software {
#-----------------------------------------------------------------------------
#Generate Whiptail menu and store results into our software arrays
Menu_CreateSoftwareList 0
#Return to Main Menu
setvar TARGETMENUID = '0'
#-----------------------------------------------------------------------------
#Install Info/Warnings
#OMV, .deb package has Nginx as a dependancy. Not compatible with other webservers
if (( ${aSOFTWARE_INSTALL_STATE[126]} == 1 &&
( ${aSOFTWARE_INSTALL_STATE[77]} == 0 && ${aSOFTWARE_INSTALL_STATE[78]} == 0 && ${aSOFTWARE_INSTALL_STATE[79]} == 0 && $INDEX_WEBSERVER_TARGET != -1 ) )) {
setvar WHIP_TITLE = ''OMV: Requires Nginx''
setvar WHIP_QUESTION = ""Open Media Vault (OMV) requires Nginx webserver and is not compatible with other web servers (eg: Lighttpd/Apache2). This is due to the OMV package listing Nginx as a dependency.\n\nOptions:\n - Change 'web server choice' to 'Nginx'\n - Uninstall current web server, then, select any Nginx web stack for install (eg: LESP)\n\nOpen Media Vault has been deselected and will not be installed.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 19 70
setvar aSOFTWARE_INSTALL_STATE[126]=0
}
#SickRage, setup for Transmission, install it aswell?
if (( ${aSOFTWARE_INSTALL_STATE[116]} == 1 &&
${aSOFTWARE_INSTALL_STATE[44]} == 0 )) {
setvar WHIP_TITLE = ''SickRage - Install Transmission?''
setvar WHIP_QUESTION = ""The DietPi SickRage installation is pre-configured to work with Transmission BitTorrent Server. This will allow SickRage to automatically download TV shows for you.\n\nNB: If you have another BitTorrent server installed, or prefer manual setup, please select No.\n\nWould you like DietPi to also install Transmission (recommended)?""
whiptail --title $WHIP_TITLE --yesno $WHIP_QUESTION --defaultno --backtitle $WHIP_BACKTITLE 14 72
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
setvar aSOFTWARE_INSTALL_STATE[44]=1
}
}
#Gogs: Requires OpenSSH for ssh-keygen binary: https://github.com/Fourdee/DietPi/issues/442
if (( ${aSOFTWARE_INSTALL_STATE[49]} == 1 && $INDEX_SSHSERVER_TARGET != -2 )) {
setvar WHIP_TITLE = ''Gogs: Requires OpenSSH''
setvar 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?""
whiptail --title $WHIP_TITLE --yesno $WHIP_QUESTION --defaultno --backtitle $WHIP_BACKTITLE 13 65
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
# - Use SSH target index to ensure Dropbear gets removed if installed.
setvar INDEX_SSHSERVER_TARGET = '-2'
} else {
setvar aSOFTWARE_INSTALL_STATE[49]=0
}
}
#Webserver stacks
for ((i=74; i<=82; i++))
do
#Please let DietPi install them for you...
if (( ${aSOFTWARE_INSTALL_STATE[$i]} == 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
break
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 (( ${aSOFTWARE_INSTALL_STATE[90]} == 1 &&
$INDEX_WEBSERVER_TARGET == -2 &&
( ${aSOFTWARE_INSTALL_STATE[80]} < 2 && ${aSOFTWARE_INSTALL_STATE[82]} < 2 ) )) {
setvar WHIP_TITLE = ''PhpMyAdmin''
setvar WHIP_QUESTION = ""Due to a apt-get installation issue with PhpMyAdmin, you must have a fully installed Lighttpd + 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
setvar aSOFTWARE_INSTALL_STATE[90]=0
}
#DietPiCam - warn user of locking out camera: https://github.com/Fourdee/DietPi/issues/249
if (( ${aSOFTWARE_INSTALL_STATE[59]} == 1 )) {
setvar WHIP_TITLE = ''DietPi Cam - Camera''
setvar 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
}
#EmonHUB/EmonPi
if (( ${aSOFTWARE_INSTALL_STATE[99]} == 1 )) {
# - Enter API KEY
# - Grab key from dietpi.txt
setvar USER_EMONHUB_APIKEY_CURRENT = $(cat /DietPi/dietpi.txt | grep -m1 '^SOFTWARE_EMONHUB_APIKEY=' | sed 's/.*=//') {
setvar WHIP_TITLE = ''EmonPi/Hub - API KEY''
setvar WHIP_QUESTION = ""Please enter your \"Write API KEY\":\n - Goto http://emoncms.org and register an account and login.\n - Select \"Setup\" from the top right of screen, then select \"My Account\"\n - Enter the \"Write API Key\" into the box below.""
setvar OPTION = $(whiptail --inputbox "$WHIP_QUESTION" 14 75 "$USER_EMONHUB_APIKEY_CURRENT" --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" 3>&1 1>&2 2>&3)
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
setvar USER_EMONHUB_APIKEY_CURRENT = "$OPTION"
setvar WHIP_TITLE = ''EmonPi/Hub - API KEY''
setvar WHIP_QUESTION = ""The following \"Write API KEY\" will be applied during installation:\n$USER_EMONHUB_APIKEY_CURRENT\n\nIs this key correct?""
whiptail --title $WHIP_TITLE --yesno $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 11 70
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
# - update dietpi.txt so the value will be applied during installation.
sed -i "/^SOFTWARE_EMONHUB_APIKEY=/c\SOFTWARE_EMONHUB_APIKEY=$USER_EMONHUB_APIKEY_CURRENT" /DietPi/dietpi.txt
setvar USER_EMONHUB_APIKEY_COMPLETED = '1'
}
}
}
}
#Pi-hole.
if (( ${aSOFTWARE_INSTALL_STATE[93]} == 1 )) {
# - prompt for static ip.
setvar WHIP_TITLE = '' Pi-hole - Setup Static IP Now?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
setvar WHIP_TITLE = '' Pi-hole - Setup Static IP''
setvar WHIP_QUESTION = ''DietPi-Config will now be launched. Simply select your Ethernet or Wifi connection from the menu to access the IP address settings.\n\nThe "copy current address to STATIC" menu option can be used to quickly setup your static IP. Please ensure you change the mode "DHCP" to "STATIC".\n\nWhen you are done, select "Apply, Save Changes", then exit DietPi-Config to resume setup.''
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 15 70
#Launch DietPi-config networking menu
/DietPi/dietpi/dietpi-config 8 1
}
}
#Wifi Hotspot Criteria
if (( ${aSOFTWARE_INSTALL_STATE[60]} == 1 )) ||
(( ${aSOFTWARE_INSTALL_STATE[61]} == 1 )) {
#Enable wifi modules
/DietPi/dietpi/func/dietpi-set_hardware wifimodules enable
local check_criteria=1 {
local criteria_passed=1
setvar WHIP_TITLE = ""WiFi Hotspot Criteria""
setvar WHIP_QUESTION = ""The following criteria must be met for this installation to succeed:""
local ethernet_active_state=$(ip r | grep -ci -m1 "eth$(sed -n 1p /DietPi/dietpi/.network)")
if (( $ethernet_active_state == 1 )) {
setvar WHIP_QUESTION = ""\n\n - Ethernet online: PASSED""
} else {
setvar criteria_passed = '0'
setvar WHIP_QUESTION = ""\n\n - Ethernet online: FAILED.\nUse dietpi-config to connect and configure ethernet.""
}
if test -d /sys/class/net/wlan$(sed -n 2p /DietPi/dietpi/.network) {
setvar WHIP_QUESTION = ""\n\n - Wifi adapter detected: PASSED""
} else {
setvar criteria_passed = '0'
setvar WHIP_QUESTION = ""\n\n - Wifi adapter detected: FAILED.\nPlease connect a WiFi adapter and try again.""
}
#Passed
if (( $criteria_passed == 1 )) {
setvar WHIP_QUESTION = ""\n\nPASSED: Criteria met. Good to go.""
whiptail --title $WHIP_TITLE --msgbox $WHIP_QUESTION --backtitle $WHIP_BACKTITLE 14 75
setvar check_criteria = '0'
#Failed, retry?
} else {
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
echo "retry" &> /dev/null
} else {
# - Disable user selection
setvar check_criteria = '0'
setvar aSOFTWARE_INSTALL_STATE[60]=0
setvar 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
}
}
}
}
#Weaved
if (( ${aSOFTWARE_INSTALL_STATE[68]} == 1 )) {
setvar WHIP_TITLE = ''Remot3.it - 1st run setup''
setvar WHIP_QUESTION = ''Remot3.it 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
}
#LetsEncrypt
if (( ${aSOFTWARE_INSTALL_STATE[92]} == 1 )) {
setvar WHIP_TITLE = ''Lets Encrypt Info''
setvar WHIP_QUESTION = ''Currently, the DietPi installation of CertBot supports Apache2 & Lighttpd 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
}
#-----------------------------------------------------------------------------
#dietpi-config can be used to install/configure the following software. Ask user.
#NoIp
if (( ${aSOFTWARE_INSTALL_STATE[67]} == 1 )) {
setvar WHIP_TITLE = ''NoIp - Setup Now?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
#Write installed states to temp
Write_InstallFileList temp
#Launch DietPi-config
/DietPi/dietpi/dietpi-config 16 1
#Read installed states from temp
Read_InstallFileList temp
}
}
#-----------------------------------------------------------------------------
#Boot Choices
if (( ${aSOFTWARE_INSTALL_STATE[23]} == 1 ||
${aSOFTWARE_INSTALL_STATE[24]} == 1 ||
${aSOFTWARE_INSTALL_STATE[25]} == 1 ||
${aSOFTWARE_INSTALL_STATE[26]} == 1 ||
${aSOFTWARE_INSTALL_STATE[31]} == 1 ||
${aSOFTWARE_INSTALL_STATE[51]} == 1 ||
${aSOFTWARE_INSTALL_STATE[108]} == 1 ||
${aSOFTWARE_INSTALL_STATE[112]} == 1 ||
${aSOFTWARE_INSTALL_STATE[119]} == 1 ||
${aSOFTWARE_INSTALL_STATE[155]} == 1 )) {
# Set Boot Order
setvar WHIP_TITLE = '' DietPi - Boot Options''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
/DietPi/dietpi/dietpi-autostart
}
}
}
#TARGETMENUID=2
proc Menu_Linux_Software {
#Inform User that DietPi software will automatically install additional linux software when required.
if (( ! $USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED )) {
setvar WHIP_TITLE = ''Additional Linux Software''
setvar 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
setvar USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED = '1'
}
#-----------------------------------------------------------------------------
#Generate Whiptail menu and store results into our software arrays
Menu_CreateSoftwareList 1
#Return to Main Menu
setvar TARGETMENUID = '0'
#-----------------------------------------------------------------------------
#dietpi-config can be used to install/configure the following software. Ask user.
#CurlFTPfs -
if (( ${aSOFTWARE_INSTALL_STATE[2]} == 1 )) {
setvar WHIP_TITLE = ''FTP Client - Setup Now?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
#Write installed states to temp
Write_InstallFileList temp
#Launch DietPi-config
/DietPi/dietpi/dietpi-config 16 1
#Read installed states from temp
Read_InstallFileList temp
}
}
#SMBCLIENT -
if (( ${aSOFTWARE_INSTALL_STATE[1]} == 1 )) {
setvar WHIP_TITLE = ''Samba Client - Setup Now?''
setvar 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
setvar CHOICE = ""$?
if (( $CHOICE == 0 )) {
#Write installed states to temp
Write_InstallFileList temp
#Launch DietPi-config
/DietPi/dietpi/dietpi-config 16 1
#Read installed states from temp
Read_InstallFileList temp
}
}
#-----------------------------------------------------------------------------
}
#TARGETMENUID=3
proc Menu_Uninstall_Software {
#Return to main menu
setvar 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 &&
${aSOFTWARE_TYPE[$i]} >= -1 )); 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 )) {
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_BACKTITLE 18 75 10 ${whiptail_list_array[@]} 2>/tmp/dietpi-software_uninstall_results
while read choice
{
case (choice) {
* {
#Convert lined list into a 1 line string.
setvar asoftware_for_uninstall = ''("$choice")
}
}
} < /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 )) {
# - Create list
setvar 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 20 70
setvar CHOICE = ""$?
#Run uninstall
if (( $CHOICE == 0 )) {
# - 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
}
}
}
#delete[] arrays
unset whiptail_list_array
unset asoftware_for_uninstall
}
#/////////////////////////////////////////////////////////////////////////////////////
# Banner Print
#/////////////////////////////////////////////////////////////////////////////////////
proc Banner_Setup {
/DietPi/dietpi/dietpi-banner 0
echo -e "\n Welcome to DietPi-Software \n"
}
proc Banner_Installing {
G_DIETPI-NOTIFY 3 DietPi-Software "Installing ${aSOFTWARE_WHIP_NAME[$INSTALLING_INDEX]}: ${aSOFTWARE_WHIP_DESC[$INSTALLING_INDEX]}"
}
proc Banner_Configuration {
G_DIETPI-NOTIFY 3 DietPi-Software "Configuring ${aSOFTWARE_WHIP_NAME[$INSTALLING_INDEX]}: ${aSOFTWARE_WHIP_DESC[$INSTALLING_INDEX]}"
}
proc Banner_Apt_Update {
G_DIETPI-NOTIFY 3 DietPi-Software "Update & upgrade APT"
sleep 1
}
proc Banner_Reboot {
if (( ! $DISABLE_REBOOT )) {
G_DIETPI-NOTIFY 3 DietPi-Software "Installation completed"
G_DIETPI-NOTIFY 0 "The system will now reboot. \n This completes the DietPi-Software installation.\n"
sleep 3
} else {
G_DIETPI-NOTIFY 0 "DietPi-Software installation completed."
}
}
proc Banner_Configs {
G_DIETPI-NOTIFY 3 DietPi-Software "Optimize and configure software"
G_DIETPI-NOTIFY 2 "Applying DietPi optimizations and configurations for $G_HW_MODEL_DESCRIPTION, please wait...\n"
}
proc Banner_Aborted {
#1st run abort
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
/DietPi/dietpi/dietpi-banner 0
G_DIETPI-NOTIFY 1 "\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
}
}
#/////////////////////////////////////////////////////////////////////////////////////
# Main Loop
#/////////////////////////////////////////////////////////////////////////////////////
#--------------------------------------------------------------------------------------
G_DIETPI-NOTIFY 2 "Initializing database, please wait..."
#--------------------------------------------------------------------------------------
#Init software arrays
Software_Arrays_Init
#--------------------------------------------------------------------------------------
#load .installed file, update vars, if it exists
Read_InstallFileList
#--------------------------------------------------------------------------------------
# - CLi input mode
if test -n $1 {
# - Run input mode
Input_Modes @ARGV
#--------------------------------------------------------------------------------------
#Standard launch
} else {
#Check if we are setting no user inputs and prompts
# - Load all automation vars
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
FirstRun_Automation_Init
}
#GPL compliance prompt
if (( $G_DIETPI_INSTALL_STAGE == 0 && $G_USER_INPUTS )) {
whiptail --title "DietPi - GPLv2 License" --msgbox "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/" --backtitle "DietPi - GPLv2 Compliance" 18 70
}
Banner_Setup
#Prevent continue if NTPD is not completed: https://github.com/Fourdee/DietPi/issues/786
Check_NTPD_Status
#1st run Connection test and DietPi updates
#NB: Contains EXIT path
if (( $(cat /DietPi/dietpi/.update_stage) == -1 )) {
Check_Internet_Connection
FirstRun_DietPi_Update
}
#Apply 1st run automation
if (( $G_DIETPI_INSTALL_STAGE == 0 )) {
#Activate automation settings from dietpi.txt, if set.
FirstRun_Automation_Set
} {
clear
if (( $TARGETMENUID == 0 )) {
Menu_Main
} elif (( $TARGETMENUID == 1 )) {
Menu_Dietpi_Software
} elif (( $TARGETMENUID == 2 )) {
Menu_Linux_Software
} elif (( $TARGETMENUID == 3 )) {
Menu_Uninstall_Software
}
}
}
#--------------------------------------------------------------------------------------
#Start DietPi-Software installs
if (( $GOSTARTINSTALL )) {
#Insufficient free space
/DietPi/dietpi/dietpi-drive_manager 2
if (( $? != 0 )) {
Exit_Destroy
}
Check_Internet_Connection
#Start installations for software
Run_Installations
#Upload DietPi-Survey Data
/DietPi/dietpi/dietpi-survey &> /dev/null
#Reboot
Banner_Reboot
if (( $DISABLE_REBOOT )) {
# - Start services
/DietPi/dietpi/dietpi-services start
} else {
sync
reboot
}
}
#-----------------------------------------------------------------------------------
Exit_Destroy
#-----------------------------------------------------------------------------------
}