diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d8e2d03205..b278511a65 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,49 @@ +v120 +(xx/06/16) + +Important Information: +Raspberry Pi Wheezy | Support for Raspberry Pi Wheezy has now finished. I have uploaded a final Wheezy DietPi image which users must install if they want to continue using Wheezy. Please see here for more information: http://dietpi.com/phpbb/viewtopic.php?f=9&t=432 +Image Downloads | All DietPi image downloads have been updated to v120. This includes all firmware/kernel/modules updates where applicable. http://dietpi.com/download + +Changes / Improvements / Optimizations: +DietPi-Software > User Data | You can now setup a dedicated USB drive at any stage, on the fly : https://github.com/Fourdee/DietPi/issues/377 +DietPi-Software > User Data | When changing user data location, DietPi will automatically move your existing data and setup required symlinks. +DietPi-Software > User Data | You can now force Flash or USB drive user data locations on the fly, disabling the automatic setting. +DietPi-Software > User Data | /mnt/dietpi_userdata will now always point to your user data location, even if its custom. +DietPi-Software | Added DietPi installation option for Mate Desktop: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=60#p2073 . Many thanks to Xenformation (JK) for his contributions on this. +DietPi-Software | Added DietPi installation option for GNUstep Desktop: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=60#p2072 . Many thanks to Xenformation (JK) for his contributions on this. +DietPi-Software | Added DietPi installation option for NoMachine: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=60#p2071 . Many thanks to Xenformation (JK) for his contributions on this. +DietPi-Software | Added DietPi installation option for XRDP: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=70#p2074 . Many thanks to Xenformation (JK) for his contributions on this. +DietPi-Software | Added DietPi installation option for QuiteRSS: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&start=70#p2075 . Many thanks to Xenformation (JK) for his contributions on this. +DietPi-Software | Added DietPi installation option for Cuberite (C++ Minecraft Server with web interface): http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=2069#p2068 +DietPi-Software | Added DietPi installation option for MineOS (Java Minecraft Servers with web interface): http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=2069#p2069 +DietPi-Software | FBturbo is now installed along with XSERVERXORG for Pine 64. Should improve 2D (eg: window) performance: https://github.com/Fourdee/DietPi/issues/380#issuecomment-226512966 +DietPi-Software | HiFi (MPD + YMPD) is now available for ARM64 devices (eg: Odroid C2/Pine A64). +DietPi-Config | You can now set your country code in "network options: adapters" menu, when running WiFi in hotspot mode (eg: dietpi-sofware > WiFi Hotspot installation). This will allow for channels 12/13 in some countries (eg: EU), and, increased power output (range) for the hotspot. +DietPi-Config | RPi 3 internal WiFi is now disabled by default to save resources on new installs. It will automatically be enabled by DietPi if required. +DietPi-Config | RPi 3 internal Bluetooth is now disabled by default to save resources on new installs. It can be enabled in the advanced menu. +DietPi-Config | RPi 3 increased thermal limit from 65c to 75c. This should reduce the chance of users seeing the heat warning icon on-screen, whilst keeping the device below the 85c official thermal limit used in Raspbian: https://github.com/Fourdee/DietPi/issues/356#issuecomment-223282185 +DietPi-Config | cfg80211 wifi module is now disabled by default to save resources on new installs. It will automatically be enabled by DietPi if required. +DietPi-Config | bluetooth module is now disabled by default to save resources on new installs. It can be enabled in the advanced menu. +DietPi-Config | Serial console is now disabled for all DietPi images (where possible): https://github.com/Fourdee/DietPi/issues/343#issuecomment-226946848 +DietPi-Config | Corrected typos. Many thanks to Erkan-Yilmaz for spotting these: https://github.com/Fourdee/DietPi/pull/381 +DietPi-Cloudshell | Added a feature which allows users to specify start and end times, where DietPi-Cloudshell will power off the screen and disable processing: https://github.com/Fourdee/DietPi/issues/379 +DietPi-Backup | Now shows the most recent and successful backup date in main menu. +DietPi-Sync | Now shows the most recent and successful sync date in main menu. + +Bug fixes: +DietPi-Banner | Resolved an issue where delayed DHCP offers would not provide the IP address during boot: https://github.com/Fourdee/DietPi/issues/350#issuecomment-223273610 +General | DietPi desktop items icon will now show correctly. +DietPi-Automation | Updated missing software automation entries in dietpi.txt. Many thanks for K-plan for his input on this: https://github.com/Fourdee/DietPi/issues/374 +DietPi-Software | Resolved an issue where Transmission would not start the web interface during boot (:9091), when using DHCP: https://github.com/Fourdee/DietPi/issues/350 +DietPi-Software | Resolved an issue where VIFM and MTRTINY would not be flagged as installed, after the installation. Many thanks to K-plan for spotting this one: https://github.com/Fourdee/DietPi/issues/373 | https://github.com/Fourdee/DietPi/issues/374#issuecomment-225436379 +DietPi-Software | Kodi has been disabled for Pine64 (non-functional) whilst we wait for working mali/mali_drm driver: https://github.com/Fourdee/DietPi/issues/380 +DietPi-Config | Resolved an issue where the RPi3 internal wifi would still be active after being disabled: https://github.com/Fourdee/DietPi/issues/376 Many thanks to K-plan for reporting this. +DietPi-Backup | Resolved an issue where search results, did not provide the most recent and successful backup date. +DietPi-Sync | Now contains the correct program name in the backtitle. + +----------------------------------------------------------------------------------------------------------- + v119 (01/06/16) diff --git a/README.md b/README.md index 6dca09b5b8..9825576105 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - Feature rich configuration tool for your device with dietpi-config. #### Find out more: http://dietpi.com +#### Download image: http://dietpi.com/download ##### DietPi is available for: - Raspberry Pi's: http://dietpi.com @@ -16,7 +17,7 @@ - Odroid C2: http://dietpi.com/phpbb/viewtopic.php?f=8&t=339&p=1492#p1492 - ODroid XU3/4: http://dietpi.com/phpbb/viewtopic.php?f=8&t=57 - Orange Pi PC: http://dietpi.com/phpbb/viewtopic.php?f=8&t=164#p612 -- BananaPi M2+: +- BananaPi M2+: http://dietpi.com/phpbb/viewtopic.php?f=8&t=431 - VMware x64 (Virtual Machine): http://dietpi.com/phpbb/viewtopic.php?f=8&t=90 - VirtualBox x64 (Virtual Machine): http://dietpi.com/phpbb/viewtopic.php?f=8&t=390&p=1683#p1683 diff --git a/boot_c1.ini b/boot_c1.ini index 7ef7618895..6a386bb398 100644 --- a/boot_c1.ini +++ b/boot_c1.ini @@ -41,7 +41,7 @@ setenv vpu "0" setenv hdmioutput "1" # Default Console Device Setting -setenv condev "console=tty0 console=ttyS0,115200n8" +setenv condev "console=tty0" ########################################### diff --git a/boot_c2.ini b/boot_c2.ini index fb86b35cbc..37bf47a023 100644 --- a/boot_c2.ini +++ b/boot_c2.ini @@ -23,7 +23,7 @@ setenv hpd "true" # setenv hpd "false" # Default Console Device Setting -setenv condev "console=tty0 console=ttyS0,115200n8" +setenv condev "console=tty0" # Meson Timer # 1 - Meson Timer diff --git a/boot_xu4.ini b/boot_xu4.ini index d9decc0ab1..d2f85d1c9e 100644 --- a/boot_xu4.ini +++ b/boot_xu4.ini @@ -10,7 +10,7 @@ setenv macaddr "00:1e:06:61:7a:72" #------------------------------------------------------------------------------------------------------ # Basic Ubuntu Setup. Don't touch unless you know what you are doing. # -------------------------------- -setenv bootrootfs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes" +setenv bootrootfs "console=tty1 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes" # boot commands setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; fatload mmc 0:1 0x44000000 exynos5422-odroidxu3.dtb; bootz 0x40008000 0x42000000 0x44000000" diff --git a/dietpi.txt b/dietpi.txt index 787049ea84..c543da1a3f 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -54,6 +54,8 @@ AUTO_Install_Index=0 #DietPi-Optimized Software to automatically install | Requires AUTO_Install_Index=1 # 1=install AUTO_DietpiSoftware_Install_DESKTOP_LXDE=0 +AUTO_DietpiSoftware_Install_DESKTOP_MATE=0 +AUTO_DietpiSoftware_Install_DESKTOP_GNUSTEP=0 AUTO_DietpiSoftware_Install_TIGHTVNCSERVER=0 AUTO_DietpiSoftware_Install_VNC4SERVER=0 AUTO_DietpiSoftware_Install_OWNCLOUD=0 @@ -115,6 +117,10 @@ AUTO_DietpiSoftware_Install_MUMBLESERVER=0 AUTO_DietpiSoftware_Install_EMBYSERVER=0 AUTO_DietpiSoftware_Install_OPENBAZAAR=0 AUTO_DietpiSoftware_Install_PLEXMEDIASERVER=0 +AUTO_DietpiSoftware_Install_XRDP=0 +AUTO_DietpiSoftware_Install_NOMACHINE=0 +AUTO_DietpiSoftware_Install_CUBERITE=0 +AUTO_DietpiSoftware_Install_MINEOS=0 #Linux Additional Software to automatically install | Requires AUTO_Install_Index=1 @@ -132,6 +138,18 @@ AUTO_DietpiSoftware_Install_XSERVERXORG=0 AUTO_DietpiSoftware_Install_FFMPEG=0 AUTO_DietpiSoftware_Install_ORACLEJAVA=0 AUTO_DietpiSoftware_Install_NODEJS=0 +AUTO_DietpiSoftware_Install_VIFM=0 +AUTO_DietpiSoftware_Install_QUITERSS=0 +AUTO_DietpiSoftware_Install_GNUEMACS=0 +AUTO_DietpiSoftware_Install_JED=0 +AUTO_DietpiSoftware_Install_VIMTINY=0 +AUTO_DietpiSoftware_Install_MIDNIGHTCOMMANDER=0 +AUTO_DietpiSoftware_Install_IFTOP=0 +AUTO_DietpiSoftware_Install_IPTRAF=0 +AUTO_DietpiSoftware_Install_IPERF=0 +AUTO_DietpiSoftware_Install_MTRTINY=0 +AUTO_DietpiSoftware_Install_NLOAD=0 +AUTO_DietpiSoftware_Install_TCPDUMP=0 AUTO_DietpiSoftware_Install_LOGGING_RSYSLOG=0 #DietPi-Software Choice System @@ -244,8 +262,8 @@ wifi_hotspot_channel=3 #WiFi country code. 2 character value (eg GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 wifi_country_code= -#Serial Console: If you dont know what this is, you can safely disable it (=0) to reduce system resource usage. -serial_console_enabled=1 +#Serial Console: Set to 1 if you require a serial console during 1st run of DietPi. +serial_console_enabled=0 #Soundcard soundcard=none @@ -256,7 +274,7 @@ soundcard=none #------------------------------------------------------------------------------------------------------ #Override target directory for user/personal data. #This is applied to software configurations when installing software (eg: owncloud, bittorrent downloads etc). -# Auto = Automatic (default). If USB dedicated drive was setup /mnt/usb_1, else, /root +# Auto = Automatic (default). If USB dedicated drive was setup /mnt/usb_1, else, /mnt/dietpi_userdata # /mnt/Where/I/Want/My/Data = Example # /mnt/user_data = Example dietpi_userdata_basedirectory=Auto diff --git a/dietpi/.version b/dietpi/.version index 176fdebf1b..8bc6583717 100644 --- a/dietpi/.version +++ b/dietpi/.version @@ -1 +1 @@ -119 \ No newline at end of file +120 \ No newline at end of file diff --git a/dietpi/boot b/dietpi/boot index c6462ef63c..0d185b0ffb 100644 --- a/dietpi/boot +++ b/dietpi/boot @@ -19,6 +19,8 @@ #///////////////////////////////////////////////////////////////////////////////////// #Globals #///////////////////////////////////////////////////////////////////////////////////// + FP_LOGFILE='/var/log/dietpi-boot.log' + HW_MODEL=0 DISTRO=0 @@ -61,6 +63,8 @@ sed -i '/arm_freq=/c\#arm_freq=1200' /DietPi/config.txt sed -i '/core_freq=/c\#core_freq=400' /DietPi/config.txt sed -i '/sdram_freq=/c\#sdram_freq=400' /DietPi/config.txt + sed -i "/temp_limit=/c\temp_limit=75" /DietPi/config.txt # https://github.com/Fourdee/DietPi/issues/356 + fi fi @@ -133,6 +137,10 @@ _EOF_ #Set Key sed -i "/wireless-key/c\wireless-key $Wifi_KEY" /etc/network/interfaces sed -i "/wpa-psk/c\wpa-psk $Wifi_KEY" /etc/network/interfaces + + #Enable wifi modules + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 1 + # - Ethernet elif (( $Ethernet_Enabled == 1 )); then #Enable Eth, disable Wlan @@ -181,8 +189,35 @@ _EOF_ ifup eth"$index_eth" fi - #Update network details - /DietPi/dietpi/func/obtain_network_details + #Wait for active connection, then update network details file + Wait_For_Valid_Network_Connection + + } + + Wait_For_Valid_Network_Connection(){ + + #Attempt to wait for a valid network connection + local max_loops=10 + local loop_count=0 + while true + do + + if (( $loop_count >= $max_loops )); then + echo -e "$(date) | Valid connection wait timed out." >> "$FP_LOGFILE" + break + elif (( ! $(route | awk '{print $4}' | grep -ci -m1 'UG') )); then + echo -e "$(date) | Waiting for valid connection." >> "$FP_LOGFILE" + sleep 1 + else + # - Update network details (for IP in dietpi-banner etc..) + echo -e "$(date) | Valid connection found." >> "$FP_LOGFILE" + /DietPi/dietpi/func/obtain_network_details + break + fi + + ((loop_count++)) + + done } @@ -218,13 +253,12 @@ _EOF_ /DietPi/dietpi/func/obtain_network_details #---------------------------------------------------------------- #Disable RPi hdmi output if set in dietpi.txt - if (( $HW_MODEL < 10 )); then + if (( $HW_MODEL < 10 && + $(cat /DietPi/dietpi.txt | grep -ci -m1 '^rpi_hdmi_output=0'))); then #FBset value below allows for reduced memory bandwidth usage from VideoCore (eg: Faster RAM bandwidth/performance) - if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 'rpi_hdmi_output=0') == 1 )); then - fbset -xres 16 -yres 16 -vxres 16 -vyres 16 -depth 8 &> /dev/null - /opt/vc/bin/tvservice -o &> /dev/null - fi + fbset -xres 16 -yres 16 -vxres 16 -vyres 16 -depth 8 &> /dev/null + /opt/vc/bin/tvservice -o &> /dev/null fi #---------------------------------------------------------------- @@ -248,8 +282,11 @@ _EOF_ #Normal Boot if (( $DIETPI_INSTALL_STAGE == 1 )); then - if (( $( cat /DietPi/dietpi.txt | grep -ci -m1 'dietpi_check_for_updates=1') == 1 )); then + Wait_For_Valid_Network_Connection + + if (( $( cat /DietPi/dietpi.txt | grep -ci -m1 '^dietpi_check_for_updates=1') )); then #Check for DietPi updates (+thread) + echo -e "$(date) | +Thread: checking for DietPi-Updates" >> "$FP_LOGFILE" /DietPi/dietpi/dietpi-update 2 &> /dev/null & fi @@ -268,13 +305,13 @@ _EOF_ /DietPi/dietpi/func/change_hostname "$(cat /DietPi/dietpi.txt | grep -m1 '^Hostname=' | sed 's/.*=//')" #Automation - Set auto login for next bootup - if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^AUTO_AutoLogin=1') == 1 )); then + if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^AUTO_AutoLogin=1') )); then /DietPi/dietpi/dietpi-autostart 7 fi - #Disable serial console? (enabled by default) - if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^serial_console_enabled=0') )); then - /DietPi/dietpi/dietpi-set_serialconsole -1 + #Enable serial console? + if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^serial_console_enabled=1') )); then + /DietPi/dietpi/func/dietpi-set_serialconsole 1 fi echo -e " Expanding SD/Flash partition. Please wait..." diff --git a/dietpi/conf/desktop/.gtk-bookmarks b/dietpi/conf/desktop/.gtk-bookmarks index 99ec3cdf8e..0033aeecc7 100644 --- a/dietpi/conf/desktop/.gtk-bookmarks +++ b/dietpi/conf/desktop/.gtk-bookmarks @@ -1,5 +1,6 @@ file:/// / file:///root /root +file:///mnt/dietpi_userdata DietPi User Data file:///mnt/usb_1 USB Drive file:///mnt/samba Samba Client file:///mnt/ftp_client FTP Client \ No newline at end of file diff --git a/dietpi/conf/desktop/dietpi-icon.png b/dietpi/conf/desktop/dietpi-icon.png index bdaa717e13..f9bd50e0ee 100644 Binary files a/dietpi/conf/desktop/dietpi-icon.png and b/dietpi/conf/desktop/dietpi-icon.png differ diff --git a/dietpi/conf/desktop/kodi-icon.png b/dietpi/conf/desktop/kodi-icon.png index ff4fe8696e..783e967a3c 100644 Binary files a/dietpi/conf/desktop/kodi-icon.png and b/dietpi/conf/desktop/kodi-icon.png differ diff --git a/dietpi/conf/mpd.conf b/dietpi/conf/mpd.conf index af297503b5..8d1867c0a6 100644 --- a/dietpi/conf/mpd.conf +++ b/dietpi/conf/mpd.conf @@ -1,8 +1,8 @@ #/etc/mpd.conf -music_directory "/mnt/usb_1/Music" -playlist_directory "/mnt/usb_1/Music" -db_file "/mnt/usb_1/.mpd_cache/db_file" +music_directory "/mnt/dietpi_userdata/Music" +playlist_directory "/mnt/dietpi_userdata/Music" +db_file "/mnt/dietpi_userdata/.mpd_cache/db_file" log_file "/var/log/mpd/mpd.log" pid_file "/var/run/mpd/pid" state_file "/var/lib/mpd/state" @@ -36,8 +36,8 @@ input { } replaygain "track" -#replaygain_preamp "0" -volume_normalization "no" +replaygain_preamp "8" +volume_normalization "yes" #audio_buffer_size "2048" #buffer_before_play "10%" diff --git a/dietpi/dietpi-autostart b/dietpi/dietpi-autostart index 8a98c2c552..e5afca6ebc 100644 --- a/dietpi/dietpi-autostart +++ b/dietpi/dietpi-autostart @@ -86,7 +86,7 @@ _EOF_ "0" "Console: Manual Login (default)" "7" "Console: Automatic Login" "1" "Kodi" - "2" "LXDE: Desktop" + "2" "Desktop (LXDE/MATE etc)" "3" "RetroPie" "4" "OpenTyrian" "5" "DietPi-Cloudshell" @@ -139,4 +139,4 @@ _EOF_ #----------------------------------------------------------------------------------- exit #----------------------------------------------------------------------------------- -} \ No newline at end of file +} diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup index a036c00f4c..3773fadddc 100644 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -46,9 +46,13 @@ #TARGETMENUID=0 Menu_Main(){ + local backup_last_completed='No previous backup found. Create one.' + if [ -f "$FP_TARGET/$BACKUP_STATS_FILENAME" ]; then + backup_last_completed=$(grep '^Backup Completed' "$FP_TARGET/$BACKUP_STATS_FILENAME" | tail -1 | awk '{print $3}') + fi - WHIP_TITLE='--- DietPi-Backup ---' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Current backup and restore location:\n\n$FP_TARGET" --cancel-button "Exit" --backtitle "$WHIP_BACKTITLE" 14 73 4 \ + WHIP_TITLE='- DietPi-Backup -' + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Current backup and restore location:\n $FP_TARGET\n\nMost recent successful backup date:\n $backup_last_completed" --cancel-button "Exit" --backtitle "$WHIP_BACKTITLE" 16 73 4 \ "Help" "What does DietPi-Backup do?" \ "Location" "Change where your backup will be saved and restored from." \ "Backup" "Create (or update) a backup of this system." \ @@ -130,7 +134,7 @@ local search_results_whiptail=() for ((i=0; i<${#search_results_list[@]}; i++)) do - local last_backup_date=$( sed -n 1p ${search_results_list[$i]} | awk '{print $3}' ) # Date of last backup for this backup + local last_backup_date=$( grep '^Backup Completed' ${search_results_list[$i]} | tail -1 | awk '{print $3}' ) # Date of last backup for this backup local backup_directory=$( echo -e ${search_results_list[$i]} | sed 's/\/'"$BACKUP_STATS_FILENAME"'//g' ) # Backup directory (minus the backup file), that we can use for target backup directory. search_results_whiptail+=("$backup_directory" ": $last_backup_date") done diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport index 5daa138666..bd966ea342 100644 --- a/dietpi/dietpi-bugreport +++ b/dietpi/dietpi-bugreport @@ -195,6 +195,12 @@ _EOF_ zip "$zip_settings" "$FILE_GENERATED_ZIP" /etc/apt/sources.list zip "$zip_settings" "$FILE_GENERATED_ZIP" /etc/apt/sources.list.d/* + #locale + locale > locale.txt + zip "$zip_settings" "$FILE_GENERATED_ZIP" /locale.txt + rm locale.txt + + } diff --git a/dietpi/dietpi-cloudshell b/dietpi/dietpi-cloudshell index 8c58a57877..b512ff87e6 100644 --- a/dietpi/dietpi-cloudshell +++ b/dietpi/dietpi-cloudshell @@ -30,16 +30,43 @@ CPU_CORES=$(nproc --all) #Version - DIETPI_CLOUDSHELL_VERSION=5 + DIETPI_CLOUDSHELL_VERSION=6 #/tmp/.* files used throughout this script. FP_TEMP="/tmp/dietpi-cloudshell" PROGRAM_NAME="DietPi-Cloudshell" - #///////////////////////////////////////////////////////////////////////////////////// - #Global misc functions - #///////////////////////////////////////////////////////////////////////////////////// + BLANK_SCREEN_ACTIVE=0 + BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED=0 + BLANK_SCREEN_TIME_HOUR_START=0 + BLANK_SCREEN_TIME_HOUR_END=0 + + #This will only work if dietpi-cloudshell was started by autostart (login script), as the setterm power options can only be applied when the command originates from the same terminal (no redirects). + RUN_BLANK_SCREEN_AT_SPECIFIC_TIME(){ + + local current_hour=$(date +%-H) + + #Turn screen off + if (( ! $BLANK_SCREEN_ACTIVE )); then + + if (( $BLANK_SCREEN_TIME_HOUR_START == $current_hour )); then + clear + echo -e "\n\nScreen will be powered down in under 1 minute\n" + setterm --blank 1 --powersave on &> /dev/tty1 #blank after 1 minute as force requires a poke to bring it back up. + BLANK_SCREEN_ACTIVE=1 + fi + + #Turn screen on + elif (( $BLANK_SCREEN_TIME_HOUR_END == $current_hour )); then + setterm --blank poke &> /dev/tty1 + setterm --reset &> /dev/tty1 + setterm --blank 0 --powersave off &> /dev/tty1 + BLANK_SCREEN_ACTIVE=0 + + fi + + } #BC does not allow for printing leading zeros. BC_ADD_LEADING_ZERO(){ @@ -127,6 +154,24 @@ } + #Apply fonts and powersave options + Enable_Term_Options(){ + + setterm --blank 0 --powersave off #must originate from source tty (currently via autostart login): https://github.com/Fourdee/DietPi/issues/379#issuecomment-225637243 + setfont /usr/share/consolefonts/Uni3-TerminusBold24x12.psf + tput civis + + } + + Disable_Term_Options(){ + + setterm --reset &> /dev/tty1 + setfont /usr/share/consolefonts/Uni3-Terminus16.psf.gz &> /dev/tty1 + clear &> /dev/tty1 + tput reset &> /dev/tty1 + + } + #///////////////////////////////////////////////////////////////////////////////////// # Colours #///////////////////////////////////////////////////////////////////////////////////// @@ -644,8 +689,6 @@ #///////////////////////////////////////////////////////////////////////////////////// # Scene Settings #///////////////////////////////////////////////////////////////////////////////////// - #Run - RUN_LOOP=1 RUN_INTRO=0 if (( $INPUT == 1 )); then RUN_INTRO=1 @@ -970,6 +1013,9 @@ TEMPERATURE_OUTPUT_TYPE=$(sed -n 4p $FILEPATH_SETTINGS) OUTPUT_DISPLAY_INDEX=$(sed -n 5p $FILEPATH_SETTINGS) NETWORK_USAGE_CURRENT_OUTPUT_TYPE=$(sed -n 6p $FILEPATH_SETTINGS) + BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED=$(sed -n 7p $FILEPATH_SETTINGS) + BLANK_SCREEN_TIME_HOUR_START=$(sed -n 8p $FILEPATH_SETTINGS) + BLANK_SCREEN_TIME_HOUR_END=$(sed -n 9p $FILEPATH_SETTINGS) #10-19 Enabled Scenes local sed_index=11 @@ -990,9 +1036,9 @@ echo -e "$TEMPERATURE_OUTPUT_TYPE" >> $FILEPATH_SETTINGS echo -e "$OUTPUT_DISPLAY_INDEX" >> $FILEPATH_SETTINGS echo -e "$NETWORK_USAGE_CURRENT_OUTPUT_TYPE" >> $FILEPATH_SETTINGS - echo -e "" >> $FILEPATH_SETTINGS - echo -e "" >> $FILEPATH_SETTINGS - echo -e "" >> $FILEPATH_SETTINGS + echo -e "$BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED" >> $FILEPATH_SETTINGS + echo -e "$BLANK_SCREEN_TIME_HOUR_START" >> $FILEPATH_SETTINGS + echo -e "$BLANK_SCREEN_TIME_HOUR_END" >> $FILEPATH_SETTINGS echo -e "" >> $FILEPATH_SETTINGS #10-19 Enabled Scenes @@ -1053,7 +1099,6 @@ Write_Settings_File fi - #-------------------------------------------------------------------------------- #Update DietPi network shared data: https://github.com/Fourdee/DietPi/issues/359 /DietPi/dietpi/func/obtain_network_details @@ -1075,12 +1120,8 @@ kill $line &> /dev/null done < $FP_TEMP - #Reset screens - setfont /usr/share/consolefonts/Uni3-Terminus16.psf.gz &> /dev/tty1 - clear - clear &> /dev/tty1 - #Cursor - tput reset &> /dev/tty1 + #Reset term options for main screen + Disable_Term_Options } @@ -1101,10 +1142,6 @@ read -p "Use CTRL+C to exit. Press any key to launch $PROGRAM_NAME..." fi - setterm -blank 0 -powersave off &> /dev/tty1 - setfont /usr/share/consolefonts/Uni3-TerminusBold24x12.psf &> /dev/tty1 - tput civis &> /dev/tty1 - #Launch in blocking mode if (( $output_current_screen == 1 )); then /DietPi/dietpi/dietpi-cloudshell 1 @@ -1163,13 +1200,19 @@ bitbyte_output_text="Byte (KB, MB, GB)" fi - OPTION=$(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "" --cancel-button "Exit" --default-item "$LASTSELECTED_ITEM" 15 75 8 \ + local autoscreenoff="Disabled" + if (( $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED )); then + autoscreenoff="Enabled" + fi + + OPTION=$(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "" --cancel-button "Exit" --default-item "$LASTSELECTED_ITEM" 16 75 9 \ "Colour" "Setting: Change the colour scheme." \ "Update Rate" "Setting: Control the time between screen updates." \ "Scenes" "Setting: Toggle which scenes are shown." \ "Temperature" "Setting: Output = $temp_output_text" \ "Net Usage Current" "Setting: Output = $bitbyte_output_text" \ "Output Display" "Setting: $target_output_text." \ + "Auto screen off" "Setting: $autoscreenoff | Start $BLANK_SCREEN_TIME_HOUR_START h | End $BLANK_SCREEN_TIME_HOUR_END h" \ "Start / Restart" "Apply settings. Launch on $target_output_text." \ "Stop" "Stops $PROGRAM_NAME." 3>&1 1>&2 2>&3) @@ -1180,6 +1223,9 @@ case "$OPTION" in + "Auto screen off") + TARGETMENUID=4 + ;; "Net Usage Current") ((NETWORK_USAGE_CURRENT_OUTPUT_TYPE++)) if (( $NETWORK_USAGE_CURRENT_OUTPUT_TYPE > 1 )); then @@ -1357,6 +1403,72 @@ } + #TARGETMENUID=4 + Menu_BlankScreenAtTime(){ + + #Return to main menu + TARGETMENUID=0 + + #generate 24 hour array + local aWhipHour=() + for ((i=0; i<24; i++)) + do + aWhipHour+=("$i" "Hour") + + done + + local blank_screen_at_specific_time_enabled_text='Disabled' + if (( $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED )); then + blank_screen_at_specific_time_enabled_text='Enabled' + fi + + WHIP_TITLE='- Options : Auto screen off -' + WHIP_QUESTION='Automatically power down the screen and disable DietPi-Cloudshell processing during a specific time.\n\nNB: This feature will only work if DietPi-Cloudshell was launched with the DietPi-Autostart option, or, launched from the main screen (tty1).' + OPTION=$(whiptail --title "$WHIP_TITLE" --backtitle "$WHIP_BACKTITLE" --menu "$WHIP_QUESTION" --cancel-button "Back" --default-item "$REFRESH_RATE" 16 60 3 \ + "Toggle" "$blank_screen_at_specific_time_enabled_text" \ + "Start time" "Set which hour to power off screen ($BLANK_SCREEN_TIME_HOUR_START)." \ + "End time" "Set which hour to power on screen ($BLANK_SCREEN_TIME_HOUR_END)." 3>&1 1>&2 2>&3) + + CHOICE=$? + if (( $CHOICE == 0 )); then + + if [ "$OPTION" = "Toggle" ];then + + ((BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED++)) + if (( $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED > 1 )); then + BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED=0 + fi + + elif [ "$OPTION" = "Start time" ];then + + WHIP_QUESTION='Please select which hour (24h) you would like to screen to power off.' + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "$WHIP_QUESTION" --default-item "$BLANK_SCREEN_TIME_HOUR_START" --backtitle "$WHIP_BACKTITLE" 16 55 7 "${aWhipHour[@]}" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + BLANK_SCREEN_TIME_HOUR_START=$OPTION + fi + + elif [ "$OPTION" = "End time" ];then + + WHIP_QUESTION='Please select which hour (24h) you would like to screen to power on.' + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "$WHIP_QUESTION" --default-item "$BLANK_SCREEN_TIME_HOUR_END" --backtitle "$WHIP_BACKTITLE" 16 55 7 "${aWhipHour[@]}" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + BLANK_SCREEN_TIME_HOUR_END=$OPTION + fi + + fi + + Write_Settings_File + + TARGETMENUID=4 + + fi + + unset aWhipHour + + } + #///////////////////////////////////////////////////////////////////////////////////// # MAIN #///////////////////////////////////////////////////////////////////////////////////// @@ -1370,11 +1482,10 @@ Read_Settings_File #Start Menu - while (( $TARGETMENUID > -1 )); do + while (( $TARGETMENUID >= 0 )); do clear - if (( $TARGETMENUID == 0 )); then Menu_Main elif (( $TARGETMENUID == 1 )); then @@ -1383,16 +1494,17 @@ Menu_UpdateRate elif (( $TARGETMENUID == 3 )); then Menu_SceneSelection + elif (( $TARGETMENUID == 4 )); then + Menu_BlankScreenAtTime fi + done #----------------------------------------------------------------------------------- #Run DietPi-Cloudshell - else + elif (( $INPUT == 1 )); then - #prevent sleep - moved to login - #set font - moved to login - #Disable Cursor - moved to login + Enable_Term_Options #Start Intro if (( $RUN_INTRO == 1 )); then @@ -1403,26 +1515,42 @@ renice -n 10 $$ &> /dev/null #Start display updates - while (( $RUN_LOOP == 1 )) + while true do + if (( $BLANK_SCREEN_AT_SPECIFIC_TIME_ENABLED )); then + + RUN_BLANK_SCREEN_AT_SPECIFIC_TIME + + fi + + #Disable updates when screen is blanked + if (( $BLANK_SCREEN_ACTIVE )); then + + sleep 60 + #Update enabled scenes - if (( ${aEnabledScenes[$SCENE_CURRENT]} == 1 )); then + else - Update_Banner - Update_Scene_$SCENE_CURRENT + if (( ${aEnabledScenes[$SCENE_CURRENT]} == 1 )); then - #Apply refresh rate delay - sleep $REFRESH_RATE + Update_Banner + Update_Scene_$SCENE_CURRENT - fi + #Apply refresh rate delay + sleep $REFRESH_RATE + + fi + + #Scene Switcher + ((SCENE_CURRENT++)) + + #Cap + if (( $SCENE_CURRENT >= $SCENE_MAX )); then + SCENE_CURRENT=0 + fi - #Scene Switcher - ((SCENE_CURRENT++)) - #Cap - if (( $SCENE_CURRENT >= $SCENE_MAX )); then - SCENE_CURRENT=0 fi done diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index cd0c60367c..bed0ce3656 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -242,8 +242,6 @@ overscan_text=$HW_MSG_NOTSUPPORTED rpi_camera_module_text=$HW_MSG_NOTSUPPORTED rpi_camera_led_text=$HW_MSG_NOTSUPPORTED - rpi_i2c_text=$HW_MSG_NOTSUPPORTED - rpi_i2cbaudrate_hz=$HW_MSG_NOTSUPPORTED fi WHIP_TITLE='DietPi - Display Options' @@ -499,31 +497,34 @@ case "$OPTION" in 1080p) sed -i '/setenv m /c\setenv m "1080p"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; 720p) sed -i '/setenv m /c\setenv m "720p"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; 480p) sed -i '/setenv m /c\setenv m "480p"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; PC1) sed -i '/setenv m /c\setenv m "1024x768"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; "VU7+") sed -i '/setenv m /c\setenv m "1024x600"' /DietPi/boot.ini - # - DVI mode sed -i '/setenv vout_mode /c\setenv vout_mode "dvi"' /DietPi/boot.ini REBOOT_REQUIRED=1 @@ -555,25 +556,27 @@ case "$OPTION" in 1080p) sed -i '/setenv videoconfig /c\setenv videoconfig "drm_kms_helper.edid_firmware=edid/1920x1080.bin"' /DietPi/boot.ini + sed -i '/^setenv vout /c\setenv vout "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; 720p) sed -i '/setenv videoconfig /c\setenv videoconfig "drm_kms_helper.edid_firmware=edid/1280x720.bin"' /DietPi/boot.ini + sed -i '/^setenv vout /c\setenv vout "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; 480p) sed -i '/setenv videoconfig /c\setenv videoconfig "drm_kms_helper.edid_firmware=edid/720x480.bin"' /DietPi/boot.ini + sed -i '/^setenv vout /c\setenv vout "hdmi"' /DietPi/boot.ini REBOOT_REQUIRED=1 #Return to This Menu TARGETMENUID=2 ;; "VU7+") sed -i '/setenv videoconfig /c\setenv videoconfig "drm_kms_helper.edid_firmware=edid/1024x600.bin"' /DietPi/boot.ini - # - DVI mode sed -i '/^setenv vout /c\setenv vout "dvi"' /DietPi/boot.ini REBOOT_REQUIRED=1 @@ -695,12 +698,15 @@ TARGETMENUID=0 + local whiptail_menu_array=() + #Get Current Settings local swap_size=$(cat /etc/dphys-swapfile | grep -m1 '^CONF_SWAPSIZE=' | sed 's/.*=//') local swap_text="$swap_size MB" if (( $swap_size == 0 )); then swap_text="Disabled" fi + whiptail_menu_array+=("Swapfile size" ": $swap_text") #NTPD local ntpd_mode_current=$(cat /DietPi/dietpi.txt | grep -m1 '^ntpd_update_mode=' | sed 's/.*=//') @@ -716,46 +722,64 @@ elif (( $ntpd_mode_current == 4 )); then ntpd_mode_text="Daemon + Drift" fi + whiptail_menu_array+=("Time sync mode" ": $ntpd_mode_text") - #i2c - local rpi_i2c_enabled=$(cat /DietPi/config.txt | grep -ci -m1 'dtparam=i2c_arm=on') - local rpi_i2c_text='Disabled' - if (( $rpi_i2c_enabled == 1 )); then - rpi_i2c_text='Enabled' + serialconsole_state=$(cat /DietPi/dietpi.txt | grep -m1 '^serial_console_enabled=' | sed 's/.*=//') + serialconsole_text='Disabled' + if (( $serialconsole_state == 1 )); then + serialconsole_text='Enabled' fi - local rpi_i2cbaudrate_hz="$(( $(cat /DietPi/config.txt | grep -m1 'i2c_arm_baudrate=' | sed 's/.*=//') / 1000 )) kHz" - #RPi ONly - local usb_max_current_enabled=$(cat /DietPi/config.txt | grep -ci -m1 'max_usb_current=1') - local usb_max_current_text='Disabled' - if [ "$usb_max_current_enabled" = 1 ]; then - usb_max_current_text='Enabled' + whiptail_menu_array+=("Update firmware" "") + + local bluetooth_state_text='Enabled' + local bluetooth_state=1 + if [ -f /etc/modprobe.d/disable_bt.conf ]; then + bluetooth_state=0 + bluetooth_state_text='Disabled' + fi + # - No bluetooth for VM + if (( $HW_MODEL != 20 )); then + whiptail_menu_array+=("Bluetooth" ": $bluetooth_state_text") fi - if (( $HW_MODEL >= 10 )); then - usb_max_current_text=$HW_MSG_NOTSUPPORTED + # - No serial console for VM + if (( $HW_MODEL != 20 )); then + whiptail_menu_array+=("Serial console" ": $serialconsole_text") fi - serialconsole_state=$(cat /DietPi/dietpi.txt | grep -m1 '^serial_console_enabled=' | sed 's/.*=//') - serialconsole_text='Disabled' - if (( $serialconsole_state == 1 )); then - serialconsole_text='Enabled' + #RPi Specific + if (( $HW_MODEL < 10 )); then + + local rpi_i2c_enabled=$(cat /DietPi/config.txt | grep -ci -m1 'dtparam=i2c_arm=on') + local rpi_i2c_text='Disabled' + if (( $rpi_i2c_enabled == 1 )); then + rpi_i2c_text='Enabled' + fi + + local rpi_i2cbaudrate_hz="$(( $(cat /DietPi/config.txt | grep -m1 'i2c_arm_baudrate=' | sed 's/.*=//') / 1000 )) kHz" + local usb_max_current_enabled=$(cat /DietPi/config.txt | grep -ci -m1 'max_usb_current=1') + local rpi_usbmaxcurrent_text='Disabled' + if [ "$usb_max_current_enabled" = 1 ]; then + rpi_usbmaxcurrent_text='Enabled' + fi + + whiptail_menu_array+=("Max USB current" ": $rpi_usbmaxcurrent_text") + whiptail_menu_array+=("I2c state" ": $rpi_i2c_text") + whiptail_menu_array+=("I2c frequency" ": $rpi_i2cbaudrate_hz") + fi WHIP_TITLE='DietPi - Advanced Options' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Choose an option" --cancel-button "$TEXT_MENU_BACK" 16 60 7 \ - "1" "Swapfile Size : $swap_text" \ - "2" "Time sync (ntpd) : $ntpd_mode_text" \ - "3" "Max Usb Current : $usb_max_current_text" \ - "4" "Update Firmware" \ - "5" "i2c state : $rpi_i2c_text" \ - "6" "i2c freq : $rpi_i2cbaudrate_hz" \ - "7" "Serial console : $serialconsole_text" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Choose an option" --cancel-button "$TEXT_MENU_BACK" 16 60 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? + + unset whiptail_menu_array + if (( $CHOICE == 0 )); then - if (( $OPTION == 1 )); then + if [ "$OPTION" = "Swapfile size" ]; then MIN_VALUE=0 MAX_VALUE=2000 OPTION=$(whiptail --inputbox "This will set the size of your swap file in MB:\n - Swapfile has a swapiness setting of 1.\n - Swapfile is used only to prevent out of memory errors.\n - Recommended value = 100 \n - Valid range $MIN_VALUE - $MAX_VALUE\n - 0 = Disable Swapfile." 13 65 "$swap_size" --title "SwapFile Size (MB)" 3>&1 1>&2 2>&3) @@ -776,7 +800,7 @@ #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 2 )); then + elif [ "$OPTION" = "Time sync mode" ]; then OPTION=$(whiptail --title "Time Sync (NTPD)" --menu "Here you can adjust the frequency of NTPD time syncs.\n\n - Modes 1-3:\nDietPi will launch NTPD as a program, rather than a daemon. Once the time has been updated on your system, NTPD will exit to reduce resource usage.\n\n - Mode 4:\nNTPD will run as a background daemon/service. Differences in time will be gradually adjusted over time, rather than instantly." --cancel-button "$TEXT_MENU_BACK" --default-item "$ntpd_mode_current" 22 70 5 \ "0" "Disabled" \ @@ -797,7 +821,7 @@ #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 4 )); then + elif [ "$OPTION" = "Update firmware" ]; then #RPI if (( $HW_MODEL < 10 )); then @@ -850,107 +874,92 @@ #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 3 )); then - - #RPI - if (( $HW_MODEL < 10 )); then + elif [ "$OPTION" = "Max USB current" ]; then - #Enabled - if (( $usb_max_current_enabled == 1 )); then - WHIP_QUESTION=" Current setting: $usb_max_current_text (1.2AMP) \n Would you like to disable this setting ? \n \n Once Disabled: \n - Max USB current will be limited to 0.6AMP.\n - Shared by all USB ports." - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 12 70 - CHOICE=$? - if (( $CHOICE == 0 )); then - sed -i '/max_usb_current=/c\max_usb_current=0' /DietPi/config.txt - REBOOT_REQUIRED=1 - fi - #Disabled - elif (( $usb_max_current_enabled == 0 )); then - WHIP_QUESTION=" Current setting: $usb_max_current_text (0.6AMP) \n Would you like to enable this setting ? \n \n Once Enabled: \n - Max USB current will be set to 1.2AMP.\n - Shared by all USB ports." - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 14 70 - CHOICE=$? - if (( $CHOICE == 0 )); then - sed -i '/max_usb_current=/c\max_usb_current=1' /DietPi/config.txt - REBOOT_REQUIRED=1 - fi + #Enabled + if (( $usb_max_current_enabled == 1 )); then + WHIP_QUESTION=" Current setting: $rpi_usbmaxcurrent_text (1.2AMP) \n Would you like to disable this setting ? \n \n Once Disabled: \n - Max USB current will be limited to 0.6AMP.\n - Shared by all USB ports." + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 12 70 + CHOICE=$? + if (( $CHOICE == 0 )); then + sed -i '/max_usb_current=/c\max_usb_current=0' /DietPi/config.txt + REBOOT_REQUIRED=1 + fi + #Disabled + elif (( $usb_max_current_enabled == 0 )); then + WHIP_QUESTION=" Current setting: $rpi_usbmaxcurrent_text (0.6AMP) \n Would you like to enable this setting ? \n \n Once Enabled: \n - Max USB current will be set to 1.2AMP.\n - Shared by all USB ports." + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --yes-button "Ok" --no-button "Back" --defaultno --backtitle "$WHIP_BACKTITLE" 14 70 + CHOICE=$? + if (( $CHOICE == 0 )); then + sed -i '/max_usb_current=/c\max_usb_current=1' /DietPi/config.txt + REBOOT_REQUIRED=1 fi - else - Info_HW_OptionNotSupported fi #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 5 )); then + elif [ "$OPTION" = "I2c state" ]; then - #RPI only - if (( $HW_MODEL < 10 )); then - - if (( $rpi_i2c_enabled == 0 )); then - /DietPi/dietpi/func/dietpi-i2c_control 1 - REBOOT_REQUIRED=1 - else - /DietPi/dietpi/func/dietpi-i2c_control -1 - REBOOT_REQUIRED=1 - fi + if (( $rpi_i2c_enabled == 0 )); then + /DietPi/dietpi/func/dietpi-i2c_control 1 + REBOOT_REQUIRED=1 else - Info_HW_OptionNotSupported + /DietPi/dietpi/func/dietpi-i2c_control -1 + REBOOT_REQUIRED=1 fi #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 6 )); then - #RPI only - if (( $HW_MODEL < 10 )); then + elif [ "$OPTION" = "I2c frequency" ]; then - #remove kHz from current - rpi_i2cbaudrate_hz=$(echo -e "$rpi_i2cbaudrate_hz" | tr -d ' kHz') - OPTION=$(whiptail --inputbox "Please enter the required i2c baudrate frequency (kHz)." 8 60 "$rpi_i2cbaudrate_hz" --title "i2c baudrate frequency (kHz)" 3>&1 1>&2 2>&3) - CHOICE=$? - if (( $CHOICE == 0 )); then - #check valid int - if [[ $OPTION =~ ^-?[0-9]+$ ]]; then - /DietPi/dietpi/func/dietpi-i2c_control "$OPTION" - REBOOT_REQUIRED=1 - else - Info_Input_Not_Valid_Integer - fi + #remove kHz from current + rpi_i2cbaudrate_hz=$(echo -e "$rpi_i2cbaudrate_hz" | tr -d ' kHz') + OPTION=$(whiptail --inputbox "Please enter the required i2c baudrate frequency (kHz)." 8 60 "$rpi_i2cbaudrate_hz" --title "i2c baudrate frequency (kHz)" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + #check valid int + if [[ $OPTION =~ ^-?[0-9]+$ ]]; then + /DietPi/dietpi/func/dietpi-i2c_control "$OPTION" + REBOOT_REQUIRED=1 + else + Info_Input_Not_Valid_Integer fi - - else - Info_HW_OptionNotSupported fi + #Return to This Menu TARGETMENUID=3 - elif (( $OPTION == 7 )); then + elif [ "$OPTION" = "Serial console" ]; then - # - Disable for VM's - if (( $HW_MODEL == 20 )); then + if (( $serialconsole_state == 0 )); then - Info_HW_OptionNotSupported + /DietPi/dietpi/func/dietpi-set_serialconsole 1 + REBOOT_REQUIRED=1 - # - SBC lovin' ;) else - if (( $serialconsole_state == 0 )); then - - /DietPi/dietpi/func/dietpi-set_serialconsole 1 - REBOOT_REQUIRED=1 + /DietPi/dietpi/func/dietpi-set_serialconsole -1 + REBOOT_REQUIRED=1 - else + fi - /DietPi/dietpi/func/dietpi-set_serialconsole -1 - REBOOT_REQUIRED=1 + #Return to This Menu + TARGETMENUID=3 - fi + elif [ "$OPTION" = "Bluetooth" ]; then + if (( $bluetooth_state )); then + /DietPi/dietpi/func/dietpi-set_wifi_bt bluetooth 0 + else + /DietPi/dietpi/func/dietpi-set_wifi_bt bluetooth 1 fi #Return to This Menu TARGETMENUID=3 + fi fi @@ -1100,7 +1109,7 @@ whiptail_menu_list+=("0" "Disabled") #Run menu - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Limit the maximum frequency that your processor can reach.\nThis can be useful for lowering temprature and saving power.\n\nCurrent setting: $user_frequency_max_text" --cancel-button "Back" --backtitle "$WHIP_BACKTITLE" --default-item "$user_frequency_max_current" 18 65 7 "${whiptail_menu_list[@]}" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Limit the maximum frequency that your processor can reach.\nThis can be useful for lowering temperature and saving power.\n\nCurrent setting: $user_frequency_max_text" --cancel-button "Back" --backtitle "$WHIP_BACKTITLE" --default-item "$user_frequency_max_current" 18 65 7 "${whiptail_menu_list[@]}" 3>&1 1>&2 2>&3) CHOICE=$? if (( $CHOICE == 0 )); then sed -i "/cpu_max_frequency=/c\cpu_max_frequency=$OPTION" /DietPi/dietpi.txt @@ -1205,10 +1214,14 @@ "ARM Temp Limit"*) MIN_VALUE=45 MAX_VALUE=85 - OPTION=$(whiptail --inputbox "When the ARM temprature ('c) reaches this value, the ARM will underclock to reduce heat. \n - Recommended value is 65 \n - Valid range $MIN_VALUE - $MAX_VALUE" 11 60 "$current_arm_temp_limit" --title "ARM Temprature Limit" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --inputbox "When the ARM temperature ('c) reaches this value, the ARM will underclock to reduce heat. \n - Recommended value is 65 \n - Valid range $MIN_VALUE - $MAX_VALUE" 11 60 "$current_arm_temp_limit" --title "ARM Temprature Limit" 3>&1 1>&2 2>&3) CHOICE=$? if (( $CHOICE == 0 )); then if [[ $OPTION =~ ^-?[0-9]+$ ]] && (($OPTION <= $MAX_VALUE)) && (($OPTION >= $MIN_VALUE)); then + + if (( $OPTION > 65 )); then + whiptail --title "Warning: $OPTION 'c" --msgbox "Higher operating temperatures will reduce the life of your ARM SoC. Heat also dissipates through the PCB into other components, decreasing the lifespan of the whole device. Use at your own risk.\n\nDietPi recommends 65'c as a safe value (75'c for RPi 3).\n\nMore info: https://github.com/Fourdee/DietPi/issues/356" 14 70 + fi sed -i "/temp_limit=/c\temp_limit=$OPTION" /DietPi/config.txt REBOOT_REQUIRED=1 else @@ -1584,6 +1597,21 @@ #Kill dhclient killall dhclient &> /dev/null + + # Enable/Disable wifi modules + # - enable + if (( $WIFI_DISABLED == 0 )); then + + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 1 + + # - disable + else + + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 0 + + fi + + echo -e "\n - Restarting networking services..." #Restart Networking if (( $DISTRO == 3 )); then @@ -1613,17 +1641,40 @@ Network_ApplyChanges(){ + #Disable all adapters sed -i "/allow-hotplug eth/c\#allow-hotplug eth$ETH_INDEX" /etc/network/interfaces sed -i "/allow-hotplug wlan/c\#allow-hotplug wlan$WIFI_INDEX" /etc/network/interfaces #Enable adapters if (( $ETH_DISABLED == 0 )); then + sed -i "/allow-hotplug eth/c\allow-hotplug eth$ETH_INDEX" /etc/network/interfaces + fi if (( $WIFI_DISABLED == 0 )); then + sed -i "/allow-hotplug wlan/c\allow-hotplug wlan$WIFI_INDEX" /etc/network/interfaces + + fi + + #if both adapaters, install netplug to enable support for multiple adapter control in dietpi-config. + if (( (! $ETH_DISABLED && !$WIFI_DISABLED) && ! $WIFI_HOTSPOT )); then + if (( ! $(dpkg --get-selections | grep -ci -m1 '^netplug') )); then + /DietPi/dietpi/dietpi-apt-get_update 1 + apt-get install netplug + service netplug start + fi + + #remove netplug + else + + if (( $(dpkg --get-selections | grep -ci -m1 '^netplug') )); then + /DietPi/dietpi/dietpi-apt-get_update 1 + apt-get purge -y netplug + fi + fi #Save STATIC/DHCP @@ -2002,7 +2053,17 @@ if [ -f /usr/sbin/hostapd ]; then WIFI_HOTSPOT=1 fi - WIFI_COUNTRYCODE=$(iw reg get | grep -m1 'country' | awk '{print $2}' | tr -d ':') + + # - Prevent "nl80211 not found" message, when running this command with cfg80211 module disabled. + #?????????????????????????????????????????????????????? + # We cant rely on lsmod for this. Some of our images have cfg80211 built into kernel, so lsmod wont show a result. + # Redirect stderr and stdout does nowt 2> /dev/null and &> /dev/null no effect. + + #if (( $(lsmod | grep -ci -m1 'cfg80211' ) )); then + WIFI_COUNTRYCODE=$(iw reg get | grep -m1 'country' | awk '{print $2}' | tr -d ':') + #fi + + #?????????????????????????????????????????????????????? #eth if [ -d /sys/class/net/eth$ETH_INDEX ]; then @@ -2026,6 +2087,11 @@ fi #wlan + # + RPi 3 - Always consider the onboard wifi as hardware available + if (( $HW_MODEL == 3 )); then + WIFI_HARDWARE=true + fi + if [ -d /sys/class/net/wlan$WIFI_INDEX ]; then #Hardware WIFI_HARDWARE=true @@ -2214,6 +2280,7 @@ CHOICE=$? # Confirm action if (( $CHOICE == 0 )); then + WIFI_DISABLED=0 Network_ApplyChanges TARGETMENUID=10 @@ -2393,7 +2460,6 @@ whiptail_menu_array+=("SSID" "Change the wireless hotspot name"); ((whip_options_total++)) whiptail_menu_array+=("Channel" "Change the wireless channel"); ((whip_options_total++)) whiptail_menu_array+=("Key" "Change the access key required to connect"); ((whip_options_total++)) - #whiptail_menu_array+=("Country" "$WIFI_COUNTRYCODE"); ((whip_options_total++)) # Has no effect on hostapd description_text="SSID : $HOTSPOT_SSID\nChannel : $HOTSPOT_CHANNEL\nKey : $HOTSPOT_KEY" @@ -2426,19 +2492,19 @@ whiptail_menu_array+=("Static DNS" "$WIFI_DNS_STATIC"); ((whip_options_total++)) fi - # - Unset country code? - if [ "$WIFI_COUNTRYCODE" = "00" ]; then - whiptail_menu_array+=("Country" "Not set, please configure ($WIFI_COUNTRYCODE)"); ((whip_options_total++)) - else - whiptail_menu_array+=("Country" "$WIFI_COUNTRYCODE"); ((whip_options_total++)) - fi - whiptail_menu_array+=("Disable" "Disable WiFi adapter"); ((whip_options_total++)) description_text=" Current Details: \n - SSID = $WIFI_SSID | $WIFI_BITRATE Mbit | Strength: $WIFI_SIGNALSTRENGTH%\n - KEY = $WIFI_KEY \n - Mode = $mode_current \n - Ip = $WIFI_IP\n - Mask = $WIFI_MASK\n - DNS = $WIFI_DNS" fi + # - Unset country code? + if [ "$WIFI_COUNTRYCODE" = "00" ]; then + whiptail_menu_array+=("Country" "Not set, please configure ($WIFI_COUNTRYCODE)"); ((whip_options_total++)) + else + whiptail_menu_array+=("Country" "$WIFI_COUNTRYCODE"); ((whip_options_total++)) + fi + whiptail_menu_array+=("Apply" "Save Changes (Restart Networking)"); ((whip_options_total++)) if (( $whip_options_total > $WHIP_OPTIONS_MAX_DISPLAY )); then @@ -2511,8 +2577,10 @@ CHOICE=$? #Confirm action if (( $CHOICE == 0 )); then + WIFI_DISABLED=1 Network_ApplyChanges + TARGETMENUID=8 else #Return to this Menu diff --git a/dietpi/dietpi-external_drive_setup b/dietpi/dietpi-external_drive_setup index c959c7a254..eb86f7fa23 100644 --- a/dietpi/dietpi-external_drive_setup +++ b/dietpi/dietpi-external_drive_setup @@ -40,7 +40,7 @@ Check_Drive_Mounted(){ USB_FILESYSTEM_TYPE=$(blkid -o list | grep '/dev/sda1' | awk '{ print $2 }') - USB_MOUNTED=$(df -h | grep -ci -m1 '/mnt/usb_1') + USB_MOUNTED=$(df -P | grep -ci -m1 '/mnt/usb_1') } Wait_For_Drive_Connection(){ @@ -97,7 +97,7 @@ clear echo -e " --------------------------------\n D I E T - P I \n External Drive Setup \n --------------------------------" echo -e " An Existing $USB_FILESYSTEM_TYPE Drive has Been Found \n" - df /dev/sda1 -h + df -Ph /dev/sda1 echo -e "" if [ "$USB_FILESYSTEM_TYPE" = "ntfs" ]; then @@ -125,7 +125,7 @@ #Finish setup, add mount to fstab clear Check_Drive_Mounted - if (( $USB_MOUNTED == 1 )); then + if (( $USB_MOUNTED )); then #Add root delay to RPi (Prevents slow powering external drives, from failing to be ready and mountable during boot.) if (( $HW_MODEL < 10 )) && @@ -140,8 +140,13 @@ sed -i -E '/\/mnt\/usb_1[[:space:]]+ext4/s/^/#/' /etc/fstab fi + #Update .installed file + if [ -f /DietPi/dietpi/.installed ]; then + sed -i '/USBDRIVE=/c\USBDRIVE=2' /DietPi/dietpi/.installed + fi + if (( $INPUT == 0 )); then - whiptail --title "Dedicated Drive Completed" --msgbox "Dedicated USB harddrive setup completed successfully:\n\nFilesystem Size Used Avail Use% Mounted on\n$(df -h | grep '/mnt/usb_1')" --backtitle "DietPi-External Drive Setup" 12 70 + whiptail --title "Dedicated Drive Completed" --msgbox "Dedicated USB harddrive setup completed successfully:\n\nFilesystem Size Used Avail Use% Mounted on\n$(df -Ph | grep '/mnt/usb_1')" --backtitle "DietPi-External Drive Setup" 12 70 fi RUNNING_SETUP=0 diff --git a/dietpi/dietpi-obtain_hw_model b/dietpi/dietpi-obtain_hw_model index 0f190a9e25..c6ce6940fe 100644 --- a/dietpi/dietpi-obtain_hw_model +++ b/dietpi/dietpi-obtain_hw_model @@ -37,13 +37,13 @@ # - Line5 - # UUID # - Line 6 - - # HW_ARCH 21 x86_64 (VM's) - # HW_ARCH 20 x86_32 (you never know :)) - # HW_ARCH 10 arm64 (c2) - # HW_ARCH 3 arm8 hf (RPi 3) - # HW_ARCH 2 arm7 hf (RPi 2) - # HW_ARCH 1 arm6 hf (RPi 1) - # HW_ARCH 0 unknown + # HW_ARCH 21 x86_64 (VM's) + # HW_ARCH 20 x86_32 (you never know :)) + # HW_ARCH 10 arm64 (c2) + # HW_ARCH 3 arm8 hf (RPi 3) + # HW_ARCH 2 arm7 hf (RPi 2) + # HW_ARCH 1 arm6 hf (RPi 1) + # HW_ARCH 0 unknown # - Line 7 - # HW_ARCH_DESCRIPTION #//////////////////////////////////// diff --git a/dietpi/dietpi-process_tool b/dietpi/dietpi-process_tool index bd64da743b..301bc08494 100644 --- a/dietpi/dietpi-process_tool +++ b/dietpi/dietpi-process_tool @@ -151,6 +151,7 @@ aNAME[$index]="Bluetooth (Service)";aPROCESS_NAME[$index]="bluetooth";((index++)) aNAME[$index]="Bluetooth (Hciuart)";aPROCESS_NAME[$index]="hciattach";((index++)) aNAME[$index]="BruteFIR";aPROCESS_NAME[$index]="brutefir";((index++)) + aNAME[$index]="Cuberite";aPROCESS_NAME[$index]="Cuberite";((index++)) aNAME[$index]="Cron";aPROCESS_NAME[$index]="cron";((index++)) aNAME[$index]="Deluge (Daemon)";aPROCESS_NAME[$index]="deluged";((index++)) aNAME[$index]="Deluge (Web interface)";aPROCESS_NAME[$index]="deluge-web";((index++)) @@ -173,6 +174,7 @@ aNAME[$index]="Samba Server (Daemon)";aPROCESS_NAME[$index]="smbd";((index++)) aNAME[$index]="Samba Server (NetBios)";aPROCESS_NAME[$index]="nmbd";((index++)) aNAME[$index]="Shairport Sync";aPROCESS_NAME[$index]="shairport-sync";((index++)) + aNAME[$index]="Supervisor";aPROCESS_NAME[$index]="supervisor";((index++)) aNAME[$index]="Squeezebox Server (LMS)";aPROCESS_NAME[$index]="squeezeboxserver";((index++)) aNAME[$index]="Squeezebox Lite";aPROCESS_NAME[$index]="squeezelite";((index++)) aNAME[$index]="Transmission";aPROCESS_NAME[$index]="transmission-daemon";((index++)) diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 65efa3032e..22af26fc01 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -54,6 +54,8 @@ "mumble-server" "emby-server" "plexmediaserver" + "cuberite" + "supervisor" ) aSERVICE_AVAILABLE=0 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 6995f599b4..89f05118cf 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -55,7 +55,8 @@ FP_DIETPIAUTOMATION_LOG="/root/DietPi-Automation.log" #Used to set user/personal data directories (eg: usbdrive /mnt/usb_1) - USERDATA_DIRECTORY="/mnt/dietpi_userdata" + DIETPI_USERDATA_DIRECTORY='/mnt/dietpi_userdata' + DIETPI_USBDRIVE_DIRECTORY='/mnt/usb_1' #Uninstall temp file UNINSTALL_FILE='/tmp/dietpi_uninstall_list' @@ -155,32 +156,63 @@ } + Create_Desktop_DietPi_Applications(){ + + #Copy DietPi favourite links + cp /DietPi/dietpi/conf/desktop/.gtk-bookmarks "$HOME"/.gtk-bookmarks + + #Create Desktop SymLinks + mkdir -p "$HOME"/Desktop + ln -sf /usr/share/applications/pcmanfm.desktop "$HOME"/Desktop/pcmanfm.desktop + ln -sf /usr/share/applications/htop.desktop "$HOME"/Desktop/htop.desktop + + #DietPi Desktop symlinks + ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop "$HOME"/Desktop/dietpi-software.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop "$HOME"/Desktop/dietpi-config.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop "$HOME"/Desktop/dietpi-launcher.desktop + + #DietPi Menu symlinks + mkdir -p /usr/share/applications + ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop /usr/share/applications/dietpi-software.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-update.desktop /usr/share/applications/dietpi-update.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop /usr/share/applications/dietpi-config.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-uninstall.desktop /usr/share/applications/dietpi-uninstall.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-backup.desktop /usr/share/applications/dietpi-backup.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-sync.desktop /usr/share/applications/dietpi-sync.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-bugreport.desktop /usr/share/applications/dietpi-bugreport.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-process_tool.desktop /usr/share/applications/dietpi-process_tool.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-cleaner.desktop /usr/share/applications/dietpi-cleaner.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-cron.desktop /usr/share/applications/dietpi-cron.desktop + ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop /usr/share/applications/dietpi-launcher.desktop + + } + Create_UserContent_Folders(){ - mkdir -p "$USERDATA_DIRECTORY"/"$FOLDER_MUSIC" &> /dev/null - mkdir -p "$USERDATA_DIRECTORY"/"$FOLDER_PICTURES" &> /dev/null - mkdir -p "$USERDATA_DIRECTORY"/"$FOLDER_VIDEO" &> /dev/null - mkdir -p "$USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" &> /dev/null + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" &> /dev/null - chmod -R 775 "$USERDATA_DIRECTORY"/"$FOLDER_MUSIC" - chmod -R 775 "$USERDATA_DIRECTORY"/"$FOLDER_PICTURES" - chmod -R 775 "$USERDATA_DIRECTORY"/"$FOLDER_VIDEO" - chmod -R 775 "$USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_MUSIC" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_PICTURES" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_VIDEO" + chmod -R 775 "$DIETPI_USERDATA_DIRECTORY"/"$FOLDER_DOWNLOADS" } Download_Test_Media(){ - if [ ! -f "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg ]; then + if [ ! -f "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg ]; then #Grab My test music - wget http://dietpi.com/downloads/audio/fourdee_tech.ogg -O "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg + wget http://dietpi.com/downloads/audio/fourdee_tech.ogg -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/fourdee_tech.ogg #Grab Absolute Radio Streams - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb -O "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8bb -O "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-80s.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a9bb -O "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-90s.pls - wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a0bb -O "$USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-00s.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a8bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-80s.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a9bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-90s.pls + wget http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=a0bb -O "$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC"/Absolute-Radio-00s.pls fi @@ -218,6 +250,8 @@ USBDRIVE=${USBDRIVE:=0} #DietPi Software GRASSHOPPER=${GRASSHOPPER:=0} DESKTOP_LXDE=${DESKTOP_LXDE:=0} +DESKTOP_MATE=${DESKTOP_MATE:=0} +DESKTOP_GNUSTEP=${DESKTOP_GNUSTEP:=0} WEBSERVER_LAMP=${WEBSERVER_LAMP:=0} WEBSERVER_LASP=${WEBSERVER_LASP:=0} @@ -241,6 +275,11 @@ WEBSERVER_PHP=${WEBSERVER_PHP:=0} WEBSERVER_MYADMINPHP=${WEBSERVER_MYADMINPHP:=0} WEBSERVER_REDIS=${WEBSERVER_REDIS:=0} +NOMACHINE=${NOMACHINE:=0} +XRDP=${XRDP:=0} +TIGHTVNCSERVER=${TIGHTVNCSERVER:=0} +VNC4SERVER=${VNC4SERVER:=0} + OWNCLOUD=${OWNCLOUD:=0} TRANSMISSION=${TRANSMISSION:=0} PHPBB=${PHPBB:=0} @@ -265,8 +304,6 @@ DIETPICLOUDSHELL=${DIETPICLOUDSHELL:=0} HAPROXY=${HAPROXY:=0} SQUEEZEBOXSERVER=${SQUEEZEBOXSERVER:=0} WORDPRESS=${WORDPRESS:=0} -TIGHTVNCSERVER=${TIGHTVNCSERVER:=0} -VNC4SERVER=${VNC4SERVER:=0} FAIL2BAN=${FAIL2BAN:=0} PHPSYSINFO=${PHPSYSINFO:=0} PHPIMAGEGALLERY=${PHPIMAGEGALLERY:=0} @@ -290,14 +327,19 @@ MUMBLESERVER=${MUMBLESERVER:=0} EMBYSERVER=${EMBYSERVER:=0} OPENBAZAAR=${OPENBAZAAR:=0} PLEXMEDIASERVER=${PLEXMEDIASERVER:=0} +CUBERITE=${CUBERITE:=0} +MINEOS=${MINEOS:=0} + #Additional Linux Software VIMFULL=${VIMFULL:=0} VIMTINY=${VIMTINY:=0} +QUITERSS=${QUITERSS:=0} GNUEMACS=${GNUEMACS:=0} SSHCLIENT=${SSHCLIENT:=0} SMBCLIENT=${SMBCLIENT:=0} MIDNIGHTCOMMANDER=${MIDNIGHTCOMMANDER:=0} +VIFM=${VIFM:=0} JED=${JED:=0} IFTOP=${IFTOP:=0} IPTRAF=${IPTRAF:=0} @@ -532,21 +574,88 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} #-------------------------------------------------------------- #Install Software - #Installs that require DESKTOP_LXDE - if (( $TIGHTVNCSERVER == 1 )); then - DESKTOP_LXDE=1 - elif (( $VNC4SERVER == 1 )); then - DESKTOP_LXDE=1 + #Installs that require a DESKTOP + if (( $TIGHTVNCSERVER == 1 || $VNC4SERVER == 1 || $XRDP == 1 || $NOMACHINE == 1 || $QUITERSS == 1 )); then + + # - If no desktop is selected or installed (0), default to LXDE + if (( ! $DESKTOP_LXDE && ! $DESKTOP_MATE && ! $DESKTOP_GNUSTEP )); then + + DESKTOP_LXDE=1 + + fi + fi #Desktop LXDE if (( $DESKTOP_LXDE == 1 )); then - INSTALL_DESCRIPTION='Desktop (LXDE)' Banner_Installing AGI lxde upower policykit-1 iceweasel p7zip-full --no-install-recommends #upower policykit-1. Needed for LXDE logout menu item to show shutdown/restart ...... + fi + + #Desktop MATE + if (( $DESKTOP_MATE == 1 )); then + INSTALL_DESCRIPTION="Desktop (MATE)" + Banner_Installing + + AGI mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full --no-install-recommends + fi + + #Desktop GNUStep + if (( $DESKTOP_GNUSTEP == 1 )); then + INSTALL_DESCRIPTION="Desktop (GNUStep)" + Banner_Installing + + AGI x-window-system-core wmaker gnustep gnustep-devel gnustep-games libc-dbg upower policykit-1 iceweasel p7zip-full --no-install-recommends + fi + + #XRDP + if (( $XRDP == 1 )); then + INSTALL_DESCRIPTION="XRDP (Remote Desktop Server)" + Banner_Installing + + AGI xrdp + fi + + #NOMACHINE + if (( $NOMACHINE == 1 )); then + # NoMachine Supports many, many architectures and operating systems + # The following link can be used as a reference: + # https://www.nomachine.com/download/linux&id=1 + INSTALL_DESCRIPTION="NoMachine (Secure RDP Server & Client)" + Banner_Installing + + #x86_32 - As was said (you never know) + if (( $HW_ARCH == 20 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_i386.deb" + #x86_64 + elif (( $HW_ARCH == 21 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_1_amd64.deb" + #arm6 (RPi1) + elif (( $HW_ARCH == 1 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_6_armv6hf.deb" + #arm7+ (RPi 2/3) + elif (( $HW_ARCH >= 2 && $HW_ARCH < 10 )); then + INSTALL_URL_ADDRESS="http://download.nomachine.com/download/5.1/Linux/nomachine_5.1.26_5_armhf.deb" + fi + + # Now, check that the links are legitimate + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + + if (( $? == 0 )); then + + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + rm package.deb + + else + Error_NoConnection_NoInstall + + # ABORT INSTALLATION + NOMACHINE=0 + fi fi @@ -841,13 +950,13 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} INSTALL_DESCRIPTION='Hifi / Web Interface Music Player (Mpd Ympd)' Banner_Installing - #check source is online + #ympd # - armhf if (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then INSTALL_URL_ADDRESS='http://www.ympd.org/downloads/ympd-1.2.3-armhf.tar.bz2' - # - arm64 #mpd package for arm64 is not available. Only in sid. + # - arm64 elif (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/ympd-1.2.3-arm64.tar.bz2' @@ -858,15 +967,36 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} #Install if (( $? == 0 )); then - #Install MPD - AGI mpd libmpdclient2 - - #Setup ympd + #Install ympd wget "$INSTALL_URL_ADDRESS" tar -xvf ympd-* rm ympd-* mv ympd /usr/bin/ympd + #Install MPD + AGI libmpdclient2 + + # - arm64 + if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + + # - additional preqs + #AGI libsmbclient libcurl4-gnutls-dev libmodplug1 libfaad2 libmpcdec6 libavformat56 libupnp6 libnfs4 libflac8 libyajl2 libvorbisfile3 libsndfile1 libaudiofile1 libgme0 libsidplay2 libresid-builder0c2a libsidutils0 libfluidsynth1 libWildMidi1 libwavpack1 libmad0 libmpg123-0 + + # - Install same dev packages as per a compile to ensure libary's are available. + AGI libmad0-dev libmpg123-dev libid3tag0-dev libflac-dev libvorbis-dev libopus-dev libaudiofile-dev libsndfile1-dev libfaad-dev libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev libmpcdec-dev libwavpack-dev libwildmidi-dev libsidplay2-dev libsidutils-dev libresid-builder-dev libavcodec-dev libavformat-dev libmp3lame-dev libsamplerate0-dev libsoxr-dev libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev libzzip-dev libcurl4-gnutls-dev libyajl-dev libexpat-dev libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev libpulse-dev libroar-dev libshout3-dev libnfs-dev libsmbclient-dev libupnp-dev libavahi-client-dev libsqlite3-dev libsystemd-daemon-dev libwrap0-dev libcppunit-dev xmlto libboost-dev libicu-dev + + wget http://dietpi.com/downloads/binaries/all/mpd_0.19.16_arm64.deb -O package.deb + dpkg -i package.deb + rm package.deb + + # - everything else + else + + AGI mpd + + fi + + else Error_NoConnection_NoInstall @@ -1005,6 +1135,7 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} fi fi + #DietPi Cam if (( $DIETPICAM == 1 )); then INSTALL_DESCRIPTION='RPi Camera / Web Interface Surveillance (DietPi-Cam)' Banner_Installing @@ -1662,10 +1793,10 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} #check source is online # - NB: These are hostapd binaries with RTL drivers enabled. - # - armv6 + # - armv6+ INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/hostapd_14128.zip' # - arm64 - if (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >= 40 && $HW_MODEL < 50 ) )); then + if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/hostapd_2.5-arm64.zip' fi @@ -1685,6 +1816,9 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} chmod +x /usr/sbin/hostapd fi + #Enable wifi modules + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 1 + else Error_NoConnection_NoInstall @@ -1731,6 +1865,9 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} # - Prereqs AGI openssl avahi-daemon libsoxr0 libavahi-client3 libtool libconfig9 libpopt0 libdaemon0 --no-install-recommends + # This occured on C2: shairport-sync : Depends: libpopt-dev but it is not installed + AGI libpopt-dev + wget "$INSTALL_URL_ADDRESS" -O package.deb dpkg -i package.deb rm package.deb @@ -2041,149 +2178,94 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} fi - - } - - Install_Linux_Software(){ - - # Stop Services - /DietPi/dietpi/dietpi-services stop - - if (( $VIMFULL == 1 )); then - INSTALL_DESCRIPTION='Vim' + #CUBERITE + if (( $CUBERITE == 1 )); then + INSTALL_DESCRIPTION='Cuberite (Minecraft Server)' Banner_Installing - AGI vim - - VIMFULL=2 - fi - - if (( $VIMTINY == 1 )); then - INSTALL_DESCRIPTION='Vim Tiny' - Banner_Installing - AGI vim-tiny - - VIMTINY=2 - fi - - if (( $GNUEMACS == 1 )); then - INSTALL_DESCRIPTION='Emacs' - Banner_Installing - AGI emacs - - GNUEMACS=2 - fi - - if (( $MIDNIGHTCOMMANDER == 1 )); then - INSTALL_DESCRIPTION='Midnight Commander' - Banner_Installing - AGI mc - - MIDNIGHTCOMMANDER=2 - fi - if (( $JED == 1 )); then - INSTALL_DESCRIPTION='Jed Text Editor' - Banner_Installing - AGI jed + #check folder is online - JED=2 - fi + #x86_64 + if (( $HW_ARCH == 21 )); then + INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' + #32bit ARM + elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then + INSTALL_URL_ADDRESS='http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz' + fi + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $IFTOP == 1 )); then - INSTALL_DESCRIPTION='iftop' - Banner_Installing - AGI iftop + #Install + if (( $? == 0 )); then - IFTOP=2 - fi + wget "$INSTALL_URL_ADDRESS" -O package.tar + mkdir -p /etc/cubrite + tar xzvf package.tar -C /etc/cubrite + rm package.tar - if (( $IPTRAF == 1 )); then - INSTALL_DESCRIPTION='IPTraf' - Banner_Installing - AGI iptraf + # - Move everything into base directory (cuberite) + mv /etc/cubrite/Server/* /etc/cubrite/ + rm -R /etc/cuberite/Server - IPTRAF=2 - fi + else + Error_NoConnection_NoInstall - if (( $MTRTINY == 1 )); then - INSTALL_DESCRIPTION='MTR-Tiny' - Banner_Installing - AGI mtr-tiny + #Abort failed install + CUBERITE=0 + fi - MTR-TINY=2 fi - if (( $NLOAD == 1 )); then - INSTALL_DESCRIPTION='nLoad' + #MINEOS + if (( $MINEOS == 1 )); then + INSTALL_DESCRIPTION='MineOS (Minecraft Servers)' Banner_Installing - AGI nload - NLOAD=2 - fi - - if (( $TCPDUMP == 1 )); then - INSTALL_DESCRIPTION='TCPDUMP' - Banner_Installing - AGI tcpdump + #check folder is online - TCPDUMP=2 - fi + INSTALL_URL_ADDRESS='http://github.com/hexparrot/mineos-node.git' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - if (( $SSHCLIENT == 1 )); then - INSTALL_DESCRIPTION='OpenSSH Client' - Banner_Installing - AGI openssh-client + #Install + if (( $? == 0 )); then - SSHCLIENT=2 - fi + #prereqs + apt-get install -y python python3 supervisor rdiff-backup screen - if (( $SMBCLIENT == 1 )); then - INSTALL_DESCRIPTION='Samba Client' - Banner_Installing + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos + cd "$DIETPI_USERDATA_DIRECTORY"/mineos + git clone https://github.com/hexparrot/mineos-node.git minecraft - #Remove Information file - rm /mnt/samba/readme.txt &> /dev/null + cd minecraft + git config core.filemode false + chmod +x service.js mineos_console.js generate-sslcert.sh webui.js - AGI smbclient cifs-utils --no-install-recommends + npm install - SMBCLIENT=2 - fi + cd "$HOME" - #DietPi software that requires Build-Essential - if (( $HAPROXY == 1 )); then - BUILDESSENTIAL=1 - elif (( $WIRINGPI == 1 )); then - BUILDESSENTIAL=1 - elif (( $OPENBAZAAR == 1 )); then - BUILDESSENTIAL=1 - fi + else + Error_NoConnection_NoInstall - if (( $BUILDESSENTIAL == 1 )); then - INSTALL_DESCRIPTION='Build Essential' - Banner_Installing - AGI build-essential --no-install-recommends + #Abort failed install + MINEOS=0 + fi - BUILDESSENTIAL=2 fi - #DietPi software that requires GITCLIENT - if (( $AMPACHE == 1 )); then - GITCLIENT=1 - elif (( $OPENBAZAAR == 1 )); then - GITCLIENT=1 - fi + } - if (( $GITCLIENT == 1 )); then - INSTALL_DESCRIPTION='Git' - Banner_Installing - AGI git --no-install-recommends + Install_Linux_Software(){ - GITCLIENT=2 - fi + # Stop Services + /DietPi/dietpi/dietpi-services stop #DietPi software that requires Alsa-base if (( $DESKTOP_LXDE == 1 )); then ALSABASE=1 + elif (( $DESKTOP_MATE == 1 )); then + ALSABASE=1 + elif (( $DESKTOP_GNUSTEP == 1 )); then + ALSABASE=1 elif (( $HIFI == 1 )); then ALSABASE=1 elif (( $KODI == 1 )); then @@ -2200,6 +2282,10 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} ALSABASE=1 elif (( $VNC4SERVER == 1 )); then ALSABASE=1 + elif (( $NOMACHINE == 1 )); then + ALSABASE=1 + elif (( $XRDP == 1 )); then + ALSABASE=1 elif (( $SQUEEZEBOXSERVER == 1 )); then ALSABASE=1 elif (( $AMPACHE == 1 )); then @@ -2235,6 +2321,10 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} #DietPi software that requires Xserver - Xorg if (( $DESKTOP_LXDE == 1 )); then XSERVERXORG=1 + elif (( $DESKTOP_MATE == 1 )); then + XSERVERXORG=1 + elif (( $DESKTOP_GNUSTEP == 1 )); then + XSERVERXORG=1 elif (( $KODI == 1 )); then XSERVERXORG=1 elif (( $OPENTYRIAN == 1 )); then @@ -2243,6 +2333,12 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} XSERVERXORG=1 elif (( $VNC4SERVER == 1 )); then XSERVERXORG=1 + elif (( $NOMACHINE == 1 )); then + XSERVERXORG=1 + elif (( $XRDP == 1 )); then + XSERVERXORG=1 + elif (( $QUITERSS == 1 )); then + XSERVERXORG=1 fi if (( $XSERVERXORG == 1 )); then @@ -2302,10 +2398,205 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} cp /DietPi/dietpi/conf/xorg_c1.conf /etc/X11/xorg.conf + #Pine64 + elif (( $HW_MODEL >= 40 && $HW_MODEL < 50 )); then + + #check source is online + INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + + #Install + if (( $? == 0 )); then + + 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 << _EOF_ > /etc/X11/xorg.conf +Section "Device" + Identifier "Allwinner A10/A13 FBDEV" + Driver "fbturbo" + Option "fbdev" "/dev/fb0" + Option "SwapbuffersWait" "true" +EndSection +_EOF_ + + else + Error_NoConnection_NoInstall + + #Abort failed install + XSERVERXORG=0 + fi + fi fi + #DietPi software that requires Build-Essential + if (( $HAPROXY == 1 )); then + BUILDESSENTIAL=1 + elif (( $WIRINGPI == 1 )); then + BUILDESSENTIAL=1 + elif (( $OPENBAZAAR == 1 )); then + BUILDESSENTIAL=1 + elif (( $MINEOS == 1 )); then + BUILDESSENTIAL=1 + fi + + if (( $BUILDESSENTIAL == 1 )); then + INSTALL_DESCRIPTION='Build Essential' + Banner_Installing + AGI build-essential --no-install-recommends + + BUILDESSENTIAL=2 + fi + + #DietPi software that requires GITCLIENT + if (( $AMPACHE == 1 )); then + GITCLIENT=1 + elif (( $OPENBAZAAR == 1 )); then + GITCLIENT=1 + elif (( $MINEOS == 1 )); then + GITCLIENT=1 + fi + + if (( $GITCLIENT == 1 )); then + INSTALL_DESCRIPTION='Git' + Banner_Installing + AGI git --no-install-recommends + + GITCLIENT=2 + fi + + if (( $QUITERSS == 1 )); then + INSTALL_DESCRIPTION="QuiteRSS" + Banner_Installing + AGI quiterss + + QUITERSS=2 + + fi + + if (( $VIFM == 1 )); then + INSTALL_DESCRIPTION='ViFM (File Manager with Vi Bindings)' + Banner_Installing + AGI vifm + + VIFM=2 + fi + + if (( $VIMFULL == 1 )); then + INSTALL_DESCRIPTION='Vim' + Banner_Installing + AGI vim + + VIMFULL=2 + fi + + if (( $VIMTINY == 1 )); then + INSTALL_DESCRIPTION='Vim Tiny' + Banner_Installing + AGI vim-tiny + + VIMTINY=2 + fi + + if (( $GNUEMACS == 1 )); then + INSTALL_DESCRIPTION='Emacs' + Banner_Installing + AGI emacs + + GNUEMACS=2 + fi + + if (( $IPERF == 1 )); then + INSTALL_DESCRIPTION='Iperf' + Banner_Installing + AGI iperf + + IPERF=2 + fi + + if (( $MIDNIGHTCOMMANDER == 1 )); then + INSTALL_DESCRIPTION='Midnight Commander' + Banner_Installing + AGI mc + + MIDNIGHTCOMMANDER=2 + fi + + if (( $JED == 1 )); then + INSTALL_DESCRIPTION='Jed Text Editor' + Banner_Installing + AGI jed + + JED=2 + fi + + if (( $IFTOP == 1 )); then + INSTALL_DESCRIPTION='iftop' + Banner_Installing + AGI iftop + + IFTOP=2 + fi + + if (( $IPTRAF == 1 )); then + INSTALL_DESCRIPTION='IPTraf' + Banner_Installing + AGI iptraf + + IPTRAF=2 + fi + + if (( $MTRTINY == 1 )); then + INSTALL_DESCRIPTION='MTR-Tiny' + Banner_Installing + AGI mtr-tiny + + MTRTINY=2 + fi + + if (( $NLOAD == 1 )); then + INSTALL_DESCRIPTION='nLoad' + Banner_Installing + AGI nload + + NLOAD=2 + fi + + if (( $TCPDUMP == 1 )); then + INSTALL_DESCRIPTION='TCPDUMP' + Banner_Installing + AGI tcpdump + + TCPDUMP=2 + fi + + if (( $SSHCLIENT == 1 )); then + INSTALL_DESCRIPTION='OpenSSH Client' + Banner_Installing + AGI openssh-client + + SSHCLIENT=2 + fi + + if (( $SMBCLIENT == 1 )); then + INSTALL_DESCRIPTION='Samba Client' + Banner_Installing + + #Remove Information file + rm /mnt/samba/readme.txt &> /dev/null + + AGI smbclient cifs-utils --no-install-recommends + + SMBCLIENT=2 + fi + if (( $CURLFTPFS == 1 )); then INSTALL_DESCRIPTION='CurlFtpFs (FTP client as filesystem mount)' Banner_Installing @@ -2463,6 +2754,8 @@ INDEX_WEBSERVER_TARGET=${INDEX_WEBSERVER_TARGET:=-2} ORACLEJAVA=1 elif (( $SUBSONIC6 == 1 )); then ORACLEJAVA=1 + elif (( $MINEOS == 1 )); then + ORACLEJAVA=1 fi if (( $ORACLEJAVA == 1 )); then @@ -2500,6 +2793,8 @@ _EOF_ #Programs that require NODEJS if (( $NETDATA == 1 )); then NODEJS=1 + elif (( $MINEOS == 1 )); then + NODEJS=1 fi #NODEJS @@ -2507,8 +2802,8 @@ _EOF_ INSTALL_DESCRIPTION='NodeJS - Javascript Runtime' Banner_Installing - #arm64 (Odroid C2 and PineA64) - Not currently available via nodesource.com - if (( ( $HW_MODEL == 12 ) || ( $HW_MODEL >= 40 && $HW_MODEL < 50 ) )); then + #arm64 - Not currently available via nodesource.com or https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh + if (( $HW_ARCH == 10 )); then #check, is online INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/c2/nodejs_5-1_arm64.deb' @@ -2535,20 +2830,18 @@ _EOF_ else #check, is online - INSTALL_URL_ADDRESS='https://deb.nodesource.com/setup_5.x' + INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install if (( $? == 0 )); then # - Preqs - AGI apt-transport-https + wget "$INSTALL_URL_ADDRESS" -O node_install.sh + chmod +x node_install.sh + ./node_install.sh - # - Add repo (use their install script) - curl -sL "$INSTALL_URL_ADDRESS" | -E bash - - - # - install - AGI nodejs + rm node_install.sh NODEJS=2 @@ -2728,7 +3021,7 @@ _EOF_ # Copy/Set optimised Software settings. # Set install states to 2 (installed). - #Destop + #Destop LXDE if (( $DESKTOP_LXDE == 1 )); then #Odroid C1/C2 - Fix for broken/laggy transparency @@ -2754,9 +3047,6 @@ _EOF_ #Disable Trash sed -i '/use_trash=/c\use_trash=0' /etc/xdg/libfm/libfm.conf - #Copy DietPi pcmanfm favourite links - cp /DietPi/dietpi/conf/desktop/.gtk-bookmarks "$HOME"/.gtk-bookmarks - #Copy DietPi Panel config mkdir -p "$HOME"/.config/lxpanel/LXDE/panels cp /DietPi/dietpi/conf/desktop/panel "$HOME"/.config/lxpanel/LXDE/panels/panel @@ -2765,32 +3055,31 @@ _EOF_ mkdir -p "$HOME"/.config/openbox cp /DietPi/dietpi/conf/desktop/lxde-rc.xml "$HOME"/.config/openbox/lxde-rc.xml - #Create Desktop SymLinks - mkdir -p "$HOME"/Desktop - ln -sf /usr/share/applications/pcmanfm.desktop "$HOME"/Desktop/pcmanfm.desktop - ln -sf /usr/share/applications/htop.desktop "$HOME"/Desktop/htop.desktop - - #DietPi Desktop symlinks - ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop "$HOME"/Desktop/dietpi-software.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop "$HOME"/Desktop/dietpi-config.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop "$HOME"/Desktop/dietpi-launcher.desktop - - #DietPi Menu symlinks - ln -sf /DietPi/dietpi/conf/desktop/dietpi-software.desktop /usr/share/applications/dietpi-software.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-update.desktop /usr/share/applications/dietpi-update.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-config.desktop /usr/share/applications/dietpi-config.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-uninstall.desktop /usr/share/applications/dietpi-uninstall.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-backup.desktop /usr/share/applications/dietpi-backup.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-sync.desktop /usr/share/applications/dietpi-sync.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-bugreport.desktop /usr/share/applications/dietpi-bugreport.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-process_tool.desktop /usr/share/applications/dietpi-process_tool.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-cleaner.desktop /usr/share/applications/dietpi-cleaner.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-cron.desktop /usr/share/applications/dietpi-cron.desktop - ln -sf /DietPi/dietpi/conf/desktop/dietpi-launcher.desktop /usr/share/applications/dietpi-launcher.desktop + Create_Desktop_DietPi_Applications + DESKTOP_LXDE=2 fi + #Desktop MATE + if (( $DESKTOP_MATE == 1 )); then + + Create_Desktop_DietPi_Applications + + + DESKTOP_MATE=2 + + fi + + #Desktop GNUStep + if (( $DESKTOP_GNUSTEP == 1 )); then + + Create_Desktop_DietPi_Applications + + DESKTOP_GNUSTEP=2 + + fi + #WEBSERVER_LAMP if (( $WEBSERVER_LAMP == 1 )); then @@ -3180,10 +3469,10 @@ _EOF_ #Setup Data directory - local target_data_dir="$USERDATA_DIRECTORY/owncloud_data" + local target_data_dir="$DIETPI_USERDATA_DIRECTORY/owncloud_data" mkdir -p "$target_data_dir" - #Create symlink from default /var/www/owncloud/data to USERDATA_DIRECTORY + #Create symlink from default /var/www/owncloud/data to DIETPI_USERDATA_DIRECTORY local target_data_symlink="/var/www/owncloud/data" mkdir -p "$target_data_symlink" &> /dev/null @@ -3247,7 +3536,7 @@ _EOF_ cp /DietPi/dietpi/conf/transmission_settings /etc/transmission-daemon/settings.json Create_UserContent_Folders - sed -i '/"download-dir":/c\"download-dir": "'$USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' /etc/transmission-daemon/settings.json + sed -i '/"download-dir":/c\"download-dir": "'$DIETPI_USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' /etc/transmission-daemon/settings.json #total mem / 7 # - Generally a good allround setting for > RPi3 devices @@ -3319,7 +3608,7 @@ _EOF_ if (( $FILESERVER_PROFTP == 1 )); then sed -i "/root/c\#root" /etc/ftpusers cp /DietPi/dietpi/conf/proftpd.conf /etc/proftpd/proftpd.conf - sed -i "/DefaultRoot /c\DefaultRoot $USERDATA_DIRECTORY" /etc/proftpd/proftpd.conf + sed -i "/DefaultRoot /c\DefaultRoot $DIETPI_USERDATA_DIRECTORY" /etc/proftpd/proftpd.conf FILESERVER_PROFTP=2 fi @@ -3329,7 +3618,7 @@ _EOF_ echo -e "dietpi\ndietpi" | smbpasswd -s -a root cp /DietPi/dietpi/conf/smb.conf /etc/samba/smb.conf - sed -i "/path = /c\path = $USERDATA_DIRECTORY" /etc/samba/smb.conf + sed -i "/path = /c\path = $DIETPI_USERDATA_DIRECTORY" /etc/samba/smb.conf FILESERVER_SAMBA=2 fi @@ -3339,7 +3628,7 @@ _EOF_ cp /DietPi/dietpi/conf/vsftpd.conf /etc/vsftpd.conf sed -i '/root/c\#root' /etc/ftpusers - sed -i "/local_root=/c\local_root=$USERDATA_DIRECTORY" /etc/vsftpd.conf + sed -i "/local_root=/c\local_root=$DIETPI_USERDATA_DIRECTORY" /etc/vsftpd.conf FILESERVER_VSFTPD=2 fi @@ -3347,10 +3636,53 @@ _EOF_ #Ympd MPD if (( $HIFI == 1 )); then - #Start at boot - cp /DietPi/dietpi/conf/ympd_init /etc/init.d/ympd - chmod +x /etc/init.d/ympd - update-rc.d ympd defaults + #Start at boot + cp /DietPi/dietpi/conf/ympd_init /etc/init.d/ympd + chmod +x /etc/init.d/ympd + update-rc.d ympd defaults + + # + arm64 MPD using our compiled mpd binary. + if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then + + cat << _EOF_ > /etc/default/mpd +## Defaults for the MPD init script, sourced by /etc/init.d/mpd on Debian +## systems. Uncomment (remove the leading '#') and change values as needed. + +## If you don't want MPD to be started as a system service (for example, if +## you want to run it from a regular user account), disable it using the +## command 'update-rc.d mpd disable' + +## The configuration file location for mpd: +MPDCONF=/etc/mpd.conf +_EOF_ + + + cat << _EOF_ > /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/lib/mpd +ExecStartPre=/bin/mkdir -p /var/log/mpd +ExecStartPre=/bin/mkdir -p /var/run/mpd +ExecStartPre=/bin/mkdir -p /var/lib/mpd +ExecStart=/usr/local/bin/mpd --no-daemon /etc/mpd.conf + +# allow MPD to use real-time priority 50 +LimitRTPRIO=50 +LimitRTTIME=-1 + +[Install] +WantedBy=multi-user.target + +_EOF_ + + systemctl daemon-reload + + fi #Copy default config cp /DietPi/dietpi/conf/mpd.conf /etc/mpd.conf @@ -3360,31 +3692,20 @@ _EOF_ audio_output { type "alsa" name "My ALSA Device" - device "hw:0,0" +# device "hw:0,0" format "44100:16:2" mixer_device "default" - mixer_control "PCM" - mixer_index "0" +# mixer_control "PCM" +# mixer_index "0" } #HDMI - Set format and audio_output_format to 48000hz #audio_output_format "48000:16:2" #samplerate_converter "Fastest Sinc Interpolator" _EOF_ - #OrangePi , unmute 3.5mm and add mixer controls - if (( $HW_MODEL >= 30 )) && (( $HW_MODEL < 40 )); then - amixer set -c 0 'Audio lineout' unmute &> /dev/null - - sed -i '/mixer_device/c\mixer_device "hw:0"' /etc/mpd.conf - sed -i '/mixer_control/c\mixer_control "Lineout volume control"' /etc/mpd.conf - fi - #Setup data locations Create_UserContent_Folders - sed -i '/music_directory/c\music_directory "'$USERDATA_DIRECTORY/$FOLDER_MUSIC'"' /etc/mpd.conf - sed -i '/playlist_directory/c\playlist_directory "'$USERDATA_DIRECTORY/$FOLDER_MUSIC'"' /etc/mpd.conf - mkdir -p "$USERDATA_DIRECTORY"/.mpd_cache - sed -i '/db_file/c\db_file "'$USERDATA_DIRECTORY'/.mpd_cache/db_file"' /etc/mpd.conf + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.mpd_cache #Grab our test music for the user. Download_Test_Media @@ -3434,12 +3755,12 @@ _EOF_ #Setup data directories Create_UserContent_Folders - mkdir -p "$USERDATA_DIRECTORY"/.MiniDLNA_Cache + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/.MiniDLNA_Cache - sed -i "/media_dir=A,/c\media_dir=A,$USERDATA_DIRECTORY/$FOLDER_MUSIC" /etc/minidlna.conf - sed -i "/media_dir=P,/c\media_dir=P,$USERDATA_DIRECTORY/$FOLDER_PICTURES" /etc/minidlna.conf - sed -i "/media_dir=V,/c\media_dir=V,$USERDATA_DIRECTORY/$FOLDER_VIDEO" /etc/minidlna.conf - sed -i "/db_dir=/c\db_dir=$USERDATA_DIRECTORY/.MiniDLNA_Cache" /etc/minidlna.conf + sed -i "/media_dir=A,/c\media_dir=A,$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" /etc/minidlna.conf + sed -i "/media_dir=P,/c\media_dir=P,$DIETPI_USERDATA_DIRECTORY/$FOLDER_PICTURES" /etc/minidlna.conf + sed -i "/media_dir=V,/c\media_dir=V,$DIETPI_USERDATA_DIRECTORY/$FOLDER_VIDEO" /etc/minidlna.conf + sed -i "/db_dir=/c\db_dir=$DIETPI_USERDATA_DIRECTORY/.MiniDLNA_Cache" /etc/minidlna.conf MINIDLNA=2 fi @@ -3485,7 +3806,7 @@ _EOF_ chown -R www-data:www-data /var/www/dietpicam # - Setup Data directory - local dietpicam_media_directory=$USERDATA_DIRECTORY + local dietpicam_media_directory=$DIETPI_USERDATA_DIRECTORY mkdir -p "$dietpicam_media_directory"/dietpicam rm -R /var/www/dietpicam/media @@ -3518,9 +3839,9 @@ _EOF_ #Setup data directory Create_UserContent_Folders - sed -i '/"move_completed_path": /c\"move_completed_path": "'$USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf - sed -i '/"download_location": /c\"download_location": "'$USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf - sed -i '/"torrentfiles_location": /c\"torrentfiles_location": "'$USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf + sed -i '/"move_completed_path": /c\"move_completed_path": "'$DIETPI_USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf + sed -i '/"download_location": /c\"download_location": "'$DIETPI_USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf + sed -i '/"torrentfiles_location": /c\"torrentfiles_location": "'$DIETPI_USERDATA_DIRECTORY/$FOLDER_DOWNLOADS'",' "$HOME"/.config/deluge/core.conf #Applied Optimized settings # - Cache size is in steps of 16 KiB. (Cachesize * 16 = total KiB) @@ -3615,7 +3936,7 @@ _EOF_ cat << _EOF_ > /etc/default/subsonic SUBSONIC_USER=root -SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC" +SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" _EOF_ #Grab our test media for user @@ -3649,7 +3970,7 @@ _EOF_ cat << _EOF_ > /etc/default/subsonic SUBSONIC_USER=root -SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$USERDATA_DIRECTORY/$FOLDER_MUSIC" +SUBSONIC_ARGS="--quiet --pidfile=/run/subsonic.pid --max-memory=$subsonic_memory_max --default-music-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-podcast-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC --default-playlist-folder=$DIETPI_USERDATA_DIRECTORY/$FOLDER_MUSIC" _EOF_ #Grab our test media for user @@ -3719,6 +4040,20 @@ _EOF_ DIETPICLOUDSHELL=2 fi + #XRDP + if (( $XRDP == 1 )); then + + XRDP=2 + + fi + + #NOMACHINE + if (( $NOMACHINE == 1 )); then + + NOMACHINE=2 + + fi + #HAPROXY if (( $HAPROXY == 1 )); then @@ -3993,13 +4328,29 @@ _EOF_ if (( $VNC4SERVER == 1 )); then + local cmd_launch_desktop='' + if (( $DESKTOP_LXDE > 0 )); then + + cmd_launch_desktop='/usr/bin/lxsession -s LXDE &' + + elif (( $DESKTOP_MATE > 0 )); then + + cmd_launch_desktop='x-window-manager &' + + elif (( $DESKTOP_GNUSTEP > 0 )); then + + cmd_launch_desktop='x-window-manager &' + + fi + cat << _EOF_ > "$HOME"/.vnc/xstartup [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r /root/.Xresources ] && xrdb /root/.Xresources xsetroot -solid grey vncconfig -iconic & -/usr/bin/lxsession -s LXDE & +$cmd_launch_desktop _EOF_ + chmod +x "$HOME"/.vnc/xstartup @@ -4200,7 +4551,7 @@ _EOF_ echo '' >> /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn #Copy client file to DietPi fileserver locations (/root or /mnt/usb_1) - cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn "$USERDATA_DIRECTORY"/ + cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn "$DIETPI_USERDATA_DIRECTORY"/ # - and /boot partition cp /etc/openvpn/easy-rsa/keys/DietPi_OpenVPN_Client.ovpn /boot/ @@ -4447,7 +4798,7 @@ _EOF_ /DietPi/dietpi/func/create_mysql_db pydio dietpi root dietpi #Setup Data directory - local target_data_dir="$USERDATA_DIRECTORY/pydio_data" + local target_data_dir="$DIETPI_USERDATA_DIRECTORY/pydio_data" # - Generate user data dir mkdir -p "$target_data_dir" @@ -4644,6 +4995,92 @@ _EOF_ fi + #CUBERITE + if (( $CUBERITE == 1 )); then + + cat << _EOF_ > /etc/systemd/system/cuberite.service +[Unit] +Description=Cuberite Server + +[Service] +Type=oneshot +WorkingDirectory=/etc/cubrite +ExecStart=/etc/cubrite/Cuberite --service +ExecStop=/usr/bin/killall -w Cuberite +RemainAfterExit=yes +User=root + +[Install] +WantedBy=multi-user.target +_EOF_ +systemctl enable cuberite.service +systemctl daemon-reload + + #WebUI settings + cat << _EOF_ > /etc/cubrite/webadmin.ini +[User:root] +Password=dietpi + +[WebAdmin] +Ports=1339 +Enabled=1 +_EOF_ + + + CUBERITE=2 + + fi + + #MINEOS + if (( $MINEOS == 1 )); then + + #Stop mineos from running while we config it. When we didnt do this, the program would constantly overwrite our symlink from (/var/games/minecraft). + /DietPi/dietpi/dietpi-services stop + killall -w supervisord &> /dev/null + killall -w node &> /dev/null + killall -w nodejs &> /dev/null + + ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos_console.js /usr/local/bin/mineos + + cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/mineos.conf /etc/mineos.conf + + # - setup SSL cert + cd "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft + ./generate-sslcert.sh + + # - Supervisor service + cp "$DIETPI_USERDATA_DIRECTORY"/mineos/minecraft/init/supervisor_conf /etc/supervisor/conf.d/mineos.conf + + cd "$HOME" + + # - Add underprivilged user for web access + useradd mineos + echo -e "dietpi\ndietpi\n" | passwd mineos + + # - Move server data storage to userdata dir (High disk writes) + mkdir -p "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata + mkdir -p /var/games #sometimes this is not created by mineos after installation... Ensures symlink creation does not fail. + cp -R /var/games/minecraft/* "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata/ + rm -R /var/games/minecraft + + ln -sf "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata /var/games/minecraft + + chown -R mineos:mineos /var/games/minecraft + chown -R mineos:mineos "$DIETPI_USERDATA_DIRECTORY"/mineos/serverdata + + # - correct the node filepath for supervisor mineos + sed -i '/^command=/c\command=/usr/local/bin/node webui.js' /etc/supervisor/conf.d/mineos.conf + + # - Set directory to DIETPI_USERDATA_DIRECTORY + sed -i "/^directory=/c\directory=$DIETPI_USERDATA_DIRECTORY/mineos/minecraft" /etc/supervisor/conf.d/mineos.conf + + supervisorctl reload + + + MINEOS=2 + + fi + } Install_Apply_GPU_Settings(){ @@ -4660,6 +5097,10 @@ _EOF_ #Mode 2 (Desktop / LOW GPU RAM) elif (( $DESKTOP_LXDE == 2 )); then memory_split_mode=2 + elif (( $DESKTOP_MATE == 2 )); then + memory_split_mode=2 + elif (( $DESKTOP_GNUSTEP == 2 )); then + memory_split_mode=2 elif (( $OPENTYRIAN == 2 )); then memory_split_mode=2 @@ -4750,17 +5191,13 @@ _EOF_ Dedicated_Usb_Drive_Enable(){ - local usb_hdd_mounted=$(df -h | grep -ci -m1 '/mnt/usb_1') + USBDRIVE=0 #Only enable if mounted - if (( $usb_hdd_mounted == 1 )); then + if (( $(df -P | grep -ci -m1 "$DIETPI_USBDRIVE_DIRECTORY") )); then USBDRIVE=2 - #Move swapfile to USB - echo -e "\nDietPi: Moving swapfile to USB drive, please wait...\n" - /DietPi/dietpi/func/dietpi-set_dphys-swapfile $(cat /etc/dphys-swapfile | grep 'CONF_SWAPSIZE=' | sed 's/.*=//') /mnt/usb_1/.swapfile - fi } @@ -4772,56 +5209,35 @@ _EOF_ setterm -blank 0 -powersave off 2> /dev/null #------------------------------------------------------------ - #Set target user/personal data base directory - USERDATA_DIRECTORY="/mnt/dietpi_userdata" - - # - dietpi.txt custom override? (dietpi_userdata_basedirectory=) - local dietpi_userdata_basedirectory=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//') - if [ "$dietpi_userdata_basedirectory" != "Auto" ]; then - USERDATA_DIRECTORY="$dietpi_userdata_basedirectory" - - # - USB - elif (( $USBDRIVE > 0 )); then - - # - Copy any existing data to usb drive, if it is not a symlink already. - if [ -d "$USERDATA_DIRECTORY" ] && [ ! -L "$USERDATA_DIRECTORY" ]; then + #Check if we need to setup different userdata directory for this run. + local current_userdata_dir=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) + local target_userdata_dir=$DIETPI_USERDATA_DIRECTORY - # - stop all running services. As this is done in apply_configs sections, its probably unessacary, but lets be safe. - /DietPi/dietpi/dietpi-services stop - - echo -e "\n DietPi is moving existing data from $USERDATA_DIRECTORY to your USB drive. Please wait...\n" - cp -R "$USERDATA_DIRECTORY"/* /mnt/usb_1/ - # - check for completion - if (( $? != 0 )); then - Error_Create_UserDataDirectory - exit - fi + # - Auto | flash is default value, set to USB drive if available + dietpi_userdata_basedirectory=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') + if [ "$dietpi_userdata_basedirectory" = "auto" ]; then + if (( $USBDRIVE == 2 )); then + target_userdata_dir=$DIETPI_USBDRIVE_DIRECTORY fi - # - Create symlink - rm -R "$USERDATA_DIRECTORY" - ln -sf /mnt/usb_1 "$USERDATA_DIRECTORY" - + # - custom directory + else + target_userdata_dir=$dietpi_userdata_basedirectory fi - #Attempt to create user/personal data directory - mkdir -p "$USERDATA_DIRECTORY" &> /dev/null - - # - Permissions test | Generate a test file inside the target directory, and check it exists. - local test_file_name=".testfile_dietpi_userdata_basedirectory" - echo 0 > "$USERDATA_DIRECTORY"/"$test_file_name" - - if [ -f "$USERDATA_DIRECTORY"/"$test_file_name" ]; then - rm "$USERDATA_DIRECTORY"/"$test_file_name" &> /dev/null - else + # - Setup user directory and move existing userdata if required + /DietPi/dietpi/func/dietpi-set_userdata "$current_userdata_dir" "$target_userdata_dir" + # - Check for failure + if (( $? != 0 )); then Error_Create_UserDataDirectory exit fi + #------------------------------------------------------------ #Set current path to home folder - cd "$HOME"/ + cd "$HOME" #Update Apt Banner_Apt_Update @@ -5025,9 +5441,6 @@ _EOF_ #Run Format /DietPi/dietpi/dietpi-external_drive_setup 1 - #Enable USB drive for this system. - Dedicated_Usb_Drive_Enable - fi #Define Install indexs @@ -5168,8 +5581,8 @@ _EOF_ if (( $USBDRIVE == 0 )) && (( $AUTOINSTALL_SKIPUSBDRIVEPROMPT == 0 )); then WHIP_TITLE='Setup USB Dedicated Drive?' - WHIP_QUESTION='Will you be using a dedicated USB hard drive with this DietPi installation? \n \n(NOTICE) Your decision now is final and cannot be changed at a later date. DietPi will automatically setup your future software installations to utilize the USB drive instead of MicroSD.\nAs USB hard drives are generally faster than MicroSD, using a USB drive can vastly improve system performance.\n\n This is recommended for: \n - BitTorrent (Store downloads) \n - OwnCloud \n - Kodi (Store Media Files)\n - Hifi (Store Music)' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --defaultno 22 70 + WHIP_QUESTION='If you choose to setup a dedicated USB drive, DietPi will automatically configure your future software installations to utilize the USB drive for user data storage, instead of SD.\nAs USB hard drives can be faster than most SD cards, using a USB drive can vastly improve system performance.\n\nExamples of software, that will benefit from a USB drive: \n - BitTorrent (Store downloads) \n - OwnCloud (Larger data storage)\n - Kodi / Plex / Emby etc (Store Media Files)\n\nMore information on user data in DietPi:\n - http://dietpi.com/phpbb/viewtopic.php?f=8&t=478&p=2087\n\nWould you like to setup a USB drive now?' + whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --defaultno 21 70 CHOICE=$? if (( $CHOICE == 0 )); then @@ -5178,28 +5591,9 @@ _EOF_ #Run external drive setup script /DietPi/dietpi/dietpi-external_drive_setup - #Enable USB drive for this system. - Dedicated_Usb_Drive_Enable - fi fi - #Request user to disable serial console, if not already disabled. - if (( $AUTOINSTALL_SKIPQUESTIONS == 0 && - $(cat /DietPi/dietpi.txt | grep -ci -m1 '^serial_console_enabled=1') )); then - - WHIP_TITLE='Disable Serial Console?' - WHIP_QUESTION='DietPi enables the serial console by default.\nDisabling the serial console will free up system resources if not required.\n\nIf you do not know what a serial console is, you should disable it by saying yes.\n\nWould you like to disable the serial console?' - whiptail --title "$WHIP_TITLE" --yesno "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" --defaultno 15 70 - CHOICE=$? - if (( $CHOICE == 0 )); then - - /DietPi/dietpi/func/dietpi-set_serialconsole -1 - - fi - - fi - #Questions End if (( $AUTOINSTALL_SKIPQUESTIONS == 0 )) && (( $AUTOINSTALL_INDEX == 0 )); then @@ -5237,7 +5631,7 @@ _EOF_ Error_Create_UserDataDirectory(){ - ERROR_TEXT="DietPi was unable to create your user/personal data directory ($(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//'))\n\nDietPi-Software will now exit. Please contact us on the DietPi forums for support http://dietpi.com/forum" + ERROR_TEXT="DietPi was unable to create your user data directory:\n\n $(cat /var/log/dietpi-move_userdata.log)\n\nDietPi-Software will now exit." Error_Display } @@ -5294,19 +5688,16 @@ _EOF_ #Hold our string that tells the user what software will be removed when using Index based choice systems local toberemoved_text="" - #User/Personal Data override - local user_data_path=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_userdata_basedirectory=' | sed 's/.*=//') - - # - Add location info for Auto - local user_data_auto_location="" - if [ "$user_data_path" = "Auto" ]; then - - if (( $USBDRIVE == 2 )); then - user_data_auto_location="| USB Drive | $USERDATA_DIRECTORY" - else - user_data_auto_location="| Flash (SD/EMMC) | $USERDATA_DIRECTORY" - fi + #User Data mode, auto or custom override + local user_data_mode=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') + # - Get current location of userdata + local user_data_location_actual=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) + local user_data_mode_description='Custom' + if [ "$user_data_location_actual" = "$DIETPI_USBDRIVE_DIRECTORY" ]; then + user_data_mode_description="USB Drive" + elif [ "$user_data_location_actual" = "$DIETPI_USERDATA_DIRECTORY" ]; then + user_data_mode_description="Flash (SD/EMMC)" fi # - Webserver preference system @@ -5327,7 +5718,7 @@ _EOF_ "File Server" ": $index_fileserver_text" \ "Log System" ": $index_logging_text" \ "Webserver Preference" ": $index_webserver_text" \ - "User Data Location" ": $user_data_path $user_data_auto_location" \ + "User Data Location" ": $user_data_mode_description | $user_data_location_actual" \ "DietPi-Config" "Feature-rich configuration tool for your device." \ "Help!" "Links to online guides and information." \ "Go" ">> Start Installation." 3>&1 1>&2 2>&3) @@ -5452,50 +5843,131 @@ _EOF_ "User Data Location") WHIP_TITLE='User Data Location' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Choose where to store your user/personal data. User/personal data includes software such as Owncloud data, BitTorrent downloads etc. Your fileserver choice (eg: samba, proftp) will also point to this location.\n\nNB: Changes will only affect NEW software that you install with DietPi-Software. Existing software will use the previous location.\n\n > Auto $user_data_auto_location\nIf a dedicated USB drive was setup on this system, DietPi will use that device. If not, Flash Storage will be used.\n\n> Manual\nInput a custom directory that will be used for your user/personal data." --cancel-button "Back" --default-item "$index_fileserver_text" 22 75 2 \ - "Auto" "Default (recommended)." \ - "Manual" "Input a custom directory." 3>&1 1>&2 2>&3) + # - Vars if we need to move data. + local move_data_source=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) + local move_data_target=$move_data_source + local dietpi_txt_entry='Auto' + local custom_location=1 #As we are now replacing Auto when the user selects Force DRIVE, we need to know what is considered a custom location. + + #Auto info + local autostate_text='Select now to enable Auto location.' + if [ "$user_data_mode" = "auto" ]; then + autostate_text="Active | $user_data_mode_description" + fi + #Flash info + local flashdrive_text='Not active. Select to move data.' + if [ "$move_data_source" = "$DIETPI_USERDATA_DIRECTORY" ]; then + flashdrive_text="Active ($DIETPI_USERDATA_DIRECTORY)." + custom_location=0 + fi + + #USB info + local usbdrive_text='Not active. Select to move data.' + if (( ! $USBDRIVE )); then + usbdrive_text='Select to setup a USB drive for your user data.' + elif [ "$move_data_source" = "$DIETPI_USBDRIVE_DIRECTORY" ]; then + usbdrive_text="Active ($DIETPI_USERDATA_DIRECTORY > $DIETPI_USBDRIVE_DIRECTORY)." + custom_location=0 + fi + + #Manual info + local manual_text='Not active. Select to move data.' + if (( $custom_location )) && + [ "$move_data_source" = "$user_data_mode" ]; then + manual_text="Active ($DIETPI_USERDATA_DIRECTORY > $user_data_mode)." + fi + + 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> Auto\nIf a dedicated USB drive is setup on this system, DietPi will use that device. If not, Flash Storage will be used.\n\n> Manual\nInput a custom directory that will be used for your user data." --cancel-button "Back" --default-item "$index_fileserver_text" 23 75 4 \ + "Auto" "$autostate_text" \ + "Force Flash Drive" "$flashdrive_text" \ + "Force USB Drive" "$usbdrive_text" \ + "Manual" "$manual_text" 3>&1 1>&2 2>&3) CHOICE=$? if (( $CHOICE == 0 )); then - if [ "$OPTION" = "Auto" ]; then - sed -i "/^dietpi_userdata_basedirectory=/c\dietpi_userdata_basedirectory=Auto" /DietPi/dietpi.txt + + # - Force flash + if [ "$OPTION" = "Force Flash Drive" ]; then + + move_data_target=$DIETPI_USERDATA_DIRECTORY + dietpi_txt_entry=$move_data_target + + # - Setup dedicated drive + elif [ "$OPTION" = "Force USB Drive" ]; then + + if (( ! $USBDRIVE )); then + + /DietPi/dietpi/dietpi-external_drive_setup + + #Enable USB drive for this system if sucessful. + Dedicated_Usb_Drive_Enable + + fi + + if (( $USBDRIVE == 2 )); then + move_data_target=$DIETPI_USBDRIVE_DIRECTORY + dietpi_txt_entry=$move_data_target + fi + + # - Auto + elif [ "$OPTION" = "Auto" ]; then + + move_data_target=$DIETPI_USERDATA_DIRECTORY + # - Target auto, check for USB drive + if (( $USBDRIVE == 2 )); then + move_data_target=$DIETPI_USBDRIVE_DIRECTORY + fi + dietpi_txt_entry='Auto' + + # - Manual filepath entry elif [ "$OPTION" = "Manual" ]; then - local default_item=$user_data_path - if [ "$default_item" = "Auto" ]; then - default_item="" + local default_item=$user_data_mode + if [ "$default_item" = "auto" ]; then + default_item='' + fi + + OPTION=$(whiptail --inputbox "Please input a location. Your user data will be stored inside this location.\n - eg: /mnt/MyDrive/MyData" 11 60 "$default_item" --title "User/Personal Data Directory" --backtitle "$WHIP_BACKTITLE" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + move_data_target=$OPTION + dietpi_txt_entry=$OPTION fi - OPTION=$(whiptail --inputbox "Please input a location. Your user/personal data will be stored inside this location.\n - eg: /mnt/MyDrive/MyData" 11 60 "$default_item" --title "User/Personal Data Directory" --backtitle "$WHIP_BACKTITLE" 3>&1 1>&2 2>&3) + fi + + # - Move data if the new entry has changed + if [ "$move_data_source" != "$move_data_target" ]; then + + # - Ask before we begin + whiptail --title "Data move required" --yesno "DietPi will now attempt to move any existing user data from $move_data_source to $move_data_target\n\nWould you like to begin?" --backtitle "$WHIP_BACKTITLE" --defaultno 12 70 CHOICE=$? if (( $CHOICE == 0 )); then - local path_valid=0 + # - Move data, setup symlinks + /DietPi/dietpi/func/dietpi-set_userdata "$move_data_source" "$move_data_target" - #Check for / at start of value - if [ "${OPTION:0:1}" = "/" ]; then + # - If sucessful, apply updated user data directory var. + if (( $? == 0 )); then - # - Generate dir, check for valid. - mkdir -p "$OPTION" + sed -i "/^dietpi_userdata_basedirectory=/c\dietpi_userdata_basedirectory=$dietpi_txt_entry" /DietPi/dietpi.txt + whiptail --title "$WHIP_TITLE" --msgbox "Your userdata has been sucessfuly moved from $move_data_source to $move_data_target" 12 70 - if [ -d "$OPTION" ]; then - path_valid=1 - sed -i "/^dietpi_userdata_basedirectory=/c\dietpi_userdata_basedirectory=$OPTION" /DietPi/dietpi.txt - fi - fi + else + + whiptail --title "Data move failed:" --msgbox "$(cat /var/log/dietpi-move_userdata.log)\nNo changes have been applied." 12 70 - # - Invalid path - if (( $path_valid == 0 )); then - whiptail --title "Error: Invalid Path" --msgbox "Unable to create directory:\n - $OPTION\n\nNo changes have been applied." 11 60 fi fi + # - If user selected Auto, always update dietpi.txt var if no data move was required. + elif [ "$dietpi_txt_entry" = "Auto" ]; then + sed -i "/^dietpi_userdata_basedirectory=/c\dietpi_userdata_basedirectory=$dietpi_txt_entry" /DietPi/dietpi.txt fi - fi + fi ;; "Webserver Preference") WHIP_TITLE='Webserver Preference' @@ -5711,15 +6183,24 @@ _EOF_ fi fi - local desktop_w="off" + local desktop_lxde_w="off" if (( $DESKTOP_LXDE > 0 )); then - desktop_w="on" + desktop_lxde_w="on" #Reset to 0. Menu checklists will apply back to 1 if (( $DESKTOP_LXDE == 1 )); then DESKTOP_LXDE=0 fi fi + local desktop_mate_w="off" + if (( $DESKTOP_MATE > 0 )); then + desktop_matew="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $DESKTOP_MATE == 1 )); then + DESKTOP_MATE=0 + fi + fi + local transmission_w="off" if (( $TRANSMISSION > 0 )); then transmission_w="on" @@ -6258,6 +6739,62 @@ _EOF_ fi fi + #Desktop GNUSetp + local desktop_gnustep_w="off" + if (( $DESKTOP_GNUSTEP > 0 )); then + desktop_gnustep_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $DESKTOP_GNUSTEP == 1 )); then + DESKTOP_GNUSTEP=0 + fi + fi + + #Remote Desktop: XRDP + local xrdp_w="off" + if (( $XRDP > 0 )); then + xrdp_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $XRDP == 1 )); then + XRDP=0 + fi + fi + + #Remote Desktop: No Machine + local nomachine_w="off" + if (( $NOMACHINE > 0 )); then + nomachine_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $NOMACHINE == 1 )); then + NOMACHINE=0 + fi + fi + + local desktop_mate_w="off" + if (( $DESKTOP_MATE > 0 )); then + desktop_mate_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $DESKTOP_MATE == 1 )); then + DESKTOP_MATE=0 + fi + fi + + local cuberite_w="off" + if (( $CUBERITE > 0 )); then + cuberite_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $CUBERITE == 1 )); then + CUBERITE=0 + fi + fi + + local mineos_w="off" + if (( $MINEOS > 0 )); then + mineos_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $MINEOS == 1 )); then + MINEOS=0 + fi + fi #----------------------------------------------------------------------------- WHIP_TITLE='DietPi Optimized Software Selection' @@ -6267,10 +6804,15 @@ _EOF_ if (( $HW_ARCH >= 10 && $HW_ARCH < 20 )); then whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: VNC4 Server" "LXDE Desktop for remote connection." $vnc4server_w \ + "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ + "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ + "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ + "" "────Remote Desktop Access──────────────────" "off" \ + "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ + "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ "" "────Media Systems───────────────────────────" "off" \ "Kodi" "Your very own media centre / player." $kodi_w \ + "HiFi" "Web interface music / radio player." $hifi_w \ "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ "Shairport Sync" "AirPlay audio player with multiroom sync" $shairportsync_w \ @@ -6283,6 +6825,8 @@ _EOF_ "" "────Cloud / Backups─────────────────────────" "off" \ "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ "Pydio" "Feature-rich backup and sync server" $pydio_w \ + "" "────Gaming──────────────────────────────────" "off" \ + "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ "" "────Social Media───────────────────────────" "off" \ "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ @@ -6331,9 +6875,14 @@ _EOF_ elif (( $HW_MODEL == 30 || $HW_MODEL == 50 )); then whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: TightVNC Server" "LXDE Desktop for remote connection." $tightvncserver_w \ - "LXDE: VNC4 Server" "LXDE Desktop for remote connection." $vnc4server_w \ + "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ + "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ + "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ + "" "────Remote Desktop Access──────────────────" "off" \ + "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ + "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ + "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ + "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ "" "────Media Systems───────────────────────────" "off" \ "HiFi" "Web interface music / radio player." $hifi_w \ "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ @@ -6349,6 +6898,9 @@ _EOF_ "" "────Cloud / Backups─────────────────────────" "off" \ "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ "Pydio" "Feature-rich backup and sync server" $pydio_w \ + "" "────Gaming──────────────────────────────────" "off" \ + "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ + "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ "" "────Social Media───────────────────────────" "off" \ "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ @@ -6394,9 +6946,14 @@ _EOF_ elif (( $HW_MODEL == 20 )); then whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops───────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: TightVNC Server" "LXDE Desktop for remote connection." $tightvncserver_w \ - "LXDE: VNC4 Server" "LXDE Desktop for remote connection." $vnc4server_w \ + "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ + "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ + "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ + "" "────Remote Desktop Access──────────────────" "off" \ + "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ + "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ + "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ + "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ "" "────Media Systems──────────────────────────" "off" \ "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ "SubSonic 6" "(NEW) Web interface media streaming server." $subsonic6_w \ @@ -6411,6 +6968,9 @@ _EOF_ "" "────Cloud / Backups────────────────────────" "off" \ "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ "Pydio" "Feature-rich backup and sync server" $pydio_w \ + "" "────Gaming──────────────────────────────────" "off" \ + "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ + "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ "" "────Social Media───────────────────────────" "off" \ "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ @@ -6453,9 +7013,14 @@ _EOF_ elif (( $HW_MODEL == 10 || $HW_MODEL == 11 )); then whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: TightVNC Server" "LXDE Desktop for remote connection." $tightvncserver_w \ - "LXDE: VNC4 Server" "LXDE Desktop for remote connection." $vnc4server_w \ + "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ + "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ + "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ + "" "────Remote Desktop Access──────────────────" "off" \ + "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ + "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ + "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ + "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ "" "────Media Systems───────────────────────────" "off" \ "Kodi" "Your very own media centre / player." $kodi_w \ "SubSonic 5" "Web interface media streaming server." $subsonic5_w \ @@ -6472,6 +7037,9 @@ _EOF_ "" "────Cloud / Backups─────────────────────────" "off" \ "OwnCloud" "Your very own cloud (eg: dropbox)." $owncloud_w \ "Pydio" "Feature-rich backup and sync server" $pydio_w \ + "" "────Gaming──────────────────────────────────" "off" \ + "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ + "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ "" "────Social Media───────────────────────────" "off" \ "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ @@ -6524,9 +7092,14 @@ _EOF_ whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: TightVNC Server" "LXDE Desktop for remote connection." $tightvncserver_w \ - "LXDE: VNC4 Server" "LXDE Desktop for remote connection." $vnc4server_w \ + "LXDE: Desktop" "Ultra Lightweight Desktop." $desktop_lxde_w \ + "MATE: Desktop" "MATE Desktop Enviroment" $desktop_mate_w \ + "GNUStep: Desktop" "Lightweight Desktop based on OpenStep." $desktop_gnustep_w \ + "" "────Remote Desktop Access──────────────────" "off" \ + "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ + "VNC4 Server" "Desktop for remote connection." $vnc4server_w \ + "XRDP" "Remote Desktop Protocol (RDP) server." $xrdp_w \ + "NoMachine" "Multi-Platform Server and Client Access." $nomachine_w \ "" "────Media Systems───────────────────────────" "off" \ "Kodi" "Your very own media centre / player." $kodi_w \ "HiFi" "Web interface music / radio player." $hifi_w \ @@ -6549,6 +7122,8 @@ _EOF_ "Pydio" "Feature-rich backup and sync server" $pydio_w \ "" "────Gaming──────────────────────────────────" "off" \ "OpenTyrian" "Gaming: A classic retro game, addictive." $opentyrian_w \ + "Cuberite" "Minecraft Server with web interface (C++)" $cuberite_w \ + "MineOS" "Minecraft Servers with web interface (Java)" $mineos_w \ "" "────Social Media───────────────────────────" "off" \ "Forums" "Your very own website forums (Phpbb3)." $phpbb_w \ "Wordpress" "Website Blog and Publishing platform." $wordpress_w \ @@ -6609,8 +7184,8 @@ _EOF_ whiptail --title "$WHIP_TITLE" --checklist --separate-output "Please use the spacebar to select the software you wish to install.\nSoftware details: http://dietpi.com/software" --backtitle "$WHIP_BACKTITLE" 20 82 12 \ "" "────Desktops────────────────────────────────" "off" \ - "LXDE: Desktop" "Ultra lightweight desktop." $desktop_w \ - "LXDE: TightVNC Server" "LXDE Desktop for remote connection." $tightvncserver_w \ + "LXDE: Desktop" "Ultra lightweight desktop." $desktop_lxde_w \ + "TightVNC Server" "Desktop for remote connection." $tightvncserver_w \ "" "────Media Systems───────────────────────────" "off" \ "Kodi" "Your very own media centre / player." $kodi_w \ "HiFi" "Web interface music / radio player." $hifi_w \ @@ -6674,13 +7249,40 @@ _EOF_ fi - #disabled options - # "EmonCMS" "Web interface for Open Energy Monitor data" $emoncms_w \ - while read choice do case $choice in + MineOS) + if (( $MINEOS == 0 )); then + MINEOS=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; + Cuberite) + if (( $CUBERITE == 0 )); then + CUBERITE=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; + "MATE: Desktop") + if (( $DESKTOP_MATE == 0 )); then + DESKTOP_MATE=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; + "XRDP") + if (( $XRDP == 0 )); then + XRDP=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; + "NoMachine") + if (( $NOMACHINE == 0 )); then + NOMACHINE=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; "Plex Server") if (( $PLEXMEDIASERVER == 0 )); then PLEXMEDIASERVER=1 @@ -6825,18 +7427,24 @@ _EOF_ INSTALL_DIETPI_CHOICESMADE=1 fi ;; - "LXDE: TightVNC Server") + "TightVNC Server") if (( $TIGHTVNCSERVER == 0 )); then TIGHTVNCSERVER=1 INSTALL_DIETPI_CHOICESMADE=1 fi ;; - "LXDE: VNC4 Server") + "VNC4 Server") if (( $VNC4SERVER == 0 )); then VNC4SERVER=1 INSTALL_DIETPI_CHOICESMADE=1 fi ;; + "GNUStep: Desktop") + if (( $DESKTOP_GNUSTEP == 0 )); then + DESKTOP_GNUSTEP=1 + INSTALL_DIETPI_CHOICESMADE=1 + fi + ;; Wordpress) if (( $WORDPRESS == 0 )); then WORDPRESS=1 @@ -7060,6 +7668,15 @@ _EOF_ #----------------------------------------------------------------------------- #Install Info/Warnings + #Disable Kodi for Pine64: https://github.com/Fourdee/DietPi/issues/380 + if (( $HW_MODEL >= 40 && $HW_MODEL < 50 && $KODI == 1 )); then + WHIP_TITLE='Kodi' + WHIP_QUESTION="Kodi for PineA64 is not currently functional and is disabled. Your selection has been removed.\n\nPlease see here for discussions and updates: https://github.com/Fourdee/DietPi/issues/380" + whiptail --title "$WHIP_TITLE" --msgbox "$WHIP_QUESTION" --backtitle "$WHIP_BACKTITLE" 12 65 + + KODI=0 + fi + #Webserver stacks, please let DietPi install them for you... # - == 1 to prevent installed stacks appearing if (( $WEBSERVER_LAMP == 1 || $WEBSERVER_LASP == 1 || $WEBSERVER_LAAP == 1 || @@ -7150,6 +7767,9 @@ _EOF_ if (( $WIFIHOTSPOT == 1 )) || (( $TORHOTSPOT == 1 )); then + #Enable wifi modules + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 1 + local check_criteria=1 while (( $check_criteria == 1 )); do @@ -7192,6 +7812,7 @@ _EOF_ WIFIHOTSPOT=0 TORHOTSPOT=0 whiptail --title "WiFi Hotspot Failed" --msgbox "WiFi Hotspot criteria was not met. Your selection has been removed." --backtitle "$WHIP_BACKTITLE" 10 65 + fi fi @@ -7282,6 +7903,10 @@ _EOF_ local bootchoices_available=0 if (( $DESKTOP_LXDE == 1 )); then bootchoices_available=1 + elif (( $DESKTOP_MATE == 1 )); then + bootchoices_available=1 + elif (( $DESKTOP_GNUSTEP == 1 )); then + bootchoices_available=1 elif (( $KODI == 1 )); then bootchoices_available=1 elif (( $OPENTYRIAN == 1 )); then @@ -7325,94 +7950,94 @@ _EOF_ fi local vimtiny_w="off" - if (( $VIMTINY > 0 )); then - vimtiny_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $VIMTINY == 1 )); then - VIMTINY=0 - fi - fi + if (( $VIMTINY > 0 )); then + vimtiny_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $VIMTINY == 1 )); then + VIMTINY=0 + fi + fi - local gnuemacs_w="off" - if (( $GNUEMACS > 0 )); then - gnuemacs_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $GNUEMACS == 1 )); then - GNUEMACS=0 - fi - fi + local gnuemacs_w="off" + if (( $GNUEMACS > 0 )); then + gnuemacs_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $GNUEMACS == 1 )); then + GNUEMACS=0 + fi + fi - local jed_w="off" - if (( $JED > 0 )); then - jed_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $JED == 1 )); then - JED=0 - fi - fi + local jed_w="off" + if (( $JED > 0 )); then + jed_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $JED == 1 )); then + JED=0 + fi + fi - local midnightcommander_w="off" - if (( $MIDNIGHTCOMMANDER > 0 )); then - midnightcommander_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MIDNIGHTCOMMANDER == 1 )); then - MIDNIGHTCOMMANDER=0 - fi - fi + local midnightcommander_w="off" + if (( $MIDNIGHTCOMMANDER > 0 )); then + midnightcommander_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $MIDNIGHTCOMMANDER == 1 )); then + MIDNIGHTCOMMANDER=0 + fi + fi - local iftop_w="off" - if (( $IFTOP > 0 )); then - iftop_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IFTOP == 1 )); then - IFTOP=0 - fi - fi + local iftop_w="off" + if (( $IFTOP > 0 )); then + iftop_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $IFTOP == 1 )); then + IFTOP=0 + fi + fi - local iptraf_w="off" - if (( $IPTRAF > 0 )); then - iptraf_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IPTRAF == 1 )); then - IPTRAF=0 - fi - fi + local iptraf_w="off" + if (( $IPTRAF > 0 )); then + iptraf_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $IPTRAF == 1 )); then + IPTRAF=0 + fi + fi - local iperf_w="off" - if (( $IPERF > 0 )); then - iperf_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $IPERF == 1 )); then - IPERF=0 - fi - fi + local iperf_w="off" + if (( $IPERF > 0 )); then + iperf_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $IPERF == 1 )); then + IPERF=0 + fi + fi - local mtrtiny_w="off" - if (( $MTRTINY > 0 )); then - mtrtiny_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $MTRTINY == 1 )); then - MTRTINY=0 - fi - fi + local mtrtiny_w="off" + if (( $MTRTINY > 0 )); then + mtrtiny_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $MTRTINY == 1 )); then + MTRTINY=0 + fi + fi - local nload_w="off" - if (( $NLOAD > 0 )); then - nload_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $NLOAD == 1 )); then - NLOAD=0 - fi - fi + local nload_w="off" + if (( $NLOAD > 0 )); then + nload_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $NLOAD == 1 )); then + NLOAD=0 + fi + fi - local tcpdump_w="off" - if (( $TCPDUMP > 0 )); then - tcpdump_w="on" - #Reset to 0. Menu checklists will apply back to 1 - if (( $TCPDUMP == 1 )); then - TCPDUMP=0 - fi - fi + local tcpdump_w="off" + if (( $TCPDUMP > 0 )); then + tcpdump_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $TCPDUMP == 1 )); then + TCPDUMP=0 + fi + fi local sshclient_w="off" if (( $SSHCLIENT > 0 )); then @@ -7508,9 +8133,28 @@ _EOF_ fi fi + local quiterss_w="off" + if (( $QUITERSS > 0 )); then + quiterss_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $QUITERSS == 1 )); then + QUITERSS=0 + fi + fi + + local vifm_w="off" + if (( $VIFM > 0 )); then + vifm_w="on" + #Reset to 0. Menu checklists will apply back to 1 + if (( $VIFM == 1 )); then + VIFM=0 + fi + fi WHIP_TITLE='Linux - Software Selection' whiptail --title "$WHIP_TITLE" --checklist --separate-output "Press the spacebar to select additional software for installation." --backtitle "$WHIP_BACKTITLE" 19 71 12 \ + "" "────Desktops and Utilities───────────────────" "off" \ + "QuiteRSS" "Cross-Platform, Free RSS Reader" $quiterss_w \ "" "────Editors──────────────────────────────────" "off" \ "Emacs" "GNU Emacs editor." $gnuemacs_w \ "Jed" "Editor for programmers." $jed_w \ @@ -7518,6 +8162,7 @@ _EOF_ "Vim-Tiny" "Compact release of Vim." $vimtiny_w \ "" "────File Managers────────────────────────────" "off" \ "MC" "Midnight Commander - a powerful file manager." $midnightcommander_w \ + "ViFM" "File Manager with Vi bindings." $vifm_w \ "" "────SSH Clients──────────────────────────────" "off" \ "OpenSSH" "SSH Client: OpenSSH." $sshclient_w \ "" "────Fileserver Clients───────────────────────" "off" \ @@ -7544,6 +8189,18 @@ _EOF_ while read choice do case $choice in + "QuiteRSS") + if (( $QUITERSS == 0 )); then + QUITERSS=1 + INSTALL_LINUX_CHOICESMADE=1 + fi + ;; + "ViFM") + if (( $VIFM == 0 )); then + VIFM=1 + INSTALL_LINUX_CHOICESMADE=1 + fi + ;; Iperf) if (( $IPERF == 0 )); then IPERF=1 @@ -7788,6 +8445,10 @@ _EOF_ fi + #-------------------------------------------------------------------------------------- + #Enable USBDRIVE flag for this system if its mounted/available. + Dedicated_Usb_Drive_Enable + #-------------------------------------------------------------------------------------- #Start DietPi Menu while (( $TARGETMENUID > -1 )); do @@ -7801,6 +8462,7 @@ _EOF_ elif (( $TARGETMENUID == 2 )); then Menu_Linux_Software fi + done #-------------------------------------------------------------------------------------- diff --git a/dietpi/dietpi-sync b/dietpi/dietpi-sync index 8ba3283c48..94776a59b8 100644 --- a/dietpi/dietpi-sync +++ b/dietpi/dietpi-sync @@ -29,7 +29,7 @@ #///////////////////////////////////////////////////////////////////////////////////// # MENUS #///////////////////////////////////////////////////////////////////////////////////// - WHIP_BACKTITLE='DietPi-Backup' + WHIP_BACKTITLE='DietPi-Sync' WHIP_TITLE='' CHOICE=0 OPTION=0 @@ -66,8 +66,13 @@ SYNC_CRONDAILY_TEXT="Enabled" fi - WHIP_TITLE='--- DietPi-Sync ---' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Source location:\n$FP_SOURCE\n\nTarget location:\n$FP_TARGET" --cancel-button "Exit" --backtitle "$WHIP_BACKTITLE" 20 73 8 \ + local sync_last_completed='No previous sync found in target directory.' + if [ -f "$FP_TARGET/$SYNC_STATS_FILENAME" ]; then + sync_last_completed=$(grep '^Sync completed' "$FP_TARGET/$SYNC_STATS_FILENAME" | tail -1 | awk '{print $3}') + fi + + WHIP_TITLE='- DietPi-Sync -' + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Source location:\n $FP_SOURCE\n\nTarget location:\n $FP_TARGET\n\nMost recent successful sync date:\n $sync_last_completed" --cancel-button "Exit" --backtitle "$WHIP_BACKTITLE" 23 73 8 \ "Help" "What does DietPi-Sync do?" \ "Source Location" "Change the Source directory." \ "Target Location" "Change the Target directory." \ diff --git a/dietpi/dietpi-uninstall b/dietpi/dietpi-uninstall index 12840eae1a..3bec1909cf 100644 --- a/dietpi/dietpi-uninstall +++ b/dietpi/dietpi-uninstall @@ -27,9 +27,6 @@ INPUT=$1 VALIDINPUT=1 - #///////////////////////////////////////////////////////////////////////////////////// - #Exit Paths - #///////////////////////////////////////////////////////////////////////////////////// #Exit path for non-root logins. if (( $UID != 0 )); then clear @@ -47,9 +44,13 @@ #Apt-get purge AGP='apt-get purge -y' - #///////////////////////////////////////////////////////////////////////////////////// - #Obtain Pi/Odroid Model - #///////////////////////////////////////////////////////////////////////////////////// + USERDATA_DIRECTORY='/mnt/dietpi_userdata' + + # - dietpi.txt custom override? (DIETPI_USERDATA_BASEDIRECTORY=) + DIETPI_USERDATA_BASEDIRECTORY=$(cat /DietPi/dietpi.txt | grep -m1 'dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') + if [ "$DIETPI_USERDATA_BASEDIRECTORY" != "auto" ]; then + USERDATA_DIRECTORY="$DIETPI_USERDATA_BASEDIRECTORY" + fi HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) HW_MODEL_DESCRIPTION=$(sed -n 2p /DietPi/dietpi/.hw_model) @@ -58,7 +59,7 @@ #///////////////////////////////////////////////////////////////////////////////////// #Menu #///////////////////////////////////////////////////////////////////////////////////// - WHIP_TITLE='------ DietPi-Uninstall ------' + WHIP_TITLE='- DietPi-Uninstall -' Menu_Uninstall(){ @@ -183,6 +184,16 @@ elif [ "$INPUT" = "DESKTOP_LXDE" ]; then $AGP lxde upower policykit-1 iceweasel p7zip-full + elif [ "$INPUT" = "DESKTOP_MATE" ]; then + $AGP mate-desktop-environment-extras upower policykit-1 iceweasel p7zip-full + elif [ "$INPUT" = "DESKTOP_GNUSTEP" ]; then + $AGP x-window-system-core wmaker gnustep gnustep-devel gnustep-games upower policykit-1 iceweasel p7zip-full + elif [ "$INPUT" = "QUITERSS" ]; then + $AGP quiterss + elif [ "$INPUT" = "NOMACHINE" ]; then + $AGP nomachine + elif [ "$INPUT" = "XRDP" ]; then + $AGP xrdp elif [ "$INPUT" = "TRANSMISSION" ]; then $AGP transmission-daemon rm /etc/init.d/transmission-daemon &> /dev/null @@ -350,6 +361,8 @@ rm /usr/local/bin/vncserver + rm -R "$HOME"/.vnc + elif [ "$INPUT" = "FAIL2BAN" ]; then $AGP fail2ban @@ -512,6 +525,24 @@ _EOF_ rm /etc/apt/sources.list.d/plex.list &> /dev/null /DietPi/dietpi/dietpi-apt-get_update 2 + elif [ "$INPUT" = "CUBERITE" ]; then + + rm -R /etc/cuberite + rm /etc/systemd/system/cuberite.service + + elif [ "$INPUT" = "MINEOS" ]; then + + rm -R "$USERDATA_DIRECTORY"/mineos + rm -R /var/games/minecraft + + rm /etc/supervisor/conf.d/mineos.conf + supervisorctl reload + + rm /usr/local/bin/mineos + + userdel -f mineos + + #---------------------------------------------------------------------- #LINUX SOFTWARE elif [ "$INPUT" = "TCPDUMP" ]; then @@ -588,13 +619,23 @@ _EOF_ elif [ "$INPUT" = "LOGGING_RSYSLOG" ]; then $AGP rsyslog elif [ "$INPUT" = "NODEJS" ]; then + $AGP nodejs - rm /etc/apt/sources.list.d/nodesource_nodejs.list - /DietPi/dietpi/dietpi-apt-get_update 2 + + # - old install via repo + if [ -f /etc/apt/sources.list.d/nodesource_nodejs.list ]; then + rm /etc/apt/sources.list.d/nodesource_nodejs.list + /DietPi/dietpi/dietpi-apt-get_update 2 + fi + + rm /usr/local/bin/node elif [ "$INPUT" = "OPENBAZAAR" ]; then echo -e "nothing here" + elif [ "$INPUT" = "VIFM" ]; then + $AGP vifm + #---------------------------------------------------------------------- #No Matching software else diff --git a/dietpi/dietpi-update b/dietpi/dietpi-update index 64ddbbae5e..f00e46ebd0 100644 --- a/dietpi/dietpi-update +++ b/dietpi/dietpi-update @@ -101,15 +101,13 @@ #///////////////////////////////////////////////////////////////////////////////////// # MENUS #///////////////////////////////////////////////////////////////////////////////////// - WHIP_BACKTITLE='DietPi - Update' - WHIP_TITLE='DietPi - Update' - WHIP_QUESTION='DietPi - Update' + WHIP_BACKTITLE='- DietPi-Update -' + WHIP_TITLE=$WHIP_BACKTITLE CHOICE=0 OPTION=0 Menu_Update(){ - WHIP_TITLE='---------- DietPi - Update ----------' whiptail --title "$WHIP_TITLE" --yesno " DietPi Version: $VERSION_CURRENT \n Latest Version: $VERSION_SERVER \n \n Update available, would you like to update DietPi?\n\n Changelog: https://goo.gl/G9ikqn" --yes-button "Ok" --no-button "Exit" --backtitle "$WHIP_BACKTITLE" 14 60 CHOICE=$? #Confirm action diff --git a/dietpi/finalise b/dietpi/finalise index 88a9cfe521..e3d821931f 100644 --- a/dietpi/finalise +++ b/dietpi/finalise @@ -10,6 +10,7 @@ # # Info: # - Preps the system for saving an image file, and, setting up for 1st use. + # NB: Use of this script will drop WiFi connections, use ETH only. #//////////////////////////////////// #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. @@ -100,6 +101,13 @@ #Copy Network Interface conf cp /DietPi/dietpi/conf/network_interfaces /etc/network/interfaces + # WiFi country code to GB + /DietPi/dietpi/func/dietpi-set_wificountrycode GB + + # Disable wifi and bluetooth modules on all devices. + /DietPi/dietpi/func/dietpi-set_wifi_bt bluetooth 0 + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 0 + #Set Hostname cat << _EOF_ > /etc/hosts 127.0.0.1 localhost @@ -111,10 +119,6 @@ DietPi _EOF_ - #//////////////////////////////////// - #Enable serial console - /DietPi/dietpi/func/dietpi-set_serialconsole 1 - #//////////////////////////////////// #Set Pi cmdline.txt back to normal # - Remove root delay @@ -126,6 +130,9 @@ _EOF_ /DietPi/dietpi/func/dietpi-i2c_control -1 + sed -i "/temp_limit=/c\temp_limit=65" /DietPi/config.txt + + #//////////////////////////////////// # ODROID's - Set boot.ini back to normal if (( $HW_MODEL == 10 )); then @@ -169,6 +176,9 @@ _EOF_ #Update README.MD wget https://raw.githubusercontent.com/Fourdee/DietPi/testing/README.md -O /boot/README.md + #//////////////////////////////////// + #Disable serial console + /DietPi/dietpi/func/dietpi-set_serialconsole -1 #//////////////////////////////////// #Disable soundcards @@ -197,16 +207,46 @@ _EOF_ echo -e "$IMAGE_VERSION" > /DietPi/dietpi/.version echo -e "$IMAGE_VERSION" > /etc/.dietpi_image_version - #Remove backup/sync - rm -R /mnt/dietpi-backup - rm -R /mnt/dietpi-sync - #.dietpi-autostart_index Console echo 0 > /DietPi/dietpi/.dietpi-autostart_index #Create our update file (used on 1st run to check for DietPi updates) echo -1 > /DietPi/dietpi/.update_stage + #//////////////////////////////////// + #clean and setup DietPi specific mount folders + rm -R /mnt/dietpi-backup + rm -R /mnt/dietpi-sync + rm -R /mnt/dietpi_userdata + + mkdir -p /mnt/dietpi_userdata + + umount /mnt/samba + if (( ! $(df | grep -ci -m1 '/mnt/samba') )); then + rm -R /mnt/samba + mkdir -p /mnt/samba + echo -e "Samba client can be installed and setup by DietPi-Config.\nSimply run: dietpi-config" > /mnt/samba/readme.txt + else + echo -e "\nWARN: samba is mounted, please unmount and run this script again." + fi + + umount /mnt/ftp_client + if (( ! $(df | grep -ci -m1 '/mnt/ftp_client') )); then + rm -R /mnt/ftp_client + mkdir -p /mnt/ftp_client + echo -e "FTP client mount can be installed and setup by DietPi-Config.\nSimply run: dietpi-config" > /mnt/ftp_client/readme.txt + else + echo -e "\nWARN: ftp_client is mounted, please unmount and run this script again." + fi + + umount /mnt/usb_1 + if (( ! $(df | grep -ci -m1 '/mnt/usb_1') )); then + rm -R /mnt/usb_1 + mkdir -p /mnt/usb_1 + else + echo -e "\nWARN: usb_1 is mounted, please unmount and run this script again." + fi + #//////////////////////////////////// #Set Init .install_stage to -3 (first boot) echo -3 > /DietPi/dietpi/.install_stage diff --git a/dietpi/func/dietpi-set_serialconsole b/dietpi/func/dietpi-set_serialconsole index baddd514a5..1a0ac1964c 100644 --- a/dietpi/func/dietpi-set_serialconsole +++ b/dietpi/func/dietpi-set_serialconsole @@ -153,7 +153,7 @@ if (( $HW_MODEL == 3 && $(cat /DietPi/config.txt | grep -m1 'core_freq=' | sed 's/.*=//') == 250 )); then - sed -i '/core_freq=/c\#core_freq=400' /DietPi/config.txt + sed -i '/core_freq=/c\#core_freq=400' /DietPi/config.txt fi diff --git a/dietpi/func/dietpi-set_userdata b/dietpi/func/dietpi-set_userdata new file mode 100644 index 0000000000..cb126f531c --- /dev/null +++ b/dietpi/func/dietpi-set_userdata @@ -0,0 +1,232 @@ +#!/bin/bash +{ + #//////////////////////////////////// + # DietPi Function: + # + #//////////////////////////////////// + # Created by Daniel Knight / daniel_haze@hotmail.com / dietpi.com + # + #//////////////////////////////////// + # + # Info: + # - Sets up user data directory. + # - Allows automated moving of user data in DietPi. Automatically generates a symlink from /mnt/dietpi_userdata to target directory if needed. + # - Also moves the Dphys swapfile to $TARGET_DIRECTORY. Required to prevent locked .swapfile from allow us to delete $SOURCE_DIRECTORY. + # + # Usage: + # - /DietPi/dietpi/func/dietpi-set_userdata return_source | Return current user data directory FP + # - /DietPi/dietpi/func/dietpi-set_userdata sSOURCE_DIRECTORY sTARGET_DIRECTORY | Setup user data directory, move data if needed. Returns 1 if failed. + #//////////////////////////////////// + + #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. + LANG=en_GB.UTF-8 + + EXIT_CODE=0 + + DIETPI_USERDATA_DIRECTORY='/mnt/dietpi_userdata' # Global, must match same var in dietpi-software in dietpi-uninstall. Probably a good idea to never change this. + + SOURCE_DIRECTORY="$1" + TARGET_DIRECTORY="$2" + + LOGFILE_OUTPUT_TEXT='' + FP_LOGFILE='/var/log/dietpi-move_userdata.log' + + SWAPFILE_SIZE=$(/DietPi/dietpi/func/dietpi-set_dphys-swapfile | awk '{print $1}') + + FREESPACE_AVAILABLE_TARGET=0 + FREESPACE_REQUIRED_SOURCE=0 + + RUN_MOVE_DATA=1 + Run_Move_Data(){ + + # - stop all running services. + /DietPi/dietpi/dietpi-services stop + + # - move swap out the way + /DietPi/dietpi/func/dietpi-set_dphys-swapfile 0 /mnt/.swapfile + + # - setup target directory. Remove directory if its currently a symlink. + if [ -L "$TARGET_DIRECTORY" ]; then + + rm -R "$TARGET_DIRECTORY" + + fi + + mkdir -p "$TARGET_DIRECTORY" + + # - Copy source to target, if it contains any files/folders + if [ -z "$(find $SOURCE_DIRECTORY -maxdepth 0 -empty)" ]; then + + echo -e "\n DietPi is moving your existing data from $SOURCE_DIRECTORY to $TARGET_DIRECTORY. Please wait...\n" + sleep 1 + cp -vR "$SOURCE_DIRECTORY"/* "$TARGET_DIRECTORY"/ + + # - Remove all files in source + if (( $? == 0 )); then + + rm -R "$SOURCE_DIRECTORY"/* + + else + + LOGFILE_OUTPUT_TEXT="ERROR: Failed to copy $SOURCE_DIRECTORY/* to $TARGET_DIRECTORY." + EXIT_CODE=1 + break + + fi + + fi + + #If no previous errors, remove source directory and setup symlink if required. + # - Remove source base folder if its a symlink + if [ -L "$SOURCE_DIRECTORY" ]; then + + rm -R "$SOURCE_DIRECTORY" + + fi + + # - Create symlink to DIETPI_USERDATA_DIRECTORY if required + if [ "$TARGET_DIRECTORY" != "$DIETPI_USERDATA_DIRECTORY" ]; then + + rm -R "$DIETPI_USERDATA_DIRECTORY" &> /dev/null + ln -sf "$TARGET_DIRECTORY" "$DIETPI_USERDATA_DIRECTORY" + + fi + + # - move swapfile + /DietPi/dietpi/func/dietpi-set_dphys-swapfile "$SWAPFILE_SIZE" "$TARGET_DIRECTORY"/.swapfile + + # - Start services back up again + /DietPi/dietpi/dietpi-services start + + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Main Loop + #///////////////////////////////////////////////////////////////////////////////////// + #init + # - If there is no directory or symlink for $DIETPI_USERDATA_DIRECTORY, always create a directory. + if [ ! -d "$DIETPI_USERDATA_DIRECTORY" ] && [ ! -L "$DIETPI_USERDATA_DIRECTORY" ]; then + mkdir -p "$DIETPI_USERDATA_DIRECTORY" + fi + + #------------------------------------------------------------------------------------- + #Returns + # - Return current userdata dir + if [ "$1" = "return_source" ]; then + + echo -e "$(readlink -f $DIETPI_USERDATA_DIRECTORY)" + exit + + fi + + #------------------------------------------------------------------------------------- + #Run + while (( $RUN_MOVE_DATA )); + do + + # Sanity checks + # - Check for both inputs + if [ -z "$SOURCE_DIRECTORY" ] || [ -z "$TARGET_DIRECTORY" ]; then + + LOGFILE_OUTPUT_TEXT="ERROR: Please provide a source ($SOURCE_DIRECTORY) and target ($TARGET_DIRECTORY) directory for input." + EXIT_CODE=1 + break + + # - Check if symlink is already pointing to target directory. + elif [ "$(readlink -f $DIETPI_USERDATA_DIRECTORY)" = "$TARGET_DIRECTORY" ]; then + + LOGFILE_OUTPUT_TEXT="INFO: $DIETPI_USERDATA_DIRECTORY is already symlinked to target directory." + EXIT_CODE=0 #return ok + break + + + # - Check if source directory exists + elif [ ! -d "$SOURCE_DIRECTORY" ]; then + + LOGFILE_OUTPUT_TEXT="ERROR: source directory $SOURCE_DIRECTORY does not exist." + EXIT_CODE=1 + break + + + # - Check for disallowed directory match + elif (( $(echo -e "$SOURCE_DIRECTORY" | grep -ci -m1 "$TARGET_DIRECTORY") || + $(echo -e "$TARGET_DIRECTORY" | grep -ci -m1 "$SOURCE_DIRECTORY") )); then + + LOGFILE_OUTPUT_TEXT="ERROR: $SOURCE_DIRECTORY and $TARGET_DIRECTORY cannot be within each other. Disallowed directory match." + EXIT_CODE=1 + break + + # - Only allow full filepaths + elif [ "${SOURCE_DIRECTORY:0:1}" != "/" ] || [ "${TARGET_DIRECTORY:0:1}" != "/" ]; then + + LOGFILE_OUTPUT_TEXT="ERROR: Both source ($SOURCE_DIRECTORY) and target directories ($TARGET_DIRECTORY) must contain the full filepath (eg: /mnt/drive1)" + EXIT_CODE=1 + break + + fi + + #Ensure we can create and write to target directory + mkdir -p "$TARGET_DIRECTORY" &> /dev/null + if [ ! -d "$TARGET_DIRECTORY" ]; then + + LOGFILE_OUTPUT_TEXT="ERROR: Unable to create target directory $TARGET_DIRECTORY." + EXIT_CODE=1 + break + + # - Create a test file inside target directory + else + + test_file_name=".testfile_dietpi_userdata_basedirectory" + + echo 0 > "$TARGET_DIRECTORY"/"$test_file_name" + + if [ -f "$TARGET_DIRECTORY"/"$test_file_name" ]; then + rm "$TARGET_DIRECTORY"/"$test_file_name" + else + LOGFILE_OUTPUT_TEXT="ERROR: Unable to create test file in target directory $TARGET_DIRECTORY. Check permissions." + EXIT_CODE=1 + break + fi + + fi + + #Ensure enough freespace in target + FREESPACE_AVAILABLE_TARGET=$(( $(df -Pk "$TARGET_DIRECTORY" | awk '{print $4}' | sed -n 2p) * 1024 )) #bytes + + echo -e "INFO: Calculating space required for moving data, please wait..." + FREESPACE_REQUIRED_SOURCE=$(du -cbs "$SOURCE_DIRECTORY" | awk '{print $1}' | sed -n 1p) #bytes + + echo -e " - Available $FREESPACE_AVAILABLE_TARGET bytes" + echo -e " - Required $FREESPACE_REQUIRED_SOURCE bytes" + + if (( $FREESPACE_AVAILABLE_TARGET < $FREESPACE_REQUIRED_SOURCE )); then + + LOGFILE_OUTPUT_TEXT="ERROR: Not enough free space in target directory $TARGET_DIRECTORY.\n - Available $FREESPACE_AVAILABLE_TARGET\n - Required $FREESPACE_REQUIRED_SOURCE" + EXIT_CODE=1 + break + + fi + + #Run, attempt to move data. + Run_Move_Data + + #Done + RUN_MOVE_DATA=0 + + done + + #----------------------------------------------------------------------------------- + #Print any errors and send to logfile + rm "$FP_LOGFILE" &> /dev/null + if [ -n "$LOGFILE_OUTPUT_TEXT" ]; then + + echo -e "$LOGFILE_OUTPUT_TEXT" + + # + send to logfile + echo -e "$LOGFILE_OUTPUT_TEXT" > "$FP_LOGFILE" + + fi + #----------------------------------------------------------------------------------- + exit $EXIT_CODE + #----------------------------------------------------------------------------------- +} diff --git a/dietpi/func/dietpi-set_wifi_bt b/dietpi/func/dietpi-set_wifi_bt new file mode 100644 index 0000000000..c9822ba0c6 --- /dev/null +++ b/dietpi/func/dietpi-set_wifi_bt @@ -0,0 +1,137 @@ +#!/bin/bash +{ + #//////////////////////////////////// + # DietPi Function: + # + #//////////////////////////////////// + # Created by Daniel Knight / daniel_haze@hotmail.com / dietpi.com + # + #//////////////////////////////////// + # + # Info: + # - Enables/disables Wifi/BT modules. Also controls internal adapters on some devices (eg: RPI3) + # + # Usage: + # - /DietPi/dietpi/func/dietpi-set_wifi_bt sADAPTER iSTATE + #//////////////////////////////////// + + #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. + LANG=en_GB.UTF-8 + + HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) + + ADAPTER=$(echo -e "$1" | tr '[:upper:]' '[:lower:]') # bluetooth/wifi + STATE=$2 # 0=disable | 1=enable + + #///////////////////////////////////////////////////////////////////////////////////// + # Main Loop + #///////////////////////////////////////////////////////////////////////////////////// + #----------------------------------------------------------------------------------- + #WiFi + if [ "$ADAPTER" = "wifi" ]; then + + rm /etc/modprobe.d/disable_wifi.conf &> /dev/null + + aWIFI_MODULES=() + + # - All + aWIFI_MODULES=("cfg80211") + + # + RPi 3 + aWIFI_MODULES+=("brcmfmac") #RPi 3 onboard WiFi + aWIFI_MODULES+=("brcmutil") #RPi 3 onboard WiFi + + # + Pine A64 + aWIFI_MODULES+=("8723bs") #PineA64 addon WiFi/BT board. + + # - Disable + if (( ! $STATE )); then + + #cfg80211 last + for ((i=$(( ${#aWIFI_MODULES[@]} - 1 )); i>=0; i--)) + do + modprobe -rf "${aWIFI_MODULES[$i]}" 2> /dev/null + echo -e "blacklist ${aWIFI_MODULES[$i]}" >> /etc/modprobe.d/disable_wifi.conf + done + + # - Enable + else + + #cfg80211 first + for ((i=0; i<${#aWIFI_MODULES[@]}; i++)) + do + modprobe "${aWIFI_MODULES[$i]}" 2> /dev/null + done + + # - Delay. Without this, kernel reports wifi device not found with RPi 3 and Pine A64 addon board, when ran straight after this script. + echo -e "Please wait, enabling WiFi Modules..." + sleep 3 + + fi + + unset aWIFI_MODULES + + #----------------------------------------------------------------------------------- + #BT + elif [ "$ADAPTER" = "bluetooth" ]; then + + # - Disable + if (( ! $STATE )); then + + systemctl stop bluetooth + systemctl disable bluetooth + + # - all + modprobe -rf bnep + + # + RPi 3 + if (( $HW_MODEL == 3 )); then + systemctl stop hciuart + systemctl disable hciuart + + modprobe -rf hci_uart + modprobe -rf btbcm + fi + + modprobe -rf bluetooth + + cat << _EOF_ > /etc/modprobe.d/disable_bt.conf +#DietPi - Disable Bluetooth modules. Use dietpi-config > advanced to enable bluetooth. +blacklist bluetooth +blacklist bnep #RPi 3 +blacklist hci_uart #RPi 3 +blacklist btbcm #RPi 3 +_EOF_ + + # - Enable + else + + rm /etc/modprobe.d/disable_bt.conf &> /dev/null + + # - all + modprobe bnep + + # + RPi 3 + if (( $HW_MODEL == 3 )); then + modprobe hci_uart + modprobe btbcm + fi + + modprobe bluetooth + + systemctl enable bluetooth + systemctl start bluetooth + + # + RPi 3 + if (( $HW_MODEL == 3 )); then + systemctl enable hciuart + systemctl start hciuart + fi + + fi + + fi + #----------------------------------------------------------------------------------- + exit + #----------------------------------------------------------------------------------- +} diff --git a/dietpi/login b/dietpi/login index e2be4fc668..0e935ac9df 100644 --- a/dietpi/login +++ b/dietpi/login @@ -69,7 +69,7 @@ if (( $AUTO_START_INDEX == 1 )); then /DietPi/dietpi/misc/start_kodi - #LXDE - Desktop + #Desktop (LXDE/MATE etc) elif (( $AUTO_START_INDEX == 2 )); then startx @@ -84,13 +84,9 @@ #DietPi-Cloudshell elif (( $AUTO_START_INDEX == 5 )); then - #prevent sleep - setterm -blank 0 -powersave off - #set font + setterm --blank 0 --powersave off setfont /usr/share/consolefonts/Uni3-TerminusBold24x12.psf - - #Disable Cursor tput civis #Launch DietPi-Cloudshell (+thread) @@ -158,4 +154,4 @@ #----------------------------------------------------------------------------------- exit #----------------------------------------------------------------------------------- -} \ No newline at end of file +} diff --git a/dietpi/patch_file b/dietpi/patch_file index e1c0ba92c3..d0a1a0c0b9 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -825,11 +825,116 @@ _EOF_ fi #------------------------------------------------------------------------------- + elif (( $VERSION_CURRENT == 119 )); then + #------------------------------------------------------------------------------- + #RPi 3 75 thermal limit: https://github.com/Fourdee/DietPi/issues/356#issuecomment-223282185 + if (( $HW_MODEL == 3 )); then + + sed -i '/temp_limit=/c\temp_limit=75' /DietPi/config.txt + + fi + #------------------------------------------------------------------------------- + #Disable internal WiFi and BT by default on new installs + if [ ! -f /DietPi/dietpi/.installed ]; then + + # - changed from RPi3 only script to all devices, remove old references + rm /etc/modprobe.d/disable_rpi3_bt.conf &> /dev/null + rm /etc/modprobe.d/disable_rpi3_wifi.conf &> /dev/null + + /DietPi/dietpi/func/dietpi-set_wifi_bt bluetooth 0 + + #enable WiFi for automation + if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 'Wifi_Enabled=1') )); then + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 1 + else + /DietPi/dietpi/func/dietpi-set_wifi_bt wifi 0 + fi + + fi + #------------------------------------------------------------------------------- + #Pine A64 image, disable systemd-timesyncd as we use ntp/d. New installs only. + if (( $HW_MODEL >= 40 && $HW_MODEL < 50 )) && [ ! -f /DietPi/dietpi/.installed ]; then + systemctl disable systemd-timesyncd + systemctl mask systemd-timesyncd + fi + #------------------------------------------------------------------------------- + #Netplug is now installed on demand in dietpi-config, when both adapters are enabled. + apt-get purge netplug -y + #------------------------------------------------------------------------------- + #DietPi-Cloudshell - New poweroff screen at specific time + if [ -f /DietPi/dietpi/.dietpi-cloudshell ]; then + sed -i '7s/.*/0/' /DietPi/dietpi/.dietpi-cloudshell #Enabled? + sed -i '8s/.*/22/' /DietPi/dietpi/.dietpi-cloudshell #Start time (hour) + sed -i '9s/.*/8/' /DietPi/dietpi/.dietpi-cloudshell #End time (hour) + fi + #------------------------------------------------------------------------------- + #Pine A64, now using fbturbo driver: https://github.com/Fourdee/DietPi/issues/380 + if (( $HW_MODEL >= 40 && $HW_MODEL < 50 )) && + [ -f /DietPi/dietpi/.installed ] && + (( $( cat /DietPi/dietpi/.installed | grep -ci -m1 '^XSERVERXORG=2' ) )); then + + wget http://dietpi.com/downloads/binaries/all/libump_1-1_arm64.deb -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 + + fi + #------------------------------------------------------------------------------- + #Always ensure dietpi_userdata directory exists + mkdir -p /mnt/dietpi_userdata &> /dev/null + + #Setup dietpi_userdata symlink for existing installs, if not on flash drive + if [ -f /DietPi/dietpi/.installed ]; then + + DIETPI_USERDATA_BASEDIRECTORY=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_userdata_basedirectory=' | sed 's/.*=//' | tr '[:upper:]' '[:lower:]') + + if [ -n "$DIETPI_USERDATA_BASEDIRECTORY" ]; then + + #Auto + if [ "$DIETPI_USERDATA_BASEDIRECTORY" = "auto" ]; then + + #USBDRIVE + if (( $(cat /DietPi/dietpi/.installed | grep -ci -m1 'USBDRIVE=2') && $(df | grep -ci -m1 '/mnt/usb_1') )); then + /DietPi/dietpi/func/dietpi-set_userdata /mnt/dietpi_userdata /mnt/usb_1 + fi + + #CUSTOM + else + /DietPi/dietpi/func/dietpi-set_userdata /mnt/dietpi_userdata "$DIETPI_USERDATA_BASEDIRECTORY" + fi + + # - dietpi-set_userdata restarts services, so stop them. + /DietPi/dietpi/dietpi-services stop + + else + + read -p "Error: Unable to setup DietPi Userdata directories. dietpi_userdata_basedirectory= is missing or invalid value in dietpi.txt. It is highly recommended you backup any personal data on this system, then reinstall DietPi using the latest image available from http://dietpi.com/download. Press any key to continue..." + + fi + + fi + #------------------------------------------------------------------------------- + #xz-utils missing from some images, required for decompress tar.xz support. + apt-get install -y xz-utils + #------------------------------------------------------------------------------- + #I left the serial console enabled for all the v120 images (my bad). Disable if not enabled in dietpi.txt + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^serial_console_enabled=1') )); then + /DietPi/dietpi/func/dietpi-set_serialconsole -1 + fi + #------------------------------------------------------------------------------- + fi #------------------------------------------------------------------------------- #NB: all if statements must contain at least one command. Prevents bash having a hissy fit :) #------------------------------------------------------------------------------- + #Delete all lines starting with a comment? + #Considering this for all dietpi-scripts to reduce the ramdisk size on installed system. + #sed -i '/^[[:blank:]]*#/d' file + #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- sleep 0.25 diff --git a/dietpi/server_version b/dietpi/server_version index 5b361f7b17..aeb9839e1a 100644 --- a/dietpi/server_version +++ b/dietpi/server_version @@ -1,2 +1,2 @@ -119 +120 5 \ No newline at end of file diff --git a/uEnv.txt b/uEnv.txt index 2fdeca27b5..0c41b42a7a 100644 --- a/uEnv.txt +++ b/uEnv.txt @@ -1,3 +1,3 @@ -console=tty0 console=ttyS0,115200n8 no_console_suspend console=tty1 +console=tty0 no_console_suspend console=tty1 kernel_filename=pine64/Image initrd_filename=initrd.img