From 5e9e68a203b9ea4b05d0f230be8c8a2433f63960 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Tue, 30 Apr 2019 23:07:02 +0200 Subject: [PATCH 01/41] v6.23 + DietPi-Globals | G_CONFIG_INJECT: Fix password string --- dietpi/func/dietpi-globals | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 1f7a68a6d3..0a97b4e716 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -2319,8 +2319,10 @@ $print_logfile_info # Replace password string by asterisks in output string if [[ $GCI_PASSWORD == 1 ]]; then - setting_raw=$(sed -E "s/^.*$pattern[[:blank:]]*//" <<< "$setting_raw") - setting_raw="$(sed -E "s/(^.*$pattern[[:blank:]]*).*$/\1/" <<< "$setting_raw")${setting_raw//?/*}" + local password='' + password=$(sed -E "s/^.*$pattern[[:blank:]]*//" <<< "$setting_raw") + setting_raw="$(sed -E "s/(^.*$pattern[[:blank:]]*).*$/\1/" <<< "$setting_raw")${password//?/*}" + unset password fi From f589b4f362b63eacbd51153188a5dcc7cf201b34 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Wed, 1 May 2019 15:28:53 +0200 Subject: [PATCH 02/41] v6.23 + DietPi-Drive_Manager | Fix scraping comment lines as swap and misc mounts --- dietpi/dietpi-drive_manager | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 4924ff1e4b..bcc15f2dd6 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -140,10 +140,10 @@ tmpfs /DietPi tmpfs defaults,size=10m,noatime,nodev,nosuid,mode=1777 0 0" # Else: Grab current mounts else - swap_mount=$(grep -m1 '[[:blank:]]swap[[:blank:]]' $FP_TEMP_FSTAB) + swap_mount=$(grep -m1 '^[[:blank:]]*[^#].*[[:blank:]]swap[[:blank:]]' $FP_TEMP_FSTAB) tmpfs_mounts=$(grep '^tmpfs[[:blank:]]' $FP_TEMP_FSTAB) # encryptfs, vboxsf, bind mounts - misc_mounts=$(grep -E '([[:blank:],]bind[[:blank:],]|[[:blank:]](encryptfs|vboxsf)[[:blank:]])' $FP_TEMP_FSTAB) + misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:],]bind[[:blank:],]|[[:blank:]](encryptfs|vboxsf)[[:blank:]])' $FP_TEMP_FSTAB) # CurlFtpFS, CIFS/SMB/Samba, NFS net_mounts=$(grep -E '(^curlftpfs|[[:blank:]](cifs|nfs4?)[[:blank:]])' $FP_TEMP_FSTAB) From 946cb11e4fc1d519543578181b5fcba03dadcb5e Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Wed, 1 May 2019 17:35:46 +0200 Subject: [PATCH 03/41] v6.23 (#2753) + DietPi-Software | Java: On Jessie, download our self-hosted packages, since jessie-backports branch has been removed from Debian repo which was the source for OpenJDK 8 --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 52 +++++++++++++++++------------------------- dietpi/patch_file | 3 +++ 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 369b61e44d..2d3eac078c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -47,6 +47,7 @@ Bug Fixes: - DietPi-Software | Nextcloud: Resolved an issue on Lighttpd with HTTPS enabled where OPcache settings were not applied as desired, leading to a warning on Nextcloud admin panel. Many thanks to @Borotes for reporting this issue: https://github.com/MichaIng/DietPi/issues/2489 - DietPi-Software | Nextcloud Talk: Resolved an issue where coTURN prints two warnings about deprecated settings on Buster systems, due to some changes with latest versions. - DietPi-Software | Kodi: Resolved an issue on RPi where Kodi (v18) fails to start when a custom screen resolution was chosen. Many thanks to @johnnypea for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 +- DietPi-Software | Java: Resolved an issue where install fails on Jessie systems since the used jessie-backports APT repo does not exist any more: https://github.com/MichaIng/DietPi/issues/2752 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX/files diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 764f64e747..b76e5b6690 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6775,28 +6775,28 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix Banner_Installing - local packages='ca-certificates-java openjdk-8-jre-headless openjdk-8-jdk-headless' + # On Jessie we need to our self-hosted packages: + if (( $G_DISTRO < 4 )); then - # On Jessie use backports repo: - if (( $G_DISTRO == 3 )); then + Download_Install "https://dietpi.com/downloads/binaries/jessie/openjdk-8-jre_$G_HW_ARCH_DESCRIPTION.7z" + Download_Install "https://dietpi.com/downloads/binaries/jessie/openjdk-8-jdk_$G_HW_ARCH_DESCRIPTION.7z" + dpkg --force-hold,confdef,confold -i ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb + G_AGF + rm ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb + - cat << _EOF_ > /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk -Package: ca-certificates-java java-common openjdk-8-* -Pin: release a=jessie-backports -Pin-Priority: 990 -_EOF_ + else - packages+=' -t jessie-backports' + local packages='ca-certificates-java openjdk-8-jre-headless openjdk-8-jdk-headless' + # Workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 + apt-get install -y -qq $packages + G_AGI $packages fi - # Workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 - apt-get install -y -qq $packages - G_AGI $packages - fi - software_id=9 + software_id=9 # Node.js if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6812,7 +6812,7 @@ _EOF_ fi - software_id=130 + software_id=130 # Python pip if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -6831,48 +6831,40 @@ _EOF_ fi - #SDL2 - software_id=140 + software_id=140 # SDL2 if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - #X86_64 + # X86_64 if (( $G_HW_ARCH == 10 )); then # G_AGI libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-ttf-2.0-0 libsdl2-net-2.0-0 libsdl2-mixer-2.0-0 INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-x86_64_stretch.7z' - #ARMv6 + # ARMv6 elif (( $G_HW_ARCH == 1 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-armv6_stretch.7z' - #ARMv7 FKMS: + # ARMv7 FKMS: # ./configure --disable-video-rpi --enable-video-kmsdrm elif (( $G_HW_ARCH == 2 )); then INSTALL_URL_ADDRESS='https://dietpi.com/downloads/binaries/all/sdl2-armv7_stretch.7z' # - RPi 2/3 Enable fkms OpenGL - if (( $G_HW_MODEL < 10 )); then - - /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d - - fi + (( $G_HW_MODEL < 10 )) && /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl vc4-fkms-v3d fi Download_Install "$INSTALL_URL_ADDRESS" sdl2 - dpkg -i sdl2/*.deb - rm -R sdl2 fi - #Mono repo - software_id=150 + software_id=150 # Mono runtime if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -14536,9 +14528,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - apt-mark auto $(dpkg --get-selections default-jre* default-jdk* openjdk-* | mawk '{print $1}') ca-certificates-java - [[ -f /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk ]] && rm /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk fi diff --git a/dietpi/patch_file b/dietpi/patch_file index 7bf48f504b..c2722ee5ae 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -1742,6 +1742,9 @@ NB: When accessing "deluge-console" you need to do that as user "debian-deluged" # dietpi-set_dphys-swapfile renamed to: "dietpi-set_swapfile": https://github.com/MichaIng/DietPi/pull/2720 rm -f /{DietPi,boot}/dietpi/func/dietpi-set_dphys-swapfile #------------------------------------------------------------------------------- + # Remove obsolete OpenJDK APT preferences on Jessie: https://github.com/MichaIng/DietPi/pull/2753 + [[ -f '/etc/apt/preferences.d/99-dietpi-openjdk-8-jdk' ]] && rm /etc/apt/preferences.d/99-dietpi-openjdk-8-jdk + #------------------------------------------------------------------------------- if (( $G_DIETPI_INSTALL_STAGE == 2 )); then # Infom Sonarr/Radarr/Lidarr users about DietPi-Arr_to_RAM: https://github.com/MichaIng/DietPi/pull/2698 From 173b2d403d2908d7feee0e56395f2794f48a3ec5 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Wed, 1 May 2019 23:12:07 +0200 Subject: [PATCH 04/41] v6.23 + DietPi-Software | New Wiki page allows to remove detailed comments from the script about how to implement a new software title: https://github.com/MichaIng/DietPi/wiki/How-to-implement-a-new-software-title + DietPi-Software | Britishise wording "ize" => "ise" :) + DietPi-Software | Emonhub: Revert GitHub download URL to Fourdee + DietPi-Software | PHP: Install PHP7+ specific module packages on all distro versions now since all DietPi systems are migrated to PHP7.3 --- dietpi/dietpi-software | 295 ++++++++++------------------------------- 1 file changed, 69 insertions(+), 226 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index b76e5b6690..afc4b3a621 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -9,16 +9,17 @@ #//////////////////////////////////// # # Info: - # - filename /DietPi/dietpi/dietpi-software - # - Installs "ready to run" software with optimizations unique to the device. + # - Location: /DietPi/dietpi/dietpi-software + # - Installs "ready to run" software with optimisations unique to the device. # - Generates and uses /DietPi/dietpi/.installed (software list) # -1=selected for uninstall, 0=not installed, 1=selected for install, 2=installed # # Usage: - # - dietpi-software - # - /DietPi/dietpi/dietpi-software install iUNIQUEID (OR) sINDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int - # - /DietPi/dietpi/dietpi-software reinstall #Same as installed, however, only reinstalls if state =2. Does not uninstall due to package removal danger (eg: xserver removes kodi), simply flags to be installed (=1). - # - /DietPi/dietpi/dietpi-software uninstall iUNIQUEID - # - /DietPi/dietpi/dietpi-software list #Lists UNIQUEIDs for software. + # - dietpi-software # Menu to select software for (un)install + # - dietpi-software install $software_id (OR) $INDEX_{SSHSERVER,FILESERVER,LOGGING,WEBSERVER}_TARGET=-int + # - dietpi-software reinstall # Same as installed, however, only reinstalls if state =2. Does not uninstall due to package removal danger (eg: Xserver removes Kodi), simply flags to be installed (=1). + # - dietpi-software uninstall $software_id + # - dietpi-software list # Lists all available software titles with ID and info + # - dietpi-software free # List currently unused software IDs to be used for new software implementations #//////////////////////////////////// # Import DietPi-Globals --------------------------------------------------------------- @@ -135,6 +136,7 @@ _EOF_ # - Use /etc/apt/sources.list for connection test optional_cmd_inputs='--no-check-certificate' G_CHECK_URL "$(grep -m1 '^[[:blank:]]*deb ' /etc/apt/sources.list | mawk '{print $2}')" # Will exit on failure here then prompt user to configure network + # Time sync /DietPi/dietpi/func/run_ntpd } @@ -250,71 +252,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it declare -A aSOFTWARE_AVAIL_G_HW_ARCH declare -A aSOFTWARE_AVAIL_G_DISTRO - #///////////////////////////////////////////////////////////////////////////////////// - # This function generates the array for all the software available for installation. - # - # Reference: - # - Adding new software to DietPi-Software: - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Adding software to the install list: - # ------------------------------------ - # - software_id: - # This is the next number in the sequence. Each software install has a unique number, - # so it can be referenced in all arrays. This has to be the same for install, uninstall - # and setting up the service. Run "dietpi-software list | grep ''" to - # get the next number in the sequence. Ensure that you are running a testing build, as - # release may be behind the testing branch and available software packages. - # - # - aSOFTWARE_WHIP_NAME[$software_id]: - # This is the name to display in the UI. - # - # - aSOFTWARE_WHIP_DESC[$software_id]: - # This is the description to place next to the name in the UI. - # - # - aSOFTWARE_CATEGORY_INDEX[$software_id]: - # If you are adding a new piece of software, first choose the category it belongs to - # (see aSOFTWARE_CATEGORIES_DIETPI and aSOFTWARE_CATEGORIES_LINUX below), which will - # give you the aSOFTWARE_CATEGORY_INDEX to set. In the example below this is 0. - # - # - aSOFTWARE_TYPE[$software_id]: - # If this is aSOFTWARE_CATEGORIES_DIETPI then aSOFTWARE_TYPE=0, if it is - # aSOFTWARE_CATEGORIES_LINUX then it is 1. In the example it is 0. - # - # - aSOFTWARE_ONLINEDOC_URL[$software_id]: - # This is appended to "https://dietpi.com/phpbb/viewtopic.php?" to make a URL for help on this software. - # This needs to be filled after creating the related online docs entry: https://dietpi.com/phpbb/viewtopic.php?p=5#p5 - # - # Specifying other software as dependencies: - # If your software needs other software to be available, look under the 'Requires software - # to be installed' heading and then add that to the section you create. In the example - # below ALSA and XSERVERXORG are needed. The system will check their presence - # and install as needed. - # - # Dealing with Hardware types: - # If you have hardware requirements, like must not/only be installed on a Pi, then you need - # to add something like below. Look for other examples in the existing software - # installations. Full list of models can be found in 'dietpi-obtain_hw_model'. - # - # # - Disable for all non-RPi - # for ((i=10; i<=$MAX_G_HW_MODEL; i++)) - # do - # aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,$i]=0 - # done - # - # Example: - # #------------------ Desktops: LXDE ------------------ - # software_id=23 - # - # aSOFTWARE_WHIP_NAME[$software_id]='LXDE' - # aSOFTWARE_WHIP_DESC[$software_id]='ultra lightweight desktop' - # aSOFTWARE_CATEGORY_INDEX[$software_id]=0 - # aSOFTWARE_TYPE[$software_id]=0 - # aSOFTWARE_REQUIRES_ALSA[$software_id]=1 - # aSOFTWARE_REQUIRES_XSERVERXORG[$software_id]=1 - # aSOFTWARE_ONLINEDOC_URL[$software_id]='p=42#p42' - # - #///////////////////////////////////////////////////////////////////////////////////// + # Generate arrays for all available software titles Software_Arrays_Init(){ G_DIETPI-NOTIFY -2 'Initialising database' @@ -323,7 +261,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it # Categories # NB: Unique IDs, do not re-arrange or re-order! #-------------------------------------------------------------------------------- - # DietPi software + # DietPi optimised software aSOFTWARE_CATEGORIES_DIETPI=( '●─ Desktops ' #0 @@ -350,7 +288,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it ) - # Linux software + # Linux additional software aSOFTWARE_CATEGORIES_LINUX=( '●─ SSH Clients ' #0 @@ -1361,7 +1299,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it software_id=58 aSOFTWARE_WHIP_NAME[$software_id]='OpenBazaar' - aSOFTWARE_WHIP_DESC[$software_id]='decentralized peer to peer bitcoin market' + aSOFTWARE_WHIP_DESC[$software_id]='decentralised peer to peer bitcoin market' aSOFTWARE_CATEGORY_INDEX[$software_id]=6 aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 @@ -1373,7 +1311,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it software_id=133 aSOFTWARE_WHIP_NAME[$software_id]='YaCy' - aSOFTWARE_WHIP_DESC[$software_id]='decentralized open source search engine' + aSOFTWARE_WHIP_DESC[$software_id]='decentralised open source search engine' aSOFTWARE_CATEGORY_INDEX[$software_id]=6 aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_REQUIRES_JAVA_JRE_JDK[$software_id]=1 @@ -2382,7 +2320,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it software_id=103 aSOFTWARE_WHIP_NAME[$software_id]='DietPi-RAMlog' - aSOFTWARE_WHIP_DESC[$software_id]='minimal, optimized logging' + aSOFTWARE_WHIP_DESC[$software_id]='minimal, optimised logging' aSOFTWARE_CATEGORY_INDEX[$software_id]=0 aSOFTWARE_TYPE[$software_id]=-1 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=68#p68' @@ -2421,7 +2359,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_INSTALL_STATE[104]=2 # Dropbear #-------------------------------------------------------------------------------- - G_DIETPI-NOTIFY 0 'Initialized database' + G_DIETPI-NOTIFY 0 'Initialised database' } @@ -2976,7 +2914,7 @@ Package: *php7.3*\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/di } # Return optimisation values for BitTorrent servers based on device and hardware capabilities. - Optimize_BitTorrent(){ + Optimise_BitTorrent(){ local output=0 @@ -3150,53 +3088,7 @@ Package: *php7.3*\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/di } - #///////////////////////////////////////////////////////////////////////////////////// - # This function handles the installation of the selected software. - # - # Reference: - # - Adding new software to DietPi-Software - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Installing the software: - # ------------------------------------ - # - software_id: - # This has to be the same number as software_id for the software list above. - # - # - INSTALL_URL_ADDRESS: - # This can be used to check conectivity to items you need to download later. - # A good example would also be a git repo. - # - # - Use Download_Install() (see code above) to check URL, download and install/extract - # deb|zip|tar(.gz|.bz2)|7z sources automatically and consistent, e.g. - # Download_Install 'https://www.phpbb.com/files/release/phpBB-3.2.2.zip' /var/www - # will check the URL, download phpBB archive, extract it to /var/www(/phpBB3) - # and remove the archieve afterwards. - # - # Example: - # #------------------ Bittorrent: HTPC Manager ------------------ - # software_id=155 - # if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - # - # Banner_Installing - # - # INSTALL_URL_ADDRESS='https://github.com/Hellowlol/HTPC-Manager.git' - # - # G_CHECK_URL "$INSTALL_URL_ADDRESS" - # - # # Install Python and PIP - # G_AGI python python-pip python-imaging - # - # cd /root - # git clone --depth=1 "$INSTALL_URL_ADDRESS" - # - # # Move HTPC Manager to a 'better' location - # mkdir -p $G_FP_DIETPI_USERDATA/htpc-manager - # mv /root/HTPC-Manager/* $G_FP_DIETPI_USERDATA/htpc-manager/ - # rm -R /root/HTPC-Manager - # - # fi - # - #///////////////////////////////////////////////////////////////////////////////////// + # Run marked software installs Install_Dietpi_Software(){ #-------------------------------------------------------------- @@ -3906,8 +3798,7 @@ _EOF_ fi - #myMPD - software_id=148 + software_id=148 # myMPD if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -4649,15 +4540,13 @@ _EOF_ fi - #FRESHRSS - software_id=38 + software_id=38 # FreshRSS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing # Install required PHP modules: https://github.com/FreshRSS/FreshRSS#example-of-full-installation-on-linux-debianubuntu - DEPS_LIST="$PHP_NAME-curl $PHP_NAME-gmp $PHP_NAME-intl $PHP_NAME-json" - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-zip" + DEPS_LIST="$PHP_NAME-curl $PHP_NAME-gmp $PHP_NAME-intl $PHP_NAME-json $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-zip" Download_Install 'https://github.com/FreshRSS/FreshRSS/archive/master.zip' /opt mv /opt/FreshRSS-master /opt/FreshRSS @@ -5107,10 +4996,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior Banner_Installing # Install required PHP modules - DEPS_LIST="$PHP_NAME-apcu $PHP_NAME-gd $PHP_NAME-intl" - - # - Stretch extras - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_NAME-mbstring $PHP_NAME-opcache $PHP_NAME-xml" + DEPS_LIST="$PHP_NAME-apcu $PHP_NAME-gd $PHP_NAME-intl $PHP_NAME-mbstring $PHP_NAME-opcache $PHP_NAME-xml" # Skip install, if already present if [[ -d /var/www/pydio ]]; then @@ -5176,7 +5062,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior Banner_Installing DEPS_LIST='minicom python-serial python-configobj' - Download_Install 'https://github.com/MichaIng/emonhub/archive/emon-pi.zip' + Download_Install 'https://github.com/Fourdee/emonhub/archive/emon-pi.zip' pip install paho-mqtt pydispatcher @@ -5286,8 +5172,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #CUBERITE - software_id=52 + software_id=52 # Cuberite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing @@ -5772,8 +5657,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior Banner_Installing # Needed PHP modules, (re)install to be failsafe: https://koel.phanan.net/docs/#/?id=server, https://laravel.com/docs/5.6/installation#server-requirements - DEPS_LIST="python $PHP_NAME-json" - (( $G_DISTRO > 3 )) && DEPS_LIST+=" $PHP_NAME-mbstring $PHP_NAME-xml" + DEPS_LIST="python $PHP_NAME-json $PHP_NAME-mbstring $PHP_NAME-xml" Download_Install 'https://github.com/phanan/koel/archive/v3.7.2.zip' mv koel-* $G_FP_DIETPI_USERDATA/koel @@ -7100,50 +6984,14 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix if (( $INDEX_WEBSERVER_TARGET != $INDEX_WEBSERVER_CURRENT )); then - #Update Current to Target + # Update Current to Target INDEX_WEBSERVER_CURRENT=$INDEX_WEBSERVER_TARGET fi } - #///////////////////////////////////////////////////////////////////////////////////// - # Configuration post installation goes here. - # - # Reference: - # - Adding new software to DietPi-Software - # https://github.com/MichaIng/DietPi/issues/490#issuecomment-244416570 - # - # Adding post installation steps. - # ------------------------------------ - # - software_id: - # This has to be the same number as software_id for the software list above. - # - # Here you can add any configuration changes or addtions to systemd. After this - # has run it will reload the systemd environment and start any services installed - # and referenced in 'dietpi-services' - # - # Example: - # #------------------ Desktop: MATE ------------------ - # software_id=24 - # if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - # - # # - file manager desktop icon - # ln -sf /usr/share/applications/caja.desktop /root/Desktop/caja.desktop - # - # Create_Desktop_Shared_Items - # - # #Odroid C2, define default pulseaudio sink: https://github.com/MichaIng/DietPi/issues/415 - # if (( $G_HW_MODEL == 12 )) && - # ! grep -qi '^set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo' /etc/pulse/default.pa; then - # - # echo 'set-default-sink alsa_output.platform-odroid_hdmi.37.analog-stereo' >> /etc/pulse/default.pa - # - # fi - # - # fi - # - #///////////////////////////////////////////////////////////////////////////////////// + # Configure marked software titles Install_Apply_Configs(){ # Copy/Set optimised Software settings. @@ -7156,7 +7004,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix Banner_Configuration - #Pre-create dirs + # Pre-create dirs mkdir -p /root/.config/openbox mkdir -p /root/.config/lxpanel/LXDE/panels mkdir -p /root/.config/pcmanfm/LXDE @@ -7350,7 +7198,7 @@ _EOF_ ## Start an FastCGI server using php-fpm fastcgi.server += ( ".php" => (( - "socket" => "/run/php/$PHP_NAME-fpm.sock", + "socket" => "/run/php/${PHP_NAME}-fpm.sock", "broken-scriptfilename" => "enable" )) ) @@ -7489,7 +7337,7 @@ _EOF_ fi ### Also for MariaDB? - # Optimize for reduced memory use: https://github.com/MichaIng/DietPi/issues/605#issue-188930987 + # Optimise for reduced memory use: https://github.com/MichaIng/DietPi/issues/605#issue-188930987 #cat << _EOF_ > /etc/mysql/mariadb.conf.d/99-dietpi.cnf #[mysqld] #key_buffer_size=8M @@ -8356,11 +8204,11 @@ NB: This port needs to be forwarded by your router and/or opened in your firewal mkdir -p /etc/systemd/system/transmission-daemon.service.d echo -e '[Service]\nGroup=dietpi' > /etc/systemd/system/transmission-daemon.service.d/dietpi-group.conf - # Apply optimized settings - G_CONFIG_INJECT '"cache-size-mb"' ' "cache-size-mb": '$(Optimize_BitTorrent 0)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"download-queue-size"' ' "download-queue-size": '$(Optimize_BitTorrent 1)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"peer-limit-global"' ' "peer-limit-global": '$(Optimize_BitTorrent 2)',' /etc/transmission-daemon/settings.json '^\{$' - G_CONFIG_INJECT '"upload-slots-per-torrent"' ' "upload-slots-per-torrent": '$(Optimize_BitTorrent 3)',' /etc/transmission-daemon/settings.json '^\{$' + # Apply optimised settings + G_CONFIG_INJECT '"cache-size-mb"' ' "cache-size-mb": '$(Optimise_BitTorrent 0)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"download-queue-size"' ' "download-queue-size": '$(Optimise_BitTorrent 1)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"peer-limit-global"' ' "peer-limit-global": '$(Optimise_BitTorrent 2)',' /etc/transmission-daemon/settings.json '^\{$' + G_CONFIG_INJECT '"upload-slots-per-torrent"' ' "upload-slots-per-torrent": '$(Optimise_BitTorrent 3)',' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"port-forwarding-enabled"' ' "port-forwarding-enabled": true,' /etc/transmission-daemon/settings.json '^\{$' G_CONFIG_INJECT '"encryption"' ' "encryption": 2,' /etc/transmission-daemon/settings.json '^\{$' @@ -8786,8 +8634,7 @@ _EOF_ fi - #Kodi - software_id=31 + software_id=31 # Kodi if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9130,11 +8977,11 @@ _EOF_ # Apply optimised settings # - Cache size is in steps of 16 KiB. (Cachesize * 16 = total KiB) - sed -i '/"cache_size": /c\ "cache_size": '$(( $(Optimize_BitTorrent 0) * 1024 / 16 ))',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_active_limit": /c\ "max_active_limit": '$(Optimize_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_active_downloading": /c\ "max_active_downloading": '$(Optimize_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_connections_global": /c\ "max_connections_global": '$(Optimize_BitTorrent 2)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf - sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '$(Optimize_BitTorrent 3)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"cache_size": /c\ "cache_size": '$(( $(Optimise_BitTorrent 0) * 1024 / 16 ))',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_active_limit": /c\ "max_active_limit": '$(Optimise_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_active_downloading": /c\ "max_active_downloading": '$(Optimise_BitTorrent 1)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_connections_global": /c\ "max_connections_global": '$(Optimise_BitTorrent 2)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf + sed -i '/"max_upload_slots_global": /c\ "max_upload_slots_global": '$(Optimise_BitTorrent 3)',' $G_FP_DIETPI_USERDATA/deluge/.config/deluge/core.conf fi @@ -9222,7 +9069,7 @@ Do you want to enable the Pi-hole blocking page?'; then getent passwd airsonic &> /dev/null && usercmd='usermod' $usercmd airsonic -G dietpi,audio -d $G_FP_DIETPI_USERDATA/airsonic -s /usr/sbin/nologin - # Optimize memory limit + # Optimise memory limit local airsonic_memory_max=$(( $RAM_TOTAL / 5 )) (( $airsonic_memory_max < 200 )) && airsonic_memory_max=200 airsonic_memory_max+='m' @@ -9259,7 +9106,7 @@ _EOF_ getent passwd subsonic &> /dev/null && usercmd='usermod' $usercmd subsonic -G dietpi,audio -d /var/subsonic -s /usr/sbin/nologin - # Optimize memory limit + # Optimise memory limit local subsonic_memory_max=$(( $RAM_TOTAL / 5 )) (( $subsonic_memory_max < 200 )) && subsonic_memory_max=200 @@ -9440,8 +9287,7 @@ _EOF_ fi - #WORDPRESS - software_id=55 + software_id=55 # Wordpress if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9451,8 +9297,7 @@ _EOF_ fi - #FRESHRSS - software_id=38 + software_id=38 # FreshRSS if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -9721,8 +9566,7 @@ _EOF_ fi - #Ubooquity - software_id=80 + software_id=80 # Ubooquity if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration @@ -10744,16 +10588,16 @@ _EOF_ ported_to_new_savepath_system=true [Preferences] -Downloads\DiskWriteCacheSize=$(Optimize_BitTorrent 0) +Downloads\DiskWriteCacheSize=$(Optimise_BitTorrent 0) Downloads\DiskWriteCacheTTL=60 -Queueing\MaxActiveDownloads=$(Optimize_BitTorrent 1) -Queueing\MaxActiveTorrents=$(Optimize_BitTorrent 1) +Queueing\MaxActiveDownloads=$(Optimise_BitTorrent 1) +Queueing\MaxActiveTorrents=$(Optimise_BitTorrent 1) Queueing\MaxActiveUploads=1 Queueing\IgnoreSlowTorrents=false -Bittorrent\MaxConnecs=$(Optimize_BitTorrent 2) -Bittorrent\MaxConnecsPerTorrent=$(Optimize_BitTorrent 2) -Bittorrent\MaxUploads=$(Optimize_BitTorrent 3) -Bittorrent\MaxUploadsPerTorrent=$(Optimize_BitTorrent 3) +Bittorrent\MaxConnecs=$(Optimise_BitTorrent 2) +Bittorrent\MaxConnecsPerTorrent=$(Optimise_BitTorrent 2) +Bittorrent\MaxUploads=$(Optimise_BitTorrent 3) +Bittorrent\MaxUploadsPerTorrent=$(Optimise_BitTorrent 3) WebUI\Port=1340 WebUI\Enabled=true General\Locale=en @@ -10987,20 +10831,20 @@ network.max_open_files.set = 50 scheduler.max_active.set = 3 # byte value -pieces.memory.max.set = $(( $(Optimize_BitTorrent 0) * 1024 * 1024 )) +pieces.memory.max.set = $(( $(Optimise_BitTorrent 0) * 1024 * 1024 )) # Maximum and minimum number of peers to connect to per torrent. throttle.min_peers.normal.set = 1 -throttle.max_peers.normal.set = $(( $(Optimize_BitTorrent 2) / 2 + 1 )) +throttle.max_peers.normal.set = $(( $(Optimise_BitTorrent 2) / 2 + 1 )) # Same as above but for seeding completed torrents (-1 = same as downloading) throttle.min_peers.seed.set = -1 throttle.max_peers.seed.set = -1 # Maximum number of simultaneous downloads -throttle.max_downloads.set = $(Optimize_BitTorrent 2) +throttle.max_downloads.set = $(Optimise_BitTorrent 2) # Maximum number of simultaneous uploads -throttle.max_uploads.set = $(Optimize_BitTorrent 3) +throttle.max_uploads.set = $(Optimise_BitTorrent 3) # Global upload and download rate in KiB. "0" for unlimited. throttle.global_down.max_rate.set_kb = 0 @@ -11136,11 +10980,11 @@ pause=false log=/var/log/aria2.log log-level=warn -split=$(Optimize_BitTorrent 1) +split=$(Optimise_BitTorrent 1) continue=true check-integrity=true -max-concurrent-downloads=$(Optimize_BitTorrent 1) -max-connection-per-server=$(Optimize_BitTorrent 1) +max-concurrent-downloads=$(Optimise_BitTorrent 1) +max-connection-per-server=$(Optimise_BitTorrent 1) # Bandwidth limits: https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-max-overall-upload-limit max-overall-download-limit=0 max-overall-upload-limit=0 @@ -11148,7 +10992,7 @@ max-file-not-found=3 max-tries=5 retry-wait=60 ftp-pasv=true -bt-max-peers=$(Optimize_BitTorrent 2) +bt-max-peers=$(Optimise_BitTorrent 2) listen-port=6881-6999 check-certificate=false @@ -11937,9 +11781,9 @@ _EOF_ sed -i "/CrashTrace=/c\CrashTrace=no" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf sed -i "/DetailTarget=/c\DetailTarget=none" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/ParBuffer=/c\ParBuffer=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/ArticleCache=/c\ArticleCache=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf - sed -i "/WriteBuffer=/c\WriteBuffer=$(Optimize_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/ParBuffer=/c\ParBuffer=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/ArticleCache=/c\ArticleCache=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf + sed -i "/WriteBuffer=/c\WriteBuffer=$(Optimise_BitTorrent 0)" $G_FP_DIETPI_USERDATA/nzbget/nzbget.conf cat << _EOF_ > /etc/systemd/system/nzbget.service [Unit] @@ -13223,7 +13067,6 @@ _EOF_ Banner_Uninstalling apt-mark auto mono-complete mono-devel mono-runtime libmono-cil-dev 2>/dev/null rm /etc/apt/sources.list.d/mono-xamarin.list - G_AGUP fi @@ -14773,7 +14616,7 @@ _EOF_ /DietPi/dietpi/dietpi-services stop Install_Linux_Software - # Install DietPi Optimized Software + # Install DietPi Optimised Software /DietPi/dietpi/dietpi-services stop Install_Dietpi_Software @@ -15608,7 +15451,7 @@ This will allow you to choose which program loads automatically, after the syste 'DietPi-Config' ': Feature-rich configuration tool for your device' '' '●─ Select Software ' 'Search' ': Find a software title for installation' - 'Software Optimized' ': Select DietPi optimized software for installation' + 'Software Optimised' ': Select DietPi optimised software for installation' 'Software Additional' ': Select additional Linux software for installation' 'SSH Server' ": [$index_sshserver_text]" 'File Server' ": [$index_fileserver_text]" @@ -15643,7 +15486,7 @@ This will allow you to choose which program loads automatically, after the syste ;; - 'Software Optimized') + 'Software Optimised') TARGETMENUID=1 @@ -16128,7 +15971,7 @@ Software details, usernames, passwords etc:\n - https://dietpi.com/software\n\nW if (( $G_DIETPI_INSTALL_STAGE == 1 )); then G_WHIP_YESNO 'DietPi was unable to detect any additional software selections for install.\n -NB: You can use dietpi-software at a later date, to install optimized software from our catalogue as required.\n\nDo you wish to continue with DietPi as a pure minimal image?' +NB: You can use dietpi-software at a later date, to install optimised software from our catalogue as required.\n\nDo you wish to continue with DietPi as a pure minimal image?' if (( $? == 0 )); then #exit menu system @@ -16299,7 +16142,7 @@ NB: You can use dietpi-software at a later date, to install optimized software f Banner_Configs(){ - G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Optimize and configure software' + G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Optimise and configure software' G_DIETPI-NOTIFY 2 "Applying DietPi optimizations and configurations for $G_HW_MODEL_DESCRIPTION, please wait...\n" } From de44648232c4127942dbb94ec6e1a034d5cc1e1b Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Thu, 2 May 2019 11:36:17 +0100 Subject: [PATCH 05/41] WIP: C1 Stretch Move image to ARMbian EOS. --- PREP_SYSTEM_FOR_DIETPI.sh | 9 --- boot_c1.ini | 68 ---------------- dietpi/dietpi-config | 125 +---------------------------- dietpi/dietpi-drive_manager | 4 +- dietpi/dietpi-software | 17 +--- dietpi/func/dietpi-obtain_hw_model | 2 +- dietpi/func/dietpi-set_hardware | 22 +---- 7 files changed, 13 insertions(+), 234 deletions(-) delete mode 100644 boot_c1.ini diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 18b8ed64f4..732b84831d 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -548,10 +548,6 @@ G_RUN_CMD mv "DietPi-$G_GITBRANCH/config.txt" /boot/ - elif (( $G_HW_MODEL == 10 )); then - - G_RUN_CMD mv "DietPi-$G_GITBRANCH/boot_c1.ini" /boot/boot.ini - elif (( $G_HW_MODEL == 11 )); then G_RUN_CMD mv "DietPi-$G_GITBRANCH/boot_xu4.ini" /boot/boot.ini @@ -803,11 +799,6 @@ _EOF_ G_AGI linux-image-4.14-armhf-odroid-xu4 - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - G_AGI linux-image-armhf-odroid-c1 - # BBB elif (( $G_HW_MODEL == 71 )); then diff --git a/boot_c1.ini b/boot_c1.ini deleted file mode 100644 index e36cda9466..0000000000 --- a/boot_c1.ini +++ /dev/null @@ -1,68 +0,0 @@ -# IMPORTANT: -# - Modifications to /boot/boot.ini will not be preserved on reboot. -# - Please ensure you edit from the DietPi-RAMdisk location: /DietPi/boot.ini - -ODROIDC-UBOOT-CONFIG - -setenv m "720p" - -# HDMI DVI Mode Configuration -setenv vout_mode "hdmi" -# setenv vout_mode "dvi" -# setenv vout_mode "vga" - -# HDMI BPP Mode -setenv m_bpp "16" - -# HDMI Hotplug Force (HPD) -# 1 = Enables HOTPlug Detection -# 0 = Disables HOTPlug Detection and force the connected status -setenv hpd "0" - -# CEC Enable/Disable (Requires Hardware Modification) -# 1 = Enables HDMI CEC -# 0 = Disables HDMI CEC -setenv cec "0" - -# PCM5102 I2S Audio DAC -# PCM5102 is an I2S Audio Dac Addon board for ODROID-C1+ -# Uncomment the line below to __ENABLE__ support for this Addon board. -# setenv enabledac "enabledac" - -# UHS Card Configuration -# Uncomment the line below to __DISABLE__ UHS-1 MicroSD support -# This might break boot for some brand models of cards. -setenv disableuhs "disableuhs" - -# Disable VPU (Video decoding engine, Saves RAM!!!) -# 0 = disabled -# 1 = enabled -setenv vpu "0" - -# Disable HDMI Output (Again, saves ram!) -# 0 = disabled -# 1 = enabled -setenv hdmioutput "1" - -# Default Console Device Setting -setenv condev "console=tty0 console=ttyS0,115200n8" - -########################################### - -if test "${hpd}" = "0"; then setenv hdmi_hpd "disablehpd=true"; fi -if test "${cec}" = "1"; then setenv hdmi_cec "hdmitx=cecf"; fi - -# Boot Arguments -setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs} ${hdmi_hpd} ${hdmi_cec} ${enabledac}" - -# Booting -fatload mmc 0:1 0x21000000 uImage -fatload mmc 0:1 0x22000000 uInitrd -fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb -fdt addr 21800000 - -if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi - -if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi - -bootm 0x21000000 0x22000000 0x21800000" diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 939d709d3b..8fe1c6d955 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -392,7 +392,7 @@ elif (( $G_WHIP_RETURNED_VALUE == 2 )); then - if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 12 )); then G_WHIP_MSG 'GPU/RAM Memory splits are pre-configured and applied during DietPi-Software setup.\n\nThe split value is optimized based on your software installs, however, feel free to tweak them.' TARGETMENUID=6 @@ -985,69 +985,6 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - # Get Current Values - local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini) - - G_WHIP_MENU_ARRAY=( - - '1080p' ': 1920 x 1080' - '720p' ': 1280 x 720' - '480p' ': 720 x 480' - 'VU7+' ': 1024 x 600' - 'PC1' ': 1024 x 768' - - ) - - G_WHIP_DEFAULT_ITEM=$current_resolution - if G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $current_resolution"; then - - REBOOT_REQUIRED=1 - - TARGETMENUID=2 # Return to this menu - - # - Always reset to HDMI - sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini - - case "$G_WHIP_RETURNED_VALUE" in - - '1080p') - - sed -i '/setenv m /c\setenv m "1080p"' /DietPi/boot.ini - - ;; - - '720p') - - sed -i '/setenv m /c\setenv m "720p"' /DietPi/boot.ini - - ;; - - '480p') - - sed -i '/setenv m /c\setenv m "480p"' /DietPi/boot.ini - - ;; - - 'PC1') - - sed -i '/setenv m /c\setenv m "1024x768"' /DietPi/boot.ini - - ;; - - 'VU7+') - - sed -i '/setenv m /c\setenv m "1024x600"' /DietPi/boot.ini - sed -i '/setenv vout_mode /c\setenv vout_mode "dvi"' /DietPi/boot.ini - - ;; - - esac - - fi - # Odroid XU3/4 elif (( $G_HW_MODEL == 11 )); then @@ -1979,10 +1916,6 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 gpu_mem_current=$(grep -m1 '^[[:blank:]]*gpu_mem_1024=' /DietPi/config.txt | sed 's/^[^=]*=//') ram_mem_current=$((ram_mem_total-gpu_mem_current)) - elif (( $G_HW_MODEL == 10 )); then - - gpu_mem_current=$((1024-ram_mem_current)) - elif (( $G_HW_MODEL == 12 )); then gpu_mem_current=$((2048-ram_mem_current)) @@ -2026,58 +1959,6 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - # Odroid HDMI/headless extra data - local display_output_enabled=$(grep -ci -m1 '^setenv hdmioutput "1"' /DietPi/boot.ini) - local display_vpu_enabled=$(grep -ci -m1 '^setenv vpu "1"' /DietPi/boot.ini) - local display_output_text='[On]' - local display_vpu_text='[On]' - - (( $display_output_enabled )) || display_output_text='[Off]' - (( $display_vpu_enabled )) || display_vpu_text='[Off]' - - G_WHIP_MENU_ARRAY=( - - 'Headless' 'HDMI: Disabled | VPU: Disabled' - 'Server' 'HDMI: Enabled | VPU: Disabled' - 'Desktop' 'HDMI: Enabled | VPU: Enabled' - - ) - - G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCurrent : HDMI: $display_output_text | VPU: $display_vpu_text \n Memory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM \n NB: GPU/RAM figures require a reboot after a change is made." - if (( $? == 0 )); then - - REBOOT_REQUIRED=1 - - TARGETMENUID=6 # Return to this menu - - case "$G_WHIP_RETURNED_VALUE" in - - 'Headless') - - /DietPi/dietpi/func/dietpi-set_hardware headless 1 - - ;; - - 'Server') - - /DietPi/dietpi/func/dietpi-set_hardware headless 0 - G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini - - ;; - - 'Desktop') - - /DietPi/dietpi/func/dietpi-set_hardware headless 0 - - ;; - - esac - - fi - # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -4086,8 +3967,8 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('justboom-digi' ': JustBoom: Digi HAT and Digi Zero') G_WHIP_MENU_ARRAY+=('rpi-dac' ': Soekris DAM1021 (pcm1794a)') - # - C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + # - C2 + elif (( $G_HW_MODEL == 12 )); then G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index bcc15f2dd6..d5c175864a 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -814,8 +814,8 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} local rootfstype_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /boot/cmdline.txt | grep -m1 'rootfstype=') sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$INDEX_DRIVE_BEING_EDITED]}#g" /boot/cmdline.txt - #C1/C2/XU4 | /DietPi/boot.ini - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 11 || $G_HW_MODEL == 12 )); then + #C2/XU4 | /DietPi/boot.ini + elif (( $G_HW_MODEL == 11 || $G_HW_MODEL == 12 )); then # find current root= to replace local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /DietPi/boot.ini | grep -m1 'root=' | sed 's/\"//') diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index afc4b3a621..15fe57a72c 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -494,8 +494,8 @@ DietPi-Software will decrypt and use it for software installs. You can change it # + ASUS TB aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,52]=1 - # + NanoPC T4 - #aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,68]=1 + # - C1 + aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,10]=0 #------------------ software_id=32 @@ -4799,11 +4799,6 @@ _EOF_ kernel_packages='raspberrypi-bootloader raspberrypi-kernel libraspberrypi-bin libraspberrypi0 raspberrypi-kernel-headers' - # - Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - kernel_packages='linux-image-armhf-odroid-c1 linux-headers-armhf-odroid-c1' - # - Odroid XU4 elif (( $G_HW_MODEL == 11 )); then @@ -6269,12 +6264,6 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix G_AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid #dps_index=$software_id Download_Install 'xorg_xu4.conf' /etc/X11/xorg.conf - #Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - DEPS_LIST='aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid' - dps_index=$software_id Download_Install 'xorg_c1.conf' /etc/X11/xorg.conf - #Pine64 elif (( $G_HW_MODEL == 40 )); then @@ -6667,7 +6656,7 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix dpkg --force-hold,confdef,confold -i ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb G_AGF rm ca-certificates-java.deb openjdk-8-jre-headless.deb openjdk-8-jdk-headless.deb - + else diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index b1ad7c5a24..eede515538 100644 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -650,7 +650,7 @@ elif (( $G_HW_MODEL == 10 )); then G_HW_MODEL_DESCRIPTION='Odroid C1' - IMAGE_ADDITIONAL_CREDITS='Meveric' + #IMAGE_ADDITIONAL_CREDITS='Meveric' fi diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 4579fc003a..f8c9c5c6f6 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -253,13 +253,6 @@ _EOF_ # - Disable composite hotplug, which then allows to completely disable the video pipeline + framebuffer G_CONFIG_INJECT 'hdmi_ignore_composite=' 'hdmi_ignore_composite=1' /DietPi/config.txt - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "0"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini - # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -280,13 +273,6 @@ _EOF_ G_CONFIG_INJECT 'hdmi_ignore_composite=' '#hdmi_ignore_composite=0' /DietPi/config.txt G_CONFIG_INJECT 'hdmi_blanking=' '#hdmi_blanking=0' /DietPi/config.txt - # Odroid C1 - elif (( $G_HW_MODEL == 10 )); then - - G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "1"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "1"' /DietPi/boot.ini - G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini - # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -360,8 +346,8 @@ _EOF_ G_CONFIG_INJECT 'gpio-ir-recv' 'gpio-ir-recv' /etc/modules G_CONFIG_INJECT 'gpioplug-ir-recv' 'gpioplug-ir-recv' /etc/modules - # C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + # C2 + elif (( $G_HW_MODEL == 12 )); then # - Module G_CONFIG_INJECT 'meson_ir' 'meson_ir' /etc/modules @@ -1504,8 +1490,8 @@ Do you want to continue and DISABLE Bluetooth now?'; then grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt - # - Odroid C1/C2 - elif (( $G_HW_MODEL == 10 || $G_HW_MODEL == 12 )); then + # - Odroid C2 + elif (( $G_HW_MODEL == 12 )); then local old='' [[ -f /DietPi/boot.ini ]] && old=$(grep -m1 '^setenv condev "' /DietPi/boot.ini) || return From a48ac8096dfc4990d6823fc0b77df45a423349c8 Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Thu, 2 May 2019 14:42:27 +0100 Subject: [PATCH 06/41] No need to show this info if unchanged by user. --- dietpi/dietpi-software | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 15fe57a72c..e15349e146 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -171,7 +171,7 @@ _EOF_ G_CONFIG_INJECT 'AUTO_SETUP_GLOBAL_PASSWORD=' 'AUTO_SETUP_GLOBAL_PASSWORD=Password has been encrypted and secured on rootFS' /DietPi/dietpi.txt openssl enc -e -a -md sha256 -aes-256-cbc $pbkdf2 -salt -pass pass:'DietPiRocks!' -out /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin <<< $GLOBAL_PW chmod 600 /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin - G_WHIP_MSG '[INFO] For security reasons your global software password has been removed from dietpi.txt and instead saved and ecrypted within: + [[ $GLOBAL_PW != 'dietpi' ]] && G_WHIP_MSG '[INFO] For security reasons your global software password has been removed from dietpi.txt and instead saved and ecrypted within: - /var/lib/dietpi/dietpi-software/.GLOBAL_PW.bin\n DietPi-Software will decrypt and use it for software installs. You can change it via: - dietpi-config > Security Options > Change Passwords' From 952274545188a138c244a8e5208678a684513b3e Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Thu, 2 May 2019 15:12:03 +0100 Subject: [PATCH 07/41] C1: https://github.com/MichaIng/DietPi/issues/2561 --- CHANGELOG.txt | 2 +- dietpi/patch_file | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2d3eac078c..3b71673e55 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,7 +6,7 @@ Jessie support: - The support for Debian Jessie is fading constantly by software titles and Debian itself, increasing the effort for us to work around the raising issues: https://github.com/MichaIng/DietPi/issues/2332 - As a result we move Jessie systems to a dedicated "jessie-support" branch. Next DietPi v6.24 will still be merged into this branch as well, but for following updates it depends on how much additional related issues we face. - We highly recommend to migrate to Stretch as fast as possible. -- For Ordoid C1 there is no Stretch image available since its kernel and firmware are not maintained to match minimum requirements. There are reports about successful "apt-get dist-upgrade" migrations and an ARMbian Stretch image is available that can be used as a basis for DietPi-PREP. But these systems face major limitations, especially no GPU (Xserver, Kodi, desktops) support is available. Read more about it or contribute to solutions for Odroid C1 users here: https://github.com/MichaIng/DietPi/issues/2561 +- Odroid C1: We have updated the image to Stretch based on ARMbian 4.18 kernel. Existing Jessie installations will be moved to the jessie-support branch: https://github.com/MichaIng/DietPi/issues/2561 Changes / Improvements / Optimisations: - DietPi-Banner | Added support for DietPi message of the day (MOTD). This is enabled by default, however, can be disabled. Checks for latest MOTD once a day. diff --git a/dietpi/patch_file b/dietpi/patch_file index c2722ee5ae..89b8d6b854 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -1756,6 +1756,11 @@ With v6.18 we silently added a new script that allows linking Sonarr/Radarr/Lida This script has gone through some rework and polishing with v6.23 and can now be enabled to automatically link those databases to RAM on boot and store them back to disk on shutdown.\n Further info and usage: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828' + #Jessie C1 switch to Stretch | should not occur for pre-patch compatible versions and auto switch over to jessie-support for existing installs. + elif (( $G_HW_MODEL == 10 )); then + + G_WHIP_MSG '[INFO] Odroid C1 image has been updated to Stretch. Please upgrade to continue limited support for this device:\nhttps://github.com/MichaIng/DietPi/issues/2561#issuecomment-488685121' + fi #----------------------------------------------------------------------- # Fix IPv6 connections with WireGuard: https://github.com/MichaIng/DietPi/issues/2691 @@ -1777,7 +1782,7 @@ Further info and usage: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828' if [[ -f /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER && $(grep -c '^auth-user-pass' /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER) == 2 ]]; then sed -i '/^auth-user-pass$/d' /etc/openvpn/ovpn_$PROTOCOL/$NORDVPN_SERVER - + fi unset NORDVPN_USERNAME NORDVPN_PASSWORD NORDVPN_SERVER PROTOCOL From dc09158a26fa602ab9313908e16f69e3065a7a2a Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Thu, 2 May 2019 23:12:26 +0200 Subject: [PATCH 08/41] v6.23 + DietPi-Software | Node.js: Fix broken install on ARMv6 since Node 12 does not support it any more: https://github.com/MichaIng/DietPi/issues/2755 --- dietpi/dietpi-software | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index e15349e146..f58244e457 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6677,9 +6677,12 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix INSTALL_URL_ADDRESS='https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' G_CHECK_URL "$INSTALL_URL_ADDRESS" - wget "$INSTALL_URL_ADDRESS" -O node_install.sh - chmod +x node_install.sh + wget "$INSTALL_URL_ADDRESS" + # ARMv6 workaround: https://github.com/MichaIng/DietPi/issues/2755 + (( $G_HW_ARCH == 1 )) && sed -i 's|nodejs.org/dist/latest/|nodejs.org/dist/latest-v11.x/|g' node_install.sh + mkdir -p /usr/local # failsafe + chmod +x node_install.sh ./node_install.sh rm node_install.sh From dca651c7c225dd7c46155fe6a2d4475b756dcdeb Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Thu, 2 May 2019 23:20:49 +0200 Subject: [PATCH 09/41] v6.23 + CHANGELOG | Node-RED: Resolved an issue where install failed on ARMv6 --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3b71673e55..306bb0bdf7 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -48,6 +48,7 @@ Bug Fixes: - DietPi-Software | Nextcloud Talk: Resolved an issue where coTURN prints two warnings about deprecated settings on Buster systems, due to some changes with latest versions. - DietPi-Software | Kodi: Resolved an issue on RPi where Kodi (v18) fails to start when a custom screen resolution was chosen. Many thanks to @johnnypea for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 - DietPi-Software | Java: Resolved an issue where install fails on Jessie systems since the used jessie-backports APT repo does not exist any more: https://github.com/MichaIng/DietPi/issues/2752 +- DietPi-Software | Node-RED: Resolved an issue where install failed on ARMv6 since Node 12 does not support it any more. Many thanks to @axwax for reporting this issue: https://github.com/MichaIng/DietPi/issues/2755 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX/files From 07ee4c49c679d78476851f899304d103c6e7545b Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Thu, 2 May 2019 23:23:51 +0200 Subject: [PATCH 10/41] v6.23 + CHANGELOG | Whoopsie, it was Node.js itself --- CHANGELOG.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 306bb0bdf7..4b2432e34b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -48,7 +48,7 @@ Bug Fixes: - DietPi-Software | Nextcloud Talk: Resolved an issue where coTURN prints two warnings about deprecated settings on Buster systems, due to some changes with latest versions. - DietPi-Software | Kodi: Resolved an issue on RPi where Kodi (v18) fails to start when a custom screen resolution was chosen. Many thanks to @johnnypea for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 - DietPi-Software | Java: Resolved an issue where install fails on Jessie systems since the used jessie-backports APT repo does not exist any more: https://github.com/MichaIng/DietPi/issues/2752 -- DietPi-Software | Node-RED: Resolved an issue where install failed on ARMv6 since Node 12 does not support it any more. Many thanks to @axwax for reporting this issue: https://github.com/MichaIng/DietPi/issues/2755 +- DietPi-Software | Node.js: Resolved an issue where install failed on ARMv6 since Node 12 does not support it any more. Many thanks to @axwax for reporting this issue: https://github.com/MichaIng/DietPi/issues/2755 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX/files From 7480345f28d90c697d41ca8783d573e24f4ba83c Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Fri, 3 May 2019 00:32:42 +0200 Subject: [PATCH 11/41] v6.23 + DietPi-Software | Node.js: Script name fix --- dietpi/dietpi-software | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index f58244e457..5f4f621146 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6679,12 +6679,12 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix wget "$INSTALL_URL_ADDRESS" # ARMv6 workaround: https://github.com/MichaIng/DietPi/issues/2755 - (( $G_HW_ARCH == 1 )) && sed -i 's|nodejs.org/dist/latest/|nodejs.org/dist/latest-v11.x/|g' node_install.sh + (( $G_HW_ARCH == 1 )) && sed -i 's|nodejs.org/dist/latest/|nodejs.org/dist/latest-v11.x/|g' node-install.sh mkdir -p /usr/local # failsafe - chmod +x node_install.sh - ./node_install.sh - rm node_install.sh + chmod +x node-install.sh + ./node-install.sh + rm node-install.sh fi From a61bc21ce9629940bd91cd69fb94909242834403 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 12:59:19 +0200 Subject: [PATCH 12/41] META | Slight change of bug report entry to avoid users trying to execute the whole line --- .github/ISSUE_TEMPLATE/bug_report.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ddec9ccc0b..e7af2f218e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,8 @@ about: Create a report to help us improve - Software title | (EG: Nextcloud) - Was the software title installed freshly or updated/migrated? - Can this issue be replicated on a fresh installation of DietPi? -- `dietpi-bugreport` ID | `sed -n 5p /DietPi/dietpi/.hw_model` + +- Bug report ID | `sed -n 5p /DietPi/dietpi/.hw_model` #### Steps to reproduce From b17e4a22290e8933bf5da102099a947b6ed652b3 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 13:16:26 +0200 Subject: [PATCH 13/41] v6.23 + DietPi-Set_hardware | Replace obsolete "bluetooth" meta package with bluez --- dietpi/func/dietpi-set_hardware | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index f8c9c5c6f6..0b5865bd0b 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1126,7 +1126,7 @@ _EOF_ # Purge packages if (( $G_DIETPI_INSTALL_STAGE >= 0 )); then - G_AGP bluetooth bluez-firmware pi-bluetooth + G_AGP bluez bluez-firmware pi-bluetooth G_AGA fi @@ -1157,7 +1157,8 @@ Do you want to continue and disable the serial login console?'; then else - G_AG_CHECK_INSTALL_PREREQ bluetooth bluez-firmware + # bluez-firmware: BCM203x dongles: https://packages.debian.org/stretch/bluez-firmware + G_AG_CHECK_INSTALL_PREREQ bluez bluez-firmware fi From 620b91137f856a2f0335a6d46779386401d1435e Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 13:29:51 +0200 Subject: [PATCH 14/41] v6.23 + DietPi-Patch | Remove obsolete "bluetooth" meta package and mark bluez instead --- dietpi/patch_file | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dietpi/patch_file b/dietpi/patch_file index 89b8d6b854..869bc69fe7 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -1786,6 +1786,15 @@ Further info and usage: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828' fi unset NORDVPN_USERNAME NORDVPN_PASSWORD NORDVPN_SERVER PROTOCOL + fi + #----------------------------------------------------------------------- + # Remove obsolete "bluetooth" meta package and mark bluez instead + if dpkg-query -s bluetooth &> /dev/null; then + + apt-mark manual bluez + apt-mark auto bluetooth + G_AGA + fi #----------------------------------------------------------------------- # PHP7.3 migration: https://github.com/MichaIng/DietPi/issues/2367 From 3a65f6d1a5522d2ddd433bda6b9ada3ca224866b Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Sat, 4 May 2019 12:50:09 +0100 Subject: [PATCH 15/41] https://github.com/MichaIng/DietPi/issues/1918#issuecomment-489319719 --- dietpi/dietpi-software | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 5f4f621146..8c4bd46a35 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -3127,9 +3127,9 @@ Package: *php7.3*\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/di INSTALL_URL_ADDRESS='https://dietpi.com/downloads/conf/desktop' G_CHECK_URL "$INSTALL_URL_ADDRESS" - # - Buster: No leafpad available, use mousepad instead: https://packages.debian.org/search?keywords=leafpad + # - Buster: No leafpad available, use featherpad instead: https://github.com/MichaIng/DietPi/issues/1918#issuecomment-489319719 local editor='leafpad' - (( $G_DISTRO > 4 )) && editor='mousepad' + (( $G_DISTRO > 4 )) && editor='featherpad' G_AGI lxqt qterminal firefox-esr xarchiver lxde-icon-theme upower xscreensaver $editor speedcrunch @@ -12412,7 +12412,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - apt-mark auto qterminal firefox-esr xarchiver lxde-icon-theme upower xscreensaver leafpad speedcrunch + apt-mark auto qterminal firefox-esr xarchiver lxde-icon-theme upower xscreensaver leafpad featherpad speedcrunch G_AGP lxqt [[ -d '/root/.config/lxqt' ]] && rm -R /root/.config/lxqt From aa4a36fd890a0774d68fb9e7118e72af042ac8d4 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:04:03 +0200 Subject: [PATCH 16/41] v6.23 + DietPi-Config | Allow network drop-in configs via /etc/network/interfaces.d, which e.g. allows to add VLANs, multiple network adapters and such without DietPi-Config destroying it. Future idea is to use this ourself to allow easier adding/removal/adjusting of single interface settings instead of scraping and rewriting the whole interfaces file. --- dietpi/dietpi-config | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 8fe1c6d955..8a82463a8b 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -2282,8 +2282,12 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi cat << _EOF_ > /etc/network/interfaces -# /etc/network/interfaces -# Please use DietPi-Config to modify network settings. +# Location: /etc/network/interfaces +# Please modify network settings via: dietpi-config +# Or create your own drop-ins in: /etc/network/interfaces.d/ + +# Drop-in configs +source interfaces.d/* # Local auto lo From 1ef463b93bf265cedfae52cad08fa9807907a21d Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:09:54 +0200 Subject: [PATCH 17/41] v6.23 + DietPi-PREP | Drop-in config support has been added to /etc/network/intefaces --- PREP_SYSTEM_FOR_DIETPI.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 732b84831d..83b17ca9bd 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -1150,12 +1150,16 @@ _EOF_ G_DIETPI-NOTIFY 2 'Configuring network interfaces:' - [[ -f /etc/network/interfaces ]] && rm -R /etc/network/interfaces # ARMbian symlink for bulky network-manager + [[ -f '/etc/network/interfaces' ]] && rm -R /etc/network/interfaces # ARMbian symlink for bulky network-manager G_ERROR_HANDLER_COMMAND='/etc/network/interfaces' cat << _EOF_ > $G_ERROR_HANDLER_COMMAND -#/etc/network/interfaces -#Please use DietPi-Config to modify network settings. +# Location: /etc/network/interfaces +# Please modify network settings via: dietpi-config +# Or create your own drop-ins in: /etc/network/interfaces.d/ + +# Drop-in configs +source interfaces.d/* # Local auto lo @@ -1169,7 +1173,7 @@ netmask 255.255.255.0 gateway 192.168.0.1 #dns-nameservers 8.8.8.8 8.8.4.4 -# Wifi +# WiFi #allow-hotplug wlan0 iface wlan0 inet dhcp address 192.168.0.100 @@ -1198,7 +1202,7 @@ _EOF_ fi # Fix rare WiFi interface start issue: https://github.com/MichaIng/DietPi/issues/2074 - [[ -f /etc/network/if-pre-up.d/wireless-tools ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools + [[ -f '/etc/network/if-pre-up.d/wireless-tools' ]] && sed -i '\|^[[:blank:]]ifconfig "$IFACE" up$|c\\t/sbin/ip link set dev "$IFACE" up' /etc/network/if-pre-up.d/wireless-tools G_DIETPI-NOTIFY 2 'Tweaking DHCP timeout:' @@ -1279,8 +1283,8 @@ _EOF_ G_DIETPI-NOTIFY 2 'Configuring regional settings (TZdata):' - [[ -f /etc/timezone ]] && rm /etc/timezone - [[ -f /etc/localtime ]] && rm /etc/localtime + [[ -f '/etc/timezone' ]] && rm /etc/timezone + [[ -f '/etc/localtime' ]] && rm /etc/localtime ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime G_RUN_CMD dpkg-reconfigure -f noninteractive tzdata @@ -1468,17 +1472,17 @@ _EOF_ G_DIETPI-NOTIFY 2 'Running general cleanup of misc files' # - Remove Bash history file - [[ -f /root/.bash_history ]] && rm /root/.bash_history + [[ -f '/root/.bash_history' ]] && rm /root/.bash_history rm -f /home/*/.bash_history # - Remove Nano history file - [[ -f /root/.nano_history ]] && rm /root/.nano_history + [[ -f '/root/.nano_history' ]] && rm /root/.nano_history rm -f /home/*/.nano_history G_DIETPI-NOTIFY 2 'Removing swapfile from image' /DietPi/dietpi/func/dietpi-set_swapfile 0 /var/swap - [[ -e /var/swap ]] && rm /var/swap # still exists on some images... + [[ -e '/var/swap' ]] && rm /var/swap # still exists on some images... # - re-enable for next run G_CONFIG_INJECT 'AUTO_SETUP_SWAPFILE_SIZE=' 'AUTO_SETUP_SWAPFILE_SIZE=1' /DietPi/dietpi.txt @@ -1489,7 +1493,7 @@ _EOF_ (( $G_HW_MODEL == 40 )) && [[ -f /boot/uEnv.txt ]] && sed -i '/^ethaddr/ d' /boot/uEnv.txt # - Set Pi cmdline.txt back to normal - [[ -f /boot/cmdline.txt ]] && sed -i 's/ rootdelay=10//g' /boot/cmdline.txt + [[ -f '/boot/cmdline.txt' ]] && sed -i 's/ rootdelay=10//g' /boot/cmdline.txt G_DIETPI-NOTIFY 2 'Generating default wpa_supplicant.conf' From 3a10e44be81b6bdfa91d8fbeec811082cb5d06b3 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:47:07 +0200 Subject: [PATCH 18/41] v6.23 + DietPi-Bugreport | Add usage info when wrong input argument has been added + DietPi-Bugreport | Use exit code when handled error occurs + DietPi-Bugreport | Add "uenv.txt" (Sparky SBC) and newly possible drop-in network interfaces configs + DietPi-Bugreport | Minor coding and wording --- dietpi/dietpi-bugreport | 84 +++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport index 9843a95405..bbbb5beb57 100644 --- a/dietpi/dietpi-bugreport +++ b/dietpi/dietpi-bugreport @@ -9,25 +9,26 @@ #//////////////////////////////////// # # Info: + # - Location: /DietPi/dietpi/dietpi-bugreport # - Called from G_ERROR_HANDLER - # - filename /DietPi/dietpi/dietpi-bugreport # - Generates $UNIQUE_ID.7z and uploads to dietpi.com - # Usage: - # - /DietPi/dietpi/dietpi-bugreport Interactively let user send or remove already uploaded bug report - # - /DietPi/dietpi/dietpi-bugreport 1 Automated send of bug report - # - /DietPi/dietpi/dietpi-bugreport -1 Automated remove of already uploaded bug report - #//////////////////////////////////// - - #Import DietPi-Globals --------------------------------------------------------------- + USAGE=' +Usage: /DietPi/dietpi/dietpi-bugreport +Available commands: + 0, Interactive menu to send or remove bug reports and review upload content + 1 Non-interactively send a bug report + -1 Non-interactively remove an already uploaded bug report +' #//////////////////////////////////// + + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Bugreport' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 UNIQUE_ID=$(sed -n 5p /DietPi/dietpi/.hw_model) UPLOAD_FILENAME="$UNIQUE_ID.7z" @@ -85,6 +86,7 @@ '/boot/config.txt' '/boot/cmdline.txt' '/boot/boot.ini' + '/boot/uenv.ini' '/boot/uEnv.ini' '/boot/armbianEnv.ini' @@ -113,6 +115,7 @@ '/etc/X11/xorg.conf' '/etc/asound.conf' '/etc/network/interfaces' + '/etc/network/interfaces.d' '/etc/wpa_supplicant/wpa_supplicant.conf' '/etc/fstab' '/etc/sysctl.conf' @@ -132,17 +135,17 @@ Generate_Upload_File(){ # Generate command output file - for ((i=0; i<${#aCOMMAND_LIST[@]}; i++)) + for i in "${aCOMMAND_LIST[@]}" do - echo -e "\n----------\n${aCOMMAND_LIST[$i]}:\n----------" >> CMD_OUT.txt - ${aCOMMAND_LIST[$i]} &>> CMD_OUT.txt + echo -e "\n----------\n$i\n----------" >> CMD_OUT.txt + $i &>> CMD_OUT.txt done unset aCOMMAND_LIST - # - Have the git error in 1st directory. - [[ -f /tmp/.G_ERROR_HANDLER_GITREPORT ]] && cp /tmp/.G_ERROR_HANDLER_GITREPORT ./G_ERROR_HANDLER_GITREPORT + # Have the Git error in 1st directory + [[ -f '/tmp/.G_ERROR_HANDLER_GITREPORT' ]] && cp /tmp/.G_ERROR_HANDLER_GITREPORT ./G_ERROR_HANDLER_GITREPORT G_DIETPI-NOTIFY 2 'Packing upload archive, please wait...' 7zr a -spf "$UPLOAD_FILENAME" ${aFILE_LIST[@]} &> dietpi-bugreport_compress.log @@ -162,12 +165,12 @@ fi - [[ -f dietpi-bugreport_compress.log ]] && rm dietpi-bugreport_compress.log + [[ -f 'dietpi-bugreport_compress.log' ]] && rm dietpi-bugreport_compress.log # Limit filesize UPLOAD_FILESIZE=$(stat -c%s "$UPLOAD_FILENAME") - # - Upload + # Upload if (( $UPLOAD_FILESIZE <= $UPLOAD_FILESIZE_LIMIT )); then G_DIETPI-NOTIFY -2 'Running cURL' @@ -187,6 +190,7 @@ else G_DIETPI-NOTIFY 1 'Failed to connect to SFTP server. Please try again later or report this to DietPi forum or GitHub repo in the first place.' + exit 1 fi @@ -194,12 +198,14 @@ G_DIETPI-NOTIFY 1 'The bug report upload archive appears to be unexpected large. Please inspect and in case clean up the locations to be uploaded, as their size should never be that large:' printf "%s\n" "${aFILE_LIST[@]}" + exit 1 fi else G_DIETPI-NOTIFY 1 'Failed to connect to "dietpi.com". Please try again later or report this to DietPi forum or GitHub repo in the first place.' + exit 1 fi @@ -222,11 +228,10 @@ ) - if G_WHIP_MENU "By sending a bug report file, you can help the developers to investigate your issue, in relation to your report on GitHub or the DietPi forum. + if G_WHIP_MENU 'By sending a bug report file, you can help the developers to investigate your issue, in relation to your report on GitHub or the DietPi forum. The file is sent via secured connection to our SFTP server and is stored there unreadable to the public upload user. -The file will be removed after your issue is solved and you can remove it by yourself as well by running \"dietpi-bugreport -1\" or via this menu. - -Would you like to send a bug report archive or remove an already uploaded one?"; then +The file will be removed after your issue is solved and you can remove it by yourself as well by running "dietpi-bugreport -1" or via this menu.\n +Would you like to send a bug report archive or remove an already uploaded one?'; then if (( $G_WHIP_RETURNED_VALUE == 1 )); then @@ -238,43 +243,42 @@ Would you like to send a bug report archive or remove an already uploaded one?"; elif (( $G_WHIP_RETURNED_VALUE == 3 )); then - G_WHIP_SCROLLBOX "The upload will contain the following command outputs: - -$(printf "\t- %s\n" "${aCOMMAND_LIST[@]}") - -It will contain as well the following files and directories: - + G_WHIP_SCROLLBOX "The upload will contain the following command outputs:\n +$(printf "\t- %s\n" "${aCOMMAND_LIST[@]}")\n +It will contain as well the following files and directories:\n $(printf "\t- %s\n" "${aFILE_LIST[@]}")" fi else - break + exit 0 fi done - if (( $INPUT == 1 || $INPUT == -1 )); then + if (( $INPUT == 1 )); then - if (( $INPUT == 1 )); then + # Generate 7z bug report file + Generate_Upload_File - # Generate 7z bug report file - Generate_Upload_File + elif (( $INPUT == -1 )); then - else + # Send empty file to clear already uploaded bug report + > "$UPLOAD_FILENAME" - # Send empty file to clear already uploaded bug report - > "$UPLOAD_FILENAME" + else - fi - - # Upload bug report file - Upload_Bug_Report + error=1 Print "Invalid input command ($INPUT). Aborting... +$USAGE" + exit 1 fi + # Upload bug report file + Upload_Bug_Report + #----------------------------------------------------------------------------------- exit 0 #----------------------------------------------------------------------------------- From 757f8ef24d664c8c6318e2e2d8f96ec44c1fccbb Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:50:21 +0200 Subject: [PATCH 19/41] v6.23 + DietPi-Patch | Add /etc/network/interfaces.d/ drop-in config support --- dietpi/patch_file | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dietpi/patch_file b/dietpi/patch_file index 869bc69fe7..84738ce30d 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -1797,6 +1797,9 @@ Further info and usage: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828' fi #----------------------------------------------------------------------- + # Add /etc/network/interfaces.d/ drop-in config support + grep -q 'interfaces\.d' /etc/network/interfaces || sed -i '1i\source interfaces.d/*' /etc/network/interfaces + #----------------------------------------------------------------------- # PHP7.3 migration: https://github.com/MichaIng/DietPi/issues/2367 local reinstall_ids='' local upgrade_php=0 From a94efc5aef1c214a1db814db2ca9d58154a9b8db Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:53:17 +0200 Subject: [PATCH 20/41] v6.23 + DietPi-Bugreport | Syntax --- dietpi/dietpi-bugreport | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport index bbbb5beb57..2775f14b78 100644 --- a/dietpi/dietpi-bugreport +++ b/dietpi/dietpi-bugreport @@ -270,7 +270,7 @@ $(printf "\t- %s\n" "${aFILE_LIST[@]}")" else - error=1 Print "Invalid input command ($INPUT). Aborting... + G_DIETPI-NOTIFY 1 "Invalid input command ($INPUT). Aborting... $USAGE" exit 1 From b436807770576391ff04a76ac69b6169e88da5f9 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:54:45 +0200 Subject: [PATCH 21/41] v6.23 + DietPi-Bugreport | Minor: We have an alias for this --- dietpi/dietpi-bugreport | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport index 2775f14b78..45453a0e10 100644 --- a/dietpi/dietpi-bugreport +++ b/dietpi/dietpi-bugreport @@ -13,7 +13,7 @@ # - Called from G_ERROR_HANDLER # - Generates $UNIQUE_ID.7z and uploads to dietpi.com USAGE=' -Usage: /DietPi/dietpi/dietpi-bugreport +Usage: dietpi-bugreport Available commands: 0, Interactive menu to send or remove bug reports and review upload content 1 Non-interactively send a bug report From bc6336f15bd1166c8bca96485d8fd22e912dfa62 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 15:56:14 +0200 Subject: [PATCH 22/41] v6.23 + DietPi-Arr_to_RAM | Minor: We have an alias for this --- dietpi/misc/dietpi-arr_to_RAM | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/misc/dietpi-arr_to_RAM b/dietpi/misc/dietpi-arr_to_RAM index e9bb0ab209..88b9aa146b 100644 --- a/dietpi/misc/dietpi-arr_to_RAM +++ b/dietpi/misc/dietpi-arr_to_RAM @@ -15,7 +15,7 @@ # NB: Not supported on Jessie: https://github.com/MichaIng/DietPi/issues/2689#issuecomment-487306241 # USAGE=' -Usage: /DietPi/dietpi/misc/dietpi-arr_to_RAM [] +Usage: dietpi-arr_to_RAM [] Available commands: 1 [] Link (program) database(s) to RAM 2 [] Update (program) database backup(s) From 9f6526882610533813cb52e00b7fe08a0ad06dc3 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 18:02:07 +0200 Subject: [PATCH 23/41] v6.23 + DietPi-Globals | Tiny: Change G_HW_MODEL default to "-1" since "0" is used in DietPi-PREP for all RPi models --- dietpi/func/dietpi-globals | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 0a97b4e716..471324324d 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -89,7 +89,7 @@ _EOF_ #Device details # - Declare - G_HW_MODEL=${G_HW_MODEL:-0} + G_HW_MODEL=${G_HW_MODEL:--1} G_HW_MODEL_DESCRIPTION=${G_HW_MODEL_DESCRIPTION:-NULL} G_HW_ARCH=${G_HW_ARCH:-0} G_HW_ARCH_DESCRIPTION=$(uname -m) @@ -101,7 +101,7 @@ _EOF_ # - Update # NB: dietpi-boot service launches dietpi-obtain_hw_model to create the following file - if [[ -f /DietPi/dietpi/.hw_model ]]; then + if [[ -f '/DietPi/dietpi/.hw_model' ]]; then G_HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) G_HW_MODEL_DESCRIPTION=$(sed -n 2p /DietPi/dietpi/.hw_model) From 2a8e1dc8803d4c1440e4401642b6f98f34c4b568 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 18:44:49 +0200 Subject: [PATCH 24/41] v6.23 + DietPi-Globals | G_CHECK_URL: Add support to override default timeout + attempts via passed variables + DietPi-Globals | G_CHECK_URL: Add valid value checks for passed variables and dietpi.txt entries, in case revert to defaults --- dietpi/func/dietpi-globals | 42 ++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 471324324d..4cd99ba53c 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -1376,37 +1376,61 @@ $print_logfile_info #URL Connection test # - $@ = URL - # Optional variables: $optional_cmd_inputs (eg: --no-check-certificate) + # Optional variables: + # - $optional_cmd_inputs (eg: --no-check-certificate) + # - G_CHECK_URL_TIMEOUT to override default and dietpi.txt set timeout + # - G_CHECK_URL_ATTEMPTS to override default and dietpi.txt set attempts # In case of failure and $G_USER_INPUTS=1: Prompts user to configure network G_CHECK_URL(){ - local string=$@ - local timeout=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_TIMEOUT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - local attempts=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') - #local optional_cmd_inputs + local url=$@ + local timeout=5 + if disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_TIMEOUT" 0; then + + timeout=$G_CHECK_URL_TIMEOUT + unset G_CHECK_URL_TIMEOUT + + elif [[ -f '/DietPi/dietpi.txt' ]]; then + + timeout=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_TIMEOUT=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + disable_error=1 G_CHECK_VALIDINT "$timeout" 0 || timeout=5 + + fi + local attempts=3 + if disable_error=1 G_CHECK_VALIDINT "$G_CHECK_URL_ATTEMPTS" 0; then + + attempts=$G_CHECK_URL_ATTEMPTS + unset G_CHECK_URL_ATTEMPTS + + elif [[ -f '/DietPi/dietpi.txt' ]]; then + + attempts=$(grep -m1 '^[[:blank:]]*CONFIG_G_CHECK_URL_ATTEMPTS=' /DietPi/dietpi.txt | sed 's/^[^=]*=//') + disable_error=1 G_CHECK_VALIDINT "$attempts" 0 || attempts=3 + + fi while : do - G_ERROR_HANDLER_COMMAND="Connection test: $string" + G_ERROR_HANDLER_COMMAND="Connection test: $url" G_ERROR_HANDLER_ONERROR_FPLOGFILE='/tmp/G_CHECK_URL' G_ERROR_HANDLER_RETRY=1 - G_DIETPI-NOTIFY -2 "Testing connection to $string, please wait..." + G_DIETPI-NOTIFY -2 "Testing connection to $url, please wait..." local i=0 for ((i=1; i<=$attempts; i++)) do # Since --tries/-t is not applied on "fatal" errors (resolving failed, connection refused, 404), we need to loop ourself to exclude any temporary issue - wget --spider -t 1 -T $timeout $optional_cmd_inputs "$string" &> $G_ERROR_HANDLER_ONERROR_FPLOGFILE + wget --spider -t 1 -T $timeout $optional_cmd_inputs "$url" &> $G_ERROR_HANDLER_ONERROR_FPLOGFILE G_ERROR_HANDLER_EXITCODE=$? # Valid (( $G_ERROR_HANDLER_EXITCODE )) || break # Retry - G_DIETPI-NOTIFY -2 "Failed connection attempt to $string ($i/$attempts), retrying..." + G_DIETPI-NOTIFY -2 "Failed connection attempt to $url ($i/$attempts), retrying..." sleep 1 done From f2dddb8b91be001f9fa5390ce940b407dc390f63 Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <37122999+FredericGuilbault@users.noreply.github.com> Date: Sat, 4 May 2019 12:52:42 -0400 Subject: [PATCH 25/41] v6.23 (#2756) + DietPi-PREP | Allow environment variables to automate script execution + DietPi-PREP | Add valid value checks for environment variables, otherwise revert to interactive prompt --- PREP_SYSTEM_FOR_DIETPI.sh | 213 +++++++++++++++++++++++++------------- 1 file changed, 141 insertions(+), 72 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 83b17ca9bd..4ade5df87e 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -14,12 +14,19 @@ # - G_HW_ARCH # - G_DISTRO # - G_DISTRO_NAME + # + # The following environment variables can be set to automate the this script (adjust example values to your needs): + # - GITOWNER='MichaIng' (optional, defaults to 'MichaIng') + # - GITBRANCH='master' (must be one of 'master', 'beta' or 'dev') + # - IMAGE_CREATOR='Mr. Tux' + # - PREIMAGE_INFO='Some GNU/Linux' + # - HW_MODEL=0 (must match one of the supported IDs below) + # - WIFI_REQUIRED=0 [01] + # - DISTRO_TARGET=4 [45] (Stretch: 4, Buster: 5) #------------------------------------------------------------------------------------------------ # Core globals G_PROGRAM_NAME='DietPi-PREP' - G_GITOWNER=${GITOWNER:-MichaIng} - unset GITOWNER #------------------------------------------------------------------------------------------------ # Critical checks and pre-reqs, with exit, prior to initial run of script @@ -136,27 +143,35 @@ export LANG=en_GB.UTF8 export LC_ALL=en_GB.UTF8 - # Select gitbranch - aWHIP_BRANCH=( + # Set Git owner + G_GITOWNER=${GITOWNER:-MichaIng} + unset GITOWNER - 'master' ': Stable release (recommended)' - 'beta' ': Public beta testing branch' - 'dev' ': Unstable dev branch' + # Select Git branch + if ! [[ $GITBRANCH =~ ^(master|beta|dev)$ ]]; then - ) + aWHIP_BRANCH=( - if WHIP_RETURN=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select a Git branch:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then + 'master' ': Stable release (recommended)' + 'beta' ': Public beta testing branch' + 'dev' ': Unstable dev branch' - G_GITBRANCH=$WHIP_RETURN + ) - else + if GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select a Git branch:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then - echo -e '[ INFO ] No choice detected. Aborting...\n' - exit 0 + unset aWHIP_BRANCH - fi + else + + echo -e '[ INFO ] No choice detected. Aborting...\n' + exit 0 - unset aWHIP_BRANCH WHIP_RETURN + fi + + fi + G_GITBRANCH=$GITBRANCH + unset GITBRANCH echo "[ INFO ] Selected Git branch: $G_GITOWNER/$G_GITBRANCH" @@ -185,8 +200,6 @@ G_PROGRAM_NAME='DietPi-PREP' G_INIT - DISTRO_TARGET=0 - DISTRO_TARGET_NAME='' if grep -q 'jessie' /etc/os-release; then G_DISTRO=3 @@ -233,21 +246,11 @@ fi - # WiFi install flag - WIFI_REQUIRED=0 - - # Image creator flags - IMAGE_CREATOR='' - PREIMAGE_INFO='' - - # Setup step, current (used in info) - SETUP_STEP=0 - - # URL connection test var holder - INTERNET_ADDRESS='' - Main(){ + # Setup step, current (used in info) + SETUP_STEP=0 + #------------------------------------------------------------------------------------------------ echo '' G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' @@ -301,11 +304,21 @@ # Image creator while : do + if [[ $IMAGE_CREATOR ]]; then + + G_WHIP_RETURNED_VALUE=$IMAGE_CREATOR + # unset to force interactive input if disallowed name is detected + unset IMAGE_CREATOR + + else - G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.' - if (( ! $? )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + G_WHIP_INPUTBOX 'Please enter your name. This will be used to identify the image creator within credits banner.\n\nYou can add your contact information as well for end users.\n\nNB: An entry is required.' - #Disallowed: + fi + + if [[ $G_WHIP_RETURNED_VALUE ]]; then + + # Disallowed: DISALLOWED_NAME=0 aDISALLOWED_NAMES=( @@ -340,7 +353,6 @@ else IMAGE_CREATOR=$G_WHIP_RETURNED_VALUE - G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" break fi @@ -349,20 +361,27 @@ done + G_DIETPI-NOTIFY 2 "Entered image creator: $IMAGE_CREATOR" + # Pre-image used/name - while : - do + if [[ ! $PREIMAGE_INFO ]]; then - G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspbian Lite, Meveric, FriendlyARM, or "forum.odroid.com/viewtopic.php?f=ABC&t=XYZ" etc.\n\nNB: An entry is required.' - if (( ! $? )) && [[ $G_WHIP_RETURNED_VALUE ]]; then + while : + do - PREIMAGE_INFO=$G_WHIP_RETURNED_VALUE - G_DIETPI-NOTIFY 2 "Entered pre-image info: $PREIMAGE_INFO" - break + G_WHIP_INPUTBOX 'Please enter the name or URL of the pre-image you installed on this system, prior to running this script. This will be used to identify the pre-image credits.\n\nEG: Debian, Raspbian Lite, Meveric, FriendlyARM, or "forum.odroid.com/viewtopic.php?f=ABC&t=XYZ" etc.\n\nNB: An entry is required.' + if [[ $G_WHIP_RETURNED_VALUE ]]; then - fi + PREIMAGE_INFO=$G_WHIP_RETURNED_VALUE + break - done + fi + + done + + fi + + G_DIETPI-NOTIFY 2 "Entered pre-image info: $PREIMAGE_INFO" # Hardware selection # NB: PLEASE ENSURE HW_MODEL INDEX ENTRIES MATCH : PREP, dietpi-obtain_hw_model, dietpi-survey_results, @@ -422,42 +441,72 @@ ) - G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Are fully supported by DietPi, offering full GPU + Kodi support.\n - "Limited support devices": No GPU support, supported limited to DietPi specific issues only (eg: excludes Kernel/GPU/VPU related items).' - if (( $? )) || [[ -z $G_WHIP_RETURNED_VALUE ]]; then + while : + do - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' - exit 0 + # Check for valid entry, e.g. when set via environment variabe + if disable_error=1 G_CHECK_VALIDINT "$HW_MODEL" 0; then - fi + for i in "${G_WHIP_MENU_ARRAY[@]}" + do + + [[ $HW_MODEL == $i ]] && break 2 + + done + + fi + + G_WHIP_MENU 'Please select the current device this is being installed on:\n - NB: Select "Generic device" if not listed.\n - "Core devices": Are fully supported by DietPi, offering full GPU + Kodi support.\n - "Limited support devices": No GPU support, supported limited to DietPi specific issues only (eg: excludes Kernel/GPU/VPU related items).' + if (( $? )); then + + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 + + elif [[ $G_WHIP_RETURNED_VALUE ]]; then + + HW_MODEL=$G_WHIP_RETURNED_VALUE + break + + fi + + done + G_HW_MODEL=$HW_MODEL + unset HW_MODEL # + Set for future scripts - G_HW_MODEL=$G_WHIP_RETURNED_VALUE echo $G_HW_MODEL > /etc/.dietpi_hw_model_identifier G_DIETPI-NOTIFY 2 "Selected hardware model ID: $G_HW_MODEL" G_DIETPI-NOTIFY 2 "Detected CPU architecture: $G_HW_ARCH_DESCRIPTION (ID: $G_HW_ARCH)" - G_WHIP_MENU_ARRAY=( + # WiFi selection + if [[ $WIFI_REQUIRED != [01] ]]; then - '0' ': I do not require WiFi functionality, skip related package install.' - '1' ': I require WiFi functionality, install related packages.' + G_WHIP_MENU_ARRAY=( - ) + '0' ': I do not require WiFi functionality, skip related package install.' + '1' ': I require WiFi functionality, install related packages.' - G_WHIP_DEFAULT_ITEM=1 - (( $G_HW_MODEL == 20 )) && G_WHIP_DEFAULT_ITEM=0 + ) - if G_WHIP_MENU 'Please select an option:' && (( $G_WHIP_RETURNED_VALUE )); then + G_WHIP_DEFAULT_ITEM=1 + (( $G_HW_MODEL == 20 )) && G_WHIP_DEFAULT_ITEM=0 + if G_WHIP_MENU 'Please select an option:'; then - G_DIETPI-NOTIFY 2 'Marking WiFi as required' - WIFI_REQUIRED=1 - else + WIFI_REQUIRED=$G_WHIP_RETURNED_VALUE + + else - G_DIETPI-NOTIFY 2 'Marking WiFi as NOT required' + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 + + fi fi + (( $WIFI_REQUIRED )) && G_DIETPI-NOTIFY 2 'Marking WiFi as required' || G_DIETPI-NOTIFY 2 'Marking WiFi as NOT required' + # Distro Selection DISTRO_LIST_ARRAY=( @@ -488,24 +537,44 @@ unset DISTRO_LIST_ARRAY - if [[ -z ${G_WHIP_MENU_ARRAY+x} ]]; then + if (( ! ${#G_WHIP_MENU_ARRAY[@]} )); then G_DIETPI-NOTIFY 1 'No available distro versions for this system. Aborting...\n' exit 1 fi - G_WHIP_DEFAULT_ITEM=${G_WHIP_MENU_ARRAY[0]} # Downgrades disabled, so first item matches current/lowest supported distro version - G_WHIP_BUTTON_CANCEL_TEXT='Exit' - G_WHIP_MENU "Please select a distro version to install on this system. Selecting a distro that is older than the current installed on system, is not supported.\n\nCurrently installed:\n - $G_DISTRO $G_DISTRO_NAME" - if (( $? )) || [[ -z $G_WHIP_RETURNED_VALUE ]]; then + while : + do - G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' - exit 0 + if disable_error=1 G_CHECK_VALIDINT "$DISTRO_TARGET" 0; then - fi + for i in "${G_WHIP_MENU_ARRAY[@]}" + do + + [[ $DISTRO_TARGET == $i ]] && break 2 + + done + + fi + + G_WHIP_DEFAULT_ITEM=${G_WHIP_MENU_ARRAY[0]} # Downgrades disabled, so first item matches current/lowest supported distro version + G_WHIP_BUTTON_CANCEL_TEXT='Exit' + G_WHIP_MENU "Please select a distro version to install on this system. Selecting a distro that is older than the current installed on system, is not supported.\n\nCurrently installed:\n - $G_DISTRO $G_DISTRO_NAME" + if (( $? )); then + + G_DIETPI-NOTIFY 1 'No choice detected. Aborting...\n' + exit 0 + + else + + DISTRO_TARGET=$G_WHIP_RETURNED_VALUE + break + + fi + + done - DISTRO_TARGET=$G_WHIP_RETURNED_VALUE if (( $DISTRO_TARGET == 4 )); then DISTRO_TARGET_NAME='stretch' @@ -531,9 +600,9 @@ G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' #------------------------------------------------------------------------------------------------ - INTERNET_ADDRESS="https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.zip" - G_CHECK_URL "$INTERNET_ADDRESS" - G_RUN_CMD wget "$INTERNET_ADDRESS" -O package.zip + local url="https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.zip" + G_CHECK_URL "$url" + G_RUN_CMD wget "$url" -O package.zip [[ -d DietPi-$G_GITBRANCH ]] && l_message='Cleaning previously extracted files' G_RUN_CMD rm -R "DietPi-$G_GITBRANCH" l_message='Extracting DietPi sourcecode' G_RUN_CMD unzip package.zip From 02e15dce6f20e369f3a812ff4ac3bb6c678e823d Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sat, 4 May 2019 18:55:17 +0200 Subject: [PATCH 26/41] v6.23 + CHANGELOG | DietPi-PREP automation via environment variables --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4b2432e34b..b3a8452d99 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -15,6 +15,7 @@ Changes / Improvements / Optimisations: - DietPi-LetsEncrypt | When applying to Lighttpd, "webroot" authentication is now used instead of "standalone". This allows the auto-renewal service to succeed while Lighttpd is running. Many thanks to @minnux for testing this method: https://github.com/MichaIng/DietPi/issues/2680#issuecomment-480095449 - DietPi-Arr_to_RAM | With v6.18 we silently added a new script (for Stretch and above) that allows linking Sonarr/Radarr/Lidarr database files to RAM, increasing access performance, reducing disk I/O and avoiding constant external HDD spinning due to the very regular access to these files. This script has gone through some rework and polishing and can now be enabled to automatically link those databases to RAM on boot and store them back to disk on shutdown. For more details read: https://dietpi.com/phpbb/viewtopic.php?f=8&t=5828. Many thanks to @Dr0bac for providing valuable input and testing the development progress constantly: https://github.com/MichaIng/DietPi/issues/2689 - DietPi-Drive_Manager | encryptfs and vboxsf (VirtualBox shared folder) fstab entries are now preserved. Many thanks to @johnvick and @Phil1988 for suggesting: https://github.com/MichaIng/DietPi/issues/2078, https://github.com/MichaIng/DietPi/issues/2202 +- DietPi-PREP | The script execution can now be fully automated via environment variables. Many thanks to @FredericGuilbault for adding this feature: https://github.com/MichaIng/DietPi/pull/2756 - DietPi-Config | Added support to toggle Intel CPU turbo/boost mode. Requires Intel CPU that supports the feature. - DietPi-Config | G_CHECK_URL: Added ability to change the connection attempts and timeout, before DietPi URL checking assumes a dead link and failure: https://github.com/MichaIng/DietPi/issues/2717 - DietPi-Config | Serial/UART device handling has been reworked. Serial login consoles can now be toggled for every found serial device individually. On RPi the primary UART can be completely disabled and warnings are prompted if Bluetooth and login console are to be enabled both on ttyAMA0. On update existing systems will be patched so that serial-getty masks and enabled instances are removed if the related serial device does not exist. This solves some error messages during boot. From c23700e14a8870cc06db5cce3edd6706b204a5a3 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sun, 5 May 2019 01:01:01 +0200 Subject: [PATCH 27/41] v6.23 + DietPi-CPU_info | Minor coding --- dietpi/dietpi-cpuinfo | 63 +++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/dietpi/dietpi-cpuinfo b/dietpi/dietpi-cpuinfo index 5d297bdcf9..3766500de7 100644 --- a/dietpi/dietpi-cpuinfo +++ b/dietpi/dietpi-cpuinfo @@ -12,23 +12,19 @@ # - Prints CPU information # # Usage: - # - /DietPi/dietpi/dietpi-cpuinfo Obtain stats and print + # - /DietPi/dietpi/dietpi-cpuinfo Obtain stats and print # - /DietPi/dietpi/dietpi-cpuinfo 2 Generates file of available, ordered scaling freq's $FP_CPU_SCALINGAVAILABLE_FREQ #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-CPU_info' G_CHECK_ROOT_USER G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #DietPi-Globals exit trap addition - G_EXIT_CUSTOM(){ unset aCPU_CURRENT_FREQ aCPU_MIN_FREQ aCPU_MAX_FREQ aCPU_SCALINGAVAILABLE_FREQ; } - - #Grab Input - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab input + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 aCPU_CURRENT_FREQ=() aCPU_MIN_FREQ=() @@ -38,19 +34,19 @@ for ((i=0; i<$(nproc --all); i++)) do - if [[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq ]]; then + if [[ -f '/sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq' ]]; then aCPU_CURRENT_FREQ[$i]=$( $FP_CPU_SCALINGAVAILABLE_FREQ if (( $CPU_SCALINGSUPPORTED )); then @@ -176,16 +167,16 @@ for i in ${aCPU_SCALINGAVAILABLE_FREQ[@]} do - echo -e "$i" >> $FP_CPU_SCALINGAVAILABLE_FREQ + echo $i >> $FP_CPU_SCALINGAVAILABLE_FREQ done - # Order, remove dupes + # - Order, remove dupes sort -u -n $FP_CPU_SCALINGAVAILABLE_FREQ -o $FP_CPU_SCALINGAVAILABLE_FREQ fi - #Print all stats + # Print all stats else Obtain_Cpu_Freq From 81810d3e2b9be2c2664d4335ad78cca29b5578b9 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sun, 5 May 2019 01:02:50 +0200 Subject: [PATCH 28/41] v6.23 + DietPi-CPU_info | Syntax --- dietpi/dietpi-cpuinfo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dietpi/dietpi-cpuinfo b/dietpi/dietpi-cpuinfo index 3766500de7..c49969c1b2 100644 --- a/dietpi/dietpi-cpuinfo +++ b/dietpi/dietpi-cpuinfo @@ -34,19 +34,19 @@ for ((i=0; i<$(nproc --all); i++)) do - if [[ -f '/sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq' ]]; then + if [[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq ]]; then aCPU_CURRENT_FREQ[$i]=$( Date: Sun, 5 May 2019 01:53:40 +0200 Subject: [PATCH 29/41] v6.23 + DietPi-Cleaner | Minor coding --- dietpi/dietpi-cleaner | 151 ++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 85 deletions(-) diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner index 07ed115228..3d9cbf7391 100644 --- a/dietpi/dietpi-cleaner +++ b/dietpi/dietpi-cleaner @@ -8,6 +8,7 @@ #//////////////////////////////////// # # Info: + # - Location: /DietPi/dietpi/dietpi-cleaner # - Cleans "crap" on users system :) # # - Usage @@ -16,17 +17,16 @@ # /DietPi/dietpi/dietpi-cleaner 2 = Run All cleaners (no menu). #//////////////////////////////////// - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_PROGRAM_NAME='DietPi-Cleaner' G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW G_INIT - #Import DietPi-Globals --------------------------------------------------------------- + # Import DietPi-Globals -------------------------------------------------------------- - #Grab Input (valid interger) - INPUT=0 - disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 + # Grab Input (valid interger) + disable_error=1 G_CHECK_VALIDINT "$1" && INPUT=$1 || INPUT=0 #///////////////////////////////////////////////////////////////////////////////////// # Globals @@ -48,7 +48,7 @@ #///////////////////////////////////////////////////////////////////////////////////// # Menu #///////////////////////////////////////////////////////////////////////////////////// - #Whippy Whoopy Whiptail! + # Whippy Whoopy Whiptail! TARGETMENUID=0 Menu_Exit(){ @@ -56,22 +56,20 @@ G_WHIP_SIZE_X_MAX=50 if G_WHIP_YESNO "Exit $G_PROGRAM_NAME?"; then - #exit - TARGETMENUID=-1 + TARGETMENUID=-1 # Exit else - #Return to Main Menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu fi } - #TARGETMENUID=0 + # TARGETMENUID=0 Menu_Main(){ - #Get current RootFS usage + # Get current RootFS usage Update_Space_Used TARGETMENUID=0 @@ -114,10 +112,10 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 Test) - #Enable test + # Enable test DRY_RUN=1 - #check for at least 1 enabled. + # Check for at least 1 enabled. local at_least_one_cleaner_is_enabled=0 for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -133,8 +131,8 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 if (( $at_least_one_cleaner_is_enabled )); then - G_WHIP_YESNO "$G_PROGRAM_NAME will now simulate your enabled cleaners.\n\n(Notice): No data will be modified.\n\nContinue with test run?" - (( $? == 0 )) && Run_Cleaners + G_WHIP_YESNO "$G_PROGRAM_NAME will now simulate your enabled cleaners.\n +(Notice): No data will be modified.\n\nContinue with test run?" && Run_Cleaners else @@ -146,10 +144,10 @@ Further information:\n - https://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=623#p6 Run) - #Disable test + # Disable test DRY_RUN=0 - #check for at least 1 enabled. + # Check for at least 1 enabled. local at_least_one_cleaner_is_enabled=0 for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -187,23 +185,21 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - #TARGETMENUID=1 + # TARGETMENUID=1 Menu_Cleaners(){ - #Return to main menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu - #Get on/off whilptail status + # Get on/off whilptail status G_WHIP_CHECKLIST_ARRAY=() local OnOff_Status='on' for ((i=0; i<$MAX_CLEANERS; i++)) do - #On/Off status - OnOff_Status='on' - (( ${aEnabledCleaners[$i]} )) || OnOff_Status='off' + # On/Off status + (( ${aEnabledCleaners[$i]} )) && OnOff_Status='on' || OnOff_Status='off' - #Define options + # Define options if (( $i == 0 )); then G_WHIP_CHECKLIST_ARRAY+=("$i " ': Dev - Uninstalls all dev packages (eg: git, lib123-dev).' "$OnOff_Status") @@ -222,7 +218,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners elif (( $i == 4 )); then - G_WHIP_CHECKLIST_ARRAY+=("$i " ': Apt - Clears the apt cache and runs a fresh update.' "$OnOff_Status") + G_WHIP_CHECKLIST_ARRAY+=("$i " ': APT - Clears the APT cache and runs a fresh update.' "$OnOff_Status") else @@ -252,11 +248,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - #TARGETMENUID=2 + # TARGETMENUID=2 Menu_Options_Files(){ - #Return to main menu - TARGETMENUID=0 + TARGETMENUID=0 # Main menu local option_1_text='Include mount directory (/mnt/*) during file scan' local include_mnt_status='Disabled' @@ -277,24 +272,15 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners "$option_1_text") - if (( $INCLUDE_MNT )); then - - INCLUDE_MNT=0 - - else - - INCLUDE_MNT=1 - - fi - - TARGETMENUID=2 + (( $INCLUDE_MNT )) && INCLUDE_MNT=0 || INCLUDE_MNT=1 + TARGETMENUID=2 # Files menu ;; "$option_2_text") nano $FILEPATH_CUSTOMFILES - TARGETMENUID=2 + TARGETMENUID=2 # Files menu ;; @@ -339,13 +325,13 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners Run_Cleaners(){ - #stop services + # Stop services /DietPi/dietpi/dietpi-services stop Update_Space_Used ROOT_SPACE_USED_BEFORE=$ROOT_SPACE_USED_CURRENT - #Run enabled cleaners + # Run enabled cleaners for ((i=0; i<$MAX_CLEANERS; i++)) do @@ -356,7 +342,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners Update_Space_Used ROOT_SPACE_USED_AFTER=$ROOT_SPACE_USED_CURRENT - #start services + # Start services /DietPi/dietpi/dietpi-services start #inform user of space cleared. @@ -384,18 +370,18 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners while read line do - #Convert lined list into a 1 line string. + # Convert lined list into a 1 line string. string_package_names+="$line " done <<< "$(dpkg --get-selections | mawk '/-dev/ {print $1}')" - #add other dev packages + # Add other dev packages string_package_names+='build-essential git' - #Purge + # Purge if (( $DRY_RUN )); then - apt-get remove -ys $string_package_names + apt-get -s purge $string_package_names else @@ -414,18 +400,16 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INFO_CLEAN_NAME='Man pages and docs' Banner_Cleaning - local Yes_or_Simulate='-y' - (( $DRY_RUN )) && Yes_or_Simulate='-s' + # Purge + if (( $DRY_RUN )); then - G_AGP man manpages $Yes_or_Simulate - G_AGA $Yes_or_Simulate + apt-get -s purge man manpages - #Remove files - if (( ! $DRY_RUN )); then + else - rm -R /usr/share/man - rm -R /usr/share/doc - rm -R /usr/share/doc-base + G_AGP man manpages + G_AGA + rm -Rf /usr/share/{man,doc,doc-base} fi @@ -437,25 +421,25 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners INFO_CLEAN_NAME='Files' Banner_Cleaning - #Generate list of files to include. Remove lines with (#) or (space) or (empty) from list + # Generate list of files to include. Remove lines with (#) or (space) or (empty) from list sed -E '/([#[:blank:]]|^$)/d' $FILEPATH_CUSTOMFILES > $FP_TEMP - #Check include file has at least one value/line to process. + # Check include file has at least one value/line to process. local line_count=$(wc -l < $FP_TEMP) - if (( $line_count == 0 )); then + if (( ! $line_count )); then - echo -e "\nNo files to find. Have you setup the Files options and added filename entries to match?\n" + echo -e '\nNo files to find. Have you setup the Files options and added filename entries to match?\n' else - #Create array to hold user includes + # Create array to hold user includes local aCustomFiles=() readarray aCustomFiles < $FP_TEMP - #Generate the find string + # Generate the find string local find_string='' echo -e '\nSearching for filenames matching:' - for ((i=0; i<${#aCustomFiles[@]}; i++)) + for i in ${!aCustomFiles[@]} do echo -e "- ${aCustomFiles[$i]}" @@ -474,10 +458,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners echo 'Please wait...' - #Find all matching filenames. + # Find all matching filenames. find / -type f $find_string > $FP_TEMP - #Remove /mnt from find list + # Remove /mnt from find list (( $INCLUDE_MNT )) || sed -i '/\/mnt/d' $FP_TEMP line_count=$(wc -l < $FP_TEMP) @@ -491,7 +475,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners fi - #Remove files + # Remove files while read line do @@ -505,9 +489,6 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners done < $FP_TEMP - #delete[] - unset aCustomFiles - fi rm $FP_TEMP @@ -529,7 +510,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners } - # Apt caches + # APT caches Run_Cleaner_4(){ INFO_CLEAN_NAME='APT cache and update' @@ -548,7 +529,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners #///////////////////////////////////////////////////////////////////////////////////// # Settings File #///////////////////////////////////////////////////////////////////////////////////// - #Define Location + # Define Location FILEPATH_SETTINGS='/DietPi/dietpi/.dietpi-cleaner' FILEPATH_CUSTOMFILES='/DietPi/dietpi/.dietpi-cleaner_custom_files' @@ -556,10 +537,10 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners if [[ -f $FILEPATH_SETTINGS ]]; then - #Get line count - local line_count=$(cat $FILEPATH_SETTINGS | wc -l) + # Get line count + local line_count=$(wc -l < $FILEPATH_SETTINGS) - #Load settings + # Load settings for ((i=0; i<$line_count; i++)) do @@ -569,7 +550,7 @@ Would you like to continue and start the cleaning process?" && Run_Cleaners fi - #Custom filescan options + # Custom filescan options if [[ ! -f $FILEPATH_CUSTOMFILES ]]; then cat << _EOF_ > $FILEPATH_CUSTOMFILES @@ -600,26 +581,26 @@ _EOF_ Write_Settings_File(){ - #Enabled/Disabled Cleaner Settings - rm $FILEPATH_SETTINGS &> /dev/null + # Enabled/Disabled Cleaner Settings + [[ -f $FILEPATH_SETTINGS ]] && rm $FILEPATH_SETTINGS for ((i=0; i<$MAX_CLEANERS; i++)) do - echo -e "${aEnabledCleaners[$i]}" >> $FILEPATH_SETTINGS + echo "${aEnabledCleaners[$i]}" >> $FILEPATH_SETTINGS done } #///////////////////////////////////////////////////////////////////////////////////// - #Main + # Main #///////////////////////////////////////////////////////////////////////////////////// Read_Settings_File #----------------------------------------------------------------------------------- - #Run Menu + # Run Menu if (( $INPUT == 0 )); then - #Start DietPi Menu + # Start DietPi Menu while (( $TARGETMENUID > -1 )); do if (( $TARGETMENUID == 0 )); then @@ -641,13 +622,13 @@ _EOF_ Write_Settings_File #----------------------------------------------------------------------------------- - #Run Enabled cleaners (no menu) + # Run Enabled cleaners (no menu) elif (( $INPUT == 1 )); then Run_Cleaners #----------------------------------------------------------------------------------- - #Run ALL cleaners (no menu) + # Run ALL cleaners (no menu) elif (( $INPUT == 2 )); then for ((i=0; i<$MAX_CLEANERS; i++)) From f51948bf1771944b9c1e6c197eb916f134a06ddd Mon Sep 17 00:00:00 2001 From: Frederic Guilbault Date: Sun, 5 May 2019 08:13:16 -0400 Subject: [PATCH 30/41] Trivial text edit for better clarity --- PREP_SYSTEM_FOR_DIETPI.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index 4ade5df87e..dbd1be3c08 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -158,7 +158,7 @@ ) - if GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select a Git branch:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then + if GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select the Git branch the installer should use:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then unset aWHIP_BRANCH @@ -200,6 +200,7 @@ G_PROGRAM_NAME='DietPi-PREP' G_INIT + # - Detect the the Debian version of this operating system. if grep -q 'jessie' /etc/os-release; then G_DISTRO=3 @@ -222,6 +223,7 @@ fi + # - Detect the the hardware architecture of this operating system. G_HW_ARCH_DESCRIPTION=$(uname -m) if [[ $G_HW_ARCH_DESCRIPTION == 'armv6l' ]]; then @@ -260,7 +262,7 @@ #------------------------------------------------------------------------------------------------ if [[ -d /DietPi/dietpi || -d /boot/dietpi ]]; then - G_DIETPI-NOTIFY 2 'DietPi system found, running pre-prep' + G_DIETPI-NOTIFY 2 'DietPi system found, removing the old files and stopping services. (pre-prep)' # - Stop services: RAMdisk includes (Pre|Post)Boot due to dependencies [[ -f /DietPi/dietpi/dietpi-services ]] && /DietPi/dietpi/dietpi-services stop @@ -296,7 +298,7 @@ #------------------------------------------------------------------------------------------------ echo '' G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' - G_DIETPI-NOTIFY 0 "Step $SETUP_STEP (inputs): Image info / Hardware / WiFi / Distro:" + G_DIETPI-NOTIFY 0 "Step $SETUP_STEP Ask user about: Image info / Hardware / WiFi / Distro:" ((SETUP_STEP++)) G_DIETPI-NOTIFY 2 '-----------------------------------------------------------------------------------' #------------------------------------------------------------------------------------------------ @@ -783,6 +785,7 @@ _EOF_ # - G_HW_ARCH specific required Kernel packages # As these are kernel, or bootloader packages, we need to install them directly to allow autoremove of in case older kernel packages: # https://github.com/MichaIng/DietPi/issues/1285#issuecomment-354602594 + # x86_64 if (( $G_HW_ARCH == 10 )); then From 66b8ecc77f1229b2d331d3a8b833b80003d77cf8 Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Sun, 5 May 2019 13:20:35 +0100 Subject: [PATCH 31/41] Resolve Java on buster. --- dietpi/dietpi-software | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 8c4bd46a35..c2ccd14f18 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -6660,7 +6660,10 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix else - local packages='ca-certificates-java openjdk-8-jre-headless openjdk-8-jdk-headless' + local version=8 + (( $G_DISTRO == 5 )) && version=11 + + local packages="ca-certificates-java openjdk-$version-jre-headless openjdk-$version-jdk-headless" # Workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 apt-get install -y -qq $packages G_AGI $packages From 489571834081480a01d13c746d0b3791648e21c2 Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Sun, 5 May 2019 13:22:08 +0100 Subject: [PATCH 32/41] Minor --- dietpi/dietpi-software | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index c2ccd14f18..007943edd9 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -2128,7 +2128,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it software_id=8 aSOFTWARE_WHIP_NAME[$software_id]='Java' - aSOFTWARE_WHIP_DESC[$software_id]='OpenJDK 8 + JRE libary' + aSOFTWARE_WHIP_DESC[$software_id]='OpenJDK + JRE libary' aSOFTWARE_CATEGORY_INDEX[$software_id]=4 aSOFTWARE_TYPE[$software_id]=1 #------------------ From 158d0e44e615c34a14b4d6f8ba3e4a87e5ddd909 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sun, 5 May 2019 21:33:25 +0200 Subject: [PATCH 33/41] v6.23 (#2768) + DietPi-Software | SABnzbd: Install latest master version + DietPi-Software | SABnzbd: Clear install dir before reinstalling, preserving config file + DietPi-Software | SABnzbd: Do not touch existing config files on reinstall + DietPi-Software | SABnzbd: p7zip-full binaries are expected + DietPi-Software | SABnzbd: Skip install non-required -dev packages + DietPi-Software | SABnzbd: Build-essentials are not required. Par2 multicore compiling requires it, but info about that has been added to online docs. + DietPi-Software | SABnzbd: Slight systemd unit updates based on docs and shebang + DietPi-Software | SABnzbd: Start with Python 2.7 binary explicitly to avoid possible conflicts with Python 3 + DietPi-Set_software | setpermissions: Add SABnzbd download sub dirs + DietPi-Patch | Reinstall SABnzbd to update to current version and apply 7zip-full and systemd unit --- CHANGELOG.txt | 1 + dietpi/dietpi-software | 119 ++++++++++++++++++++------------ dietpi/func/dietpi-set_software | 13 ++-- dietpi/patch_file | 5 +- 4 files changed, 84 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b3a8452d99..cb673b4676 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -30,6 +30,7 @@ Changes / Improvements / Optimisations: - DietPi-Software | Logitech Media Server: Now installs the latest nightly version, since no public "releases" are done. As well the systemd service has gone through some update and now runs as limited user to align with other media servers, enhance security and follow the defaults of the DPKG package. The update/change is applied to existing installs via DietPi-Update as well. Your settings/date are preserved. - DietPi-Software | Tor/WiFi Hotspot: Resolved an issue where WiFi Hotspot fails to start when Tor Hotspot is installed. Many thanks to @schnuckz for reporting this issue: https://github.com/MichaIng/DietPi/issues/2673#issuecomment-482605700 - DietPi-Software | Nextcloud Talk: We do not apply (D)TLS settings to coTURN any more. Since WebRTC is encrypted by itself there is no security benefit. More importantly Nextcloud Talk does not make use of the required TURNS protocol, so there is absolutely no point to apply these settings. The (D)TLS feature is meant to allow passing firewalls that only allow encrypted traffic. WebRTC, although encrypted, might not pass such firewalls since the encryption is not on transport layer. For those how are interested in further details and discussion: https://github.com/coturn/coturn/issues/33, https://github.com/nextcloud/spreed/issues/257 +- DietPi-Software | SABnzbd: Install latest version via GitHub master and skip adjusting existing config file. Systemd unit and dependencies have been adjusted to match minimum requirements and official documentation. The update will be applied via DietPi v6.23 patch as well. Many thanks to @19eighties for reporting the outdated version: https://github.com/MichaIng/DietPi/issues/2762 Bug Fixes: - System | Debian has vastly reduced support for Jessie systems from their official APT repository. The limited possible list entries are applied during DietPi-Update. Many thanks to @BerndKohl for reporting this issue: https://github.com/MichaIng/DietPi/issues/2665 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 007943edd9..44a2c0054f 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -910,7 +910,6 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_CATEGORY_INDEX[$software_id]=3 aSOFTWARE_TYPE[$software_id]=0 aSOFTWARE_ONLINEDOC_URL[$software_id]='p=6747#p6747' - aSOFTWARE_REQUIRES_BUILDESSENTIAL[$software_id]=1 #------------------ software_id=142 @@ -5596,22 +5595,29 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=sid\nPin-Prior fi - #sabnzbd - software_id=139 + software_id=139 # SABnzbd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - Banner_Installing + Banner_Installing # https://sabnzbd.org/wiki/installation/install-off-modules + + # Pre-reqs + DEPS_LIST='par2 p7zip-full' + + Download_Install 'https://github.com/sabnzbd/sabnzbd/archive/master.zip' - local version='2.3.5' + # Clear old install dir (in case of reinstall) + if [[ -d '/etc/sabnzbd' ]]; then - #prereqs - DEPS_LIST='par2 python-dev libffi-dev libssl-dev' + # - Preserve old config file + [[ -f '/etc/sabnzbd/sabnzbd.ini' ]] && mv /etc/sabnzbd/sabnzbd.ini sabnzbd-master/ + rm -R /etc/sabnzbd - Download_Install "https://github.com/sabnzbd/sabnzbd/archive/$version.zip" /etc/sabnzbd + fi - mv /etc/sabnzbd/sabnzbd-"$version"/* /etc/sabnzbd/ - rm -R /etc/sabnzbd/sabnzbd-"$version" + # Install new files + mv sabnzbd-master /etc/sabnzbd + # Required Python modules pip install cheetah cryptography sabyenc fi @@ -11446,60 +11452,76 @@ _EOF_ Banner_Configuration - useradd -rM sabnzbd -G dietpi -s /usr/sbin/nologin + # User + local usercmd='useradd -rM' + getent passwd sabnzbd &> /dev/null && usercmd='usermod' + $usercmd sabnzbd -G dietpi -d /etc/sabnzbd -s $(command -v nologin) + + # Service: https://github.com/sabnzbd/sabnzbd/blob/master/linux/sabnzbd%40.service + # - Options: https://sabnzbd.org/wiki/advanced/command-line-parameters + # "-OO": Optimise code and remove doc lines (default shebang of SABnzbd.py, but we run python2.7 explicitly to avoid version conflicts) + # "-d": Run in daemon mode without terminal and browser start (requires "-f ") + # NB: In systemd unit leads to unreliable long taking webserver start. A new process is forked which allows web access, but sometimes after very long time, sometimes never: https://github.com/sabnzbd/sabnzbd/issues/1283 + # "-b 0": Do no start browser with daemon cat << _EOF_ > /etc/systemd/system/sabnzbd.service [Unit] -Description=sabnzbd (DietPi) +Description=SABnzbd (DietPi) +Documentation=https://sabnzbd.org/wiki/ +Wants=network-online.target +After=network-online.target [Service] User=sabnzbd Group=dietpi -ExecStart=$(command -v python) /etc/sabnzbd/SABnzbd.py -f /etc/sabnzbd/sabnzbd.ini +ExecStart=$(command -v python2.7) -OO /etc/sabnzbd/SABnzbd.py -b 0 -f /etc/sabnzbd/sabnzbd.ini +Restart=on-failure [Install] WantedBy=multi-user.target _EOF_ - systemctl daemon-reload + # Log dir and permissions mkdir -p /var/log/sabnzbd - chown -R sabnzbd:dietpi /etc/sabnzbd - chown -R sabnzbd:dietpi /var/log/sabnzbd + chown -R sabnzbd:sabnzbd /etc/sabnzbd /var/log/sabnzbd - # Create config: - # API keys and intial config are only generated during 1st run of sabnzbd - # We need to launch program, then apply our config tweaks, else, wizard setup in web interface simply loops without API keys. - rm /etc/sabnzbd/sabnzbd.ini &> /dev/null + # Create config + # - Touch only if it does not yet exist, assume reinstall otherwise and preserve custom changes + # - API keys and initial config are only generated during 1st run + # - We need to launch program, then apply our config tweaks, else, wizard setup in web interface simply loops without API keys. + if [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]]; then - systemctl start sabnzbd - G_DIETPI-NOTIFY 2 "Generating initial config, please wait..." - while [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]] - do - - sleep 1 + systemctl daemon-reload + systemctl start sabnzbd - done + G_DIETPI-NOTIFY 2 'Generating initial config, please wait...' + while [[ ! -f '/etc/sabnzbd/sabnzbd.ini' ]] + do - sleep 2 + sleep 0.5 - systemctl stop sabnzbd + done + sleep 2 - sleep 2 #additional wait, config being overwritten after below changes: https://dietpi.com/phpbb/viewtopic.php?f=11&t=1848&p=7085#p7082 + systemctl stop sabnzbd + sleep 2 # Additional wait, config being overwritten after below changes: https://dietpi.com/phpbb/viewtopic.php?p=7082#p7082 - sed -i "/^download_dir =/c\download_dir = $G_FP_DIETPI_USERDATA/downloads/incomplete" /etc/sabnzbd/sabnzbd.ini - sed -i "/^complete_dir =/c\complete_dir = $G_FP_DIETPI_USERDATA/downloads/complete" /etc/sabnzbd/sabnzbd.ini - sed -i "/^nzb_backup_dir =/c\nzb_backup_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_nzb_backup" /etc/sabnzbd/sabnzbd.ini - sed -i "/^admin_dir =/c\admin_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_admin" /etc/sabnzbd/sabnzbd.ini - sed -i "/^log_dir =/c\log_dir = /var/log/sabnzbd" /etc/sabnzbd/sabnzbd.ini - sed -i "/^log_level =/c\log_level = 0" /etc/sabnzbd/sabnzbd.ini #err only - sed -i "/^refresh_rate =/c\refresh_rate = 2" /etc/sabnzbd/sabnzbd.ini - sed -i "/^host =/c\host = 0.0.0.0" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'download_dir =' "download_dir = $G_FP_DIETPI_USERDATA/downloads/incomplete" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'complete_dir =' "complete_dir = $G_FP_DIETPI_USERDATA/downloads/complete" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'nzb_backup_dir =' "nzb_backup_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_nzb_backup" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'admin_dir =' "admin_dir = $G_FP_DIETPI_USERDATA/downloads/sabnzbd_admin" /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'log_dir =' 'log_dir = /var/log/sabnzbd' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'log_level =' 'log_level = 0' /etc/sabnzbd/sabnzbd.ini # Warning errors only + G_CONFIG_INJECT 'refresh_rate =' 'refresh_rate = 2' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'host =' 'host = 0.0.0.0' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'permissions =' 'permissions = 0775' /etc/sabnzbd/sabnzbd.ini + G_CONFIG_INJECT 'auto_browser =' 'auto_browser = 0' /etc/sabnzbd/sabnzbd.ini - G_CONFIG_INJECT 'permissions =' 'permissions = "0775"' /etc/sabnzbd/sabnzbd.ini + fi - # - Install language packs: https://github.com/MichaIng/DietPi/issues/1917#issue-340631943 + # Install language packs: https://github.com/MichaIng/DietPi/issues/1917#issue-340631943 cd /etc/sabnzbd - G_RUN_CMD python tools/make_mo.py - cd /root + G_RUN_CMD python2.7 tools/make_mo.py + cd /tmp/$G_PROGRAM_NAME fi @@ -12908,13 +12930,18 @@ _EOF_ fi - software_id=139 + software_id=139 # SABnzbd if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - userdel -rf sabnzbd - rm -R /etc/sabnzbd - rm /etc/systemd/system/sabnzbd.service + getent passwd sabnzbd &> /dev/null && userdel -rf sabnzbd + [[ -d '/etc/sabnzbd' ]] && rm -R /etc/sabnzbd + if [[ -f '/etc/systemd/system/sabnzbd.service' ]]; then + + systemctl disable sabnzbd + rm /etc/systemd/system/sabnzbd.service + + fi fi diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software index 64da1412c7..84f720e41c 100644 --- a/dietpi/func/dietpi-set_software +++ b/dietpi/func/dietpi-set_software @@ -328,9 +328,9 @@ _EOF_ chmod +x /root/Desktop/* # - O!MPD, requires write permissions - chmod -R 777 /var/www/ompd/tmp #(required for database update) - chmod -R 777 /var/www/ompd/stream #(required for streaming files) - chmod -R 777 /var/www/ompd/cache #(required for downloading files) + chmod -R 777 /var/www/ompd/tmp # Required for database update + chmod -R 777 /var/www/ompd/stream # Required for streaming files + chmod -R 777 /var/www/ompd/cache # Required for downloading files # - MPD chmod 0664 /var/log/mpd/mpd.log /etc/mpd.conf @@ -401,7 +401,7 @@ _EOF_ # - sickrage # pre-v6.20 compatibility [[ -d $G_FP_DIETPI_USERDATA/sickrage ]] && chown -R sickrage:dietpi $G_FP_DIETPI_USERDATA/sickrage - [[ -f /var/log/sickrage.log ]] && chown sickrage:dietpi /var/log/sickrage.log + [[ -f '/var/log/sickrage.log' ]] && chown sickrage:dietpi /var/log/sickrage.log # - Medusa chown -R medusa:dietpi $G_FP_DIETPI_USERDATA/medusa @@ -454,14 +454,15 @@ _EOF_ chown -R fahclient:dietpi $G_FP_DIETPI_USERDATA/fahclient /var/log/fahclient.log # - Sabnzbd - chown -R sabnzbd:dietpi /etc/sabnzbd /var/log/sabnzbd + chown -R sabnzbd:sabnzbd /etc/sabnzbd /var/log/sabnzbd $G_FP_DIETPI_USERDATA/downloads/sabnzbd* + chown -R sabnzbd:dietpi $G_FP_DIETPI_USERDATA/downloads/{,in}complete # - Blynk chown -R blynk:dietpi $G_FP_DIETPI_USERDATA/blynk # - Pi-hole # - NB: Git requies special permissions to allow "pihole -up". - if [[ -d /var/www/html/pihole ]]; then + if [[ -d '/var/www/html/pihole' ]]; then cd /var/www/html/admin && git reset --hard HEAD cd /tmp/$G_PROGRAM_NAME diff --git a/dietpi/patch_file b/dietpi/patch_file index 84738ce30d..9489fa8178 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -901,7 +901,7 @@ _EOF_ fi #------------------------------------------------------------------------------- #Reinstalls: - # # => v6.20 NAA: https://dietpi.com/phpbb/viewtopic.php?f=11&t=4420&p=13914#p13914 + # # => v6.20 NAA: https://dietpi.com/phpbb/viewtopic.php?p=13914#p13914 #------------------------------------------------------------------------------- elif (( $G_DIETPI_VERSION_SUB == 14 )); then @@ -1904,13 +1904,14 @@ Your Nextcloud data are not touched.' dpkg-query -s plexmediaserver-installer &> /dev/null && dpkg -r plexmediaserver-installer [[ -f '/etc/apt/sources.list.d/plex.list' ]] && rm /etc/apt/sources.list.d/plex.list # Logitech Media Server: https://github.com/MichaIng/DietPi/commit/eccef6700381c3f044ec4d435beb167736db0bb4 + # SABnzbd: https://github.com/MichaIng/DietPi/pull/2768 if [[ -f '/etc/systemd/system/squeezeboxserver.service' ]]; then systemctl disable squeezeboxserver mv /etc/systemd/system/squeezeboxserver.service /etc/systemd/system/logitechmediaserver.service fi - /DietPi/dietpi/dietpi-software reinstall 34 35 42 $reinstall_ids + /DietPi/dietpi/dietpi-software reinstall 34 35 42 139 $reinstall_ids #----------------------------------------------------------------------- # Remove old PHP version if (( $upgrade_php )); then From 259073f79ea34a02202def42c6d8f885b294ff05 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sun, 5 May 2019 22:15:41 +0200 Subject: [PATCH 34/41] v6.23 + RC up --- dietpi/server_version-6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/server_version-6 b/dietpi/server_version-6 index 3a79d15d01..2a01bb1a3e 100644 --- a/dietpi/server_version-6 +++ b/dietpi/server_version-6 @@ -1,3 +1,3 @@ 6 23 -0 +1 From f50b9482e98ebfbabfbbb696b4d6ef805997a030 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Sun, 5 May 2019 22:16:16 +0200 Subject: [PATCH 35/41] v6.23 - DietPi-Globals | Default RC up --- dietpi/func/dietpi-globals | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 4cd99ba53c..33ce1c95b7 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -62,7 +62,7 @@ #DietPi Versions/Branch G_DIETPI_VERSION_CORE=${G_DIETPI_VERSION_CORE:-6} G_DIETPI_VERSION_SUB=${G_DIETPI_VERSION_SUB:-23} - G_DIETPI_VERSION_RC=${G_DIETPI_VERSION_RC:-0} + G_DIETPI_VERSION_RC=${G_DIETPI_VERSION_RC:-1} G_GITBRANCH=${G_GITBRANCH:-master} G_GITOWNER=${G_GITOWNER:-MichaIng} [[ -f '/DietPi/dietpi/.version' && $( Date: Sun, 5 May 2019 22:46:23 +0200 Subject: [PATCH 36/41] v6.23 + CHANGELOG | Java: Resolved an issue where install fails on Buster systems --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cb673b4676..e0cd6008ff 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -50,6 +50,7 @@ Bug Fixes: - DietPi-Software | Nextcloud Talk: Resolved an issue where coTURN prints two warnings about deprecated settings on Buster systems, due to some changes with latest versions. - DietPi-Software | Kodi: Resolved an issue on RPi where Kodi (v18) fails to start when a custom screen resolution was chosen. Many thanks to @johnnypea for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=17550#p17550 - DietPi-Software | Java: Resolved an issue where install fails on Jessie systems since the used jessie-backports APT repo does not exist any more: https://github.com/MichaIng/DietPi/issues/2752 +- DietPi-Software | Java: Resolved an issue where install fails on Buster systems since OpenJDK 8 packages are not available any more on Buster repo. OpenJDK 11 is installed instead, testing with Java software titles is outstanding. - DietPi-Software | Node.js: Resolved an issue where install failed on ARMv6 since Node 12 does not support it any more. Many thanks to @axwax for reporting this issue: https://github.com/MichaIng/DietPi/issues/2755 As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX/files From 45f79c60c78c8d0fe921da7367f5a2f8272a6086 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Mon, 6 May 2019 02:20:55 +0200 Subject: [PATCH 37/41] v6.23 + DietPi-Globals | Minor coding, cleanup, wording and alignment --- dietpi/func/dietpi-globals | 366 +++++++++++++++++-------------------- 1 file changed, 166 insertions(+), 200 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 33ce1c95b7..9fe8836d74 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -9,17 +9,10 @@ #//////////////////////////////////// # # Info: - # - Provides/Exports shared/global DietPi variables/functions for current bash session and other scripts + # - Provides shared/global DietPi variables and functions for current bash session and DietPi scripts # - CRITICAL, use local index variables in for/while loops, or unset them afterwards, else havoc: https://github.com/MichaIng/DietPi/issues/1454 - # - Sourced/Loaded in interactive bash sessions: /etc/bashrc.d/dietpi-login.sh - # - Sourced/Loaded as start of all DietPi script, except those listed below - # - # Excluded scripts, which do NOT load these globals: - # - dietpi-ramlog - # - dietpi-ramdisk - # - dietpi-obtain_hw_model - # - dietpi.txt and all other .txt, .ini or config files - # + # - Sourced/Loaded in interactive bash sessions: /etc/bashrc.d/dietpi.bash + # - Sourced/Loaded as start of most DietPi script #//////////////////////////////////// #----------------------------------------------------------------------------------- @@ -33,33 +26,33 @@ #----------------------------------------------------------------------------------- #----------------------------------------------------------------------------------- - # Core varianles, functions and environment, used at start of all scripts + # Core variables, functions and environment, used at start of all scripts #----------------------------------------------------------------------------------- - #To be exported by the originating script, after loading globals and before calling G_INIT() - # - Used in G_ERROR_ and G_WHIP_ + # To be exported by the originating script, after loading globals and before calling G_INIT() + # - Used in G_ERROR_HANDLER, G_WHIP_* and G_DIETPI-NOTIFY functions unset G_PROGRAM_NAME - #Debug enable - G_DEBUG=${G_DEBUG:-0} + # Debug mode + # - Do no pre-generate to reduce bash session variables: Needs to be checked via: [[ $G_DEBUG == 1 ]] + #G_DEBUG=${G_DEBUG:-0} - #Flag, if we are in interactive shell, by checking STDIN availability + # Flag, if we are in interactive shell, by checking STDIN availability # OK | systemd = non-STDIN # OK | Cron = non-STDIN # NB | ~/.bashrc = STDIN # - Affects whether G_ERROR_ and G_WHIP_ prompts are displayed or not # NB: You can export G_USER_INPUTS=0 to force non-interactive/automated scipt calls. Run 'unset G_USER_INPUTS' afterwards to return to auto detection. - if [[ -z $G_USER_INPUTS ]]; then + if [[ $G_USER_INPUTS != [01] ]]; then - G_USER_INPUTS=0 - [[ -t 0 ]] && G_USER_INPUTS=1 + [[ -t 0 ]] && G_USER_INPUTS=1 || G_USER_INPUTS=0 fi - #DietPi First-Run Stage | -2 = PREP_SYSTEM/Unknown | -1 = first boot | 0 = 1st run dietpi-update | 1 = 1st run dietpi-software | 2 = completed | 10 = Pre-installed image, converts to 2 during 1st boot + # DietPi First-Run Stage | -2 = PREP_SYSTEM/Unknown | -1 = 1st boot | 0 = 1st run dietpi-update | 1 = 1st run dietpi-software | 2 = completed | 10 = Pre-installed image, converts to 2 during 1st boot G_DIETPI_INSTALL_STAGE=-2 [[ -f '/DietPi/dietpi/.install_stage' ]] && G_DIETPI_INSTALL_STAGE=$( 0 )); then - # >=10 should never occur, however, if it is, lets make it line up regardless - if (( $HIERARCHY < 10 )); then - - local status_subfunction="$HIERARCHY " - - else - - local status_subfunction=$HIERARCHY + local status_subfunction="$HIERARCHY " + # > 9 should never occur, however, if it is, lets make it line up regardless + (( $HIERARCHY > 9 )) && status_subfunction=$HIERARCHY - fi output_string+="$bracket_l\e[33m SUB$status_subfunction$bracket_r $2 > " ainput_string+=('\n') - Print_Output_String 2 else - output_string+="\n \e[38;5;154m$2\e[0m" - output_string+='\n\e[90m─────────────────────────────────────────────────────' - output_string+='\n Mode: \e[0m' + output_string+=" + \e[38;5;154m$2\e[0m +\e[90m───────────────────────────────────────────────────── + Mode: \e[0m" ainput_string+=('\n\n') - Print_Output_String 2 fi + Print_Output_String 2 + fi #----------------------------------------------------------------------------------- - # Unset internal functions, otherwise they are accessible from terminal: - unset Clean_Process_Animation - unset Status_Ok - unset Status_Failed - unset Print_Output_String + # Unset internal functions, otherwise they are accessible from terminal + unset Clean_Process_Animation Status_Ok Status_Failed Print_Output_String #----------------------------------------------------------------------------------- } @@ -516,7 +502,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then #----------------------------------------------------------------------------------- # DietPi scripts, moved from /etc/bash.bashrc # - sudo command that ensures DietPi-Globals with G_* commands are loaded - G_SUDO(){ sudo -s . /DietPi/dietpi/func/dietpi-globals && $@; } + G_SUDO(){ sudo -s . /DietPi/dietpi/func/dietpi-globals && "$@"; } # - sudo alias that allows running other aliases with "sudo" alias sudo='sudo ' # https://github.com/MichaIng/DietPi/issues/424 @@ -540,61 +526,56 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then alias dietpi-survey='/DietPi/dietpi/dietpi-survey' alias dietpi-explorer='/DietPi/dietpi/dietpi-explorer' alias dietpi-banner='/DietPi/dietpi/func/dietpi-banner 2' + alias dietpi-justboom='/DietPi/dietpi/misc/dietpi-justboom' alias cpu='/DietPi/dietpi/dietpi-cpuinfo' - # - Misc - # Sudo command, that ensures DietPi-Globals with G_* commands are loaded - G_SUDO(){ sudo -s . /DietPi/dietpi/func/dietpi-globals && $@; } - alias sudo='sudo ' # https://github.com/MichaIng/DietPi/issues/424 - # - 1337 moments ;) alias 1337='echo Indeed, you are =\)' # - Helpers - #alias dd='dd status=progress ' #needs to be at end... + #alias dd='dd status=progress ' # needs to be at end... # - Optional DietPi software aliases/functions - [[ -d /var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn ]] && alias dietpi-nordvpn='/DietPi/dietpi/misc/dietpi-nordvpn' - [[ -f /opt/retropie/supplementary/emulationstation/emulationstation ]] && alias emulationstation='/opt/retropie/supplementary/emulationstation/emulationstation' - [[ -f /usr/local/games/opentyrian/run ]] && alias opentyrian='/usr/local/games/opentyrian/run' - [[ -f /DietPi/dietpi/misc/dietpi-justboom ]] && alias dietpi-justboom='/DietPi/dietpi/misc/dietpi-justboom' + [[ -d '/var/lib/dietpi/dietpi-software/installed/dietpi-nordvpn' ]] && alias dietpi-nordvpn='/DietPi/dietpi/misc/dietpi-nordvpn' + [[ -f '/opt/retropie/supplementary/emulationstation/emulationstation' ]] && alias emulationstation='/opt/retropie/supplementary/emulationstation/emulationstation' + [[ -f '/usr/local/games/opentyrian/run' ]] && alias opentyrian='/usr/local/games/opentyrian/run' [[ -f $G_FP_DIETPI_USERDATA/dxx-rebirth/run.sh ]] && alias dxx-rebirth="$G_FP_DIETPI_USERDATA/dxx-rebirth/run.sh" - [[ -f /usr/share/applications/kodi.desktop ]] && alias startkodi='/DietPi/dietpi/misc/start_kodi' - [[ -f /etc/systemd/system/dietpi-cloudshell.service ]] && alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell' + [[ -f '/usr/share/applications/kodi.desktop' ]] && alias startkodi='/DietPi/dietpi/misc/start_kodi' + [[ -f '/etc/systemd/system/dietpi-cloudshell.service' ]] && alias dietpi-cloudshell='/DietPi/dietpi/dietpi-cloudshell' (( $G_DISTRO > 3 )) && [[ -d $G_FP_DIETPI_USERDATA/sonarr || -d $G_FP_DIETPI_USERDATA/radarr || -d $G_FP_DIETPI_USERDATA/lidarr ]] && alias dietpi-arr_to_RAM='/DietPi/dietpi/misc/dietpi-arr_to_RAM' # - occ/ncc need to be global function, as aliases are not accessible from non-interactive scripts: - [[ -f /var/www/owncloud/occ ]] && occ(){ sudo -u www-data php /var/www/owncloud/occ "$@"; } - [[ -f /var/www/nextcloud/occ ]] && ncc(){ sudo -u www-data php /var/www/nextcloud/occ "$@"; } + [[ -f '/var/www/owncloud/occ' ]] && occ(){ sudo -u www-data php /var/www/owncloud/occ "$@"; } + [[ -f '/var/www/nextcloud/occ' ]] && ncc(){ sudo -u www-data php /var/www/nextcloud/occ "$@"; } #----------------------------------------------------------------------------------- # Whiptail (Whippy-da-whip-whip-whip tail!) # - Automatically detects/processes for G_USER_INPUTS #----------------------------------------------------------------------------------- - #G_WHIP_DEFAULT_ITEM | to be set by scripts to set the default selected item. + # G_WHIP_DEFAULT_ITEM | to be set by scripts to set the default selected item. G_WHIP_DEFAULT_ITEM='' - #Scaling options: + # Scaling options: # Optional, limits X to value, if below available screen X limits G_WHIP_SIZE_X_MAX=0 # Whip size overrides | optional, will override auto detection, must be exported and unset after use. #G_WHIP_SIZE_X_OVERRIDE #G_WHIP_SIZE_Y_OVERRIDE - #G_WHIP_BUTTON_X_TEXT | Change as needed, else, defaults to Ok/Cancel + # G_WHIP_BUTTON_X_TEXT | Change as needed, else, defaults to Ok/Cancel G_WHIP_BUTTON_OK_TEXT='' G_WHIP_BUTTON_CANCEL_TEXT='' - #G_WHIP_MENU_ARRAY | to be set by scripts to set available menu/checkbox options + # G_WHIP_MENU_ARRAY | to be set by scripts to set available menu/checkbox options G_WHIP_MENU_ARRAY=('NULL' 'NULL') - #G_WHIP_CHECKLIST_ARRAY | to be set by scripts to set available checklist options + # G_WHIP_CHECKLIST_ARRAY | to be set by scripts to set available checklist options G_WHIP_CHECKLIST_ARRAY=('NULL' 'NULL' 'off') - #G_WHIP_RETURNED_VALUE | Returned value from inputbox/menu/checklist based whiptail items + # G_WHIP_RETURNED_VALUE | Returned value from inputbox/menu/checklist based whiptail items G_WHIP_RETURNED_VALUE='' - #G_WHIP_DESTROY | Clear vars after run of whiptail + # G_WHIP_DESTROY | Clear vars after run of whiptail G_WHIP_DESTROY(){ # - Delete @@ -613,21 +594,21 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_INIT + # G_WHIP_INIT # - update target whiptail size, based on current screen dimensions. # - Used by G_WHIP_ automatically, doesn't need to be a global function, however, bash does not support local functions. # - $1 = input mode 0=no-Z 1=yes-Z (G_WHIP_MENU_ARRAY) 2=yes-Z (G_WHIP_CHECKLIST_ARRAY) 3=Force full size of Y G_WHIP_INIT(){ - #Set default button text, if not defined + # Set default button text, if not defined G_WHIP_BUTTON_OK_TEXT=${G_WHIP_BUTTON_OK_TEXT:-Ok} G_WHIP_BUTTON_CANCEL_TEXT=${G_WHIP_BUTTON_CANCEL_TEXT:-Cancel} - #Update backtitle + # Update backtitle WHIP_BACKTITLE="$G_PROGRAM_NAME | $G_HW_MODEL_DESCRIPTION" [[ -r '/DietPi/dietpi/.network' ]] && WHIP_BACKTITLE+=" | IP: $(sed -n 4p /DietPi/dietpi/.network)" - #Automaticaly set size of whiptail box and contents + # Automaticaly set size of whiptail box and contents local input_mode=$1 # - Whip margins @@ -638,7 +619,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then local lines_required_whip_y=0 local lines_required_whip_z=0 - #Set current screen dimensions ( - outside margin) + # Set current screen dimensions ( - outside margin) # - G_WHIP_SIZE_X_OVERRIDE allows to estimate and export terminal sizes outside of script/function # This is required in case both, STOUT and STERR are redirected ( e.g. 2>&1 | tee file.log ) # Until ncurses-bin v6.0 (current on Stretch repo), tput can not estimate terminal dimensions then. @@ -659,12 +640,12 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then WHIP_SIZE_Z=2 - #Force full size of Y? + # Force full size of Y? if (( $input_mode == 3 )); then lines_required_whip_y=$WHIP_SIZE_Y - #Calulate lines required for WHIP_MESSAGE, as displayed inside the whiptail box + # Calulate lines required for WHIP_MESSAGE, as displayed inside the whiptail box # - This can then be used to increase/decrease size of WHIP_SIZE_Z automatically. else @@ -682,7 +663,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Calculate Z + # Calculate Z # - G_WHIP_MENU_ARRAY if (( $input_mode == 1 )); then @@ -692,7 +673,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # - Requires additional line on Y ((lines_required_whip_y++)) - #Auto length for ─ + # Auto length for ─ # Get max length of all the lines in odd number array 1st | '' 'this one' local i=0 local character_count_max=0 @@ -704,17 +685,17 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then character_count_max=${#G_WHIP_MENU_ARRAY[$i]} # - cap to X | need to calculate all length of array 1st... - # if (( $character_count_max >= $WHIP_SIZE_X )); then + #if (( $character_count_max >= $WHIP_SIZE_X )); then - # character_count_max=$WHIP_SIZE_X - # break + #character_count_max=$WHIP_SIZE_X + #break - # fi + #fi fi done - ((character_count_max--)) #-1 for additional ● + ((character_count_max--)) # -1 for additional ● # Now add the additional required lines for (( i=0; i<${#G_WHIP_MENU_ARRAY[@]}; i++ )) @@ -741,7 +722,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # - ( ${#array} + 2 ) to round up single+double array entries lines_required_whip_z=$(( ( ${#G_WHIP_CHECKLIST_ARRAY[@]} + 2 ) / 3 )) - #Auto length for ─ + # Auto length for ─ # Get max length of all the lines in array index 1 1st | '' 'this one' '' local i=0 local character_count_max=0 @@ -753,17 +734,17 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then character_count_max=${#G_WHIP_CHECKLIST_ARRAY[$i]} # - cap to X | need to calculate all length of array 1st... - # if (( $character_count_max >= $WHIP_SIZE_X )); then + #if (( $character_count_max >= $WHIP_SIZE_X )); then - # character_count_max=$WHIP_SIZE_X - # break + #character_count_max=$WHIP_SIZE_X + #break - # fi + #fi fi done - ((character_count_max--)) #-1 for additional ● + ((character_count_max--)) # -1 for additional ● # Now add the additional required lines for (( i=0; i<${#G_WHIP_CHECKLIST_ARRAY[@]}; i++ )) @@ -774,7 +755,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then while (( ${#G_WHIP_CHECKLIST_ARRAY[$i]} < $character_count_max )) do - # echo -e "${#G_WHIP_CHECKLIST_ARRAY[$i]} > $WHIP_LENGTH_AUTOLINEFILL | index=$i" + #echo -e "${#G_WHIP_CHECKLIST_ARRAY[$i]} > $WHIP_LENGTH_AUTOLINEFILL | index=$i" G_WHIP_CHECKLIST_ARRAY[$i]+='─' done @@ -787,7 +768,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Calculate end result + # Calculate end result # - Message will not fit! if (( $lines_required_whip_y > $WHIP_SIZE_Y )); then @@ -829,7 +810,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_MSG "message" + # G_WHIP_MSG "message" # - Display a whip message G_WHIP_MSG(){ @@ -849,7 +830,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_SCROLLBOX "message" + # G_WHIP_SCROLLBOX "message" # - Display a whip message inside a scrollbox G_WHIP_SCROLLBOX(){ @@ -869,7 +850,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_YESNO "message" + # G_WHIP_YESNO "message" # - Prompt user for a Yes/No, return result # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_YESNO(){ @@ -893,7 +874,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_INPUTBOX "message" + # G_WHIP_INPUTBOX "message" # - Prompt user to input text and save it to G_WHIP_RETURNED_VALUE # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_INPUTBOX(){ @@ -922,7 +903,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_PASSWORD "message" + # G_WHIP_PASSWORD "message" # - Prompt user to input password and safe it in variable "result". Do not export for security reasons! G_WHIP_PASSWORD(){ @@ -961,7 +942,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_MENU "message" + # G_WHIP_MENU "message" # - Prompt user to select option from G_WHIP_MENU_ARRAY and sets G_WHIP_RETURNED_VALUE # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_MENU(){ @@ -984,7 +965,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_CHECKLIST "message" + # G_WHIP_CHECKLIST "message" # - Prompt user to select multiple option from G_WHIP_CHECKLIST_ARRAY and sets G_WHIP_RETURNED_VALUE # - returns result 0=Ok, everything else considered a user canceled result G_WHIP_CHECKLIST(){ @@ -1008,7 +989,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #G_WHIP_VIEWFILE /var/log/file.log + # G_WHIP_VIEWFILE /var/log/file.log # - Prompt user to view logfile, then display it as needed. G_WHIP_VIEWFILE(){ @@ -1016,7 +997,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if (( $G_USER_INPUTS )); then - local log=${log:-0} #Optional yes/no prompt for viewing logs + local log=${log:-0} # Optional yes/no prompt for viewing logs local fp_file=$1 if [[ -f $fp_file ]]; then @@ -1054,25 +1035,25 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then # DietPi Error Handler # https://github.com/MichaIng/DietPi/issues/1311#issuecomment-353716344 #----------------------------------------------------------------------------------- - G_ERROR_HANDLER_EXITCODE=0 #input value to use with G_ERROR_HANDLER - G_ERROR_HANDLER_EXITCODE_RETURN=0 #Same as above, but not destroyed during G_ERROR_HANDLER_RESET, allowing us to return it in funcs - G_ERROR_HANDLER_COMMAND='' #eg: G_AGI: moooooooo + G_ERROR_HANDLER_EXITCODE=0 # input value to use with G_ERROR_HANDLER + G_ERROR_HANDLER_EXITCODE_RETURN=0 # Same as above, but not destroyed during G_ERROR_HANDLER_RESET, allowing us to return it in funcs + G_ERROR_HANDLER_COMMAND='' # eg: G_AGI: moooooooo # For export: On error, following entries will be used - G_ERROR_HANDLER_NO_FAIL=0 #Always report a success, regardless of the exit code | G_USER_INPUTS=0 is not required for this - G_ERROR_HANDLER_INFO_ONLY=0 #Only print info and retry options, no exit or bug report, sets G_ERROR_HANDLER_ONERROR_EXIT=0 automatically - G_ERROR_HANDLER_ONERROR_EXIT=1 #Do we exit the program when the error occurs? 0=no 1=yes - G_ERROR_HANDLER_ONERROR_FPLOGFILE='' #FP to logfile, if available - G_ERROR_HANDLER_RETRY=0 #Used in func with while loop to re-run func as needed + G_ERROR_HANDLER_NO_FAIL=0 # Always report a success, regardless of the exit code | G_USER_INPUTS=0 is not required for this + G_ERROR_HANDLER_INFO_ONLY=0 # Only print info and retry options, no exit or bug report, sets G_ERROR_HANDLER_ONERROR_EXIT=0 automatically + G_ERROR_HANDLER_ONERROR_EXIT=1 # Do we exit the program when the error occurs? 0=no 1=yes + G_ERROR_HANDLER_ONERROR_FPLOGFILE='' # FP to logfile, if available + G_ERROR_HANDLER_RETRY=0 # Used in func with while loop to re-run func as needed - #Runs automatically after G_ERROR_HANDLER to reset vars to default + # Runs automatically after G_ERROR_HANDLER to reset vars to default G_ERROR_HANDLER_RESET(){ G_ERROR_HANDLER_EXITCODE_RETURN=$G_ERROR_HANDLER_EXITCODE - #Delete if used: + # Delete if used: [[ $G_ERROR_HANDLER_ONERROR_FPLOGFILE && -f $G_ERROR_HANDLER_ONERROR_FPLOGFILE ]] && rm $G_ERROR_HANDLER_ONERROR_FPLOGFILE - #unset originating program + # unset originating program unset G_ERROR_HANDLER_EXITCODE unset G_ERROR_HANDLER_COMMAND @@ -1093,20 +1074,20 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then } - #Handles exit code errors, as defined by G_ERROR_HANDLER_xxxx settings + # Handles exit code errors, as defined by G_ERROR_HANDLER_xxxx settings # Usage: G_RUN_CMD dothis G_ERROR_HANDLER(){ [[ $l_message ]] || local l_message=$G_ERROR_HANDLER_COMMAND - #Ok + # Ok (( $G_ERROR_HANDLER_NO_FAIL )) && G_ERROR_HANDLER_EXITCODE=0 if (( ! $G_ERROR_HANDLER_EXITCODE )); then G_DIETPI-NOTIFY 0 "$l_message" G_ERROR_HANDLER_RESET - #Error + # Error else local send_bugreport=0 @@ -1196,7 +1177,6 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then if ! ps aux | grep -qi '[d]ietpi-config' && (( ! $G_ERROR_HANDLER_INFO_ONLY )); then - aretry_menu_options+=('DietPi-Config' ': Edit network, APT/NTP mirror settings etc'); ((retry_menu_options_count++)) fi @@ -1208,11 +1188,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi local no_button_text='Ignore' - if (( $G_ERROR_HANDLER_ONERROR_EXIT )); then - - no_button_text='Exit' - - fi + (( $G_ERROR_HANDLER_ONERROR_EXIT )) && no_button_text='Exit' local choice=$(whiptail --title 'DietPi Error Handler:' --menu "$whip_msg" --cancel-button "$no_button_text" --scrolltext 24 90 $retry_menu_options_count "${aretry_menu_options[@]}" 3>&1 1>&2 2>&3) if (( $? == 0 )); then @@ -1250,7 +1226,7 @@ $(ps f -eo pid,user,tty,cmd | grep -i '[d]ietpi')"; then fi - #Github printout + # GitHub printout if (( ! $G_ERROR_HANDLER_INFO_ONLY )); then echo -e " @@ -1342,7 +1318,7 @@ $print_logfile_info } - #Run a command and send the output through the error handler. Allows for command used info, and log output/view when an error occurs + # Run a command and send the output through the error handler. Allows for command used info, and log output/view when an error occurs # NB: This command does not support inputs with redirects. For file creation, use G_FILE_EXISTS afterwards to check it exists: https://github.com/MichaIng/DietPi/issues/1311#issuecomment-354541417 # NB: automatically error handled (G_ERROR_HANDLER) # $@ = input command @@ -1366,7 +1342,7 @@ $print_logfile_info G_ERROR_HANDLER - [[ -f /tmp/G_ERROR_HANDLER_COMMAND ]] && rm /tmp/G_ERROR_HANDLER_COMMAND + [[ -f '/tmp/G_ERROR_HANDLER_COMMAND' ]] && rm /tmp/G_ERROR_HANDLER_COMMAND done @@ -1374,7 +1350,7 @@ $print_logfile_info } - #URL Connection test + # URL Connection test # - $@ = URL # Optional variables: # - $optional_cmd_inputs (eg: --no-check-certificate) @@ -1444,8 +1420,8 @@ $print_logfile_info } - #$1 = directory to test permissions support - #Returns 0=ok >=1=failed + # $1 = directory to test permissions support + # Returns 0=ok >=1=failed G_CHECK_FS_PERMISSION_SUPPORT(){ local input=$1 @@ -1454,8 +1430,7 @@ $print_logfile_info while : do - mkdir -p $input - if (( $? != 0 )); then + if ! mkdir -p $input; then G_WHIP_MSG "Error creating directory $input, unable to check filesystem permissions" break @@ -1463,8 +1438,7 @@ $print_logfile_info fi local fp_target="$input/.test" - > $fp_target - if (( $? != 0 )); then + if ! > $fp_target; then G_WHIP_MSG "Error creating test file $fp_target, unable to check filesystem permissions" break @@ -1482,11 +1456,7 @@ $print_logfile_info else chmod 644 $fp_target - if [[ $(stat -c "%a" $fp_target) != '644' ]]; then - - permissions_failed=1 - - fi + [[ $(stat -c "%a" $fp_target) != '644' ]] && permissions_failed=1 fi @@ -1502,15 +1472,14 @@ $print_logfile_info break - done - rm $fp_target &> /dev/null + [[ -f $fp_target ]] && rm $fp_target return $result } - #Checks if a file/folder exists + # Checks if a file/folder exists G_FILE_EXISTS(){ G_ERROR_HANDLER_COMMAND=$@ @@ -1542,7 +1511,7 @@ $print_logfile_info G_ERROR_HANDLER - rm /tmp/G_ERROR_HANDLER_COMMAND &> /dev/null + [[ -f '/tmp/G_ERROR_HANDLER_COMMAND' ]] && rm /tmp/G_ERROR_HANDLER_COMMAND } @@ -1551,7 +1520,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- G_FP_LOG_APT='/var/tmp/dietpi/logs/dietpi-software_apt.log' - #apt-get install + # apt-get install # NB: automatically error handled (G_ERROR_HANDLER) G_AGI(){ @@ -1568,7 +1537,7 @@ $print_logfile_info G_ERROR_HANDLER_COMMAND="G_AGI $string" G_ERROR_HANDLER_ONERROR_FPLOGFILE=$G_FP_LOG_APT - #-qq can add a slight period of appearing nothing is happening, lets inform user + # -qq can add a slight period of appearing nothing is happening, lets inform user G_DIETPI-NOTIFY 2 "\e[0mAPT installation for: \e[33m$string\e[0m, please wait..." echo -ne '\e[90m' @@ -1583,7 +1552,7 @@ $print_logfile_info } - #apt-get purge + # apt-get purge # NB: automatically error handled (G_ERROR_HANDLER) G_AGP(){ @@ -1648,7 +1617,7 @@ $print_logfile_info } - #apt-get autoremove + # apt-get autoremove # NB: automatically error handled (G_ERROR_HANDLER) G_AGA(){ @@ -1675,7 +1644,7 @@ $print_logfile_info } - #apt-get install -f + # apt-get -f install # NB: automatically error handled (G_ERROR_HANDLER) G_AGF(){ @@ -1702,7 +1671,7 @@ $print_logfile_info } - #apt-get clean + update + # apt-get clean + update # NB: automatically error handled (G_ERROR_HANDLER) G_AGUP(){ @@ -1730,7 +1699,7 @@ $print_logfile_info } - #apt-get upgrade + # apt-get upgrade # NB: automatically error handled (G_ERROR_HANDLER) G_AGUG(){ @@ -1757,7 +1726,7 @@ $print_logfile_info } - #apt-get dist-upgrade + # apt-get dist-upgrade # NB: automatically error handled (G_ERROR_HANDLER) G_AGDUG(){ @@ -1787,7 +1756,7 @@ $print_logfile_info } - #Checks for required APT packages, installs if needed. + # Checks for required APT packages, installs if needed. # $@ = list of required packages # NB: automatically error handled (G_ERROR_HANDLER) G_AG_CHECK_INSTALL_PREREQ(){ @@ -1833,7 +1802,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- # MISC: Commands #----------------------------------------------------------------------------------- - #Treesize + # Treesize # - $1 = Optional input directory (eg: G_TREESIZE /etc/apt) G_TREESIZE(){ @@ -1856,7 +1825,7 @@ $print_logfile_info ' } - #Returns current CPU temp 'C + # Returns current CPU temp 'C # print_full_info=1# optional input to print full colour text output and temp warnings. G_OBTAIN_CPU_TEMP(){ @@ -1938,7 +1907,7 @@ $print_logfile_info } - #Returns current CPU usage % + # Returns current CPU usage % G_OBTAIN_CPU_USAGE(){ # - PS (inaccurate, but fast??) @@ -1958,7 +1927,7 @@ $print_logfile_info } - #Check available free space on path, against input value (MiB) + # Check available free space on path, against input value (MiB) # - Returns 0=Ok, 1=insufficient space available # If $2 is not used, returns available space in MiB | info_autoscale=1 # Scales MiB to GiB if required and prints unit # - $1 = path @@ -1998,7 +1967,7 @@ $print_logfile_info } - #G_CHECK_VALIDINT | Simple test to verify if a variable is a valid integer. + # G_CHECK_VALIDINT | Simple test to verify if a variable is a valid integer. # $1=input # $2=Optional Min value range # $3=Optional Max value range @@ -2061,7 +2030,7 @@ $print_logfile_info } - #Verifies the integrity of the DietPi userdata folder/symlink, based on where it should be psyhically. Basically, checks if user removed the USB drive with userdata on it. + # Verifies the integrity of the DietPi userdata folder/symlink, based on where it should be psyhically. Basically, checks if user removed the USB drive with userdata on it. # NB: As this is considered a critical (if failed), current scripts will be exited automatically # 1=fail # 0=ok @@ -2096,7 +2065,7 @@ $print_logfile_info } - #Prompt user to create a backup before system changes. Exit existing scripts if failed. + # Prompt user to create a backup before system changes. Exit existing scripts if failed. G_PROMPT_BACKUP_DISABLED=${G_PROMPT_BACKUP_DISABLED:-0} G_PROMPT_BACKUP(){ @@ -2123,7 +2092,7 @@ $print_logfile_info } - #If file/folder exists, backup to *.bak_DDMMYYY + # If file/folder exists, backup to *.bak_DDMMYYY G_BACKUP_FP(){ local ainput_string=("$@") @@ -2174,7 +2143,7 @@ $print_logfile_info #----------------------------------------------------------------------------------- # Multithreading handler #----------------------------------------------------------------------------------- - #Not yet compatible with dietpi global commands. single bash commands only with no error handling. + # Not yet compatible with dietpi global commands. single bash commands only with no error handling. G_THREADING_ENABLED=${G_THREADING_ENABLED:-1} G_THREAD_COUNT=${G_THREAD_COUNT:--1} [[ $G_THREAD_COMMAND ]] || G_THREAD_COMMAND=() @@ -2205,64 +2174,61 @@ $print_logfile_info G_THREAD_WAIT(){ - # local wait_for_specific_thread_pid=0 - # if [[ -n $1 ]]; then + #local wait_for_specific_thread_pid=0 + #if [[ -n $1 ]]; then - # wait_for_specific_thread_pid=$1 + #wait_for_specific_thread_pid=$1 - # fi + #fi while : do local thread_active=0 - for (( i=0; i<${#G_THREAD_COMMAND[@]}; i++ )) + for i in ${!G_THREAD_COMMAND[@]} do - if [[ -f /tmp/.G_THREAD_EXITCODE_$i ]] && (( $( /dev/null + rm -f /tmp/.G_THREAD* - sync #Failsafe: Sync changes to disk + sync # Failsafe: Sync changes to disk G_DIETPI-NOTIFY 0 'G_THREAD: All threads finished' @@ -2305,7 +2271,7 @@ $print_logfile_info # Automatically opt in to DietPi-Survey and run + send benchmark + data G_DEV_BENCH(){ - sed -i '1s/.*/1/' /DietPi/dietpi/.dietpi-survey + echo 1 > /DietPi/dietpi/.dietpi-survey G_USER_INPUTS=0 /DietPi/dietpi/func/dietpi-benchmark 2 } From 3de84026c27a55f998659ffbaf4cf285537b9350 Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Mon, 6 May 2019 13:30:26 +0100 Subject: [PATCH 38/41] C1: Revert Jessie removal until v6.24 released. Add distro check also. --- dietpi/dietpi-config | 127 +++++++++++++++++++++++++++++++- dietpi/dietpi-drive_manager | 3 +- dietpi/dietpi-software | 14 +++- dietpi/func/dietpi-set_hardware | 22 +++++- 4 files changed, 160 insertions(+), 6 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 8a82463a8b..51438fcd0f 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -392,7 +392,8 @@ elif (( $G_WHIP_RETURNED_VALUE == 2 )); then - if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 12 )); then + if (( $G_HW_MODEL < 10 || $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 G_WHIP_MSG 'GPU/RAM Memory splits are pre-configured and applied during DietPi-Software setup.\n\nThe split value is optimized based on your software installs, however, feel free to tweak them.' TARGETMENUID=6 @@ -1084,6 +1085,70 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + # Get Current Values + local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini) + + G_WHIP_MENU_ARRAY=( + + '1080p' ': 1920 x 1080' + '720p' ': 1280 x 720' + '480p' ': 720 x 480' + 'VU7+' ': 1024 x 600' + 'PC1' ': 1024 x 768' + + ) + + G_WHIP_DEFAULT_ITEM=$current_resolution + if G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $current_resolution"; then + + REBOOT_REQUIRED=1 + + TARGETMENUID=2 # Return to this menu + + # - Always reset to HDMI + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini + + case "$G_WHIP_RETURNED_VALUE" in + + '1080p') + + sed -i '/setenv m /c\setenv m "1080p"' /DietPi/boot.ini + + ;; + + '720p') + + sed -i '/setenv m /c\setenv m "720p"' /DietPi/boot.ini + + ;; + + '480p') + + sed -i '/setenv m /c\setenv m "480p"' /DietPi/boot.ini + + ;; + + 'PC1') + + sed -i '/setenv m /c\setenv m "1024x768"' /DietPi/boot.ini + + ;; + + 'VU7+') + + sed -i '/setenv m /c\setenv m "1024x600"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "dvi"' /DietPi/boot.ini + + ;; + + esac + + fi + # Pine A64 elif (( $G_HW_MODEL == 40 )); then @@ -1916,6 +1981,10 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 gpu_mem_current=$(grep -m1 '^[[:blank:]]*gpu_mem_1024=' /DietPi/config.txt | sed 's/^[^=]*=//') ram_mem_current=$((ram_mem_total-gpu_mem_current)) + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then #REMOVE v6.24 + + gpu_mem_current=$((1024-ram_mem_current)) + elif (( $G_HW_MODEL == 12 )); then gpu_mem_current=$((2048-ram_mem_current)) @@ -1959,6 +2028,59 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + # Odroid HDMI/headless extra data + local display_output_enabled=$(grep -ci -m1 '^setenv hdmioutput "1"' /DietPi/boot.ini) + local display_vpu_enabled=$(grep -ci -m1 '^setenv vpu "1"' /DietPi/boot.ini) + local display_output_text='[On]' + local display_vpu_text='[On]' + + (( $display_output_enabled )) || display_output_text='[Off]' + (( $display_vpu_enabled )) || display_vpu_text='[Off]' + + G_WHIP_MENU_ARRAY=( + + 'Headless' 'HDMI: Disabled | VPU: Disabled' + 'Server' 'HDMI: Enabled | VPU: Disabled' + 'Desktop' 'HDMI: Enabled | VPU: Enabled' + + ) + + G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCurrent : HDMI: $display_output_text | VPU: $display_vpu_text \n Memory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM \n NB: GPU/RAM figures require a reboot after a change is made." + if (( $? == 0 )); then + + REBOOT_REQUIRED=1 + + TARGETMENUID=6 # Return to this menu + + case "$G_WHIP_RETURNED_VALUE" in + + 'Headless') + + /DietPi/dietpi/func/dietpi-set_hardware headless 1 + + ;; + + 'Server') + + /DietPi/dietpi/func/dietpi-set_hardware headless 0 + G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini + + ;; + + 'Desktop') + + /DietPi/dietpi/func/dietpi-set_hardware headless 0 + + ;; + + esac + + fi + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -3972,7 +4094,8 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('rpi-dac' ': Soekris DAM1021 (pcm1794a)') # - C2 - elif (( $G_HW_MODEL == 12 )); then + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index d5c175864a..6c8898c045 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -815,7 +815,8 @@ aDRIVE_ISPARTITIONTABLE ${aDRIVE_ISPARTITIONTABLE[$i]} sed -i "s#$rootfstype_current#rootfstype=${aDRIVE_FSTYPE[$INDEX_DRIVE_BEING_EDITED]}#g" /boot/cmdline.txt #C2/XU4 | /DietPi/boot.ini - elif (( $G_HW_MODEL == 11 || $G_HW_MODEL == 12 )); then + elif (( $G_HW_MODEL == 11 || $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 # find current root= to replace local rootfs_current=$(mawk '{for(i=1;i<=NF;i++) {print $i} }' /DietPi/boot.ini | grep -m1 'root=' | sed 's/\"//') diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 007943edd9..cb7101449f 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -495,7 +495,7 @@ DietPi-Software will decrypt and use it for software installs. You can change it aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,52]=1 # - C1 - aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,10]=0 + (( $G_DISTRO > 3 )) & aSOFTWARE_AVAIL_G_HW_MODEL[$software_id,10]=0 #------------------ software_id=32 @@ -4799,6 +4799,11 @@ _EOF_ kernel_packages='raspberrypi-bootloader raspberrypi-kernel libraspberrypi-bin libraspberrypi0 raspberrypi-kernel-headers' + #Odroid C1 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then #REMOVE v6.24 + + kernel_packages='linux-image-armhf-odroid-c1 linux-headers-armhf-odroid-c1' + # - Odroid XU4 elif (( $G_HW_MODEL == 11 )); then @@ -6264,6 +6269,13 @@ Pin-Priority: -1' > /etc/apt/preferences.d/dietpi-docker_fix G_AGI firmware-samsung xf86-video-armsoc-odroid malit628-odroid #dps_index=$software_id Download_Install 'xorg_xu4.conf' /etc/X11/xorg.conf + #Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + DEPS_LIST='aml-libs-odroid xf86-video-mali-odroid libump-odroid mali450-odroid' + dps_index=$software_id Download_Install 'xorg_c1.conf' /etc/X11/xorg.conf + #Pine64 elif (( $G_HW_MODEL == 40 )); then diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 0b5865bd0b..8e10682208 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -253,6 +253,14 @@ _EOF_ # - Disable composite hotplug, which then allows to completely disable the video pipeline + framebuffer G_CONFIG_INJECT 'hdmi_ignore_composite=' 'hdmi_ignore_composite=1' /DietPi/config.txt + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "0"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -273,6 +281,14 @@ _EOF_ G_CONFIG_INJECT 'hdmi_ignore_composite=' '#hdmi_ignore_composite=0' /DietPi/config.txt G_CONFIG_INJECT 'hdmi_blanking=' '#hdmi_blanking=0' /DietPi/config.txt + # Odroid C1 + #REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + G_CONFIG_INJECT 'setenv hdmioutput ' 'setenv hdmioutput "1"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "1"' /DietPi/boot.ini + G_CONFIG_INJECT 'setenv m_bpp ' 'setenv m_bpp "32"' /DietPi/boot.ini + # Odroid C2 elif (( $G_HW_MODEL == 12 )); then @@ -347,7 +363,8 @@ _EOF_ G_CONFIG_INJECT 'gpioplug-ir-recv' 'gpioplug-ir-recv' /etc/modules # C2 - elif (( $G_HW_MODEL == 12 )); then + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 # - Module G_CONFIG_INJECT 'meson_ir' 'meson_ir' /etc/modules @@ -1492,7 +1509,8 @@ Do you want to continue and DISABLE Bluetooth now?'; then grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt # - Odroid C2 - elif (( $G_HW_MODEL == 12 )); then + elif (( $G_HW_MODEL == 12 || + ( $G_HW_MODEL == 10 && $G_DISTRO == 3 ) )); then #REMOVE v6.24 local old='' [[ -f /DietPi/boot.ini ]] && old=$(grep -m1 '^setenv condev "' /DietPi/boot.ini) || return From ba10c1663e1efd461176954b82bc8c516eda062a Mon Sep 17 00:00:00 2001 From: Daniel Knight Date: Mon, 6 May 2019 13:59:24 +0100 Subject: [PATCH 39/41] https://github.com/MichaIng/DietPi/pull/2771#issuecomment-489606736 --- PREP_SYSTEM_FOR_DIETPI.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index dbd1be3c08..cbc8cac4c5 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -158,6 +158,8 @@ ) + grep -qi 'jessie' /etc/os-release && aWHIP_BRANCH+=( 'jessie-support' 'EOS') #REMOVE v6.24 + if GITBRANCH=$(whiptail --title "$G_PROGRAM_NAME" --menu 'Please select the Git branch the installer should use:' --default-item 'master' --ok-button 'Ok' --cancel-button 'Exit' --backtitle "$G_PROGRAM_NAME" 12 80 3 "${aWHIP_BRANCH[@]}" 3>&1 1>&2 2>&3); then unset aWHIP_BRANCH @@ -512,6 +514,7 @@ # Distro Selection DISTRO_LIST_ARRAY=( + '3' ': jessie-support' #REMOVE v6.24 '4' ': Stretch (current stable release, recommended)' '5' ': Buster (testing only, not officially supported)' @@ -577,7 +580,11 @@ done - if (( $DISTRO_TARGET == 4 )); then + if (( $DISTRO_TARGET == 3 )); then #REMOVE v6.24 + + DISTRO_TARGET_NAME='jessie' + + elif (( $DISTRO_TARGET == 4 )); then DISTRO_TARGET_NAME='stretch' From 33f6bca525e8d68dc8dfbf8bf101a84a381d79cd Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Mon, 6 May 2019 21:31:53 +0200 Subject: [PATCH 40/41] v6.23 + DietPi-Config | Reorder and alignment --- dietpi/dietpi-config | 127 +++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 51438fcd0f..d5d70d9f08 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -986,6 +986,69 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi + # Odroid C1: REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + + # Get Current Values + local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini) + + G_WHIP_MENU_ARRAY=( + + '1080p' ': 1920 x 1080' + '720p' ': 1280 x 720' + '480p' ': 720 x 480' + 'VU7+' ': 1024 x 600' + 'PC1' ': 1024 x 768' + + ) + + G_WHIP_DEFAULT_ITEM=$current_resolution + if G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $current_resolution"; then + + REBOOT_REQUIRED=1 + + TARGETMENUID=2 # Return to this menu + + # - Always reset to HDMI + sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini + + case "$G_WHIP_RETURNED_VALUE" in + + '1080p') + + sed -i '/setenv m /c\setenv m "1080p"' /DietPi/boot.ini + + ;; + + '720p') + + sed -i '/setenv m /c\setenv m "720p"' /DietPi/boot.ini + + ;; + + '480p') + + sed -i '/setenv m /c\setenv m "480p"' /DietPi/boot.ini + + ;; + + 'PC1') + + sed -i '/setenv m /c\setenv m "1024x768"' /DietPi/boot.ini + + ;; + + 'VU7+') + + sed -i '/setenv m /c\setenv m "1024x600"' /DietPi/boot.ini + sed -i '/setenv vout_mode /c\setenv vout_mode "dvi"' /DietPi/boot.ini + + ;; + + esac + + fi + # Odroid XU3/4 elif (( $G_HW_MODEL == 11 )); then @@ -1085,70 +1148,6 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - # Odroid C1 - #REMOVE v6.24 - elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - - # Get Current Values - local current_resolution=$(mawk -F '"' '/setenv m "/ {print $2;exit}' /DietPi/boot.ini) - - G_WHIP_MENU_ARRAY=( - - '1080p' ': 1920 x 1080' - '720p' ': 1280 x 720' - '480p' ': 720 x 480' - 'VU7+' ': 1024 x 600' - 'PC1' ': 1024 x 768' - - ) - - G_WHIP_DEFAULT_ITEM=$current_resolution - if G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION\nCurrent: $current_resolution"; then - - REBOOT_REQUIRED=1 - - TARGETMENUID=2 # Return to this menu - - # - Always reset to HDMI - sed -i '/setenv vout_mode /c\setenv vout_mode "hdmi"' /DietPi/boot.ini - - case "$G_WHIP_RETURNED_VALUE" in - - '1080p') - - sed -i '/setenv m /c\setenv m "1080p"' /DietPi/boot.ini - - ;; - - '720p') - - sed -i '/setenv m /c\setenv m "720p"' /DietPi/boot.ini - - ;; - - '480p') - - sed -i '/setenv m /c\setenv m "480p"' /DietPi/boot.ini - - ;; - - 'PC1') - - sed -i '/setenv m /c\setenv m "1024x768"' /DietPi/boot.ini - - ;; - - 'VU7+') - - sed -i '/setenv m /c\setenv m "1024x600"' /DietPi/boot.ini - sed -i '/setenv vout_mode /c\setenv vout_mode "dvi"' /DietPi/boot.ini - - ;; - - esac - - fi - # Pine A64 elif (( $G_HW_MODEL == 40 )); then From 528b1bb15ba8e146ae90df5b2c1b9286dca332fe Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Mon, 6 May 2019 21:35:36 +0200 Subject: [PATCH 41/41] v6.23 + DietPi-Config | Alignment --- dietpi/dietpi-config | 65 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index d5d70d9f08..2a9860be18 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -1982,7 +1982,7 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then #REMOVE v6.24 - gpu_mem_current=$((1024-ram_mem_current)) + gpu_mem_current=$((1024-ram_mem_current)) elif (( $G_HW_MODEL == 12 )); then @@ -2027,58 +2027,57 @@ More info here: https://www.raspberrypi.org/forums/viewtopic.php?p=105008#p10500 fi - # Odroid C1 - #REMOVE v6.24 - elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then + # Odroid C1: REMOVE v6.24 + elif (( $G_HW_MODEL == 10 && $G_DISTRO == 3 )); then - # Odroid HDMI/headless extra data - local display_output_enabled=$(grep -ci -m1 '^setenv hdmioutput "1"' /DietPi/boot.ini) - local display_vpu_enabled=$(grep -ci -m1 '^setenv vpu "1"' /DietPi/boot.ini) - local display_output_text='[On]' - local display_vpu_text='[On]' + # Odroid HDMI/headless extra data + local display_output_enabled=$(grep -ci -m1 '^setenv hdmioutput "1"' /DietPi/boot.ini) + local display_vpu_enabled=$(grep -ci -m1 '^setenv vpu "1"' /DietPi/boot.ini) + local display_output_text='[On]' + local display_vpu_text='[On]' - (( $display_output_enabled )) || display_output_text='[Off]' - (( $display_vpu_enabled )) || display_vpu_text='[Off]' + (( $display_output_enabled )) || display_output_text='[Off]' + (( $display_vpu_enabled )) || display_vpu_text='[Off]' - G_WHIP_MENU_ARRAY=( + G_WHIP_MENU_ARRAY=( - 'Headless' 'HDMI: Disabled | VPU: Disabled' - 'Server' 'HDMI: Enabled | VPU: Disabled' - 'Desktop' 'HDMI: Enabled | VPU: Enabled' + 'Headless' 'HDMI: Disabled | VPU: Disabled' + 'Server' 'HDMI: Enabled | VPU: Disabled' + 'Desktop' 'HDMI: Enabled | VPU: Enabled' - ) + ) - G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCurrent : HDMI: $display_output_text | VPU: $display_vpu_text \n Memory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM \n NB: GPU/RAM figures require a reboot after a change is made." - if (( $? == 0 )); then + G_WHIP_MENU "Hardware : $G_HW_MODEL_DESCRIPTION \nCurrent : HDMI: $display_output_text | VPU: $display_vpu_text \n Memory : $gpu_mem_current MB GPU | $ram_mem_current MB RAM \n NB: GPU/RAM figures require a reboot after a change is made." + if (( $? == 0 )); then - REBOOT_REQUIRED=1 + REBOOT_REQUIRED=1 - TARGETMENUID=6 # Return to this menu + TARGETMENUID=6 # Return to this menu - case "$G_WHIP_RETURNED_VALUE" in + case "$G_WHIP_RETURNED_VALUE" in - 'Headless') + 'Headless') - /DietPi/dietpi/func/dietpi-set_hardware headless 1 + /DietPi/dietpi/func/dietpi-set_hardware headless 1 - ;; + ;; - 'Server') + 'Server') - /DietPi/dietpi/func/dietpi-set_hardware headless 0 - G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini + /DietPi/dietpi/func/dietpi-set_hardware headless 0 + G_CONFIG_INJECT 'setenv vpu ' 'setenv vpu "0"' /DietPi/boot.ini - ;; + ;; - 'Desktop') + 'Desktop') - /DietPi/dietpi/func/dietpi-set_hardware headless 0 + /DietPi/dietpi/func/dietpi-set_hardware headless 0 - ;; + ;; - esac + esac - fi + fi # Odroid C2 elif (( $G_HW_MODEL == 12 )); then