diff --git a/.build/images/U-Boot/99-dietpi-uboot b/.build/images/U-Boot/99-dietpi-uboot new file mode 100755 index 0000000000..78dc0c3406 --- /dev/null +++ b/.build/images/U-Boot/99-dietpi-uboot @@ -0,0 +1,5 @@ +#!/bin/dash +echo 'update-initramfs: Converting to U-Boot format' +mkimage -A arm64 -O linux -T ramdisk -C gzip -n uInitrd -d "$2" "/boot/uInitrd-$1" +ln -sf "uInitrd-$1" /boot/uInitrd +exit 0 diff --git a/.build/images/U-Boot/boot.cmd b/.build/images/U-Boot/boot.cmd new file mode 100644 index 0000000000..d394dfc374 --- /dev/null +++ b/.build/images/U-Boot/boot.cmd @@ -0,0 +1,79 @@ +# DO NOT EDIT THIS FILE +# +# Please edit /boot/dietpiEnv.txt to set supported parameters +# +# If you must edit this file, recompile with: +# mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr + +# Default values +setenv rootdev "/dev/mmcblk0p1" +setenv rootfstype "ext4" +setenv consoleargs "console=tty1" +setenv verbosity "4" +setenv docker_optimizations "off" +setenv overlay_path "amlogic" +setenv overlay_prefix "meson" + +# Load addresses +setenv load_addr "0x32000000" +setenv kernel_addr_r "0x34000000" +setenv fdt_addr_r "0x4080000" +setenv overlay_error "false" + +# Load dietpiEnv.txt +if test -e ${devtype} ${devnum} ${prefix}dietpiEnv.txt; then + load ${devtype} ${devnum} ${load_addr} ${prefix}dietpiEnv.txt + env import -t ${load_addr} ${filesize} +fi + +# Get PARTUUID of first partition on SD/eMMC it was loaded from +# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from +if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi + +# Define kernel command-line arguments +setenv bootargs "root=${rootdev} rootfstype=${rootfstype} rootwait ${consoleargs} loglevel=${verbosity} consoleblank=0 coherent_pool=2M ubootpart=${partuuid} libata.force=noncq usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}" + +# Add bootargs for Docker +if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi + +# Load kernel, initramfs and device tree +load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image +load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd +load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} +fdt addr ${fdt_addr_r} + +# Apply DT overlays +if test -n "${overlays}" || test -n "${user_overlays}"; then + fdt resize 65536 + for overlay_file in ${overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/${overlay_path}/overlay/${overlay_prefix}-${overlay_file}.dtbo; then + echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi + done + + for overlay_file in ${user_overlays}; do + if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then + echo "Applying user provided DT overlay ${overlay_file}.dtbo" + fdt apply ${load_addr} || setenv overlay_error "true" + fi + done + + if test "${overlay_error}" = "true"; then + echo "Error applying DT overlays, restoring original DT" + load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} + else + if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/${overlay_path}/overlay/${overlay_prefix}-fixup.scr; then + echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" + source ${load_addr} + fi + if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then + load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr + echo "Applying user provided fixup script (fixup.scr)" + source ${load_addr} + fi + fi +fi + +# Boot +booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} diff --git a/.build/images/U-Boot/dietpi-initramfs_cleanup b/.build/images/U-Boot/dietpi-initramfs_cleanup new file mode 100755 index 0000000000..a4b37c5307 --- /dev/null +++ b/.build/images/U-Boot/dietpi-initramfs_cleanup @@ -0,0 +1,24 @@ +#!/bin/dash + +# Skip if initramfs-tools is not installed +[ -x '/usr/sbin/update-initramfs' ] || exit 0 + +# Passing the kernel version is required +version="$1" +if [ -z "$version" ] +then + echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 + exit 0 +fi + +# Avoid running multiple times +if [ "$DEB_MAINT_PARAMS" ] +then + eval set -- "$DEB_MAINT_PARAMS" + [ "$1" = 'upgrade' ] || exit 0 +fi + +# Delete unused initrd images +find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete + +exit 0 diff --git a/.build/images/U-Boot/dietpiEnv.txt b/.build/images/U-Boot/dietpiEnv.txt new file mode 100644 index 0000000000..5c4702d680 --- /dev/null +++ b/.build/images/U-Boot/dietpiEnv.txt @@ -0,0 +1,12 @@ +rootdev=UUID=3ccf3790-5e80-44b9-83be-17e3b21083d9 +rootfstype=ext4 +# The init system logs to the console defined last. +consoleargs=console=ttyAML0,115200 console=tty1 +verbosity=4 +usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u +extraargs=net.ifnames=0 +docker_optimizations=off +overlay_path=amlogic +overlay_prefix=meson +overlays= +user_overlays= diff --git a/.meta/dietpi-build b/.build/images/dietpi-build old mode 100644 new mode 100755 similarity index 96% rename from .meta/dietpi-build rename to .build/images/dietpi-build index 745c63fb18..c5833c4572 --- a/.meta/dietpi-build +++ b/.build/images/dietpi-build @@ -19,11 +19,12 @@ G_EXIT_CUSTOM(){ # Inputs HW_MODEL= HW_ARCH= -DISTRO=6 # 6=Bulleye, 7=Bookworm +DISTRO=6 # 6=Bullseye, 7=Bookworm PTTYPE='msdos' FSTYPE='ext4' ITYPE= VMTYPE= +GITBRANCH='master' while (( $# )) do case $1 in @@ -34,6 +35,7 @@ do '-f') shift; FSTYPE=$1;; '-i') ITYPE='Installer';; '-v') shift; VMTYPE=$1;; + '-b') shift; GITBRANCH=$1;; *) G_DIETPI-NOTIFY 1 "Invalid input \"$1\", aborting..."; exit 1;; esac shift @@ -48,6 +50,7 @@ root_size=1023 CLONING_TOOL='dd' case $HW_MODEL in 0) iname='RPi' partition_start=4 boot_size=128 root_size=892;; + 15) iname='OdroidN2' partition_start=4 root_size=768;; 20) iname='VM' WIFI_REQUIRED=0 VMTYPE=${VMTYPE:-raw};; 21) iname='NativePC-BIOS' HW_ARCH=10 root_size=1215;; *) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;; @@ -91,6 +94,8 @@ case $FSTYPE in *) G_DIETPI-NOTIFY 1 "Invalid filesystem type \"$FSTYPE\" passed, aborting..."; exit 1;; esac +G_CHECK_URL "https://github.com/MichaIng/DietPi/tree/$GITBRANCH" || { G_DIETPI-NOTIFY 1 "Failed to access Git branch \"$GITBRANCH\", aborting..."; exit 1; } + # Image name OUTPUT_IMG_NAME="DietPi_$iname-$iarch-${distro^}" [[ $ITYPE ]] && OUTPUT_IMG_NAME+="_$ITYPE" @@ -198,25 +203,14 @@ _EOF_ fi # Create rc.local to automate DietPi-PREP -cat << '_EOF_' > rootfs/etc/rc.local +cat << _EOF_ > rootfs/etc/rc.local #!/bin/dash { -_EOF_ -G_EXEC chmod +x rootfs/etc/rc.local - -# - RPi: https://github.com/RPi-Distro/repo/issues/253 -[[ $HW_MODEL == 0 ]] && cat << '_EOF_' >> rootfs/etc/rc.local -echo '[ INFO ] Installing Raspberry Pi repository keyring...' -curl -sSfLO 'https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-archive-keyring/raspberrypi-archive-keyring_2016.10.31_all.deb' || exit 1 -dpkg -i raspberrypi-archive-keyring_2016.10.31_all.deb || exit 1 -rm raspberrypi-archive-keyring_2016.10.31_all.deb || exit 1 -_EOF_ - -cat << _EOF_ >> rootfs/etc/rc.local echo '[ INFO ] Running DietPi-PREP...' -export GITBRANCH='master' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO='from scratch' WIFI_REQUIRED=$WIFI_REQUIRED DISTRO_TARGET=$DISTRO +export GITBRANCH='$GITBRANCH' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO='from scratch' WIFI_REQUIRED=$WIFI_REQUIRED DISTRO_TARGET=$DISTRO bash -c "\$(curl -sSfL 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/PREP_SYSTEM_FOR_DIETPI.sh')" _EOF_ +G_EXEC chmod +x rootfs/etc/rc.local # - VM: Generate tiny-initramfs with explicit kernel modules, as auto-detection doesn't work correctly within container and loop devices [[ $HW_MODEL == 20 ]] && cat << _EOF_ >> rootfs/etc/rc.local @@ -242,12 +236,9 @@ G_EXEC rm -Rf rootfs/var/{cache/apt,lib/apt/lists}/* # Start container # - dbus required for container spawn mask_dbus=0 -if [[ $(readlink /etc/systemd/system/dbus.socket) == '/dev/null' ]] -then - mask_dbus=1 - G_EXEC systemctl unmask dbus.socket dbus - G_EXEC systemctl start dbus.socket dbus -fi +[[ $(readlink /etc/systemd/system/dbus.socket) == '/dev/null' ]] && mask_dbus=1 +G_EXEC systemctl unmask dbus.socket dbus +G_EXEC systemctl start dbus.socket dbus # - Bind mounts required to allow container reading its own drive info, /dev/disk for GRUB and probably other tools to detect UUIDs abind=() [[ -b '/dev/loop0p2' ]] && abind=('--bind=/dev/loop0p2') diff --git a/.conf/dps_47/nginx.owncloud.conf b/.conf/dps_47/nginx.owncloud.conf index ed13b5ce24..4e631f93d5 100644 --- a/.conf/dps_47/nginx.owncloud.conf +++ b/.conf/dps_47/nginx.owncloud.conf @@ -1,4 +1,4 @@ -# Based on: https://github.com/owncloud/docs/blob/deda107004c35ccfc4927e4aab32a337bc2bb380/modules/admin_manual/examples/installation/nginx/subdirectory-configuration.conf +# Based on: https://github.com/owncloud/docs/blob/deda107/modules/admin_manual/examples/installation/nginx/subdirectory-configuration.conf location ^~ /owncloud { @@ -73,7 +73,6 @@ location ^~ /owncloud { try_files $uri /owncloud/index.php$uri$is_args$args; add_header Cache-Control "max-age=15778463" always; # Add headers to serve security related headers (It is intended to have those duplicated to the ones above) - #add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always; add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 45fb0698e7..76df2760b4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,6 @@ --- name: Bug report about: Create a report to help us improve - --- ### Creating a bug report/issue @@ -12,7 +11,7 @@ about: Create a report to help us improve - Kernel version | `uname -a` - SBC model | `echo $G_HW_MODEL_NAME` or (EG: RPi3) - Power supply used | (EG: 5V 1A RAVpower) -- SDcard used | (EG: SanDisk ultra) +- SD card used | (EG: SanDisk ultra) #### Additional Information (if applicable) - Software title | (EG: Nextcloud) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 577778e4f4..f824040758 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,6 @@ --- name: Feature request about: Suggest an idea for this project - --- ### Creating a feature request @@ -21,6 +20,3 @@ about: Suggest an idea for this project #### Additional context - ... - -#### Vote for this feature on FeatHub: https://feathub.com/MichaIng/DietPi/ - diff --git a/.github/ISSUE_TEMPLATE/image_request.md b/.github/ISSUE_TEMPLATE/image_request.md index 18b0501cc0..2fae87f186 100644 --- a/.github/ISSUE_TEMPLATE/image_request.md +++ b/.github/ISSUE_TEMPLATE/image_request.md @@ -1,7 +1,6 @@ --- name: Image request -about: Suggest a new SBC to be added to the offial support and image list of DietPi - +about: Suggest a new SBC to be added to the official support and image list of DietPi --- ### Creating an image request @@ -21,6 +20,3 @@ about: Suggest a new SBC to be added to the offial support and image list of Die #### If not, are there install instructions for Debian available? - ... - -#### Vote for this image on FeatHub: https://feathub.com/MichaIng/DietPi/ - diff --git a/.github/ISSUE_TEMPLATE/software_request.md b/.github/ISSUE_TEMPLATE/software_request.md index 72892c0b1a..03b8ba8f2f 100644 --- a/.github/ISSUE_TEMPLATE/software_request.md +++ b/.github/ISSUE_TEMPLATE/software_request.md @@ -1,7 +1,6 @@ --- name: Software request about: Suggest a software title to be added to DietPi-Software - --- ### Creating a software request @@ -33,8 +32,5 @@ about: Suggest a software title to be added to DietPi-Software 1. ... #### Are you willing to help maintaining the software installation, e.g. in case of needed setup changes due to updates etc.? This is not needed, but could speed up our decision to implement it, as man power is always a topic :wink:. - + - ... - -#### Vote for this software on FeatHub: https://feathub.com/MichaIng/DietPi/ - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c5d388eb2e..2f4690ce23 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,16 +3,3 @@ Before submitting a pull request: - Please ensure the target branch is "dev" (active development): https://github.com/MichaIng/DietPi/tree/dev - Please ensure changes have been tested and verified functional. --> -**Status**: WIP | Testing | Ready | ? -- [ ] Example task 1 - -**Reference**: https://github.com/MichaIng/DietPi/issues/XXXX - -**Commit list/description**: - -- ... diff --git a/.meta/dietpi-cloud-migration b/.meta/dietpi-cloud-migration old mode 100644 new mode 100755 index e25ef23520..0f148f01e6 --- a/.meta/dietpi-cloud-migration +++ b/.meta/dietpi-cloud-migration @@ -44,6 +44,10 @@ run_backup(){ ! rsync -aHp --delete "$fp_datadir/" "$2" && echo -e '[\e[31mFAILED\e[0m] "rsync" failed, please check for error reasons and try again.' && exit 1 echo -e "[\e[32m OK \e[0m] Successfully synced data directory to: $2" + # Remove old backups when sync was successful @StephanStS + echo "[ INFO ] Removing backups from $fp_datadir/ after successful sync to $2..." + rm -R "$fp_datadir/dietpi-$1-database-backup.sql" "$fp_datadir/dietpi-$1-installation-backup" + else echo '[ INFO ] You did not provide an additional backup location. We assume your data directory is already on an external drive, ready for migration? If not, move it there, or, rerun this script with the desired external backup path as argument.' diff --git a/.meta/dietpi-fan_control b/.meta/dietpi-fan_control old mode 100644 new mode 100755 diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report old mode 100644 new mode 100755 index 133fd743a6..b7efaba9fb --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -579,17 +579,19 @@ shopt -s extglob unset -v 'aSOFTWARE_NAME7_8[99]' # emonHub aSOFTWARE_NAME7_8[200]='DietPi-Dashboard' - # v7.9 + v8.0 + # v7.9 + v8.0 + v8.1 aSOFTWARE_NAME7_9=() aSOFTWARE_NAME8_0=() + aSOFTWARE_NAME8_1=() for i in "${!aSOFTWARE_NAME7_8[@]}" do aSOFTWARE_NAME7_9[$i]=${aSOFTWARE_NAME7_8[$i]} aSOFTWARE_NAME8_0[$i]=${aSOFTWARE_NAME7_9[$i]} + aSOFTWARE_NAME8_1[$i]=${aSOFTWARE_NAME8_0[$i]} done # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs - for i in "${aSOFTWARE_NAME8_0[@]}" + for i in "${aSOFTWARE_NAME8_1[@]}" do aSOFTWARE["$i"]=0 done diff --git a/.update/patches b/.update/patches old mode 100644 new mode 100755 index eb1de28d1a..ca147b1510 --- a/.update/patches +++ b/.update/patches @@ -619,6 +619,33 @@ Patch_8_0() [[ -f '/etc/systemd/system/blynkserver.service' ]] && ! grep -q '\-Dlog4j2.formatMsgNoLookups=true' /etc/systemd/system/blynkserver.service && G_EXEC sed -i 's/java -jar/java -Dlog4j2.formatMsgNoLookups=true -jar/' /etc/systemd/system/blynkserver.service } +Patch_8_1() +{ + # DietPi-Services cleanup: https://dietpi.com/phpbb/viewtopic.php?p=42027#p42027 + [[ -f '/dietpi-process_tool.conf' ]] && G_EXEC rm /dietpi-process_tool.conf + [[ -f '/dietpi-services_edit.conf' ]] && G_EXEC rm /dietpi-services_edit.conf + + # RPi: Remove obsolete VCSM overlay since the device node has been removed + if (( $G_HW_MODEL < 10 )) + then + grep -q 'dtoverlay=dietpi-disable_vcsm' /boot/config.txt && G_EXEC sed -i '/dtoverlay=dietpi-disable_vcsm/d' /boot/config.txt + [[ -f '/boot/overlays/dietpi-disable_vcsm.dtbo' ]] && G_EXEC rm /boot/overlays/dietpi-disable_vcsm.dtbo + fi + + # RPi: Fix MATE install: https://github.com/MichaIng/DietPi/issues/5214 + [[ $G_HW_MODEL -le 9 && -f '/etc/apt/preferences.d/dietpi-lxde' ]] && cat << '_EOF_' > /etc/apt/preferences.d/dietpi-lxde +Package: openbox* obconf* libob* pcmanfm* libfm* gtk-* libgtk* libgail* gir1.2-gtk-3.0 lx* +Pin: origin archive.raspberrypi.org +Pin-Priority: -1 +_EOF_ + + # Odroid C2 mainline image: Remove obsolete IRQ affinity: https://github.com/MichaIng/DietPi/issues/5235 + [[ $G_HW_MODEL == 12 && -f '/var/lib/dietpi/postboot.d/c2_smp.sh' ]] && ! grep -q '^[[:blank:]]*63:.*dwc_otg' /proc/interrupts && G_EXEC rm /var/lib/dietpi/postboot.d/c2_smp.sh + + # Fix Home Assistant restart: https://dietpi.com/phpbb/viewtopic.php?t=10025 + [[ -f '/etc/systemd/system/home-assistant.service' ]] && G_CONFIG_INJECT 'RestartForceExitStatus=100' 'RestartForceExitStatus=100' /etc/systemd/system/home-assistant.service '\[Service\]' +} + # v6.35 => v7 migration if (( $G_DIETPI_VERSION_CORE == 6 && $G_DIETPI_VERSION_SUB > 34 )) then diff --git a/.update/pre-patches b/.update/pre-patches old mode 100644 new mode 100755 diff --git a/.update/version b/.update/version index 992f3e79c9..9fea63b35c 100644 --- a/.update/version +++ b/.update/version @@ -1,6 +1,6 @@ # Available DietPi version G_REMOTE_VERSION_CORE=8 -G_REMOTE_VERSION_SUB=0 +G_REMOTE_VERSION_SUB=1 G_REMOTE_VERSION_RC=2 # Minimum DietPi version to allow update G_MIN_VERSION_CORE=6 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9e827c4ab6..544c0fd195 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,43 @@ +v8.1 +(2022-02-05) + +SBC support: +- Odroid N2 | Support for Odroid N2 with modern mainline Linux images has been added, including proper boot configuration, serial console selection, HDMI and 3.5mm audio selection and more. Sadly existing images cannot be migrated, a new image is available for testing: https://github.com/MichaIng/DietPi/issues/5039 + +Changes: +- DietPi-Benchmark | During RAM I/O benchmarks, the CPU governor is now changed to "performance" so that the result is not affected by possible CPU frequency scaling but the raw/max RAM I/O performance is measured. A significant effect of this has been recognised on Odroid N2 images with modern mainline kernel. Since the CPU benchmark is done first, this has no effect on its score and CPU temperature results. +- DietPi-Drive_Manager | Btrfs subvolume mounts are now preserved in /etc/fstab. Many thanks to @laddde for implementing this feature: https://github.com/MichaIng/DietPi/pull/5176 +- DietPi-Drive_Manager | The Samba mount dialogues do now indicate that a hostname can be entered instead of a server IP and a shared folder path instead of a share name only. +- DietPi-Backup | A notification is not printed when rsync dry-run to obtain required disk space is starting, since this can take a while. Many thanks to @whisdol for reporting the the impression of a hanging script: https://github.com/MichaIng/DietPi/issues/5209 +- DietPi-Software | iptables is now automatically configured to use either modern nf_tables API or legacy API, depending on whether nf_tables is supported by the kernel. This is helpful for Bullseye images with older kernel versions, where iptables is by default configured to use nf_tables, which fails. +- DietPi-Software | iptables rules are now applied for IPv6 as well in all cases (for VPN servers, WiFi and Tor hotspots) via ip6tables. This does not depend on whether IPv6 is actually enabled for interfaces, but enables general IPv6 support for affected software options. Many thanks to @vielka442 for reporting missing IPv6 support for Tor Hotspot: https://github.com/MichaIng/DietPi/issues/5038 +- DietPi-Software | Jellyfin: For new installs, the default web interface port has been changed from 8096 to 8097 to resolve a port conflict with Emby. +- DietPi-Software | Docker/K3s: The memory cgroup is now enabled as well on RPi and our new Odroid N2 image, when Docker or K3s is installed, to allow container memory usage monitoring. Many thanks to @isarrider for this request: https://github.com/MichaIng/DietPi/issues/5225 +- DietPi-Software | Raspotify: This software option has been disabled on Debian Buster systems but enabled for ARMv8 and x86_64 systems, to match the current state of the official Raspotify APT repository. + +Fixes: +- DietPi-Services | Resolved an issue where service edits and process tool settings were not effective as they were stored to the wrong file path. Many thanks to @TopFord and @MicDG for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=41509#p41509 +- DietPi-LetsEncrypt | Resolved an issue where Certbot failed on fresh Apache installs since the 000-default.conf vhost by default does not contain any directive anymore. The ServerName directive with the entered domain name is now added to 000-default.conf instead of apache2.conf, with the benefit that it overrides the global ServerName directive in dietpi.conf, which uses the local IP address only. +- DietPi-Software/DietPi-AutoStart | Chromium: Resolved an issue where the Chromium kiosk autostart option failed on all non-RPi systems. +- DietPi-Software | Roon Extension Manager: It has been disabled for ARMv6 RPi systems where it cannot run currently. Many thanks to @JanKoudijs for applying this fix: https://github.com/MichaIng/DietPi/pull/5231 +- DietPi-Software | FuguHub: Resolved an issue where the uninstall failed as the service was not stopped and removed as expected, before attempting to remove the service user. +- DietPi-Software | PHP: Resolved an issue where the PATH variable was not available for PHP applications with Lighttpd and Nginx webservers. It is now set to the static value "/usr/local/bin:/usr/bin:/bin", the default PATH excluding super user executables "sbin". Many thanks to @shanew1694 for reporting a related issue with rTorrent: https://github.com/MichaIng/DietPi/issues/5161#issuecomment-1013381362 +- DietPi-Software | MineOS: Resolved an issue where the install failed on Bullseye: https://github.com/MichaIng/DietPi/issues/5181 +- DietPi-Software | Cuberite: Resolved an issue where the server failed to start on ARMv8 systems: https://github.com/MichaIng/DietPi/issues/5180 +- DietPi-Software | MATE: Resolved an issue where the install failed when LXDE is installed already. Many thanks to @n0valis for reporting this issue: https://github.com/MichaIng/DietPi/issues/5214 +- DietPi-Software | Ampache: Resolved an issue on Bullseye systems where Ampache v5 installs/reinstalls did not work because of a changed webroot directory: https://github.com/MichaIng/DietPi/pull/5205 +- DietPi-Software | OpenBazaar: Since the original project has been taken down, we migrated to a fork which keeps up the marketplace for the community: https://github.com/MichaIng/DietPi/issues/5213 +- DietPi-Software | X.Org X Server: Resolved an issue where VMs without KMS/DRM support failed to start the X server, e.g. Hyper-V. The classic framebuffer DDX is now installed when no KMS/DRM support is detected on VMs. +- DietPi-Software | Box86/Box64: Resolved an issue where the install failed when a kernel upgrade has just been done so that the "binfmt_misc" kernel module cannot be found for the loaded kernel. +- DietPi-Software | RPi-Monitor: Resolved an issue where the CPU temperature was not shown. Many thanks to @KamikazeePL for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10001 +- DietPi-Software | Home Assistant: Resolved an issue with the latest Home Assistant version where restarting it via web interface made it remaining stopped. The fix is applied to all instances on DietPi update. Many thanks to @jchh for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=10025 + +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/5229 + +For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues + +----------------------------------------------------------------------------------------------------------- + v8.0 (2022-01-08) @@ -36,11 +76,6 @@ Fixes: 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/5146 -Known/Outstanding Issues: -- DietPi-Config | Enabling WiFi + Ethernet adapters, both on different subnets, breaks WiFi connection in some cases: https://github.com/MichaIng/DietPi/issues/2103 - -For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues - ----------------------------------------------------------------------------------------------------------- v7.9 @@ -68,7 +103,7 @@ Changes: - DietPi-Software | rTorrent: By default on fresh installs, rTorrent now listens on TCP port 49164 for incoming BitTorrent connections. Aside of DHT, listening for incoming connections was completely disabled before, which lead to slow or no peer connections, depending on the tracker used. Many thanks to @Camry2731 for reporting this inconsistency with our other BitTorrent server options. Fixes: -- Raspberry Pi | Resolved an issue in our images where on first boot two serial login consoles on the generic symlinked and actual serial devices could have been started. This doubled inputs and in turn broke successful username and password login via serial console on first boot. Many thanks to @ad7718 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5014 +- Raspberry Pi | Resolved an issue in our images where on first boot two serial login consoles on the generic symlinked and actual serial devices could have been started. This doubled inputs and in turn broke successful username and password login via serial console on first boot. Many thanks to @ad7718 for reporting this issue: https://github.com/MichaIng/DietPi/issues/5014 - DietPi-Backup | Resolved an issue where backup and restore failed if a non-default backup location is used, as a wrong log file path was used. This is a v7.8 regression. Many thanks to @Malinka for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=39909#p39909 - DietPi-Config | Resolved an issue where enabling the "odroid-lcd35" LCD panel on Odroids failed as SPI is enabled by default, blocking the same GPIO ports. Many thanks to @MarcProux for reporting this issue: https://github.com/MichaIng/DietPi/issues/4154 - DietPi-Config | Resolved an issue where the network adapter menu did not show the static DNS server(s) effetively applied at first boot based on dietpi.txt settings. Many thanks to @nils-trubkin for reporting this issue: https://github.com/MichaIng/DietPi/issues/5054 @@ -82,8 +117,6 @@ Fixes: 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/5053 -For all additional issues that may appear after release, please see the following link for active tickets: https://github.com/MichaIng/DietPi/issues - ----------------------------------------------------------------------------------------------------------- v7.8 diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh old mode 100644 new mode 100755 index aba267a9f8..c790f1a7a7 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -406,7 +406,7 @@ _EOF_ while : do - # Check for valid environment variabe + # Check for valid environment variable [[ $HW_MODEL =~ ^[0-9]+$ ]] && for i in "${G_WHIP_MENU_ARRAY[@]}" do [[ $HW_MODEL == "$i" ]] && break 2 @@ -511,36 +511,42 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "[$SETUP_STEP] Downloading and installing DietPi source code"; ((SETUP_STEP++)) #------------------------------------------------------------------------------------------------ - local url="https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.tar.gz" - G_CHECK_URL_TIMEOUT=10 G_CHECK_URL_ATTEMPTS=2 G_CHECK_URL "$url" - G_EXEC_DESC='Downloading DietPi sourcecode' G_EXEC curl -sSfL "$url" -o package.tar.gz - - [[ -d DietPi-$G_GITBRANCH ]] && G_EXEC_DESC='Cleaning previously extracted files' G_EXEC rm -R "DietPi-$G_GITBRANCH" - G_EXEC_DESC='Extracting DietPi sourcecode' G_EXEC tar xf package.tar.gz - rm package.tar.gz + G_EXEC_DESC='Downloading source code' G_EXEC curl -sSfLO "https://github.com/$G_GITOWNER/DietPi/archive/$G_GITBRANCH.tar.gz" + [[ -d DietPi-$G_GITBRANCH ]] && G_EXEC_DESC='Removing old source code' G_EXEC rm -R "DietPi-$G_GITBRANCH" + G_EXEC_DESC='Unpacking source code' G_EXEC tar xf "$G_GITBRANCH.tar.gz" + G_EXEC_DESC='Removing unused files' G_EXEC rm -f "$G_GITBRANCH.tar.gz" "DietPi-$G_GITBRANCH/dietpi/"{pre-patch_file,patch_file,server_version-6} + G_EXEC_DESC='Hardening source code mode' G_EXEC chmod -R g-w "DietPi-$G_GITBRANCH" [[ -d '/boot' ]] || G_EXEC_DESC='Creating /boot' G_EXEC mkdir /boot G_DIETPI-NOTIFY 2 'Moving kernel and boot configuration to /boot' - # HW specific config.txt, boot.ini uEnv.txt + # HW specific config.txt, boot.ini if (( $G_HW_MODEL < 10 )); then - echo "root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /) rootfstype=ext4 rootwait fsck.repair=yes net.ifnames=0 logo.nologo quiet console=serial0,115200 console=tty1" > /boot/cmdline.txt + echo "root=PARTUUID=$(findmnt -Ufnro PARTUUID -M /) rootfstype=ext4 rootwait fsck.repair=yes net.ifnames=0 logo.nologo console=serial0,115200 console=tty1" > /boot/cmdline.txt G_EXEC mv "DietPi-$G_GITBRANCH/config.txt" /boot/ # Boot in 64-bit mode if this is a 64-bit image [[ $G_HW_ARCH == 3 ]] && G_CONFIG_INJECT 'arm_64bit=' 'arm_64bit=1' /boot/config.txt - elif (( $G_HW_MODEL == 11 )); then + elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_xu4.ini" /boot/boot.ini G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini - elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then + elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_c2.ini" /boot/boot.ini - elif [[ $G_HW_MODEL == 15 && -f '/boot/boot.ini' ]]; then + elif [[ $G_HW_MODEL == 15 && $(findmnt -Ufnro TARGET -T /boot) == '/' ]]; then + + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpiEnv.txt" /boot/dietpiEnv.txt + G_EXEC mkdir -p /etc/kernel/preinst.d /etc/initramfs/post-update.d + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/dietpi-initramfs_cleanup" /etc/kernel/preinst.d/dietpi-initramfs_cleanup + G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot + + elif [[ $G_HW_MODEL == 15 && -f '/boot/boot.ini' && $(findmnt -t vfat -M /boot) ]]; then G_EXEC mv "DietPi-$G_GITBRANCH/boot_n2.ini" /boot/boot.ini G_EXEC sed -i "s/root=UUID=[^[:blank:]]*/root=UUID=$(findmnt -Ufnro UUID -M /)/" /boot/boot.ini @@ -557,15 +563,9 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then G_DIETPI_VERSION_SUB=$G_REMOTE_VERSION_SUB G_DIETPI_VERSION_RC=$G_REMOTE_VERSION_RC - # Remove server_version-6 / (pre-)patch_file (downloads fresh from dietpi-update) - rm "DietPi-$G_GITBRANCH/dietpi/server_version-6" - rm "DietPi-$G_GITBRANCH/dietpi/pre-patch_file" - rm "DietPi-$G_GITBRANCH/dietpi/patch_file" - - G_EXEC_DESC='Copy DietPi scripts to /boot/dietpi' G_EXEC cp -Rf "DietPi-$G_GITBRANCH/dietpi" /boot/ - G_EXEC_DESC='Copy DietPi system files in place' G_EXEC cp -Rf "DietPi-$G_GITBRANCH/rootfs"/. / + G_EXEC_DESC='Copy DietPi scripts to /boot/dietpi' G_EXEC cp -a "DietPi-$G_GITBRANCH/dietpi" /boot/ + G_EXEC_DESC='Copy DietPi system files in place' G_EXEC cp -a "DietPi-$G_GITBRANCH/rootfs/." / G_EXEC_DESC='Clean download location' G_EXEC rm -R "DietPi-$G_GITBRANCH" - G_EXEC_DESC='Set execute permissions for DietPi scripts' G_EXEC chmod -R +x /boot/dietpi /var/lib/dietpi/services /etc/cron.*/dietpi G_DIETPI-NOTIFY 2 'Storing DietPi version info:' G_CONFIG_INJECT 'DEV_GITBRANCH=' "DEV_GITBRANCH=$G_GITBRANCH" /boot/dietpi.txt @@ -608,6 +608,14 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then # (Re)create DietPi runtime and logs dir, used by G_AGx G_EXEC mkdir -p /run/dietpi /var/tmp/dietpi/logs + # RPi: Bootstrap repo when key is missing + if [[ $G_HW_MODEL -le 9 && ! $(apt-key list 'CF8A1AF502A2AA2D763BAE7E82B129927FA3303E' 2> /dev/null) ]] + then + G_EXEC curl -sSfLO 'https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-archive-keyring/raspberrypi-archive-keyring_2021.1.1+rpt1_all.deb' + G_AGI dpkg -i raspberrypi-archive-keyring_2016.10.31_all.deb + G_EXEC rm raspberrypi-archive-keyring_2016.10.31_all.deb + fi + G_AGUP # @MichaIng https://github.com/MichaIng/DietPi/pull/1266/files @@ -797,6 +805,34 @@ _EOF_ [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' # - G_HW_MODEL specific required firmware/kernel/bootloader packages + # Odroid N2: Modern single partition image + elif [[ $G_HW_MODEL == 15 && -f '/boot/dietpiEnv.txt' ]] + then + # Bootstrap Armbian repository + G_EXEC eval "curl -sSfL 'https://apt.armbian.com/armbian.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes" + # Remove obsolete combined keyring + [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg + [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' + # Exclude doubled device tree files, shipped with the kernel package + G_EXEC eval "echo 'path-exclude /usr/lib/linux-image-current-*' > /etc/dpkg/dpkg.cfg.d/01-dietpi-exclude_doubled_devicetrees" + # Remove obsolete lists and doubled device tree files, shipped with the kernel package + G_EXEC rm -Rf /etc/apt/sources.list.d/* /usr/lib/linux-image-current-* + # Add Armbian repository + G_EXEC eval "echo 'deb http://apt.armbian.com/ ${DISTRO_TARGET_NAME/bookworm/bullseye} main' > /etc/apt/sources.list.d/dietpi-armbian.list" + # Update APT lists + G_AGUP + # Install kernel, device tree, U-Boot, firmware and initramfs packages, initramfs-tools first to have an initramfs generated on kernel install + G_AGI initramfs-tools + G_AGI linux-{image,dtb}-current-meson64 linux-u-boot-odroidn2-current u-boot-tools armbian-firmware + # Cleanup + [[ -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage + [[ -f '/boot/.next' ]] && G_EXEC rm /boot/.next + # Compile U-Boot config + G_EXEC mkimage -C none -A arm64 -T script -d /boot/boot.cmd /boot/boot.scr + # Flash U-Boot + . /usr/lib/u-boot/platform_install.sh + write_uboot_platform "$DIR" "$(lsblk -npo PKNAME "$(findmnt -Ufnro SOURCE -M /)")" + # Armbian grab currently installed packages elif [[ $(dpkg-query -Wf '${Package} ') == *'armbian'* ]]; then @@ -830,9 +866,9 @@ _EOF_ G_EXEC mkdir -p /etc/initramfs/post-update.d cat << _EOF_ > /etc/initramfs/post-update.d/99-dietpi-uboot #!/bin/dash -echo 'update-initramfs: Converting to U-Boot format' >&2 -mkimage -A $arch -O linux -T ramdisk -C gzip -n uInitrd -d \$2 /boot/uInitrd-\$1 > /dev/null -ln -sf uInitrd-\$1 /boot/uInitrd > /dev/null 2>&1 || mv /boot/uInitrd-\$1 /boot/uInitrd +echo 'update-initramfs: Converting to U-Boot format' +mkimage -A $arch -O linux -T ramdisk -C gzip -n uInitrd -d "\$2" "/boot/uInitrd-\$1" +ln -sf "uInitrd-\$1" /boot/uInitrd > /dev/null 2>&1 || mv "/boot/uInitrd-\$1" /boot/uInitrd exit 0 _EOF_ G_EXEC chmod +x /etc/initramfs/post-update.d/99-dietpi-uboot @@ -840,22 +876,22 @@ _EOF_ cat << '_EOF_' > /etc/kernel/preinst.d/dietpi-initramfs_cleanup #!/bin/dash -# skip if initramfs-tools is not installed -[ -x /usr/sbin/update-initramfs ] || exit 0 +# Skip if initramfs-tools is not installed +[ -x '/usr/sbin/update-initramfs' ] || exit 0 -# passing the kernel version is required +# Passing the kernel version is required version="$1" -if [ -z "$version" ]; then +if [ -z "$version" ] +then echo "W: initramfs-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" >&2 exit 0 fi -# avoid running multiple times -if [ -n "$DEB_MAINT_PARAMS" ]; then +# Avoid running multiple times +if [ "$DEB_MAINT_PARAMS" ] +then eval set -- "$DEB_MAINT_PARAMS" - if [ "$1" != 'upgrade' ]; then - exit 0 - fi + [ "$1" = 'upgrade' ] || exit 0 fi _EOF_ @@ -863,21 +899,21 @@ _EOF_ if (( $DISTRO_TARGET > 5 )) then cat << '_EOF_' >> /etc/kernel/preinst.d/dietpi-initramfs_cleanup -# delete unused initrd images +# Delete unused initrd images find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete exit 0 _EOF_ else cat << '_EOF_' >> /etc/kernel/preinst.d/dietpi-initramfs_cleanup -# loop through existing initramfs images +# Loop through existing initramfs images for v in $(ls -1 /var/lib/initramfs-tools | linux-version sort --reverse); do if ! linux-version compare $v eq $version; then - # try to delete delete old initrd images via update-initramfs + # Try to delete delete old initrd images via update-initramfs INITRAMFS_TOOLS_KERNEL_HOOK=y update-initramfs -d -k $v 2>/dev/null - # delete unused state files + # Delete unused state files find /var/lib/initramfs-tools -type f ! -name "$version" -printf 'Removing obsolete file %f\n' -delete - # delete unused initrd images + # Delete unused initrd images find /boot -name 'initrd.img-*' -o -name 'uInitrd-*' ! -name "*-$version" -printf 'Removing obsolete file %f\n' -delete fi done @@ -887,6 +923,13 @@ _EOF_ fi G_EXEC chmod +x /etc/kernel/preinst.d/dietpi-initramfs_cleanup + # Add Armbian repo key as dedicated file + G_EXEC eval "curl -sSfL 'https://apt.armbian.com/armbian.key' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes" + + # Remove obsolete combined keyring + [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg + [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' + # Remove obsolete components from Armbian list and connect via HTTPS G_EXEC eval "echo 'deb http://apt.armbian.com/ ${DISTRO_TARGET_NAME/bookworm/bullseye} main' > /etc/apt/sources.list.d/armbian.list" @@ -1008,7 +1051,7 @@ _EOF_ G_EXEC apt-get clean # Remove downloaded archives # - Firmware - if dpkg-query -Wf '${Package}\n' | grep -q '^armbian-firmware'; then + if dpkg-query -s 'armbian-firmware' &> /dev/null; then aPACKAGES_REQUIRED_INSTALL+=('armbian-firmware') @@ -1322,9 +1365,8 @@ _EOF_ ln -sfv /etc/profile.d/bash_completion.sh /etc/bashrc.d/dietpi-bash_completion.sh #----------------------------------------------------------------------------------- - # UID bit for sudo: https://github.com/MichaIng/DietPi/issues/794 - G_DIETPI-NOTIFY 2 'Setting sudo UID bit' - chmod 4755 "$(command -v sudo)" + # setuid bit for sudo: https://github.com/MichaIng/DietPi/issues/794 + G_EXEC_DESC='Setting setuid bit for "sudo" executable' G_EXEC chmod 4755 /usr/bin/sudo #----------------------------------------------------------------------------------- # Dirs @@ -1490,36 +1532,41 @@ left_meter_modes=1 1 right_meters=Memory Swap Tasks LoadAverage Uptime right_meter_modes=1 1 2 2 2 _EOF_' - G_DIETPI-NOTIFY 2 'Configuring serial login consoles:' - # On virtual machines, serial consoles are not required - if (( $G_HW_MODEL == 20 )); then - - /boot/dietpi/func/dietpi-set_hardware serialconsole disable + G_DIETPI-NOTIFY 2 'Configuring serial login consoles' + # Disable all serial consoles first, also to remove invalid ones + /boot/dietpi/func/dietpi-set_hardware serialconsole disable + # On RPi the primary serial console depends on model, use "serial0" which links to the primary console, converts to correct device on first boot + if (( $G_HW_MODEL < 10 )) + then + G_CONFIG_INJECT 'enable_uart=' 'enable_uart=0' /boot/config.txt + /boot/dietpi/func/dietpi-set_hardware serialconsole enable serial0 + # Disable and mask the others explicitly to be independent of currently available serial devices + /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyAMA0 + G_EXEC systemctl mask serial-getty@ttyAMA0 + /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyS0 + G_EXEC systemctl mask serial-getty@ttyS0 + + # Odroid N2: Enable on serial debug console only + elif (( $G_HW_MODEL == 15 )) + then + local tty='ttyAML0' + [[ -e '/dev/ttyAML0' ]] || tty='ttyS0' + /boot/dietpi/func/dietpi-set_hardware serialconsole enable "$tty" - else + # ROCK Pi S: Enable on ttyS0 only + elif (( $G_HW_MODEL == 73 )) + then + /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS0 + # Else on non-VM: Enable on all present serial consoles + elif (( $G_HW_MODEL != 20 )) + then /boot/dietpi/func/dietpi-set_hardware serialconsole enable - # On RPi the primary serial console depends on model, use "serial0" which links to the primary console, converts to correct device on first boot - if (( $G_HW_MODEL < 10 )); then - - /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyAMA0 - # The actual serial console services need to be masked explicitly to ensure they are not autostarted when the image is created within a container or without both serial devices present, since masks are only placed by dietpi-set_hardware for existing devices: : https://github.com/MichaIng/DietPi/issues/5014 - G_EXEC systemctl mask serial-getty@ttyAMA0 - /boot/dietpi/func/dietpi-set_hardware serialconsole disable ttyS0 - G_EXEC systemctl mask serial-getty@ttyS0 - /boot/dietpi/func/dietpi-set_hardware serialconsole enable serial0 - - # ROCK Pi S: Enable on ttyS0 only - elif (( $G_HW_MODEL == 73 )); then - - /boot/dietpi/func/dietpi-set_hardware serialconsole disable - /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS0 - G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=1' /boot/dietpi.txt - - fi - fi + # Re-set dietpi.txt setting on non-VMs to indicated enabled serial console + (( $G_HW_MODEL == 20 )) || G_CONFIG_INJECT 'CONFIG_SERIAL_CONSOLE_ENABLE=' 'CONFIG_SERIAL_CONSOLE_ENABLE=1' /boot/dietpi.txt + G_DIETPI-NOTIFY 2 'Disabling static and automatic login prompts on consoles tty2 to tty6:' G_EXEC systemctl mask --now getty-static # - logind features are usually not needed and (aside of automatic getty spawn) require the libpam-systemd package. @@ -1549,26 +1596,21 @@ _EOF_' G_EXEC_DESC='Removing foreign i386 DPKG architecture' G_EXEC dpkg --remove-architecture i386 # Disable nouveau: https://github.com/MichaIng/DietPi/issues/1244 // https://dietpi.com/phpbb/viewtopic.php?p=9688#p9688 - rm -f /etc/modprobe.d/*nouveau* + G_EXEC rm -f /etc/modprobe.d/*nouveau* cat << '_EOF_' > /etc/modprobe.d/dietpi-disable_nouveau.conf blacklist nouveau -blacklist lbm-nouveau options nouveau modeset=0 alias nouveau off -alias lbm-nouveau off _EOF_ # Fix grub install device: https://github.com/MichaIng/DietPi/issues/3700 dpkg-query -s grub-pc &> /dev/null && G_EXEC eval "debconf-set-selections <<< 'grub-pc grub-pc/install_devices multiselect /dev/sda'" # Update initramfs with above changes - if command -v update-tirfs > /dev/null; then - + if command -v update-tirfs > /dev/null + then G_EXEC_OUTPUT=1 G_EXEC update-tirfs - else - G_EXEC_OUTPUT=1 G_EXEC update-initramfs -u - fi elif (( $G_HW_ARCH == 3 )); then @@ -1578,8 +1620,8 @@ _EOF_ fi G_DIETPI-NOTIFY 2 'Applying board-specific tweaks:' - if (( $G_HW_MODEL != 20 )); then - + if (( $G_HW_MODEL != 20 )) + then G_EXEC_DESC='Configuring hdparm' # Since Debian Bullseye, spindown_time is not applied if APM is not supported by the drive. force_spindown_time is required to override that. local spindown='spindown_time' @@ -1589,21 +1631,26 @@ apm = 127 $spindown = 120 _EOF_" unset -v spindown - fi - # - Sparky SBC - if (( $G_HW_MODEL == 70 )); then + # - Odroid N2: Modern single partition image + if [[ $G_HW_MODEL == 15 && -f '/boot/dietpiEnv.txt' ]] + then + G_CONFIG_INJECT 'rootdev=' "rootdev=UUID=$(findmnt -Ufnro UUID -M /)" /boot/dietpiEnv.txt + G_CONFIG_INJECT 'rootfstype=' "rootfstype=$(findmnt -Ufnro FSTYPE -M /)" /boot/dietpiEnv.txt + # - Sparky SBC + elif (( $G_HW_MODEL == 70 )) + then # Install latest kernel/drivers - G_EXEC curl -sSfL https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dragon_fly_check/uImage -o /boot/uImage - G_EXEC curl -sSfLO https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dragon_fly_check/3.10.38.bz2 + G_EXEC curl -sSfL 'https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dragon_fly_check/uImage' -o /boot/uImage + G_EXEC curl -sSfLO 'https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dragon_fly_check/3.10.38.bz2' G_EXEC tar -xf 3.10.38.bz2 -C /lib/modules/ G_EXEC rm 3.10.38.bz2 # - USB audio update - G_EXEC curl -sSfL https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dsd-marantz/snd-usb-audio.ko -o /lib/modules/3.10.38/kernel/sound/usb/snd-usb-audio.ko + G_EXEC curl -sSfL 'https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/dsd-marantz/snd-usb-audio.ko' -o /lib/modules/3.10.38/kernel/sound/usb/snd-usb-audio.ko # - Ethernet update - G_EXEC curl -sSfL https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/sparky-eth/ethernet.ko -o /lib/modules/3.10.38/kernel/drivers/net/ethernet/acts/ethernet.ko + G_EXEC curl -sSfL 'https://raw.githubusercontent.com/sparky-sbc/sparky-test/master/sparky-eth/ethernet.ko' -o /lib/modules/3.10.38/kernel/drivers/net/ethernet/acts/ethernet.ko # Boot args cat << '_EOF_' > /boot/uenv.txt @@ -1779,8 +1826,8 @@ _EOF_ fi # - Armbian special - if [[ -f '/boot/armbianEnv.txt' ]]; then - + if [[ -f '/boot/armbianEnv.txt' ]] + then # Disable bootsplash logo, as we removed the file above: https://github.com/MichaIng/DietPi/issues/3932#issuecomment-852376681 G_CONFIG_INJECT 'bootlogo=' 'bootlogo=false' /boot/armbianEnv.txt @@ -1789,7 +1836,6 @@ _EOF_ # Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/armbianEnv.txt - fi # Apply cgroups-v2 workaround on Bullseye if the kernel does not support it: https://github.com/MichaIng/DietPi/issues/4705 @@ -1890,7 +1936,7 @@ _EOF_ fi # Update config - G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX_DEFAULT=' 'GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0 quiet"' /etc/default/grub + G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX_DEFAULT=' 'GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0"' /etc/default/grub G_CONFIG_INJECT 'GRUB_CMDLINE_LINUX=' 'GRUB_CMDLINE_LINUX="net.ifnames=0"' /etc/default/grub G_CONFIG_INJECT 'GRUB_TIMEOUT=' 'GRUB_TIMEOUT=0' /etc/default/grub G_EXEC_DESC='Regenerating GRUB config' G_EXEC_OUTPUT=1 G_EXEC grub-mkconfig -o /boot/grub/grub.cfg @@ -1902,9 +1948,6 @@ _EOF_ G_DIETPI-NOTIFY 2 'Disabling soundcards by default' /boot/dietpi/func/dietpi-set_hardware soundcard none - G_DIETPI-NOTIFY 2 'Setting default CPU gov' - /boot/dietpi/func/dietpi-set_cpu - G_DIETPI-NOTIFY 2 'Resetting DietPi auto-generated settings and flag files' rm -v /boot/dietpi/.??* @@ -1928,7 +1971,7 @@ This program is free software: you can redistribute it and/or modify it under th This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along with this program. If not, please see http://www.gnu.org/licenses/ +You should have received a copy of the GNU General Public License along with this program. If not, please see https://www.gnu.org/licenses/ _EOF_ G_DIETPI-NOTIFY 2 'Disabling and clearing APT cache' @@ -1961,7 +2004,7 @@ _EOF_ sync G_DIETPI-NOTIFY 2 "The used kernel version is:\n\t- $(uname -a)" - kernel_apt_packages=$(dpkg -l | grep -E '[[:blank:]]linux-(image|dtb)-[0-9]') + local kernel_apt_packages=$(dpkg -l | grep -E '[[:blank:]]linux-(image|dtb)-') [[ $kernel_apt_packages ]] && G_DIETPI-NOTIFY 2 "The following kernel DEB packages have been found:\n\e[0m$kernel_apt_packages" G_DIETPI-NOTIFY 2 'The following kernel images and modules have been found:' @@ -1970,7 +2013,7 @@ _EOF_ G_DIETPI-NOTIFY 0 'Completed, disk can now be saved to .img for later use, or, reboot system to start first run of DietPi.' # shellcheck disable=SC2016 - G_DIETPI-NOTIFY 0 'To create an .img file, you can "poweroff" and run the following command from the host/external DietPi system:\n\t- bash -c "$(curl -sSfL https://github.com/MichaIng/DietPi/blob/master/.meta/dietpi-imager)"' + G_DIETPI-NOTIFY 0 'To create an .img file, you can "poweroff" and run the following command from the host/external DietPi system:\n\t- bash -c "$(curl -sSfL https://raw.githubusercontent.com/MichaIng/DietPi/master/.meta/dietpi-imager)"' } diff --git a/dietpi.txt b/dietpi.txt index 96b6450730..3e17ade13c 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -113,21 +113,22 @@ AUTO_SETUP_AUTOSTART_LOGIN_USER=root ##### Non-interactive Firstrun Setup ##### # On first login, run update, initial setup and software installs without any user input -# - Setting this to "1" is required for below settings to take effect -# - It is HIGHLY recommended to also set CONFIG_BOOT_WAIT_FOR_NETWORK=2, to force infinite wait for network connection during boot and prevent connection timeout errors. -# - Setting this to "1" indicates that you accept the DietPi GPLv2 license, available at /boot/dietpi-LICENSE.txt, superseding any setting of AUTO_SETUP_ACCEPT_LICENSE. +# - Setting this to "1" is required for AUTO_SETUP_GLOBAL_PASSWORD and AUTO_SETUP_INSTALL_SOFTWARE_ID. +# - Setting this to "1" indicates that you accept the DietPi GPLv2 license, available at /boot/dietpi-LICENSE.txt, superseding AUTO_SETUP_ACCEPT_LICENSE. AUTO_SETUP_AUTOMATED=0 # Global Password to be applied for the system +# - Requires AUTO_SETUP_AUTOMATED=1 # - Affects "root" and "dietpi" users login passwords and is used by dietpi-software as default for software installs which require a password. # - On first dietpi-software execution, the password is removed from this file and instead encrypted and saved to rootfs. # - WARN: We cannot guarantee that all software options can handle special characters like \"$. AUTO_SETUP_GLOBAL_PASSWORD=dietpi # Software to automatically install +# - Requires AUTO_SETUP_AUTOMATED=1 # - List of available software IDs: https://github.com/MichaIng/DietPi/wiki/DietPi-Software-list # - Add as many entries as you wish, one each line. -# - DietPi will automatically install all pre-reqs (e.g. ALSA/X11 for desktops etc) +# - DietPi will automatically install all dependencies, like ALSA/X11 for desktops etc. # - E.g. the following (without the leading "#") will install the LXDE desktop automatically on first boot: #AUTO_SETUP_INSTALL_SOFTWARE_ID=23 diff --git a/dietpi/dietpi-autostart b/dietpi/dietpi-autostart old mode 100644 new mode 100755 index 16c7456dd3..80e151d530 --- a/dietpi/dietpi-autostart +++ b/dietpi/dietpi-autostart @@ -136,7 +136,7 @@ _EOF_ # - Kodi elif (( $ID_AUTOSTART == 1 )) then - G_EXEC usermod -aG video $user + G_EXEC usermod -aG tty,input,video,audio $user getent group render > /dev/null && G_EXEC usermod -aG render $user # - Desktop autologin: As non-root user, it's LightDM-based diff --git a/dietpi/dietpi-backup b/dietpi/dietpi-backup old mode 100644 new mode 100755 index 4c8a17cd5c..65e9af3199 --- a/dietpi/dietpi-backup +++ b/dietpi/dietpi-backup @@ -176,7 +176,7 @@ _EOF_ # Generate Exclude/Include lists Create_Filter_Include_Exclude - # Check for sufficient free space + G_DIETPI-NOTIFY 2 'Checking for sufficient disk space via rsync dry-run, please wait...' local old_backup_size=$(du -sB1 "$FP_TARGET/data" | mawk '{print $1}') # Actual disk usage in bytes # - Dry run to obtain transferred data size rsync --dry-run --stats "${aRSYNC_RUN_OPTIONS_BACKUP[@]}" "$FP_SOURCE" "$FP_TARGET/data/" > .dietpi-backup_result diff --git a/dietpi/dietpi-bugreport b/dietpi/dietpi-bugreport old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-cleaner b/dietpi/dietpi-cleaner old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-cloudshell b/dietpi/dietpi-cloudshell old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config old mode 100644 new mode 100755 index fb6b2ded38..feb1668785 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -1053,12 +1053,12 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_WHIP_MENU_ARRAY=() (( $G_HW_MODEL < 10 )) && G_WHIP_MENU_ARRAY+=('' '●─ Toggle console ') - for i in /dev/tty{S,AMA,SAC}[0-9] + for i in /dev/tty{S,AMA,SAC,AML}[0-9] do [[ -e $i ]] || continue i=${i#/dev/} aSTATE[$i]='Off' - systemctl -q is-active "serial-getty@$i" && aSTATE[$i]='On' + systemctl -q is-enabled "serial-getty@$i" || systemctl -q is-active "serial-getty@$i" && aSTATE[$i]='On' G_WHIP_MENU_ARRAY+=("$i console" ": [${aSTATE[$i]}]") done @@ -1843,12 +1843,10 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR fi G_WHIP_DEFAULT_ITEM=$gpu_mem_current - if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM"; then + G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent: $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM" || return 0 - TARGETMENUID=6 # Return to this menu - /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$G_WHIP_RETURNED_VALUE" && REBOOT_REQUIRED=1 - - fi + TARGETMENUID=6 # Return to this menu + /boot/dietpi/func/dietpi-set_hardware gpumemsplit "$G_WHIP_RETURNED_VALUE" && REBOOT_REQUIRED=1 # Odroid C2 elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then @@ -1869,18 +1867,15 @@ Current setting: $user_frequency_min_text" && G_CONFIG_INJECT 'CONFIG_CPU_MIN_FR ) - if G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent : HDMI: [$display_output_text] | VPU: [$display_output_text]\nMemory : $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM\nNB: GPU/RAM figures require a reboot after a change is made."; then - - TARGETMENUID=6 # Return to this menu - case "$G_WHIP_RETURNED_VALUE" in + G_WHIP_MENU "Hardware : $G_HW_MODEL_NAME\nCurrent : HDMI: [$display_output_text] | VPU: [$display_output_text]\nMemory : $gpu_mem_current MiB GPU | $ram_mem_current MiB RAM\nNB: GPU/RAM figures require a reboot after a change is made." || return 0 - 'Headless') /boot/dietpi/func/dietpi-set_hardware headless 1;; - 'Default') /boot/dietpi/func/dietpi-set_hardware headless 0;; + TARGETMENUID=6 # Return to this menu + case "$G_WHIP_RETURNED_VALUE" in - esac - REBOOT_REQUIRED=1 + 'Headless') /boot/dietpi/func/dietpi-set_hardware headless 1 && REBOOT_REQUIRED=1;; + 'Default') /boot/dietpi/func/dietpi-set_hardware headless 0 && REBOOT_REQUIRED=1;; - fi + esac else @@ -3717,12 +3712,12 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('justboom-both' ': JustBoom: Simultaneous DAC and Digi usage') G_WHIP_MENU_ARRAY+=('rpi-dac' ': Soekris DAM1021 (pcm1794a)') - # C2 + # Odroid C2 legacy image elif (( $G_HW_MODEL == 12 )); then G_WHIP_MENU_ARRAY+=('default' ': HDMI') - G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') - G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') + modprobe -n 'snd-soc-pcm5102' 2> /dev/null && G_WHIP_MENU_ARRAY+=('odroid-hifishield-plus' ': Odroid HiFi Shield 1/Plus') + modprobe -n 'snd-soc-pcm512x-i2c' 2> /dev/null && G_WHIP_MENU_ARRAY+=('odroid-hifishield-2' ': Odroid HiFi Shield 2') # NanoPi M2/M3 elif [[ $G_HW_MODEL == 6[12] ]]; then @@ -3734,7 +3729,7 @@ Additional benchmarks: elif (( $G_HW_CPUID == 1 )); then G_WHIP_MENU_ARRAY+=('default' ': HDMI') - G_WHIP_MENU_ARRAY+=('H3-analogue' ': 3.5mm Analogue') + G_WHIP_MENU_ARRAY+=('h3-analogue' ': 3.5mm Analogue') # Sparky SBC elif (( $G_HW_MODEL == 70 )); then @@ -3752,6 +3747,12 @@ Additional benchmarks: G_WHIP_MENU_ARRAY+=('default' ': HDMI') G_WHIP_MENU_ARRAY+=('asus-tb-analogue' ': 3.5mm Analogue') + # Odroid N2: Modern image + elif [[ $G_HW_MODEL == 15 && -f '/boot/dietpiEnv.txt' ]]; then + + G_WHIP_MENU_ARRAY+=('OdroidN2_HDMI' ': Onboard digital HDMI audio (default)') + G_WHIP_MENU_ARRAY+=('OdroidN2_3.5mm' ': Onboard analogue 3.5mm audio') + fi # Intel SST DSP diff --git a/dietpi/dietpi-cpuinfo b/dietpi/dietpi-cpuinfo old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-cron b/dietpi/dietpi-cron old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-ddns b/dietpi/dietpi-ddns old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager old mode 100644 new mode 100755 index 05239c4e58..203535bcdb --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -122,8 +122,8 @@ tmpfs /var/log tmpfs size=${var_log_size:-50}M,noatime,lazytime,nodev,nosuid,mod swap_mounts=$(grep '^[[:blank:]]*[^#].*[[:blank:]]swap[[:blank:]]' $fp_fstab_tmp) tmpfs_mounts=$(grep '^[[:blank:]]*tmpfs[[:blank:]]' $fp_fstab_tmp) - # ecryptfs, vboxsf, glusterfs, bind mounts - misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:]](ecryptfs|vboxsf|glusterfs)[[:blank:]]|[[:blank:],]bind[[:blank:],])' $fp_fstab_tmp) + # ecryptfs, vboxsf, glusterfs, bind, Btrfs subvolume mounts + misc_mounts=$(grep -E '^[[:blank:]]*[^#].*([[:blank:]](ecryptfs|vboxsf|glusterfs)[[:blank:]]|[[:blank:],]bind[[:blank:],]|[[:blank:]]btrfs[[:blank:]]+(.+,)?subvol=)' $fp_fstab_tmp) # CurlFtpFS, CIFS/SMB/Samba, NFS, SSHFS net_mounts=$(grep -E '^[[:blank:]]*(curlftpfs|sshfs#|[^#].*[[:blank:]](cifs|nfs4?|fuse.sshfs)[[:blank:]])' $fp_fstab_tmp) @@ -142,7 +142,7 @@ $net_mounts $tmpfs_mounts #---------------------------------------------------------------- -# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts +# MISC: ecryptfs, vboxsf, glusterfs, bind, Btrfs subvolume mounts #---------------------------------------------------------------- $misc_mounts @@ -1723,23 +1723,25 @@ NB: If you are planning to dedicate the drive to this system, it is recommended # User inputs G_WHIP_DEFAULT_ITEM=$samba_clientname - G_WHIP_INPUTBOX 'Please enter the fileservers IP address\n - eg: 192.168.0.2' || return + G_WHIP_INPUTBOX 'Please enter the fileservers IP address or hostname.\n - E.g.: 192.168.0.2 or myNAS.local' || return samba_clientname=$G_WHIP_RETURNED_VALUE G_WHIP_DEFAULT_ITEM=$samba_clientshare - G_WHIP_INPUTBOX 'Please enter the fileservers shared folder name\n - eg: MySharedFolder' || return - samba_clientshare=$G_WHIP_RETURNED_VALUE + G_WHIP_INPUTBOX 'Please enter the fileservers shared folder name or path.\n - E.g.: mySharedFolder or path/to/folder' || return + # - Remove leading slash + samba_clientshare=${G_WHIP_RETURNED_VALUE#/} G_WHIP_DEFAULT_ITEM=$samba_clientuser - G_WHIP_INPUTBOX 'Please enter the fileservers username\n - eg: JoeBloggs' || return + G_WHIP_INPUTBOX 'Please enter the fileservers username.\n - E.g.: JoeBloggs' || return samba_clientuser=$G_WHIP_RETURNED_VALUE - G_WHIP_PASSWORD 'Please enter the fileservers password\n - eg: LetMeIn' || return + G_WHIP_PASSWORD 'Please enter the fileservers password.\n - E.g.: LetMeIn' || return samba_clientpassword=$result unset -v result G_WHIP_DEFAULT_ITEM=$samba_fp_mount_target - G_WHIP_INPUTBOX 'Please enter a unique folder name for the mount location (eg: samba). This will be placed in /mnt/' || return + G_WHIP_INPUTBOX 'Please enter a unique folder name for the mount location.\n - E.g.: samba\nThis will be placed in /mnt/. +\nNB: Please avoid white spaces or special characters for compatibility reasons.' || return # - Remove leading "/mnt/" and "/" in case entered by user samba_fp_mount_target=${G_WHIP_RETURNED_VALUE#/mnt/}; samba_fp_mount_target=${samba_fp_mount_target#/} # - Remove trailing slash and (re-)add "/mnt/" for full mount target path @@ -1814,11 +1816,11 @@ _EOF_ # User inputs G_WHIP_DEFAULT_ITEM=$nfs_server_ip - G_WHIP_INPUTBOX 'Please enter the NFS servers IP address (eg: 192.168.0.2).' || return + G_WHIP_INPUTBOX 'Please enter the NFS servers IP address or hostname.\n - E.g.: 192.168.0.2 or myNAS.local' || return nfs_server_ip=$G_WHIP_RETURNED_VALUE G_WHIP_DEFAULT_ITEM=$nfs_fp_mount_target - G_WHIP_INPUTBOX 'Please enter a unique folder name for the mount location (eg: nfs_client). This will be placed in /mnt/ + G_WHIP_INPUTBOX 'Please enter a unique folder name for the mount location.\n - E.g.: nfs_client\nThis will be placed in /mnt/. \nNB: Please avoid white spaces or special characters for compatibility reasons.' || return # - Remove leading "/mnt/" and "/" in case entered by user nfs_fp_mount_target=${G_WHIP_RETURNED_VALUE#/mnt/}; nfs_fp_mount_target=${nfs_fp_mount_target#/} diff --git a/dietpi/dietpi-explorer b/dietpi/dietpi-explorer old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-launcher b/dietpi/dietpi-launcher old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-led_control b/dietpi/dietpi-led_control old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-letsencrypt b/dietpi/dietpi-letsencrypt old mode 100644 new mode 100755 index 969263bc3d..150c73674e --- a/dietpi/dietpi-letsencrypt +++ b/dietpi/dietpi-letsencrypt @@ -55,7 +55,7 @@ G_DIETPI-NOTIFY 0 'Apache webserver detected' # Add ServerName if it doesn't exist. This is required to prevent Certbot complaining about vhost with no domain and mutes a warning on Apache start about a missing global server name. - G_CONFIG_INJECT 'ServerName[[:blank:]]' "ServerName $primary_domain" /etc/apache2/apache2.conf '^[[:blank:]]*[^#]' + G_CONFIG_INJECT 'ServerName[[:blank:]]' " ServerName $primary_domain" /etc/apache2/sites-available/000-default.conf '^[[:blank:]]*<' # Restart Apache to apply ServerName change G_EXEC systemctl restart apache2 diff --git a/dietpi/dietpi-login b/dietpi/dietpi-login old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-morsecode b/dietpi/dietpi-morsecode old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services old mode 100644 new mode 100755 index 98ebbad448..aac72051b5 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -75,10 +75,9 @@ Available services: 'postgresql' # - PHP - 'php7.2-fpm' - 'php7.3-fpm' - 'php7.4-fpm' - 'php8.0-fpm' + 'php7.3-fpm' # Buster + 'php7.4-fpm' # Bullseye + 'php8.1-fpm' # Bookworm # - Webservers 'apache2' @@ -485,7 +484,9 @@ _EOF_ readonly FP_PROCESS_TOOL_CONF='dietpi-process_tool.conf' Apply_Process_Tool(){ - local index=$1 setting=$2 value=${3,,} dp="/etc/systemd/system/${aSERVICE_NAME[$index]}.service.d" fp="$dp/$FP_PROCESS_TOOL_CONF" i + local index=$1 setting=$2 value=${3,,} i + local dp="/etc/systemd/system/${aSERVICE_NAME[$index]}.service.d" + local fp="$dp/$FP_PROCESS_TOOL_CONF" # Arrays to translate $2 integer to settings names local asetting=('CPUAffinity' 'CPUSchedulingPolicy' 'Nice' 'CPUSchedulingPriority' 'IOSchedulingClass' 'IOSchedulingPriority') @@ -534,7 +535,8 @@ _EOF_ # $1 = service index Load_Process_Tool(){ - local index=$1 fp="/etc/systemd/system/${aSERVICE_NAME[$index]}.service.d/$FP_PROCESS_TOOL_CONF" + local index=$1 + local fp="/etc/systemd/system/${aSERVICE_NAME[$index]}.service.d/$FP_PROCESS_TOOL_CONF" [[ -f $fp ]] || return # Source values from config file @@ -887,7 +889,8 @@ This affects starts/stops/restarts during DietPi-Software installs, DietPi-Updat 'Edit') - local dp="/etc/systemd/system/${aSERVICE_NAME[$MENU_SERVICE_INDEX]}.service.d" fp="$dp/dietpi-services_edit.conf" + local dp="/etc/systemd/system/${aSERVICE_NAME[$MENU_SERVICE_INDEX]}.service.d" + local fp="$dp/dietpi-services_edit.conf" if [[ ! -f $fp ]]; then diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software old mode 100644 new mode 100755 index 75c741d00d..80bc71e82a --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -192,13 +192,15 @@ INDEX_BROWSER=$INDEX_BROWSER" # Is the WireGuard kernel module natively shipped by the kernel package? WIREGUARD_BUILTIN=0 - # PHP version specific directories, APT package-, module- and command names - PHP_NAME='php7.3' - FP_PHP_BASE_DIR='/etc/php/7.3' - if (( $G_DISTRO > 5 )) + # PHP version + PHP_VERSION='7.4' + if (( $G_DISTRO < 6 )) then - PHP_NAME='php7.4' - FP_PHP_BASE_DIR='/etc/php/7.4' + PHP_VERSION='7.3' + + elif (( $G_DISTRO > 6 )) + then + PHP_VERSION='8.1' fi # Available for (need to match highest value in dietpi-obtain_hw_model) @@ -355,7 +357,9 @@ INDEX_BROWSER=$INDEX_BROWSER" aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/media/#kodi' aSOFTWARE_DEPS[$software_id]='5 152' # Bullseye + RPi 32-bit + Odroid N2 + Odroid C4: Kodi starts without X server - [[ $G_HW_MODEL -le 9 && $(dpkg --print-architecture) == 'armhf' || $G_DISTRO -ge 6 || $G_HW_MODEL == 1[56] ]] || aSOFTWARE_DEPS[$software_id]+=' 6' + [[ $G_DISTRO -ge 6 || ( $G_HW_MODEL -le 9 && $(dpkg --print-architecture) == 'armhf' ) || $G_HW_MODEL == 1[56] ]] || aSOFTWARE_DEPS[$software_id]+=' 6' + # Odroids from Bullseye on (no Amlogic fbdev Kodi build available) require an X server when no DRM is available. + [[ $G_HW_MODEL == 1[56] && $G_DISTRO -ge 6 && ! -e '/dev/dri' ]] && aSOFTWARE_DEPS[$software_id]+=' 6' #------------------ software_id=32 @@ -570,13 +574,12 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=167 aSOFTWARE_NAME[$software_id]='Raspotify' - aSOFTWARE_DESC[$software_id]='spotify connect client' + aSOFTWARE_DESC[$software_id]='Spotify connect client' aSOFTWARE_CATX[$software_id]=2 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/media/#raspotify' aSOFTWARE_DEPS[$software_id]='5' - # - ARMv8 - x86_64 - aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,3]=0 - aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,10]=0 + # - Buster: https://dtcooper.github.io/raspotify/ + aSOFTWARE_AVAIL_G_DISTRO[$software_id,5]=0 #------------------ software_id=80 @@ -601,6 +604,8 @@ INDEX_BROWSER=$INDEX_BROWSER" aSOFTWARE_CATX[$software_id]=2 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/media/#roon-extension-manager' aSOFTWARE_DEPS[$software_id]='162' + # - ARMv6 + aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 #------------------ software_id=178 @@ -1053,11 +1058,11 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=58 aSOFTWARE_NAME[$software_id]='OpenBazaar' - aSOFTWARE_DESC[$software_id]='decentralised peer to peer bitcoin market' + aSOFTWARE_DESC[$software_id]='Decentralised peer-to-peer Bitcoin marketplace' aSOFTWARE_CATX[$software_id]=6 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/social/#openbazaar' - aSOFTWARE_DEPS[$software_id]='188' - (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+=' 16' + # x86_64 uses pre-compiled binaries, ARM requires Go for compiling + (( $G_HW_ARCH == 10 )) || aSOFTWARE_DEPS[$software_id]+='188' aSOFTWARE_INTERACTIVE[$software_id]=1 #------------------ software_id=125 @@ -1132,7 +1137,7 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=66 aSOFTWARE_NAME[$software_id]='RPi-Monitor' - aSOFTWARE_DESC[$software_id]='Web interface for Raspberry Pi real time monitoring' + aSOFTWARE_DESC[$software_id]='Web interface for Raspberry Pi real-time monitoring' aSOFTWARE_CATX[$software_id]=8 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/system_stats/#rpi-monitor' # RPi only @@ -1346,7 +1351,7 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=75 aSOFTWARE_NAME[$software_id]='LASP' - aSOFTWARE_DESC[$software_id]='Apache | SQLite | PHP' + aSOFTWARE_DESC[$software_id]='Apache | SQLite | PHP' aSOFTWARE_CATX[$software_id]=12 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/webserver_stack/#lasp-web-stack' aSOFTWARE_DEPS[$software_id]='83 87 89' @@ -1355,7 +1360,7 @@ INDEX_BROWSER=$INDEX_BROWSER" software_id=76 aSOFTWARE_NAME[$software_id]='LAMP' - aSOFTWARE_DESC[$software_id]='Apache | MariaDB | PHP' + aSOFTWARE_DESC[$software_id]='Apache | MariaDB | PHP' aSOFTWARE_CATX[$software_id]=12 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/webserver_stack/#lamp-web-stack' aSOFTWARE_DEPS[$software_id]='83 88 89' @@ -2225,32 +2230,6 @@ INDEX_BROWSER=$INDEX_BROWSER" Resolve_Dependencies "$i" done - # Update PHP variables after all software titles have been marked - # - Never install PHP7.2 if PHP7.3 or PHP7.4 is already present - if (( ${aSOFTWARE_INSTALL_STATE[89]} > 0 )) && ! command -v php7.3 > /dev/null && ! command -v php7.4 > /dev/null; then - - # Do not upgrade PHP7.2, since we can support it for a long time - if command -v php7.2 > /dev/null; then - - PHP_NAME='php7.2' - FP_PHP_BASE_DIR='/etc/php/7.2' - - # ownCloud up to v10.2 - elif [[ -f '/var/www/owncloud/version.php' ]]; then - - local oc_version_major=$(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) - local oc_version_minor=$(sed -n '/OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) - if (( $oc_version_major < 10 || ( $oc_version_major == 10 && $oc_version_minor < 3 ) )); then - - PHP_NAME='php7.2' - FP_PHP_BASE_DIR='/etc/php/7.2' - - fi - - fi - - fi - } Create_Desktop_Shared_Items(){ @@ -2320,7 +2299,7 @@ fi [ -d ~/.config/autostart ] || mkdir -p ~/.config/autostart echo '[Desktop Entry]\nHidden=true' > ~/.config/autostart/dietpi-desktop_setup.desktop _EOF_ - + G_EXEC chmod +x /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh cat << '_EOF_' > /etc/xdg/autostart/dietpi-desktop_setup.desktop [Desktop Entry] Version=1.0 @@ -2331,10 +2310,6 @@ NoDisplay=true Exec=/var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh Icon=/var/lib/dietpi/dietpi-software/installed/desktop/icons/dietpi-icon.png _EOF_ - - # Add execute permissions to prevent "untrusted" prompt in MATE and possibly other desktops - G_EXEC chmod +x /usr/share/applications/*.desktop /var/lib/dietpi/dietpi-software/installed/desktop/dietpi-desktop_setup.sh - G_THREAD_WAIT } @@ -2462,7 +2437,6 @@ _EOF_ # dps_index=$software_id Download_Install 'conf_0' /etc/conf.conf # Optional input variables: # fallback_url='http...' = URL to use if e.g. grabbing URL from api.github.com fails: https://dietpi.com/phpbb/viewtopic.php?p=17390#p17390 - # no_check_url=[01] = Optionally disable URL check # dps_index=$software_id = Download from DietPi GitHub repo based on software ID/index # DEPS_LIST='pkg1 ...' = Install APT dependency packages # NB: This does not support installs that require user input (e.g.: a whiptail prompt for deb installs) @@ -2498,8 +2472,9 @@ _EOF_ # Download file if [[ $DEPS_LIST ]] then + # Check URL before starting background download, as a failure does not terminate the install # shellcheck disable=SC2154 - (( $no_check_url )) || G_CHECK_URL "$url" + G_CHECK_URL "$url" # Download as background thread if dependencies are to be installed G_THREAD_START curl -sSfL "$url" -o "$file" @@ -2511,7 +2486,7 @@ _EOF_ G_EXEC curl -sSfL "$url" -o "$file" fi - unset -v fallback_url dps_index no_check_url + unset -v fallback_url dps_index # Process downloaded file if [[ $type == 'deb' ]]; then @@ -2656,6 +2631,15 @@ _EOF_ local software_id DEPS_LIST + # Configure iptables to use nf_tables or legacy API, depending on which is supported by kernel + Configure_iptables() + { + local alt='nft' + iptables-nft -L &> /dev/null || alt='legacy' + G_EXEC update-alternatives --set iptables /usr/sbin/iptables-$alt + G_EXEC update-alternatives --set ip6tables /usr/sbin/ip6tables-$alt + } + software_id=5 # ALSA if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then @@ -2663,15 +2647,10 @@ _EOF_ # Get chosen sound card local soundcard=$(sed -n '/^[[:blank:]]*CONFIG_SOUNDCARD=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) - soundcard=${soundcard:-none} + soundcard=${soundcard:-default} - # Enable defaults if set to "none" - if [[ $soundcard == 'none' ]]; then - - # RPi: Onboard auto, Others: default - (( $G_HW_MODEL < 10 )) && soundcard='rpi-bcm2835-auto' || soundcard='default' - - fi + # Enable default if set to "none" + [[ $soundcard == 'none' ]] && soundcard='default' # Apply: Installs "alsa-utils" /boot/dietpi/func/dietpi-set_hardware soundcard "$soundcard" @@ -2686,60 +2665,68 @@ _EOF_ # Generic X server + Mesa OpenGL libraries and utilities DEPS_LIST='xserver-xorg-core xserver-xorg-input-libinput xinit dbus-x11 xfonts-base x11-xserver-utils x11-utils libgl1-mesa-dri mesa-utils mesa-utils-extra' - # On RPi, add fbdev display driver, as modesetting requires the full- or fake KMS driver overlay being enabled, so that /dev/dri/card0 exists. + # RPi: Add fbdev display driver for legacy framebuffer graphics support, as modesetting requires KMS driver overlay for /dev/dri/card0 to exists. (( $G_HW_MODEL > 9 )) || DEPS_LIST+=' xserver-xorg-video-fbdev' - # On VM, add VMware display driver, which offers slightly better performance. VirtualBox can emulate it as well, which is even the nowadays recommended default. - (( $G_HW_MODEL == 20 )) && DEPS_LIST+=' xserver-xorg-video-vmware' + # VM + if (( $G_HW_MODEL == 20 )) + then + # If KMS/DRM is supported, add VMware DDX, which offers slightly better performance compared to modesetting. VirtualBox can emulate it as well, which is even the nowadays recommended default. + # Else (e.g. Hyper-V) add classic framebuffer DDX + [[ -e '/dev/dri' ]] && DEPS_LIST+=' xserver-xorg-video-vmware' || DEPS_LIST+=' xserver-xorg-video-fbdev' + fi # Disable DPMS and screen blanking dps_index=$software_id Download_Install '98-dietpi-disable_dpms.conf' /etc/X11/xorg.conf.d/98-dietpi-disable_dpms.conf - # Rockchip RK3399 + Allwinner A64 + ASUS Tinker Board: Mesa GLESv2 - if [[ $G_HW_CPUID == [38] || $G_HW_MODEL == 52 ]]; then - - G_AGI libegl1 libgles2 - # Odroid C1: https://dietpi.com/meveric/pool/main/s/setup-odroid/ - elif (( $G_HW_MODEL == 10 )); then - + if (( $G_HW_MODEL == 10 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] + then local apackages=() apt-cache dumpavail | grep -q '^Package: mali400-odroid$' && apackages+=('mali400-odroid') || apackages+=('libegl1' 'libgles2') - apt-cache dumpavail | grep -q '^Package: xf86-video-mali-odroid$' && apackages+=('libump-odroid' 'xf86-video-mali-odroid') + apt-cache dumpavail | grep -q '^Package: xf86-video-mali-odroid$' && apackages+=('libump-odroid' 'xf86-video-mali-odroid') || apackages+=('xserver-xorg-video-fbdev') G_AGI "${apackages[@]}" # Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then - + elif (( $G_HW_MODEL == 11 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] + then local apackages=() apt-cache dumpavail | grep -q '^Package: malit628-odroid$' && apackages+=('malit628-odroid') || apackages+=('libegl1' 'libgles2') - apt-cache dumpavail | grep -q '^Package: xf86-video-armsoc-odroid$' && apackages+=('xf86-video-armsoc-odroid') + apt-cache dumpavail | grep -q '^Package: xf86-video-armsoc-odroid$' && apackages+=('xf86-video-armsoc-odroid') || apackages+=('xserver-xorg-video-fbdev') G_AGI "${apackages[@]}" # xf86-video-armsoc-odroid creates an xorg.conf # Odroid C2 - elif (( $G_HW_MODEL == 12 )); then - - DEPS_LIST= + elif (( $G_HW_MODEL == 12 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] + then apt-cache dumpavail | grep -q '^Package: mali450-odroid$' && DEPS_LIST='mali450-odroid' || DEPS_LIST='libegl1 libgles2' - apt-cache dumpavail | grep -q '^Package: xf86-video-fbturbo-odroid$' && DEPS_LIST+=' libump-odroid xf86-video-fbturbo-odroid' - G_BACKUP_FP /etc/X11/xorg.conf - dps_index=$software_id Download_Install 'xorg_c2.conf' /etc/X11/xorg.conf + if apt-cache dumpavail | grep -q '^Package: xf86-video-fbturbo-odroid$' + then + DEPS_LIST+=' libump-odroid xf86-video-fbturbo-odroid' + G_BACKUP_FP /etc/X11/xorg.conf + dps_index=$software_id Download_Install 'xorg_c2.conf' /etc/X11/xorg.conf + else + DEPS_LIST+=' xserver-xorg-video-fbdev' + fi # Odroid N2: https://dietpi.com/phpbb/viewtopic.php?t=9206 - elif (( $G_HW_MODEL == 15 )); then - + elif (( $G_HW_MODEL == 15 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] + then local apackages=('xserver-xorg-video-fbdev') apt-cache dumpavail | grep -q '^Package: malig52-fbdev-opencl-odroid$' && apackages+=('malig52-fbdev-opencl-odroid') || apackages+=('libegl1' 'libgles2') G_AGI "${apackages[@]}" # Odroid C4 - elif (( $G_HW_MODEL == 16 )); then - + elif (( $G_HW_MODEL == 16 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]] + then local apackages=('xserver-xorg-video-fbdev') apt-cache dumpavail | grep -q '^Packagerovides: malig31-fbdev-opencl-odroid$' && apackages+=('malig31-fbdev-opencl-odroid') || apackages+=('libegl1' 'libgles2') G_AGI "${apackages[@]}" + # non-x86_64 and non-RPi: Mesa GLESv2 + elif (( $G_HW_ARCH < 10 && $G_HW_MODEL < 10 )) + then + G_AGI libegl1 libgles2 fi fi @@ -2983,7 +2970,7 @@ _EOF_ else - G_EXEC mkdir -p /mnt/dietpi_userdata/postgresql + G_EXEC mkdir /mnt/dietpi_userdata/postgresql fi @@ -3120,8 +3107,7 @@ unix_socket_directories = '/run/postgresql'" > "$i/00dietpi.conf" (( $G_HW_MODEL > 9 )) || (( $G_RASPBIAN == 0 )) || version=11 fi - # Allow two attempts as workaround for ARM install issue: https://github.com/MichaIng/DietPi/issues/2524 - G_EXEC_RETRIES=1 G_AGI ca-certificates-java openjdk-$version-jre-headless + G_AGI openjdk-$version-jre-headless fi @@ -3281,7 +3267,7 @@ _EOF_ # - https://github.com/MichaIng/DietPi/issues/1558#issuecomment-691206284 # - https://github.com/MichaIng/DietPi/issues/4687 (( $G_HW_MODEL > 9 )) || cat << '_EOF_' > /etc/apt/preferences.d/dietpi-lxde -Package: openbox* obconf* libob* pcmanfm* libfm* libgtk* lx* +Package: openbox* obconf* libob* pcmanfm* libfm* gtk-* libgtk* libgail* gir1.2-gtk-3.0 lx* Pin: origin archive.raspberrypi.org Pin-Priority: -1 _EOF_ @@ -3510,7 +3496,7 @@ _EOF_ elif [[ $version == 'Nightly' ]] then - no_check_url=1 Download_Install "https://nightly.link/ravenclaw900/DietPi-Dashboard/workflows/push-build/main/dietpi-dashboard-$G_HW_ARCH_NAME$backend.zip" /opt/dietpi-dashboard + Download_Install "https://nightly.link/ravenclaw900/DietPi-Dashboard/workflows/push-build/main/dietpi-dashboard-$G_HW_ARCH_NAME$backend.zip" /opt/dietpi-dashboard url='https://raw.githubusercontent.com/ravenclaw900/DietPi-Dashboard/main/config.toml' fi G_EXEC chmod +x /opt/dietpi-dashboard/dietpi-dashboard @@ -3684,7 +3670,7 @@ _EOF_ cat << '_EOF_' > /etc/apache2/sites-available/000-default.conf # /etc/apache2/sites-available/000-default.conf - # Define directives here which shall apply for port 80 requests only + ServerName $(G_GET_NET ip) _EOF_ # Otherwise assure that the webroot is changed, as all our install options depend on it. @@ -3776,7 +3762,7 @@ _EOF_ G_BACKUP_FP /etc/nginx/nginx.conf dps_index=$software_id Download_Install 'nginx.conf' /etc/nginx/nginx.conf # Adjust socket name to PHP version - G_EXEC sed -i "s#/run/php/php.*-fpm.sock#/run/php/$PHP_NAME-fpm.sock#g" /etc/nginx/nginx.conf + G_EXEC sed -i "s#/run/php/php.*-fpm.sock#/run/php/php$PHP_VERSION-fpm.sock#g" /etc/nginx/nginx.conf # CPU core count G_EXEC sed -i "/worker_processes/c\worker_processes $G_HW_CPU_CORES;" /etc/nginx/nginx.conf @@ -3856,7 +3842,7 @@ _EOF_ ## Use PHP-FPM as PHP handler fastcgi.server += ( ".php" => (( - "socket" => "/run/php/$PHP_NAME-fpm.sock", + "socket" => "/run/php/php$PHP_VERSION-fpm.sock", "broken-scriptfilename" => "enable" )) ) @@ -3898,7 +3884,7 @@ _EOF_ local apackages=('mariadb-server') # Install PHP module if PHP was already installed - (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("$PHP_NAME-mysql") + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("php$PHP_VERSION-mysql") G_AGI "${apackages[@]}" G_EXEC systemctl stop mariadb @@ -3915,7 +3901,7 @@ _EOF_ Banner_Installing local apackages=('sqlite3') # Install PHP module if PHP was already installed - (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("$PHP_NAME-sqlite3") + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("php$PHP_VERSION-sqlite3") G_AGI "${apackages[@]}" fi @@ -3927,7 +3913,7 @@ _EOF_ local apackages=('redis-server') # Install PHP module if PHP was already installed - (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("$PHP_NAME-redis") + (( ${aSOFTWARE_INSTALL_STATE[89]} == 2 )) && apackages+=("php$PHP_VERSION-redis") G_AGI "${apackages[@]}" G_EXEC systemctl stop redis-server @@ -3951,27 +3937,27 @@ _EOF_ # - Webserver: PHP-FPM if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 || ${aSOFTWARE_INSTALL_STATE[84]} > 0 || ${aSOFTWARE_INSTALL_STATE[85]} > 0 )) then - local apackages=("$PHP_NAME-fpm") + local apackages=("php$PHP_VERSION-fpm") # - No webserver: CLI usage only (php binary) else - local apackages=("$PHP_NAME-cli") + local apackages=("php$PHP_VERSION-cli") fi # Additional PHP modules, commonly used by most web applications - apackages+=("$PHP_NAME-apcu" "$PHP_NAME-curl" "$PHP_NAME-gd" "$PHP_NAME-mbstring" "$PHP_NAME-xml" "$PHP_NAME-zip") + apackages+=("php$PHP_VERSION-apcu" "php$PHP_VERSION-curl" "php$PHP_VERSION-gd" "php$PHP_VERSION-mbstring" "php$PHP_VERSION-xml" "php$PHP_VERSION-zip") # MySQL/MariaDB PHP module - (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && apackages+=("$PHP_NAME-mysql") + (( ${aSOFTWARE_INSTALL_STATE[88]} > 0 )) && apackages+=("php$PHP_VERSION-mysql") # SQLite PHP module - (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && apackages+=("$PHP_NAME-sqlite3") + (( ${aSOFTWARE_INSTALL_STATE[87]} > 0 )) && apackages+=("php$PHP_VERSION-sqlite3") # Redis PHP module - (( ${aSOFTWARE_INSTALL_STATE[91]} > 0 )) && apackages+=("$PHP_NAME-redis") + (( ${aSOFTWARE_INSTALL_STATE[91]} > 0 )) && apackages+=("php$PHP_VERSION-redis") G_AGI "${apackages[@]}" - systemctl -q is-active "$PHP_NAME-fpm" && G_EXEC systemctl stop "$PHP_NAME-fpm" + systemctl -q is-active "php$PHP_VERSION-fpm" && G_EXEC systemctl stop "php$PHP_VERSION-fpm" # Assure that mod_php is purged in favour of PHP-FPM G_AGP 'libapache2-mod-php*' @@ -3981,14 +3967,16 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 || ${aSOFTWARE_INSTALL_STATE[84]} > 0 || ${aSOFTWARE_INSTALL_STATE[85]} > 0 )) then # Optimisations based on total cores - G_CONFIG_INJECT 'pm.max_children[[:blank:]=]' "pm.max_children = $(( $G_HW_CPU_CORES * 3 ))" "$FP_PHP_BASE_DIR/fpm/pool.d/www.conf" - G_CONFIG_INJECT 'pm.start_servers[[:blank:]=]' "pm.start_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR/fpm/pool.d/www.conf" - G_CONFIG_INJECT 'pm.min_spare_servers[[:blank:]=]' "pm.min_spare_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR/fpm/pool.d/www.conf" - G_CONFIG_INJECT 'pm.max_spare_servers[[:blank:]=]' "pm.max_spare_servers = $G_HW_CPU_CORES" "$FP_PHP_BASE_DIR/fpm/pool.d/www.conf" + G_CONFIG_INJECT 'pm.max_children[[:blank:]=]' "pm.max_children = $(( $G_HW_CPU_CORES * 3 ))" "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" + G_CONFIG_INJECT 'pm.start_servers[[:blank:]=]' "pm.start_servers = $G_HW_CPU_CORES" "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" + G_CONFIG_INJECT 'pm.min_spare_servers[[:blank:]=]' "pm.min_spare_servers = $G_HW_CPU_CORES" "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" + G_CONFIG_INJECT 'pm.max_spare_servers[[:blank:]=]' "pm.max_spare_servers = $G_HW_CPU_CORES" "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" + # Set static PATH, not passed by Lighttpd and Nginx by default but required by some web applications: https://github.com/MichaIng/DietPi/issues/5161#issuecomment-1013381362 + G_CONFIG_INJECT 'env\[PATH\][[:blank:]=]' 'env[PATH] = /usr/local/bin:/usr/bin:/bin' "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" fi # We create our own PHP mod to add DietPi specific configs. - target_php_ini="$FP_PHP_BASE_DIR/mods-available/dietpi.ini" + target_php_ini="/etc/php/$PHP_VERSION/mods-available/dietpi.ini" echo -e '; DietPi PHP settings\n; priority=97' > $target_php_ini # Session files need to be outside of /tmp and /var/tmp due to PrivateTmp=true, else phpsessionclean.service cannot clean sessions @@ -4011,19 +3999,17 @@ _EOF_ # Cache settings local cache_size=$(( $RAM_PHYS / 30 )) - (( $cache_size < 10 )) && cache_size=10 + (( $cache_size < 16 )) && cache_size=16 # - OPcache G_CONFIG_INJECT 'opcache.memory_consumption[[:blank:]=]' "opcache.memory_consumption=$cache_size" $target_php_ini - # Assure that interned_strings_buffer is never larger than half of memory_consumption: https://github.com/MichaIng/DietPi/issues/2293 - (( $($PHP_NAME -i | mawk '/^opcache.interned_strings_buffer/{print $5;exit}') > $cache_size / 2 )) && G_CONFIG_INJECT 'opcache.interned_strings_buffer[[:blank:]=]' "opcache.interned_strings_buffer=$(( $cache_size / 2 ))" $target_php_ini G_CONFIG_INJECT 'opcache.revalidate_freq[[:blank:]=]' 'opcache.revalidate_freq=60' $target_php_ini # 1 minute # - APCu - G_CONFIG_INJECT 'apc.shm_size[[:blank:]=]' "apc.shm_size=${cache_size}M" $target_php_ini + G_CONFIG_INJECT 'apc.shm_size[[:blank:]=]' "apc.shm_size=$(( $cache_size / 2 ))M" $target_php_ini G_CONFIG_INJECT 'apc.ttl[[:blank:]=]' 'apc.ttl=259200' $target_php_ini # 3 days # Enable all available PHP modules local amodules=() - mapfile -t amodules < <(find "$FP_PHP_BASE_DIR/mods-available" -type f -name '*.ini' -printf '%f\n') + mapfile -t amodules < <(find "/etc/php/$PHP_VERSION/mods-available" -type f -name '*.ini' -printf '%f\n') G_EXEC phpenmod "${amodules[@]%.ini}" unset -v amodules @@ -4041,7 +4027,7 @@ _EOF_ fi # Apache: Enable PHP-FPM - command -v a2enconf > /dev/null && { G_EXEC a2enmod proxy_fcgi setenvif; G_EXEC a2enconf "$PHP_NAME-fpm"; } + command -v a2enconf > /dev/null && { G_EXEC a2enmod proxy_fcgi setenvif; G_EXEC a2enconf "php$PHP_VERSION-fpm"; } fi software_id=90 # phpMyAdmin @@ -4050,7 +4036,10 @@ _EOF_ Banner_Installing # Install required PHP modules: https://docs.phpmyadmin.net/en/latest/require.html#php - G_AGI $PHP_NAME-{curl,gd,json,mbstring,xml,zip} + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || json="php$PHP_VERSION-json" + G_AGI php$PHP_VERSION-{curl,gd,mbstring,xml,zip} $json # Quick install: https://docs.phpmyadmin.net/en/latest/setup.html#quick-install # - Get latest version name @@ -4066,7 +4055,7 @@ _EOF_ G_EXEC mv "phpMyAdmin-$version-english" /var/www/phpmyadmin # Enable required PHP modules: https://docs.phpmyadmin.net/en/latest/require.html#php - G_EXEC phpenmod ctype curl gd json mbstring xml zip + G_EXEC phpenmod ctype curl gd mbstring xml zip ${json##*-} # Install and enable webserver config # - Apache @@ -4370,8 +4359,8 @@ _EOF_ # x86_64: Download pre-compiled binary if (( $G_HW_ARCH == 10 )) then - local fallback_url='https://github.com/OpenBazaar/openbazaar-go/releases/download/v0.14.6/openbazaar-go-linux-amd64' - Download_Install "$(curl -sSfL 'https://api.github.com/repos/OpenBazaar/openbazaar-go/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/openbazaar-go-linux-amd64"/{print $4}')" + local fallback_url='https://github.com/mobazha/openbazaar-desktop/releases/download/v2.4.12/openbazaar-go-linux-amd64' + Download_Install "$(curl -sSfL 'https://api.github.com/repos/mobazha/openbazaar-desktop/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/openbazaar-go-linux-amd64"/{print $4}')" command -v strip > /dev/null && G_EXEC strip --remove-section=.comment --remove-section=.note openbazaar-go-linux-amd64 G_EXEC mv openbazaar-go-linux-amd64 /usr/local/bin/openbazaar-go G_EXEC chmod +x /usr/local/bin/openbazaar-go @@ -4379,23 +4368,24 @@ _EOF_ # ARM: Go build required else # OpenBazaar cannot be installed in module mode yet: https://github.com/OpenBazaar/openbazaar-go/issues/2072 + G_AGI gcc libc6-dev # Build it in legacy mode in tmpfs and move only binary in place G_EXEC cd "$G_WORKING_DIR" # Failsafe - GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/OpenBazaar/openbazaar-go + GO111MODULE=off GOPATH=$PWD HOME=$PWD G_EXEC_OUTPUT=1 G_EXEC go get -v github.com/mobazha/openbazaar-go G_EXEC strip --remove-section=.comment --remove-section=.note bin/openbazaar-go G_EXEC mv bin/openbazaar-go /usr/local/bin/openbazaar-go G_EXEC_NOHALT=1 G_EXEC rm -Rf .cache src bin fi # Init OpenBazaar to have config file available, if not yet the case, and edit to allow remote client access - if [[ ! -f '/mnt/dietpi_userdata/openbazaar/config' ]]; then - + if [[ ! -f '/mnt/dietpi_userdata/openbazaar/config' ]] + then # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/openbazaar + [[ -d '/mnt/dietpi_userdata/openbazaar' ]] || G_EXEC mkdir /mnt/dietpi_userdata/openbazaar G_EXEC_OUTPUT=1 G_EXEC openbazaar-go init -d /mnt/dietpi_userdata/openbazaar - # Add current IP as gateway to allow external client connection + # Add current IPv4 address as gateway to allow external client connection G_CONFIG_INJECT '"Gateway": "' " \"Gateway\": \"/ip4/$(G_GET_NET -4 ip)/tcp/4002\"," /mnt/dietpi_userdata/openbazaar/config # Client connection credentials @@ -4403,28 +4393,21 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC openbazaar-go setapicreds -d /mnt/dietpi_userdata/openbazaar # Client IP needs to be added to allowed IP list - local ob_client_ip= - local invalid_entry= + local ob_client_ip='' invalid_entry='' while : do - if G_WHIP_INPUTBOX "${invalid_entry}Please enter the IP address of your ${aSOFTWARE_NAME[$software_id]} client machine -This is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9.]+$ ]]; then - + if G_WHIP_INPUTBOX "${invalid_entry}Please enter the IPv4 address of your ${aSOFTWARE_NAME[$software_id]} client machine. +\nThis is required, since the ${aSOFTWARE_NAME[$software_id]} server node by default does not allow any remote connection." && [[ $G_WHIP_RETURNED_VALUE =~ ^[0-9]+'.'[0-9]+'.'[0-9]+'.'[0-9]+$ ]] + then ob_client_ip=$G_WHIP_RETURNED_VALUE break - else - - invalid_entry='[FAILED] Please enter a valid IP address\n\n' - + invalid_entry='[FAILED] Please enter a valid IPv4 address.\n\n' fi done G_CONFIG_INJECT '"AllowedIPs":' " \"AllowedIPs\": [\"$ob_client_ip\"]," /mnt/dietpi_userdata/openbazaar/config - else - G_DIETPI-NOTIFY 2 "Existing ${aSOFTWARE_NAME[$software_id]} config found. Skipping pre-configuration..." - fi # User @@ -4583,7 +4566,7 @@ _EOF_ # Prepare our new config + data directory if not yet present if [[ ! -f '/mnt/dietpi_userdata/fahclient/config.xml' ]]; then - G_EXEC mkdir -p /mnt/dietpi_userdata/fahclient + [[ -d '/mnt/dietpi_userdata/fahclient' ]] || G_EXEC mkdir /mnt/dietpi_userdata/fahclient dps_index=$software_id Download_Install 'config.xml' /mnt/dietpi_userdata/fahclient/config.xml fi @@ -4612,7 +4595,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="$PHP_NAME-intl" # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions + DEPS_LIST="php$PHP_VERSION-intl" # https://doc.owncloud.com/server/next/admin_manual/installation/manual_installation/manual_installation_prerequisites.html#php-extensions if [[ -f '/var/www/owncloud/occ' ]]; then @@ -4625,7 +4608,7 @@ _EOF_ if [[ -f $datadir/dietpi-owncloud-installation-backup/occ ]]; then G_DIETPI-NOTIFY 2 'ownCloud installation backup found, starting recovery...' - G_EXEC cp -a "$datadir"/dietpi-owncloud-installation-backup/. /var/www/owncloud/ + G_EXEC cp -a "$datadir/dietpi-owncloud-installation-backup/." /var/www/owncloud/ # Correct config.php data directory entry, in case it changed due to server migration: G_CONFIG_INJECT "'datadirectory'" "'datadirectory' => '$datadir'," /var/www/owncloud/config/config.php "'dbtype'" @@ -4639,22 +4622,18 @@ _EOF_ [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } - G_DIETPI-NOTIFY 2 'Enabling required PHP modules.' # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#php-extensions - G_EXEC phpenmod ctype curl dom gd iconv intl json mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif - + G_DIETPI-NOTIFY 2 'Enabling required PHP modules' + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || json='json' + G_EXEC phpenmod ctype curl dom gd iconv intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif $json G_DIETPI-NOTIFY 2 'Enabling APCu memory cache for PHP command line usage (CLI) as well, including ownCloud occ command and cron jobs.' - echo -e '; ownCloud PHP settings\n; priority=98\napc.enable_cli=1' > $FP_PHP_BASE_DIR/mods-available/dietpi-owncloud.ini + echo -e '; ownCloud PHP settings\n; priority=98\napc.enable_cli=1' > /etc/php/$PHP_VERSION/mods-available/dietpi-owncloud.ini G_EXEC phpenmod dietpi-owncloud - # Get version string - local oc_version_major=$(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/owncloud/version.php) - [[ $oc_version_major ]] || oc_version_major=10 - local oc_version_minor=$(sed -n '/OC_VersionString/{s/^[^.]*\.//;s/\..*$//p;q}' /var/www/owncloud/version.php) - [[ $oc_version_minor ]] || oc_version_minor=8 - if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then - G_DIETPI-NOTIFY 2 'Apache webserver found, enabling ownCloud specific configuration.' # https://doc.owncloud.org/server/administration_manual/installation/manual_installation.html#configure-apache-web-server + G_DIETPI-NOTIFY 2 'Apache webserver found, enabling ownCloud specific configuration.' # https://doc.owncloud.com/server/next/admin_manual/installation/manual_installation/manual_installation_apache.html a2enmod rewrite headers env dir mime 1> /dev/null local owncloud_conf='/etc/apache2/sites-available/dietpi-owncloud.conf' if [[ -f $owncloud_conf ]]; then @@ -4710,7 +4689,7 @@ url.redirect += ( elif (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then - G_DIETPI-NOTIFY 2 'Nginx webserver found, enabling ownCloud specific configuration.' # https://doc.owncloud.org/server/administration_manual/installation/nginx_configuration.html + G_DIETPI-NOTIFY 2 'Nginx webserver found, enabling ownCloud specific configuration.' # https://github.com/owncloud/docs/blob/deda107/modules/admin_manual/examples/installation/nginx/subdirectory-configuration.conf local owncloud_conf='/etc/nginx/sites-dietpi/dietpi-owncloud.conf' if [[ -f $owncloud_conf ]]; then @@ -4720,21 +4699,9 @@ url.redirect += ( fi dps_index=$software_id Download_Install 'nginx.owncloud.conf' $owncloud_conf - # Uncomment HSTS header, if chosen via dietpi-letsencrypt and HTTPS connection test succeeds (incl. self-singed cert => exit code 5) - if [[ -f '/boot/dietpi/.dietpi-letsencrypt' && $(mawk 'NR==4' /boot/dietpi/.dietpi-letsencrypt) == 1 ]]; then - - wget -q --spider --timeout=10 --tries=2 https://localhost &> /dev/null - [[ $? == [05] ]] && sed -i 's/#add_header Strict-Transport-Security/add_header Strict-Transport-Security/g' $owncloud_conf - - fi - - # Disable pretty URLs (front controller) for ownCloud versions lower than 10: - (( $oc_version_major < 10 )) && sed -i 's/^[[:blank:]]*fastcgi_param front_controller_active true;/\t\t#fastcgi_param front_controller_active true;/g' $owncloud_conf - # Cal/CardDAV redirects to ownCloud DAV endpoint if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then - # shellcheck disable=SC2016 echo '# Redirect Cal/CardDAV requests to ownCloud endpoint: location = /.well-known/carddav { return 301 /owncloud/remote.php/dav/; } location = /.well-known/caldav { return 301 /owncloud/remote.php/dav/; }' > /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf @@ -4859,10 +4826,7 @@ The install script will now exit. After applying one of the the above, rerun die GCI_PRESERVE=1 GCI_NEWLINE=1 G_CONFIG_INJECT "'memcache.locking'" "'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis',\n'redis' => array ('host' => '$redis_sock', 'port' => 0,)," $config_php "'filelocking.enabled'" # Enable ownCloud background cron job: - # - v10.3 comes with new occ system:cron command: https://doc.owncloud.org/server/10.3/admin_manual/release_notes.html#changes-to-background-job-execution - local occ_command='occ system:cron' - (( $oc_version_major < 10 || ( $oc_version_major == 10 && $oc_version_minor < 3 ) )) && occ_command='cron.php' - crontab -u www-data -l 2> /dev/null | grep -q '/var/www/owncloud/.*cron' || ( crontab -u www-data -l 2> /dev/null ; echo "*/15 * * * * php /var/www/owncloud/$occ_command" ) | crontab -u www-data - + crontab -u www-data -l 2> /dev/null | grep -q '/var/www/owncloud/.*cron' || ( crontab -u www-data -l 2> /dev/null ; echo '*/15 * * * * php /var/www/owncloud/occ system:cron' ) | crontab -u www-data - occ background:cron # On <1 GiB devices assure at least 512 MiB swap space are available to stand 512 MiB file uploads + increased PHP cache and session file usage: https://github.com/MichaIng/DietPi/issues/2293 @@ -4874,7 +4838,7 @@ The install script will now exit. After applying one of the the above, rerun die if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - DEPS_LIST="$PHP_NAME-intl" # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + DEPS_LIST="php$PHP_VERSION-intl" # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation if [[ -f '/var/www/nextcloud/occ' ]]; then @@ -4887,7 +4851,7 @@ The install script will now exit. After applying one of the the above, rerun die if [[ -f $datadir/dietpi-nextcloud-installation-backup/occ ]]; then G_DIETPI-NOTIFY 2 'Nextcloud installation backup found, starting recovery...' - G_EXEC cp -a "$datadir"/dietpi-nextcloud-installation-backup/. /var/www/nextcloud/ + G_EXEC cp -a "$datadir/dietpi-nextcloud-installation-backup/." /var/www/nextcloud/ # Correct config.php data directory entry, in case it changed due to server migration: G_CONFIG_INJECT "'datadirectory'" "'datadirectory' => '$datadir'," /var/www/nextcloud/config/config.php "'dbtype'" @@ -4904,14 +4868,16 @@ The install script will now exit. After applying one of the the above, rerun die [[ $DEPS_LIST ]] && { G_DIETPI-NOTIFY 2 'Installing required PHP modules'; G_AGI $DEPS_LIST; DEPS_LIST=''; } - G_DIETPI-NOTIFY 2 'Enabling required PHP modules.' # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation - G_EXEC phpenmod ctype curl dom gd iconv intl json mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif + G_DIETPI-NOTIFY 2 'Enabling required PHP modules' + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || json='json' + G_EXEC phpenmod ctype curl dom gd intl mbstring pdo_mysql posix simplexml xmlreader xmlwriter zip fileinfo opcache apcu redis exif $json - G_DIETPI-NOTIFY 2 'Apply PHP override settings for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache - local interned_strings_buffer='' memory_consumption='' - (( $($PHP_NAME -i | mawk '/^opcache.interned_strings_buffer/{print $5;exit}') < 8 )) && interned_strings_buffer='\nopcache.interned_strings_buffer=8' - (( $($PHP_NAME -i | mawk '/^opcache.memory_consumption/{print $5;exit}') < 128 )) && memory_consumption='\nopcache.memory_consumption=128' - echo -e "; Nextcloud PHP settings\n; priority=98\nmemory_limit=512M$memory_consumption$interned_strings_buffer\nopcache.revalidate_freq=5\napc.enable_cli=1" > $FP_PHP_BASE_DIR/mods-available/dietpi-nextcloud.ini + G_DIETPI-NOTIFY 2 'Apply PHP override settings for Nextcloud.' # https://docs.nextcloud.com/server/stable/admin_manual/installation/server_tuning.html#enable-php-opcache + local memory_consumption=$(sed -n '/^[[:blank:]]*opcache.memory_consumption=/{s/^[^=]*=//p;q}' /etc/php/$PHP_VERSION/mods-available/dietpi.ini) + (( $memory_consumption < 64 )) && memory_consumption='\nopcache.memory_consumption=64' + echo -e "; Nextcloud PHP settings\n; priority=98\nmemory_limit=512M$memory_consumption\nopcache.revalidate_freq=5\napc.enable_cli=1" > /etc/php/$PHP_VERSION/mods-available/dietpi-nextcloud.ini G_EXEC phpenmod dietpi-nextcloud if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -4982,25 +4948,9 @@ url.redirect += ( fi dps_index=$software_id Download_Install 'nginx.nextcloud.conf' $nextcloud_conf - # Uncomment HSTS header, if chosen via dietpi-letsencrypt and HTTPS connection test succeeds (incl. self-singed cert => exit code 5) - if [[ -f '/boot/dietpi/.dietpi-letsencrypt' && $(mawk 'NR==4' /boot/dietpi/.dietpi-letsencrypt) == 1 ]]; then - - wget -q --spider --timeout=10 --tries=2 https://localhost &> /dev/null - [[ $? == [05] ]] && sed -i 's/#add_header Strict-Transport-Security/add_header Strict-Transport-Security/g' $nextcloud_conf - - fi - - # Disable pretty URLs (front controller), if Nextcloud version is lower than 13 - if (( $(sed -n '/OC_VersionString/{s/^[^0-9]*//;s/\..*$//p;q}' /var/www/nextcloud/version.php) < 13 )); then - - sed -i 's/^[[:blank:]]*fastcgi_param front_controller_active true;/\t\t#fastcgi_param front_controller_active true;/g' $nextcloud_conf - - fi - # Cal/CardDAV redirects to Nextcloud DAV endpoint if [[ ! -f '/etc/nginx/sites-dietpi/dietpi-dav_redirect.conf' ]]; then - # shellcheck disable=SC2016 echo '# Redirect Cal/CardDAV requests to Nextcloud endpoint: location = /.well-known/carddav { return 301 /nextcloud/remote.php/dav/; } location = /.well-known/caldav { return 301 /nextcloud/remote.php/dav/; }' > /etc/nginx/sites-dietpi/dietpi-dav_redirect.conf @@ -5519,12 +5469,12 @@ _EOF_ then G_EXEC mv /var/lib/mopidy /mnt/dietpi_userdata/mopidy # Workaround error about moving data dir into itself - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/.hidden_data + [[ -d '/mnt/dietpi_userdata/mopidy/.hidden_data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/.hidden_data # Non-hidden files/folders are data G_EXEC mv /mnt/dietpi_userdata/mopidy/* /mnt/dietpi_userdata/mopidy/.hidden_data G_EXEC mv /mnt/dietpi_userdata/mopidy/.hidden_data /mnt/dietpi_userdata/mopidy/data else - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data + [[ -d '/mnt/dietpi_userdata/mopidy/data' ]] || G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/data [[ -d '/var/lib/mopidy' ]] && G_EXEC rm -R /var/lib/mopidy fi @@ -5533,7 +5483,7 @@ _EOF_ then G_EXEC mv /var/cache/mopidy /mnt/dietpi_userdata/mopidy/cache else - G_EXEC mkdir -p /mnt/dietpi_userdata/mopidy/cache + [[ -d '/mnt/dietpi_userdata/mopidy/cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mopidy/cache [[ -d '/var/cache/mopidy' ]] && G_EXEC rm -R /var/cache/mopidy fi @@ -5601,8 +5551,8 @@ _EOF_ apackages+=('kodi') - # Odroids - elif [[ $G_HW_MODEL == 1[0-9] ]] + # Odroids on Buster or without DRM + elif [[ $G_HW_MODEL == 1[0-9] && ( $G_DISTRO -le 5 || ! -e '/dev/dri' ) ]] then local package_list=$(apt-cache dumpavail | mawk '/^Package: /{print $2}') @@ -5735,7 +5685,7 @@ _EOF_ dps_index=$software_id Download_Install 'minidlna.conf' /etc/minidlna.conf # Cache - G_EXEC mkdir -p /mnt/dietpi_userdata/.MiniDLNA_Cache + [[ -d '/mnt/dietpi_userdata/.MiniDLNA_Cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/.MiniDLNA_Cache G_EXEC chown -R minidlna:root /mnt/dietpi_userdata/.MiniDLNA_Cache Download_Test_Media @@ -5846,7 +5796,7 @@ _EOF_ G_CHECK_URL "$url" # Latest known version - local latest='2.4.14' + local latest='2.4.15' # ARMv7 local fallback_url="https://hndl.urbackup.org/Server/$latest/urbackup-server_${latest}_armhf.deb" @@ -5984,7 +5934,7 @@ _EOF_ fi # Setup data directory - G_EXEC mkdir -p /mnt/dietpi_userdata/rpicam + [[ -d '/mnt/dietpi_userdata/rpicam' ]] || G_EXEC mkdir /mnt/dietpi_userdata/rpicam G_EXEC rm -Rf /var/www/rpicam/media G_EXEC ln -s /mnt/dietpi_userdata/rpicam /var/www/rpicam/media @@ -6548,7 +6498,7 @@ _EOF_ fi # Dependencies: https://github.com/pi-hole/pi-hole/blob/development/automated%20install/basic-install.sh#L250 - G_AGI $PHP_NAME-xml $PHP_NAME-sqlite3 $PHP_NAME-intl + G_AGI php$PHP_VERSION-{xml,sqlite3,intl} # Unbound: Switch port to 5335 if it was installed before, else it got just configured within its install step above if (( ${aSOFTWARE_INSTALL_STATE[182]} == 2 )) && grep -q '^[[:blank:]]*port:[[:blank:]][[:blank:]]*53$' /etc/unbound/unbound.conf.d/dietpi.conf @@ -6791,7 +6741,7 @@ _EOF_ Download_Install 'https://github.com/airsonic-advanced/airsonic-advanced/releases/download/v10.6.0/airsonic.war' /mnt/dietpi_userdata/airsonic/airsonic.war else # Since v11 is not yet released, pull latest pre-release - local fallback_url='https://github.com/airsonic-advanced/airsonic-advanced/releases/download/11.0.0-SNAPSHOT.20220104090313/airsonic.war' + local fallback_url='https://github.com/airsonic-advanced/airsonic-advanced/releases/download/11.0.0-SNAPSHOT.20220205154701/airsonic.war' Download_Install "$(curl -sSfL 'https://api.github.com/repos/airsonic-advanced/airsonic-advanced/releases' | mawk -F\" '/"browser_download_url": .*\/airsonic\.war"/{print $4;exit}')" /mnt/dietpi_userdata/airsonic/airsonic.war fi @@ -7003,7 +6953,7 @@ _EOF_ fi # Download - local fallback_url="https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_$arch.tar.gz" + local fallback_url="https://github.com/fatedier/frp/releases/download/v0.39.0/frp_0.39.0_linux_$arch.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/fatedier/frp/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/frp_[0-9.]*_linux_$arch\.tar\.gz\"/{print \$4}")" G_EXEC cd frp_* @@ -7262,10 +7212,10 @@ _EOF_ fi # RPi: Install "onoff" for GPIO access - (( $G_HW_MODEL > 9 )) || G_EXEC_OUTPUT=1 G_EXEC npm i -g --unsafe-perm --no-audit onoff + (( $G_HW_MODEL > 9 )) || G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit onoff # Install Blynk JS library - G_EXEC_OUTPUT=1 G_EXEC npm i -g --unsafe-perm --no-audit blynk-library + G_EXEC_OUTPUT=1 G_EXEC npm i -g --no-audit blynk-library # Preserve existing config if [[ ! -f '/mnt/dietpi_userdata/blynk/server.properties' ]] @@ -7347,7 +7297,7 @@ _EOF_ debconf-set-selections <<< 'networkaudiod networkaudiod/license note false' # Install - no_check_url=1 Download_Install "$url$package" + Download_Install "$url$package" G_EXEC systemctl stop networkaudiod unset -v url arch package @@ -7414,7 +7364,7 @@ _EOF_ Banner_Installing - local version='2.5.0' # https://www.haproxy.org/download/ + local version='2.5.1' # https://www.haproxy.org/download/ DEPS_LIST='libpcre3-dev libssl-dev zlib1g-dev libsystemd-dev' Download_Install "https://www.haproxy.org/download/${version%.*}/src/haproxy-$version.tar.gz" @@ -7568,7 +7518,10 @@ _EOF_ 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 $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-zip" + DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-gmp php$PHP_VERSION-intl php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-zip" + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' if [[ -d '/opt/FreshRSS' ]] then @@ -7585,7 +7538,7 @@ _EOF_ fi # Enable required PHP modules: https://github.com/FreshRSS/FreshRSS#requirements - G_EXEC phpenmod curl gmp intl json pdo_mysql ctype dom mbstring xml zip + G_EXEC phpenmod curl gmp intl pdo_mysql ctype dom mbstring xml zip $json # Apache configuration if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then @@ -7858,10 +7811,10 @@ _EOF_ Banner_Installing - # ARMv6: Install package manually since repo is not compatible: https://grafana.com/grafana/download?platform=arm + # ARMv6: Install package manually since repo is not compatible: https://grafana.com/grafana/download?platform=arm&edition=oss if (( $G_HW_ARCH == 1 )); then - Download_Install 'https://dl.grafana.com/oss/release/grafana-rpi_8.1.2_armhf.deb' + Download_Install 'https://dl.grafana.com/oss/release/grafana-rpi_8.3.4_armhf.deb' # Else use official APT repo: https://grafana.com/docs/grafana/latest/installation/debian/#install-from-apt-repository else @@ -7894,7 +7847,7 @@ _EOF_ else - G_EXEC mkdir -p /mnt/dietpi_userdata/grafana + G_EXEC mkdir /mnt/dietpi_userdata/grafana G_EXEC chown -R grafana:grafana /mnt/dietpi_userdata/grafana fi @@ -7937,7 +7890,7 @@ _EOF_ G_EXEC curl -sSfL 'https://vaemendis.net/ubooquity/service/download.php' -o Ubooquity.zip G_EXEC unzip -o Ubooquity.zip G_EXEC_NOHALT=1 G_EXEC rm Ubooquity.zip - G_EXEC mkdir -p /mnt/dietpi_userdata/ubooquity + [[ -d '/mnt/dietpi_userdata/ubooquity' ]] || G_EXEC mkdir /mnt/dietpi_userdata/ubooquity G_EXEC mv {,/mnt/dietpi_userdata/ubooquity/}Ubooquity.jar # User @@ -7984,7 +7937,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Installing - local fallback_url='https://github.com/gotson/komga/releases/download/v0.143.0/komga-0.143.0.jar' + local fallback_url='https://github.com/gotson/komga/releases/download/v0.148.3/komga-0.148.3.jar' Download_Install "$(curl -sSfL 'https://api.github.com/repos/gotson/komga/releases/latest' | mawk -F\" '/"browser_download_url": .*\/komga-[^"\/]*\.jar"/{print $4}')" /mnt/dietpi_userdata/komga/komga.jar # User @@ -8045,7 +7998,7 @@ _EOF_ Banner_Installing # Install required PHP modules: https://sye.dk/sfpg/ - DEPS_LIST="$PHP_NAME-gd" + DEPS_LIST="php$PHP_VERSION-gd" Download_Install 'https://sye.dk/sfpg/Single_File_PHP_Gallery_4.8.1.zip' /var/www/gallery # Enable required PHP modules @@ -8078,34 +8031,45 @@ _EOF_ Banner_Installing # https://github.com/ampache/ampache/wiki/Installation # Required PHP modules: https://github.com/ampache/ampache/wiki/Installation#prerequisites - DEPS_LIST="$PHP_NAME-curl $PHP_NAME-intl $PHP_NAME-json $PHP_NAME-xml" + DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-intl php$PHP_VERSION-xml" + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' # Bullseye+ if (( $G_DISTRO > 5 )) then local fallback_url='https://github.com/ampache/ampache/releases/download/5.2.0/ampache-5.2.0_all.zip' Download_Install "$(curl -sSfL 'https://api.github.com/repos/ampache/ampache/releases/latest' | mawk -F\" '/"browser_download_url": ".*\/ampache-[0-9\.]*_all.zip"/{print $4}')" ampache + # Ampache is installed to /mnt/dietpi_userdata/ampache and the "public" directory linked to /var/www/ampache: https://github.com/MichaIng/DietPi/pull/5205 + local fp_install='/mnt/dietpi_userdata' fp_public='ampache/public' # Ampache v5 requires PHP7.4, hence pull latest Ampache v4 on Buster: https://github.com/ampache/ampache/wiki/Ampache-Next-Changes else local fallback_url='https://github.com/ampache/ampache/releases/download/4.4.3/ampache-4.4.3_all.zip' Download_Install "$(curl -sSfL 'https://api.github.com/repos/ampache/ampache/releases' | mawk -F\" '/"browser_download_url": ".*\/ampache-4[0-9\.]*_all.zip"/{print $4}' | head -1)" ampache + # Ampache is installed to /var/www/ampache. + local fp_install='/var/www' fp_public='ampache' fi - # Reinstall: Preserve existing config files + # Reinstall: Preserve configs from old and new paths [[ -f '/var/www/ampache/config/ampache.cfg.php' ]] && G_EXEC mv /var/www/ampache/config/ampache.cfg.php ampache/config/ [[ -f '/var/www/ampache/config/registration_agreement.php' ]] && G_EXEC mv /var/www/ampache/config/registration_agreement.php ampache/config/ - [[ -f '/var/www/ampache/channel/.htaccess' ]] && G_EXEC mv /var/www/ampache/channel/.htaccess ampache/channel/ - [[ -f '/var/www/ampache/rest/.htaccess' ]] && G_EXEC mv /var/www/ampache/rest/.htaccess ampache/rest/ - [[ -f '/var/www/ampache/play/.htaccess' ]] && G_EXEC mv /var/www/ampache/play/.htaccess ampache/play/ - [[ -d '/var/www/ampache' ]] && G_EXEC rm -R /var/www/ampache + [[ -f '/mnt/dietpi_userdata/ampache/config/ampache.cfg.php' ]] && G_EXEC mv /mnt/dietpi_userdata/ampache/config/ampache.cfg.php ampache/config/ + [[ -f '/mnt/dietpi_userdata/ampache/config/registration_agreement.php' ]] && G_EXEC mv /mnt/dietpi_userdata/ampache/config/registration_agreement.php ampache/config/ + [[ -f '/var/www/ampache/channel/.htaccess' ]] && G_EXEC mv /var/www/ampache/channel/.htaccess "$fp_public/channel/" + [[ -f '/var/www/ampache/rest/.htaccess' ]] && G_EXEC mv /var/www/ampache/rest/.htaccess "$fp_public/rest/" + [[ -f '/var/www/ampache/play/.htaccess' ]] && G_EXEC mv /var/www/ampache/play/.htaccess "$fp_public/play/" + [[ -d '/var/www/ampache' || -L '/var/www/ampache' ]] && G_EXEC rm -R /var/www/ampache + [[ -d '/mnt/dietpi_userdata/ampache' ]] && G_EXEC rm -R /mnt/dietpi_userdata/ampache - G_EXEC mv {,/var/www/}ampache + G_EXEC mv {,"$fp_install/"}ampache + [[ -d '/mnt/dietpi_userdata/ampache/public' ]] && G_EXEC ln -s /mnt/dietpi_userdata/ampache/public /var/www/ampache Download_Test_Media # Enable required PHP modules: https://github.com/ampache/ampache/wiki/Installation#prerequisites - G_EXEC phpenmod curl intl json xml + G_EXEC phpenmod curl intl xml $json # Import our pre-made Ampache database, if not existent already if [[ ! -d '/mnt/dietpi_userdata/mysql/ampache' ]]; then @@ -8115,39 +8079,39 @@ _EOF_ G_EXEC mysql ampache < ampache.sql G_EXEC_NOHALT=1 G_EXEC rm ampache.sql # Also update password here for rare but possible case that database was lost but config file still exists - [[ -f '/var/www/ampache/config/ampache.cfg.php' ]] && G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" /var/www/ampache/config/ampache.cfg.php + [[ -f $fp_install/ampache/config/ampache.cfg.php ]] && G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" "$fp_install/ampache/config/ampache.cfg.php" fi # Create new config, if not existent already - if [[ ! -f '/var/www/ampache/config/ampache.cfg.php' ]]; then - - G_EXEC mv /var/www/ampache/config/ampache.cfg.php{.dist,} - G_CONFIG_INJECT 'web_path[[:blank:]]+=' 'web_path = "/ampache"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'database_hostname[[:blank:]]+=' 'database_hostname = /run/mysqld/mysqld.sock' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'database_name[[:blank:]]+=' 'database_name = ampache' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'database_username[[:blank:]]+=' 'database_username = ampache' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'waveform[[:blank:]]+=' 'waveform = "true"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'tmp_dir_path[[:blank:]]+=' 'tmp_dir_path = "/tmp"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'generate_video_preview[[:blank:]]+=' 'generate_video_preview = "true"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'channel[[:blank:]]+=' 'channel = "true"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_m4a[[:blank:]]+=' 'transcode_m4a = "required"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_flac[[:blank:]]+=' 'transcode_flac = "required"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_mpc[[:blank:]]+=' 'transcode_mpc = "required"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_ogg[[:blank:]]+=' 'transcode_ogg = "allowed"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_wav[[:blank:]]+=' 'transcode_wav = "required"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_avi[[:blank:]]+=' 'transcode_avi = "allowed"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_mkv[[:blank:]]+=' 'transcode_mkv = "allowed"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_mpg[[:blank:]]+=' 'transcode_mpg = "allowed"' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'encode_target[[:blank:]]+=' 'encode_target = mp3' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'encode_video_target[[:blank:]]+=' 'encode_video_target = webm' /var/www/ampache/config/ampache.cfg.php - G_CONFIG_INJECT 'transcode_cmd[[:blank:]]+=' 'transcode_cmd = "ffmpeg"' /var/www/ampache/config/ampache.cfg.php + if [[ ! -f $fp_install/ampache/config/ampache.cfg.php ]]; then + + G_EXEC mv "$fp_install/ampache/config/ampache.cfg.php"{.dist,} + G_CONFIG_INJECT 'web_path[[:blank:]]+=' 'web_path = "/ampache"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'database_hostname[[:blank:]]+=' 'database_hostname = /run/mysqld/mysqld.sock' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'database_name[[:blank:]]+=' 'database_name = ampache' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'database_username[[:blank:]]+=' 'database_username = ampache' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'database_password[[:blank:]]+=' "database_password = \"$GLOBAL_PW\"" "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'waveform[[:blank:]]+=' 'waveform = "true"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'tmp_dir_path[[:blank:]]+=' 'tmp_dir_path = "/tmp"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'generate_video_preview[[:blank:]]+=' 'generate_video_preview = "true"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'channel[[:blank:]]+=' 'channel = "true"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_m4a[[:blank:]]+=' 'transcode_m4a = "required"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_flac[[:blank:]]+=' 'transcode_flac = "required"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_mpc[[:blank:]]+=' 'transcode_mpc = "required"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_ogg[[:blank:]]+=' 'transcode_ogg = "allowed"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_wav[[:blank:]]+=' 'transcode_wav = "required"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_avi[[:blank:]]+=' 'transcode_avi = "allowed"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_mkv[[:blank:]]+=' 'transcode_mkv = "allowed"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_mpg[[:blank:]]+=' 'transcode_mpg = "allowed"' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'encode_target[[:blank:]]+=' 'encode_target = mp3' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'encode_video_target[[:blank:]]+=' 'encode_video_target = webm' "$fp_install/ampache/config/ampache.cfg.php" + G_CONFIG_INJECT 'transcode_cmd[[:blank:]]+=' 'transcode_cmd = "ffmpeg"' "$fp_install/ampache/config/ampache.cfg.php" fi # Permissions: Ampache can automatically migrate old configs to the new config file - G_EXEC chown www-data /var/www/ampache/config/ampache.cfg.php + G_EXEC chown www-data "$fp_install/ampache/config/ampache.cfg.php" fi @@ -8157,6 +8121,7 @@ _EOF_ Banner_Installing G_AGI openvpn iptables Remove_SysV openvpn + Configure_iptables # Create initial server and client configs, if not yet present # - Wildcard config file detection via for loop @@ -8234,7 +8199,6 @@ verb 3 #push "redirect-gateway" #push "dhcp-option DNS 10.8.0.1" _EOF_ - # Client config cat << '_EOF_' > DietPi_OpenVPN_Client.ovpn client @@ -8274,11 +8238,14 @@ _EOF_ done # Enable IP forwarding - echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.all.forwarding=1\nnet.ipv6.conf.default.forwarding=1' > /etc/sysctl.d/dietpi-openvpn.conf - sysctl net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.forwarding=1 + echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.default.accept_ra=2\nnet.ipv6.conf.all.accept_ra=2\nnet.ipv6.conf.default.forwarding=1\nnet.ipv6.conf.all.forwarding=1' > /etc/sysctl.d/dietpi-openvpn.conf + sysctl net.ipv4.ip_forward=1 net.ipv6.conf.default.accept_ra=2 net.ipv6.conf.all.accept_ra=2 net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1 - # Web Forwarding (Setup iptables, must also be run during boot) + # ToDo: iptables NAT rules: Those need to run via pre-up and post-down rules when the OpenSSH server starts + #iptables -A FORWARD -i tun0 -j ACCEPT #iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$(G_GET_NET iface)" -j MASQUERADE + #ip6tables -A FORWARD -i tun0 -j ACCEPT + #ip6tables -t nat -A POSTROUTING -o "$(G_GET_NET iface)" -j MASQUERADE aSTART_SERVICES+=('openvpn') @@ -8298,6 +8265,7 @@ _EOF_ # APT deps G_AGI dnsutils net-tools bsdmainutils iptables-persistent # https://github.com/pivpn/pivpn/blob/master/auto_install/install.sh#L37 + Configure_iptables G_EXEC_OUTPUT=1 G_EXEC_NOEXIT=1 G_EXEC ./install.bash || aSOFTWARE_INSTALL_STATE[$software_id]=0 G_EXEC_NOHALT=1 G_EXEC rm install.bash @@ -8329,6 +8297,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- dpkg-query -s wireguard-dkms &> /dev/null && G_AGP wireguard-dkms # Install user space tools only G_AGI wireguard-tools iptables qrencode + Configure_iptables # Else, kernel headers and matching kernel image is required for wireguard-dkms to build the WireGuard kernel module else @@ -8388,6 +8357,7 @@ Package: wireguard wireguard-dkms wireguard-tools\nPin: release n=bullseye\nPin- # iptables required to forward incoming VPN traffic to local LAN/internet interface # qrencode required to print client config QR code to console G_AGI wireguard-dkms wireguard-tools iptables qrencode + Configure_iptables fi @@ -8470,9 +8440,9 @@ ListenPort = $port PostUp = sysctl net.ipv4.conf.%i.forwarding=1 net.ipv4.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1 PostUp = sysctl net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').accept_ra=2 PostUp = sysctl net.ipv6.conf.%i.forwarding=1 net.ipv6.conf.\$(ip r l 0/0 | mawk '{print \$5;exit}').forwarding=1 -PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE +PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE -PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE +PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -s 10.9.0.0/24 -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o \$(ip r l 0/0 | mawk '{print \$5;exit}') -j MASQUERADE # Client 1 @@ -8506,8 +8476,8 @@ DNS = $server_dns # Kill switch: Uncomment the following, if the client should stop any network traffic, when disconnected from the VPN server # NB: This requires "iptables" to be installed, thus will not work on most mobile phones. -#PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT -#PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT +#PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT; ip6tables -I OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT +#PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT; ip6tables -D OUTPUT ! -o %i -m mark ! --mark \$(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT [Peer] PublicKey = $( /etc/default/isc-dhcp-server # Remove all entries below wlan, so we can recreate them - G_EXEC sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces + G_EXEC sed -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces # Enable up wlan G_CONFIG_INJECT 'allow-hotplug wlan' "allow-hotplug $wifi_iface" /etc/network/interfaces @@ -8634,11 +8605,12 @@ iface $wifi_iface inet static address 192.168.42.1 netmask 255.255.255.0 #gateway 192.168.0.1 +#dns-nameservers 9.9.9.9 149.112.112.112 wireless-power off -#dns-nameservers 8.8.8.8 8.8.4.4 -# IP tables +# iptables NAT rules up iptables-restore < /etc/iptables.ipv4.nat +up ip6tables-restore < /etc/iptables.ipv6.nat _EOF_ # Assign static IP for wlan now G_EXEC ip a add 192.168.42.1 dev "$wifi_iface" @@ -8660,26 +8632,32 @@ wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP _EOF_ + G_EXEC chmod 0600 /etc/hostapd/hostapd.conf + # Use "rtl871xdrv" driver when special package has been installed dpkg-query -s hostapd-realtek &> /dev/null && G_CONFIG_INJECT 'driver=' 'driver=rtl871xdrv' /etc/hostapd/hostapd.conf + # RPi3/4 onboard WiFi: Enable Wi-Fi 4 support + [[ $G_HW_MODEL == [34] ]] && G_CONFIG_INJECT 'ieee80211n=' 'ieee80211n=1' /etc/hostapd/hostapd.conf + # Enable access point config echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' > /etc/default/hostapd # Enable IP forwarding - echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.all.forwarding=1\nnet.ipv6.conf.default.forwarding=1' > /etc/sysctl.d/dietpi-wifihotspot.conf - sysctl net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.forwarding=1 + echo -e 'net.ipv4.ip_forward=1\nnet.ipv6.conf.default.forwarding=1\nnet.ipv6.conf.all.forwarding=1' > /etc/sysctl.d/dietpi-wifihotspot.conf + sysctl net.ipv4.ip_forward=1 net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1 - # Apply IP tables - iptables -t nat -A POSTROUTING -o "$eth_iface" -j MASQUERADE + # Enable iptables NAT rules + iptables -t nat -A POSTROUTING -s 192.168.42.0/24 -o "$eth_iface" -j MASQUERADE iptables -A FORWARD -i "$eth_iface" -o "$wifi_iface" -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i "$wifi_iface" -o "$eth_iface" -j ACCEPT + ip6tables -t nat -A POSTROUTING -o "$eth_iface" -j MASQUERADE + ip6tables -A FORWARD -i "$eth_iface" -o "$wifi_iface" -m state --state RELATED,ESTABLISHED -j ACCEPT + ip6tables -A FORWARD -i "$wifi_iface" -o "$eth_iface" -j ACCEPT - # Save IP tables, applied during ifup in /etc/network/interfaces + # Save iptables rules, applied via /etc/network/interfaces iptables-save > /etc/iptables.ipv4.nat - - # RPi3/4 onboard WiFi: Enable N support - [[ $G_HW_MODEL == [34] ]] && G_CONFIG_INJECT 'ieee80211n=' 'ieee80211n=1' /etc/hostapd/hostapd.conf + ip6tables-save > /etc/iptables.ipv6.nat fi @@ -8702,18 +8680,24 @@ AutomapHostsOnResolve 1 TransPort 192.168.42.1:9040 DNSPort 192.168.42.1:53 _EOF_ - # Flush IP tables + # Flush iptables iptables -F iptables -t nat -F + ip6tables -F + ip6tables -t nat -F - # Generate tor prerouting tables + # Generate Tor prerouting tables local wifi_iface=$(G_GET_NET -t wlan iface) iptables -t nat -A PREROUTING -i "$wifi_iface" -p tcp --dport 22 -j REDIRECT --to-ports 22 iptables -t nat -A PREROUTING -i "$wifi_iface" -p udp --dport 53 -j REDIRECT --to-ports 53 iptables -t nat -A PREROUTING -i "$wifi_iface" -p tcp --syn -j REDIRECT --to-ports 9040 + ip6tables -t nat -A PREROUTING -i "$wifi_iface" -p tcp --dport 22 -j REDIRECT --to-ports 22 + ip6tables -t nat -A PREROUTING -i "$wifi_iface" -p udp --dport 53 -j REDIRECT --to-ports 53 + ip6tables -t nat -A PREROUTING -i "$wifi_iface" -p tcp --syn -j REDIRECT --to-ports 9040 - # Save IP tables + # Save iptables rules, applied via /etc/network/interfaces iptables-save > /etc/iptables.ipv4.nat + ip6tables-save > /etc/iptables.ipv6.nat # User: Test tor is functional #https://check.torproject.org @@ -8755,10 +8739,10 @@ _EOF_ Banner_Installing # Install required PHP modules - DEPS_LIST="$PHP_NAME-apcu $PHP_NAME-gd $PHP_NAME-intl $PHP_NAME-mbstring $PHP_NAME-opcache $PHP_NAME-xml" + DEPS_LIST="php$PHP_VERSION-apcu php$PHP_VERSION-gd php$PHP_VERSION-intl php$PHP_VERSION-mbstring php$PHP_VERSION-opcache php$PHP_VERSION-xml" - # Skip install, if already present - if [[ -d /var/www/pydio ]] + # Skip install if already present + if [[ -d '/var/www/pydio' ]] then G_DIETPI-NOTIFY 2 "${aSOFTWARE_NAME[$software_id]} install dir \"/var/www/pydio\" already exists. Download and install steps will be skipped. - Please manually backup your config files+data, remove the install dir and rerun \"dietpi-software (re)install $software_id\" if you need to reinstall. @@ -8768,8 +8752,8 @@ _EOF_ G_AGI $DEPS_LIST DEPS_LIST= else - Download_Install 'https://download.pydio.com/pub/core/ci/pydio-latest.tar.gz' /var/www - G_EXEC mv /var/www/pydio-latest /var/www/pydio + Download_Install 'https://download.pydio.com/pub/core/ci/pydio-latest.tar.gz' + G_EXEC mv pydio-latest /var/www/pydio fi # PHP configuration @@ -8777,8 +8761,8 @@ _EOF_ # Webserver config # - Apache - if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )); then - + if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 )) + then # Enable Apache rewrite engine a2enmod rewrite @@ -8787,8 +8771,8 @@ _EOF_ a2ensite dietpi-pydio # - Lighttpd - elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 )); then - + elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 )) + then # Enable Lighttpd setenv, access and rewrite modules G_CONFIG_INJECT '"mod_access",' ' "mod_access",' /etc/lighttpd/lighttpd.conf '"mod_.+",' G_CONFIG_INJECT '"mod_setenv",' ' "mod_setenv",' /etc/lighttpd/lighttpd.conf '"mod_.+",' @@ -8799,35 +8783,33 @@ _EOF_ G_EXEC lighty-enable-mod rewrite dietpi-pydio # - Nginx - elif (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 )); then - + elif (( ${aSOFTWARE_INSTALL_STATE[85]} > 0 )) + then # Move Pydio Nginx config in place dps_index=$software_id Download_Install 'nginx.pydio.conf' /etc/nginx/sites-dietpi/dietpi-pydio.conf - fi - # Create MySQL DB + # Database /boot/dietpi/func/create_mysql_db pydio pydio "$GLOBAL_PW" - # Setup Data directory - # - Skip if already existent + # Setup data directory local target_data_dir=/mnt/dietpi_userdata/pydio_data - if [[ -d $target_data_dir ]]; then - + # - Skip if already existent + if [[ -d $target_data_dir ]] + then G_DIETPI-NOTIFY 2 "Existing $target_data_dir found, will migrate..." [[ -e '/var/www/pydio/data' ]] && G_EXEC rm -R /var/www/pydio/data - else - # Move data structure [[ -e $target_data_dir ]] && G_EXEC rm -R $target_data_dir G_EXEC mv /var/www/pydio/data $target_data_dir - fi - - # Create symlink + # - Create symlink G_EXEC ln -sf $target_data_dir /var/www/pydio/data - G_EXEC chown -R www-data:www-data $target_data_dir + + # Permissions: Fix some files being 444 mode, breaking internal updater + G_EXEC chown -R www-data:www-data /var/www/pydio + G_EXEC chmod -R u+w /var/www/pydio fi @@ -8851,10 +8833,13 @@ _EOF_ # Update APT package status G_EXEC /usr/share/rpimonitor/scripts/updatePackagesStatus.pl + # Fix issue to display CPU temperature correctly: https://github.com/XavierBerger/RPi-Monitor/issues/374 + # shellcheck disable=SC2016 + G_CONFIG_INJECT 'dynamic.1.postprocess=' 'dynamic.1.postprocess=int($1/10 + 0.5)/100' /etc/rpimonitor/template/temperature.conf + # USB drive stats implementation by Rich - if [[ ! -f '/etc/rpimonitor/template/usb_hdd.conf' ]] && findmnt -S /dev/sda1 > /dev/null + if [[ $G_ROOTFS_DEV != '/dev/sda2' && ! -f '/etc/rpimonitor/template/usb_hdd.conf' ]] && findmnt -S /dev/sda1 > /dev/null then - G_EXEC sed -i '\|include=/etc/rpimonitor/template/sdcard.conf|a\include=/etc/rpimonitor/template/usb_hdd.conf' /etc/rpimonitor/data.conf cat << '_EOF_' > /etc/rpimonitor/template/usb_hdd.conf ######################################################################## # Extract USB HDD (sda1) information @@ -8864,30 +8849,29 @@ _EOF_ # - USBHDD1 used - yes - yes ######################################################################## static.10.name=usbhdd_total -static.10.source=df -t ext4 -static.10.regexp=sda1\s+(\d+) -static.10.postprocess=$1/1024 +static.10.source=df -m +static.10.regexp=^/dev/sda1\s+(\d+) dynamic.14.name=usbhdd_used -dynamic.14.source=df -t ext4 -dynamic.14.regexp=sda1\s+\d+\s+(\d+) -dynamic.14.postprocess=$1/1024 +dynamic.14.source=df -m +dynamic.14.regexp=^/dev/sda1\s+\d+\s+(\d+) dynamic.14.rrd=GAUGE web.status.1.content.9.name=USB HDD web.status.1.content.9.icon=usb_hdd.png -web.status.1.content.9.line.1="/sda1 Used: "+KMG(data.usbhdd_used,'M')+" ("+Percent(data.udbhdd_used,data.usbhdd_total,'M')+") Free: "+KMG(data.usbhdd_total-data.usbhdd_used,'M')+ " Total: "+ KMG(data.usbhdd_total,'M') +"" +web.status.1.content.9.line.1="/sda1 Used: "+KMG(data.usbhdd_used,'M')+" ("+Percent(data.usbhdd_used,data.usbhdd_total,'M')+") Free: "+KMG(data.usbhdd_total-data.usbhdd_used,'M')+ " Total: "+ KMG(data.usbhdd_total,'M') +"" web.status.1.content.9.line.2=ProgressBar(data.usbhdd_used,data.usbhdd_total) web.statistics.1.content.9.name=USB HDD web.statistics.1.content.9.graph.1=usbhdd_total web.statistics.1.content.9.graph.2=usbhdd_used -web.statistics.1.content.9.ds_graph_options.usbhdd_total.label=USB HDD total space (MB) +web.statistics.1.content.9.ds_graph_options.usbhdd_total.label=USB HDD total space (MiB) web.statistics.1.content.9.ds_graph_options.usbhdd_total.color="#FF7777" -web.statistics.1.content.9.ds_graph_options.usbhdd_used.label=USB HDD used space (MB) +web.statistics.1.content.9.ds_graph_options.usbhdd_used.label=USB HDD used space (MiB) web.statistics.1.content.9.ds_graph_options.usbhdd_used.lines={ fill: true } web.statistics.1.content.9.ds_graph_options.usbhdd_used.color="#7777FF" _EOF_ + G_EXEC sed -i '\|include=/etc/rpimonitor/template/sdcard.conf|a\include=/etc/rpimonitor/template/usb_hdd.conf' /etc/rpimonitor/data.conf fi fi @@ -8907,7 +8891,7 @@ _EOF_ Banner_Installing # APT deps: https://github.com/sabre-io/Baikal/wiki/Baïkal-dependencies - DEPS_LIST="$PHP_NAME-xml $PHP_NAME-mbstring $PHP_NAME-mysql" + DEPS_LIST="php$PHP_VERSION-xml php$PHP_VERSION-mbstring php$PHP_VERSION-mysql" local fallback_url='https://github.com/sabre-io/Baikal/releases/download/0.9.1/baikal-0.9.1.zip' Download_Install "$(curl -sSfL 'https://api.github.com/repos/sabre-io/Baikal/releases/latest' | mawk -F\" '/"browser_download_url": .*\/baikal-[^"\/]*\.zip"/{print $4}')" @@ -9056,13 +9040,21 @@ location = /.well-known/caldav { return 301 /baikal/html/dav.php; }' > /etc/ngi software_id=52 # Cuberite if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then - Banner_Installing + Banner_Installing # https://github.com/cuberite/cuberite/blob/master/easyinstall.sh - # ARMv6/7/8: https://github.com/cuberite/cuberite/issues/5221 + # ARMv6/7 local url='https://download.cuberite.org/linux-armhf-raspbian/Cuberite.tar.gz' + # ARMv8 + if (( $G_HW_ARCH == 3 )) + then + url='https://download.cuberite.org/linux-aarch64/Cuberite.tar.gz' + # x86_64 - (( $G_HW_ARCH == 10 )) && url='https://download.cuberite.org/linux-x86_64/Cuberite.tar.gz' + elif (( $G_HW_ARCH == 10 )) + then + url='https://download.cuberite.org/linux-x86_64/Cuberite.tar.gz' + fi Download_Install "$url" /mnt/dietpi_userdata/cuberite @@ -9072,7 +9064,7 @@ location = /.well-known/caldav { return 301 /baikal/html/dav.php; }' > /etc/ngi # Service: Needs to be Type=forking, else it shuts down automatically after startup has finished :/ ... cat << '_EOF_' > /etc/systemd/system/cuberite.service [Unit] -Description=Cuberite Server (DietPi) +Description=Cuberite (DietPi) [Service] Type=forking @@ -9084,7 +9076,9 @@ ExecStart=/mnt/dietpi_userdata/cuberite/Cuberite -d WantedBy=multi-user.target _EOF_ # Web UI settings: Do not overwrite existing! - [[ -f '/mnt/dietpi_userdata/cuberite/webadmin.ini' ]] || cat << _EOF_ > /mnt/dietpi_userdata/cuberite/webadmin.ini + [[ -f '/mnt/dietpi_userdata/cuberite/webadmin.ini' ]] || > /mnt/dietpi_userdata/cuberite/webadmin.ini + G_EXEC chmod 0600 /mnt/dietpi_userdata/cuberite/webadmin.ini + [[ -s '/mnt/dietpi_userdata/cuberite/webadmin.ini' ]] || cat << _EOF_ > /mnt/dietpi_userdata/cuberite/webadmin.ini [User:admin] Password=$GLOBAL_PW @@ -9093,7 +9087,6 @@ Ports=1339 Enabled=1 _EOF_ # Permissions - G_EXEC chmod 0600 /mnt/dietpi_userdata/cuberite/webadmin.ini G_EXEC chown -R cuberite:cuberite /mnt/dietpi_userdata/cuberite G_EXEC chmod +x /mnt/dietpi_userdata/cuberite/Cuberite @@ -9107,8 +9100,12 @@ _EOF_ local url='https://github.com/hexparrot/mineos-node.git' G_CHECK_URL "$url" + # Python 3 is not pulled by rdiff-backup on Buster, but required to compile Node.js posix. + local python= + (( $G_DISTRO > 5 )) || python='python3' + # APT deps - G_AGI rdiff-backup rsync screen + G_AGI rdiff-backup rsync screen $python # Download/Update MineOS [[ -d '/mnt/dietpi_userdata/mineos' ]] || G_EXEC mkdir /mnt/dietpi_userdata/mineos @@ -9133,12 +9130,11 @@ _EOF_ G_EXEC git config core.filemode false G_EXEC chmod +x mineos_console.js webui.js update_webui.sh reset_webui.sh generate-sslcert.sh - # Install Node 11, as MineOS is currently not compatible with newer Node versions: https://github.com/hexparrot/mineos-node/issues/374 - G_EXEC_OUTPUT=1 G_EXEC npm i -g --unsafe-perm --no-audit n - G_EXEC_OUTPUT=1 G_EXEC n 11 + # Workaround: Node.js posix needs to be installed alone first: https://github.com/MichaIng/DietPi/issues/5181 + G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit --no-package-lock posix # Install MineOS - G_EXEC_OUTPUT=1 G_EXEC npm i --unsafe-perm --no-audit + G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit G_EXEC cd "$G_WORKING_DIR" # Config: Preserve existing @@ -9199,7 +9195,7 @@ _EOF_ arch='amd64' fi - local fallback_url="https://github.com/gogs/gogs/releases/download/v0.12.3/gogs_0.12.3_linux_$arch.tar.gz" + local fallback_url="https://github.com/gogs/gogs/releases/download/v0.12.4/gogs_0.12.4_linux_$arch.tar.gz" url=$(curl -sSfL 'https://api.github.com/repos/gogs/gogs/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/gogs_[^\"\/]*_linux_$arch.tar.gz\"/{print \$4}") fi @@ -9219,7 +9215,7 @@ _EOF_ Create_User -d /etc/gogs gogs # Directories + permissions - G_EXEC mkdir -p /mnt/dietpi_userdata/gogs-repo + [[ -d '/mnt/dietpi_userdata/gogs-repo' ]] || G_EXEC mkdir /mnt/dietpi_userdata/gogs-repo G_EXEC chown -R gogs:gogs /etc/gogs /mnt/dietpi_userdata/gogs-repo # Database @@ -9497,7 +9493,7 @@ _EOF_ G_CONFIG_INJECT '"curl"[[:blank:]]' ' "curl" => "/usr/bin/curl",' /var/www/rutorrent/conf/config.php # Session dir - G_EXEC mkdir -p /mnt/dietpi_userdata/downloads/.session + [[ -d '/mnt/dietpi_userdata/downloads/.session' ]] || G_EXEC mkdir /mnt/dietpi_userdata/downloads/.session # User Create_User -g dietpi -d /mnt/dietpi_userdata/rtorrent rtorrent @@ -9610,7 +9606,7 @@ _EOF_ Create_User -g dietpi -d /mnt/dietpi_userdata/aria2 aria2 # Config - G_EXEC mkdir -p /mnt/dietpi_userdata/aria2 + [[ -d '/mnt/dietpi_userdata/aria2' ]] || G_EXEC mkdir /mnt/dietpi_userdata/aria2 [[ -f '/mnt/dietpi_userdata/aria2/aria2.conf' ]] || cat << _EOF_ > /mnt/dietpi_userdata/aria2/aria2.conf # DietPi default aria2c options served as aria2.conf file via --conf-path # https://aria2.github.io/manual/en/html/aria2c.html#options @@ -9760,7 +9756,7 @@ _EOF_ fi - local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.18.5/syncthing-linux-$arch-v1.18.5.tar.gz" + local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.19.0/syncthing-linux-$arch-v1.19.0.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/syncthing/syncthing/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/syncthing-linux-$arch-[^\"\/]*\.tar\.gz\"/{print \$4}")" G_EXEC mv syncthing-* /opt/syncthing fi @@ -9781,7 +9777,7 @@ _EOF_ G_EXEC sed -i '\|:8384|c\
0.0.0.0:8384
' /mnt/dietpi_userdata/syncthing/config.xml # Set default data directory - G_EXEC mkdir -p /mnt/dietpi_userdata/syncthing_data + [[ -d '/mnt/dietpi_userdata/syncthing_data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/syncthing_data G_EXEC chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing_data sed -i '\| /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh #!/bin/dash # Autostart run script for kiosk mode, based on @AYapejian: https://github.com/MichaIng/DietPi/issues/1737#issue-318697621 -# - Please see /root/.chromium-browser.init (and /etc/chromium.d/custom_flags) for additional EGL/GL init options +# - Please see /root/.chromium-browser.init (and /etc/chromium.d/custom_flags) for additional falgs. # Command line switches: https://peter.sh/experiments/chromium-command-line-switches/ -# --test-type gets rid of some of the chromium warnings that you may or may not care about in kiosk on a LAN +# --test-type gets rid of some of the Chromium warnings that you may or may not care about in kiosk on a LAN # --pull-to-refresh=1 # --ash-host-window-bounds="400,300" @@ -9900,7 +9896,7 @@ _EOF_ RES_X=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) RES_Y=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_Y=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) -CHROMIUM_OPTS="--kiosk --test-type --window-size=$RES_X,$RES_Y --start-fullscreen --start-maximized --window-position=0,0" +CHROMIUM_OPTS="--kiosk --test-type --window-size=${RES_X:-1280},${RES_Y:-720} --start-fullscreen --start-maximized --window-position=0,0" # If you want tablet mode, uncomment the next line. #CHROMIUM_OPTS+=' --force-tablet-mode --tablet-ui' @@ -9910,9 +9906,9 @@ URL=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_AUTOSTART_URL=/{s/^[^=]*=//p;q}' / # RPi or Debian Chromium package FP_CHROMIUM=$(command -v chromium-browser) -[ $FP_CHROMIUM ] || FP_CHROMIUM=$(command -v chromium-browser) +[ "$FP_CHROMIUM" ] || FP_CHROMIUM=$(command -v chromium) -exec xinit "$FP_CHROMIUM" $CHROMIUM_OPTS --homepage "$URL" +exec xinit "$FP_CHROMIUM" $CHROMIUM_OPTS --homepage "${URL:-https://dietpi.com/}" _EOF_ G_EXEC chmod +x /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh @@ -10176,7 +10172,7 @@ _EOF_ Create_User -d /mnt/dietpi_userdata/firefox-sync ffsync # Create database and config directory - G_EXEC mkdir -p /mnt/dietpi_userdata/firefox-sync + [[ -d '/mnt/dietpi_userdata/firefox-sync' ]] || G_EXEC mkdir /mnt/dietpi_userdata/firefox-sync # Create database if it doesn't exist [[ -f '/mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db' ]] || G_EXEC sqlite3 /mnt/dietpi_userdata/firefox-sync/FF-Sync-DB.db 'create table aTable(field1 int); drop table aTable;' @@ -10235,7 +10231,7 @@ _EOF_ # Download local version=$(curl -sSfL 'https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest' | mawk -F\" '/"tag_name": /{print $4}') - [[ $version ]] || { version='1.23.1'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + [[ $version ]] || { version='1.24.0'; G_DIETPI-NOTIFY 1 "Automatic latest ${aSOFTWARE_NAME[$software_id]} version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/dani-garcia/vaultwarden/archive/$version.tar.gz" # Replace old instance on reinstall using new project name @@ -10285,7 +10281,7 @@ _EOF_ # User Create_User -d /mnt/dietpi_userdata/vaultwarden vaultwarden - [[ ! -d '/mnt/dietpi_userdata/vaultwarden' ]] && G_EXEC mkdir -p /mnt/dietpi_userdata/vaultwarden + [[ ! -d '/mnt/dietpi_userdata/vaultwarden' ]] && G_EXEC mkdir /mnt/dietpi_userdata/vaultwarden # Config: Preserve old if [[ ! -f '/mnt/dietpi_userdata/vaultwarden/vaultwarden.env' ]] @@ -10373,9 +10369,15 @@ _EOF_ [[ -d '/etc/systemd/system/k3s.service.d' ]] || G_EXEC mkdir /etc/systemd/system/k3s.service.d echo -e '[Service]\nRestart=on-success' > /etc/systemd/system/k3s.service.d/dietpi.conf - # Enable cgroups used by Docker and alike - if [[ -f '/boot/boot.cmd' ]] && grep -q 'docker_optimizations' /boot/boot.cmd + # Enable memory cgroup + if (( $G_HW_MODEL < 10 )) + then + grep -Eq '(^|[[:blank]])cgroup_enable=memory([[:blank]]|$)' /boot/cmdline.txt || G_EXEC sed -i '/root=/s/[[:blank:]]*$/ cgroup_enable=memory/' /boot/cmdline.txt + + elif [[ -f '/boot/boot.scr' ]] && grep -q 'docker_optimizations' /boot/boot.scr then + # DietPi mainline U-Boot + [[ -f '/boot/dietpiEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/dietpiEnv.txt # Armbian [[ -f '/boot/armbianEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/armbianEnv.txt # Radxa Zero @@ -10415,10 +10417,13 @@ _EOF_ # APT dependencies: https://docs.koel.dev/#server > https://laravel.com/docs/master/deployment#server-requirements # - PHP composer install fails if no PHP SQLite and cURL modules are installed and enabled, even when MariaDB is used later. - DEPS_LIST="$PHP_NAME-bcmath $PHP_NAME-json $PHP_NAME-mbstring $PHP_NAME-xml $PHP_NAME-curl $PHP_NAME-sqlite3" + DEPS_LIST="php$PHP_VERSION-bcmath php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-curl php$PHP_VERSION-sqlite3" + # - Add JSON module for PHP7, as it does not exist (embedded in core package) on PHP8 + local json= + [[ $PHP_VERSION == 8* ]] || DEPS_LIST+=" php$PHP_VERSION-json" json='json' # Grab latest release - local fallback_url='https://github.com/koel/koel/releases/download/v5.1.12/koel-v5.1.12.tar.gz' + local fallback_url='https://github.com/koel/koel/releases/download/v5.1.13/koel-v5.1.13.tar.gz' Download_Install "$(curl -sSfL 'https://api.github.com/repos/koel/koel/releases/latest' | mawk -F\" '/"browser_download_url": .*\/koel-[^"\/]*\.tar\.gz"/{print $4}')" # Reinstall: Clear previous install, but keep existing config file @@ -10435,7 +10440,7 @@ _EOF_ G_EXEC chmod +x /usr/local/bin/composer # Enable required PHP modules - G_EXEC phpenmod bcmath ctype fileinfo json mbstring tokenizer xml pdo_sqlite curl sqlite3 + G_EXEC phpenmod bcmath ctype fileinfo mbstring tokenizer xml pdo_sqlite curl sqlite3 $json # Install Koel G_EXEC cd /mnt/dietpi_userdata/koel @@ -10480,8 +10485,8 @@ _EOF_ Download_Test_Media # Init - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel $PHP_NAME artisan koel:init -n --no-assets - G_EXEC_OUTPUT=1 G_EXEC sudo -u koel $PHP_NAME artisan koel:sync + G_EXEC_OUTPUT=1 G_EXEC sudo -u koel php$PHP_VERSION artisan koel:init -n --no-assets + G_EXEC_OUTPUT=1 G_EXEC sudo -u koel php$PHP_VERSION artisan koel:sync G_EXEC cd "$G_WORKING_DIR" # Service: Run on port 8003 by default to avoid conflict with IceCast @@ -10496,7 +10501,7 @@ After=network-online.target SyslogIdentifier=Koel User=koel WorkingDirectory=/mnt/dietpi_userdata/koel -ExecStart=$(command -v $PHP_NAME) /mnt/dietpi_userdata/koel/artisan serve --host 0.0.0.0 --port 8003 +ExecStart=$(command -v php$PHP_VERSION) /mnt/dietpi_userdata/koel/artisan serve --host 0.0.0.0 --port 8003 [Install] WantedBy=multi-user.target @@ -10531,7 +10536,7 @@ _EOF_ [[ -f '/mnt/dietpi_userdata/sonarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/sonarr/nzbdrone.db.bak # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/sonarr + [[ -d '/mnt/dietpi_userdata/sonarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/sonarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/sonarr sonarr @@ -10608,7 +10613,7 @@ _EOF_ else # ARMv6 local url=$(curl -sSfL 'https://api.github.com/repos/Radarr/Radarr/releases/latest' | mawk -F\" '/"browser_download_url": .*linux\.tar\.gz"/{print $4}') - local version='3.2.2.5080' + local version='4.0.4.5922' local fallback_url="https://github.com/Radarr/Radarr/releases/download/v$version/Radarr.master.$version.linux.tar.gz" # ARMv7 @@ -10639,7 +10644,7 @@ _EOF_ [[ -f '/mnt/dietpi_userdata/radarr/nzbdrone.db.bak' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /mnt/dietpi_userdata/radarr/nzbdrone.db.bak # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/radarr + [[ -d '/mnt/dietpi_userdata/radarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/radarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/radarr radarr @@ -10747,7 +10752,7 @@ _EOF_ fi # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/lidarr + [[ -d '/mnt/dietpi_userdata/lidarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/lidarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/lidarr lidarr @@ -10818,7 +10823,7 @@ _EOF_ G_EXEC cd "$G_WORKING_DIR" # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/bazarr + [[ -d '/mnt/dietpi_userdata/bazarr' ]] || G_EXEC mkdir /mnt/dietpi_userdata/bazarr # User Create_User -g dietpi -d /mnt/dietpi_userdata/bazarr bazarr @@ -10910,7 +10915,7 @@ _EOF_ Create_User -d /mnt/dietpi_userdata/tautulli tautulli # Directory - G_EXEC mkdir -p /mnt/dietpi_userdata/tautulli + [[ -d '/mnt/dietpi_userdata/tautulli' ]] || G_EXEC mkdir /mnt/dietpi_userdata/tautulli # Service: https://github.com/Tautulli/Tautulli/blob/master/init-scripts/init.systemd cat << _EOF_ > /etc/systemd/system/tautulli.service @@ -10941,7 +10946,7 @@ _EOF_ # - ARMv6: Requires Mono: https://github.com/Jackett/Jackett#installation-on-linux-armv6-or-below local url=$(curl -sSfL 'https://api.github.com/repos/Jackett/Jackett/releases/latest' | mawk -F\" '/"browser_download_url": .*\/Jackett\.Binaries\.Mono\.tar\.gz"/{print $4}') - local fallback_url='https://github.com/Jackett/Jackett/releases/download/v0.20.266/Jackett.Binaries.Mono.tar.gz' + local fallback_url='https://github.com/Jackett/Jackett/releases/download/v0.20.510/Jackett.Binaries.Mono.tar.gz' # - ARMv7 if (( $G_HW_ARCH == 2 )); then @@ -11034,7 +11039,7 @@ _EOF_ Banner_Installing G_EXEC curl -sSfL 'https://nzbget.net/download/nzbget-latest-bin-linux.run' -o package.run - G_EXEC mkdir -p /mnt/dietpi_userdata/nzbget + [[ -d '/mnt/dietpi_userdata/nzbget' ]] || G_EXEC mkdir /mnt/dietpi_userdata/nzbget G_EXEC_OUTPUT=1 G_EXEC dash package.run --destdir /mnt/dietpi_userdata/nzbget G_EXEC_NOHALT=1 G_EXEC rm package.run @@ -11095,24 +11100,21 @@ _EOF_ # Python build dependencies for ARM (( $G_HW_ARCH < 10 )) && G_AGI libffi-dev libssl-dev zlib1g-dev libjpeg-dev - if [[ -d '/mnt/dietpi_userdata/htpc-manager/.git' ]]; then - + if [[ -d '/mnt/dietpi_userdata/htpc-manager/.git' ]] + then G_EXEC cd /mnt/dietpi_userdata/htpc-manager G_EXEC_OUTPUT=1 G_EXEC git remote set-url origin "$url" G_EXEC_OUTPUT=1 G_EXEC git fetch origin G_EXEC_OUTPUT=1 G_EXEC git reset --hard origin G_EXEC_OUTPUT=1 G_EXEC git clean -dxfe '/userdata' - else - G_EXEC_OUTPUT=1 G_EXEC git clone --depth 1 "$url" - G_EXEC mkdir -p /mnt/dietpi_userdata/htpc-manager + [[ -d '/mnt/dietpi_userdata/htpc-manager' ]] || G_EXEC mkdir /mnt/dietpi_userdata/htpc-manager G_EXEC cp -a HTPC-Manager/. /mnt/dietpi_userdata/htpc-manager/ G_EXEC_NOHALT=1 G_EXEC rm -R HTPC-Manager G_EXEC cd /mnt/dietpi_userdata/htpc-manager G_EXEC_OUTPUT=1 G_EXEC git reset --hard origin G_EXEC_OUTPUT=1 G_EXEC git clean -dxfe '/userdata' - fi # Python deps @@ -11148,7 +11150,7 @@ _EOF_ [[ -d '/mnt/dietpi_userdata/octoprint/.cache' ]] && G_EXEC rm -R /mnt/dietpi_userdata/octoprint/.cache # Install OctoPrint - G_EXEC_OUTPUT=1 G_EXEC sudo -u octoprint pip3 install --no-cache-dir -U --user octoprint + G_EXEC_OUTPUT=1 G_EXEC sudo -u octoprint pip3 install --no-cache-dir -U --user --no-warn-script-location octoprint # Service: https://github.com/OctoPrint/OctoPrint/blob/master/scripts/octoprint.service cat << '_EOF_' > /etc/systemd/system/octoprint.service @@ -11293,7 +11295,7 @@ _EOF_ G_EXEC mv /root/.steam /mnt/dietpi_userdata/steam else - G_EXEC mkdir -p /mnt/dietpi_userdata/steam + G_EXEC mkdir /mnt/dietpi_userdata/steam fi G_EXEC ln -s /mnt/dietpi_userdata/steam /root/.steam @@ -11394,9 +11396,15 @@ _EOF_ G_CONFIG_INJECT '\[debug\]' '[debug]' /etc/containerd/config.toml GCI_PRESERVE=1 G_CONFIG_INJECT 'level[[:blank:]]*=' ' level = "warn"' /etc/containerd/config.toml '^\[debug\]' - # Enable cgroups used by Docker and alike - if [[ -f '/boot/boot.cmd' ]] && grep -q 'docker_optimizations' /boot/boot.cmd + # Enable memory cgroup + if (( $G_HW_MODEL < 10 )) + then + grep -Eq '(^|[[:blank]])cgroup_enable=memory([[:blank]]|$)' /boot/cmdline.txt || G_EXEC sed -i '/root=/s/[[:blank:]]*$/ cgroup_enable=memory/' /boot/cmdline.txt + + elif [[ -f '/boot/boot.scr' ]] && grep -q 'docker_optimizations' /boot/boot.scr then + # DietPi mainline U-Boot + [[ -f '/boot/dietpiEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/dietpiEnv.txt # Armbian [[ -f '/boot/armbianEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/armbianEnv.txt # Radxa Zero @@ -11541,7 +11549,7 @@ _EOF_ arch='amd64' fi - local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.15.9/gitea-1.15.9-linux-$arch" + local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.16.0/gitea-1.16.0-linux-$arch" Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/gitea-[^\"\/]*-linux-$arch\"/{print \$4}")" /mnt/dietpi_userdata/gitea/gitea # User @@ -11913,6 +11921,9 @@ _EOF_ # shellcheck disable=SC2015 [[ -d '/var/cache/jellyfin' ]] && G_EXEC mv /var/cache/jellyfin /mnt/dietpi_userdata/jellyfin/cache || G_EXEC mkdir /mnt/dietpi_userdata/jellyfin/cache G_CONFIG_INJECT 'JELLYFIN_CACHE_DIR=' 'JELLYFIN_CACHE_DIR=/mnt/dietpi_userdata/jellyfin/cache' /etc/default/jellyfin + # Change default port due to conflict with Emby + G_CONFIG_INJECT '' '8097' /etc/jellyfin/network.xml + G_CONFIG_INJECT '' ' 8097' /etc/jellyfin/network.xml fi # Permissions @@ -11962,8 +11973,8 @@ _EOF_ G_EXEC strip --remove-section=.comment --remove-section=.note box86 G_EXEC make install - # Reload binfmt to have i386 binaries executed via box86 automatically from now on - G_EXEC systemctl restart systemd-binfmt + # Reload binfmt if kernel module is available (covering kernel upgrade without reboot) to have i386 binaries executed via box86 automatically from now on + modprobe binfmt_misc 2> /dev/null && G_EXEC systemctl restart systemd-binfmt fi software_id=197 # Box64 @@ -11998,8 +12009,8 @@ _EOF_ G_EXEC strip --remove-section=.comment --remove-section=.note box64 G_EXEC make install - # Reload binfmt to have x86_64 binaries executed via box64 automatically from now on - G_EXEC systemctl restart systemd-binfmt + # Reload binfmt if kernel module is available (covering kernel upgrade without reboot) to have x86_64 binaries executed via box64 automatically from now on + modprobe binfmt_misc 2> /dev/null && G_EXEC systemctl restart systemd-binfmt fi software_id=27 # TasmoAdmin @@ -12008,7 +12019,7 @@ _EOF_ Banner_Installing # Install required PHP modules - DEPS_LIST="$PHP_NAME-curl $PHP_NAME-zip" # https://github.com/reloxx13/TasmoAdmin#linux + DEPS_LIST="php$PHP_VERSION-curl php$PHP_VERSION-zip" # https://github.com/reloxx13/TasmoAdmin#linux # Skip install, if already present if [[ -d '/var/www/tasmoadmin' ]] @@ -12081,7 +12092,7 @@ _EOF_ local ha_user='homeassistant' local ha_home="/home/$ha_user" local ha_pyenv_activation=". $ha_home/pyenv-activate.sh" - local ha_python_version='3.9.9' + local ha_python_version='3.9.10' # https://www.python.org/downloads/ G_DIETPI-NOTIFY 2 "Home Assistant user: $ha_user" G_DIETPI-NOTIFY 2 "Home Assistant home: $ha_home" @@ -12177,6 +12188,7 @@ After=network-online.target mariadb.service SyslogIdentifier=homeassistant User=homeassistant ExecStart=/home/homeassistant/homeassistant-start.sh +RestartForceExitStatus=100 [Install] WantedBy=multi-user.target @@ -12188,7 +12200,7 @@ _EOF_ then G_EXEC mv /home/homeassistant/.homeassistant /mnt/dietpi_userdata/homeassistant else - G_EXEC mkdir -p /mnt/dietpi_userdata/homeassistant + G_EXEC mkdir /mnt/dietpi_userdata/homeassistant fi fi G_EXEC rm -Rf /home/homeassistant/.homeassistant @@ -12212,7 +12224,7 @@ _EOF_ #local file=$(curl -sSfL "$url/versions/$version/builds/$build"); file=${file##*\"name\":\"} file=${file%%\"*} # Download and install PaperMC Download_Install "$url/versions/$version/builds/$build/downloads/paper-$version-$build.jar" /opt/papermc/paperclip.jar - G_EXEC mkdir -p /mnt/dietpi_userdata/papermc + [[ -d '/mnt/dietpi_userdata/papermc' ]] || G_EXEC mkdir /mnt/dietpi_userdata/papermc G_EXEC eval 'echo "eula=true" > /mnt/dietpi_userdata/papermc/eula.txt' # User @@ -12301,7 +12313,7 @@ _EOF_ Download_Install "https://releases.domoticz.com/releases/release/domoticz_linux_${G_HW_ARCH_NAME/armv6l/armv7l}.tgz" /opt/domoticz # Data dir - G_EXEC mkdir -p /mnt/dietpi_userdata/domoticz + [[ -d '/mnt/dietpi_userdata/domoticz' ]] || G_EXEC mkdir /mnt/dietpi_userdata/domoticz # Config file if [[ ! -f '/mnt/dietpi_userdata/domoticz/domoticz.conf' ]]; then @@ -12507,7 +12519,7 @@ _EOF_ # Config: Do not touch on reinstall if [[ ! -f '/mnt/dietpi_userdata/spotifyd/spotifyd.conf' ]] then - G_EXEC mkdir -p /mnt/dietpi_userdata/spotifyd/cache + [[ -d '/mnt/dietpi_userdata/spotifyd/cache' ]] || G_EXEC mkdir /mnt/dietpi_userdata/spotifyd/cache dps_index=$software_id Download_Install 'spotifyd.conf' /mnt/dietpi_userdata/spotifyd/spotifyd.conf G_EXEC chmod 0600 /mnt/dietpi_userdata/spotifyd/spotifyd.conf fi @@ -12610,41 +12622,44 @@ _EOF_ Install_Apply_GPU_Settings(){ - # RPi: Define minimal memory split based on installed software - local gpu_memory=0 + # RPi: Recommend memory split based on installed software + local suggest_gpu_mem=0 - # Kodi prior to Bullseye, Jellyfin - if (( ( ${aSOFTWARE_INSTALL_STATE[31]} == 1 && $G_DISTRO < 6 ) || ${aSOFTWARE_INSTALL_STATE[178]} == 1 )); then + # Kodi, Jellyfin + if (( ${aSOFTWARE_INSTALL_STATE[31]} == 1 || ${aSOFTWARE_INSTALL_STATE[178]} == 1 )); then - gpu_memory=256 - (( ${G_HW_MEMORY_SIZE:-0} > 256 )) || gpu_memory=128 + suggest_gpu_mem=256 + (( ${G_HW_MEMORY_SIZE:-0} > 256 )) || suggest_gpu_mem=128 # DXX-Rebirth elif (( ${aSOFTWARE_INSTALL_STATE[112]} == 1 )); then - gpu_memory=128 + suggest_gpu_mem=128 # RPi Cam Control, Amiberry, Chromium elif (( ${aSOFTWARE_INSTALL_STATE[59]} == 1 || ${aSOFTWARE_INSTALL_STATE[108]} == 1 || ${aSOFTWARE_INSTALL_STATE[113]} == 1 )); then - gpu_memory=96 + suggest_gpu_mem=96 - # Desktops, OpenTyrian, Kodi since Bullseye + # Desktops, OpenTyrian elif (( ${aSOFTWARE_INSTALL_STATE[23]} == 1 || ${aSOFTWARE_INSTALL_STATE[24]} == 1 || ${aSOFTWARE_INSTALL_STATE[25]} == 1 || ${aSOFTWARE_INSTALL_STATE[26]} == 1 || - ${aSOFTWARE_INSTALL_STATE[31]} == 1 || - ${aSOFTWARE_INSTALL_STATE[51]} == 1 )); then + ${aSOFTWARE_INSTALL_STATE[51]} == 1 || + ${aSOFTWARE_INSTALL_STATE[173]} == 1 )); then - gpu_memory=1 # default + suggest_gpu_mem=1 # default fi - # Disable headless/enable GPU when graphics software was installed - (( $gpu_memory )) || return 0 + # RPi Bullseye: No need to raise GPU memory above default with CMA + (( $G_DISTRO > 5 && $suggest_gpu_mem > 1 )) && suggest_gpu_mem=1 + + # Disable headless/enable GPU when GUI software was installed + (( $suggest_gpu_mem )) || return 0 /boot/dietpi/func/dietpi-set_hardware headless 0 @@ -12652,13 +12667,15 @@ _EOF_ (( $G_HW_MODEL < 10 )) || return 0 # Never override a higher existing value + local default_gpu_mem=76 + (( $G_HW_MEMORY_SIZE < 1024 )) && default_gpu_mem=64 local current_gpu_mem=$(sed -n '/^[[:blank:]]*gpu_mem_1024=/{s/^[^=]*=//p;q}' /boot/config.txt) - [[ $current_gpu_mem ]] || { (( $G_HW_MEMORY_SIZE < 1024 )) && current_gpu_mem=64 || current_gpu_mem=76; } - (( $gpu_memory == 1 )) && gpu_memory=$current_gpu_mem - (( $current_gpu_mem < $gpu_memory )) && G_WHIP_DEFAULT_ITEM='Ok' G_WHIP_YESNO "[ INFO ] DietPi has detected an increased GPU memory is required for your installed software: - - Current: $current_gpu_mem MiB\n - Recommended: $gpu_memory MiB\n\nWould you like DietPi to apply the recommended GPU memory split?\n\nIf unsure, select 'Ok'." || return 0 + [[ $current_gpu_mem ]] || current_gpu_mem=$default_gpu_mem + (( $suggest_gpu_mem == 1 )) && suggest_gpu_mem=$default_gpu_mem + (( $current_gpu_mem < $suggest_gpu_mem )) && G_WHIP_DEFAULT_ITEM='Ok' G_WHIP_YESNO "[ INFO ] DietPi has detected an increased GPU memory is required for your installed software: + - Current: $current_gpu_mem MiB\n - Recommended: $suggest_gpu_mem MiB\n\nWould you like DietPi to apply the recommended GPU memory split?\n\nIf unsure, select 'Ok'." || return 0 - /boot/dietpi/func/dietpi-set_hardware gpumemsplit $gpu_memory + /boot/dietpi/func/dietpi-set_hardware gpumemsplit $suggest_gpu_mem } @@ -12959,6 +12976,7 @@ _EOF_ # Config [[ -d '/etc/lighttpd' ]] && G_EXEC rm -R /etc/lighttpd + [[ -d '/var/www/index.lighttpd.html' ]] && G_EXEC rm /var/www/index.lighttpd.html # Pre-v8.0: Certbot renewal hook [[ -f 'etc/systemd/system/certbot.service.d/dietpi-lighttpd.conf' ]] && G_EXEC rm /etc/systemd/system/certbot.service.d/dietpi-lighttpd.conf @@ -12990,7 +13008,7 @@ _EOF_ Banner_Uninstalling G_AGP 'php*-*' 'libapache2-mod-php*' - G_EXEC rm -Rf /{etc,var/lib}/php + G_EXEC rm -Rf /{etc,var/lib}/php /var/log/php*-fpm.log [[ -f '/etc/tmpfiles.d/dietpi-php_sessions.conf' ]] && G_EXEC rm /etc/tmpfiles.d/dietpi-php_sessions.conf [[ -f '/var/www/phpinfo.php' ]] && G_EXEC rm /var/www/phpinfo.php [[ -f '/var/www/apc.php' ]] && G_EXEC rm /var/www/apc.php @@ -13143,7 +13161,7 @@ _EOF_ G_EXEC rm -Rf /{root,home/*}/.node-red # Pre-v6.25 # Pre-v7.0 - command -v npm > /dev/null && npm r -g --unsafe-perm node-red + command -v npm > /dev/null && npm r -g node-red [[ -f '/usr/local/bin/node-red' ]] && G_EXEC rm /usr/local/bin/node-red [[ -f '/usr/local/bin/node-red-pi' ]] && G_EXEC rm /usr/local/bin/node-red-pi @@ -13211,7 +13229,7 @@ _EOF_ [[ -d '/var/log/blynk' ]] && G_EXEC rm -R /var/log/blynk getent passwd blynk > /dev/null && G_EXEC userdel blynk getent group blynk > /dev/null && G_EXEC groupdel blynk - command -v npm > /dev/null && npm r -g --unsafe-perm blynk-library + command -v npm > /dev/null && npm r -g blynk-library [[ -f '/usr/local/bin/blynk-ctrl' ]] && G_EXEC rm /usr/local/bin/blynk-ctrl [[ -f '/usr/local/bin/blynk-client' ]] && G_EXEC rm /usr/local/bin/blynk-client [[ -d '/etc/blynkserver' ]] && G_EXEC rm -R /etc/blynkserver # Pre-v6.19 @@ -13808,6 +13826,7 @@ _EOF_ [[ -f '/etc/modules-load.d/dietpi-n2-kodi.conf' ]] && G_EXEC rm /etc/modules-load.d/dietpi-n2-kodi.conf [[ -f '/etc/modules-load.d/dietpi-c4-kodi.conf' ]] && G_EXEC rm /etc/modules-load.d/dietpi-c4-kodi.conf [[ -f '/etc/apt/preferences.d/dietpi-kodi' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-kodi + [[ -f '/var/lib/dietpi/dietpi-software/installed/desktop/icons/kodi-icon.png' ]] && G_EXEC rm /var/lib/dietpi/dietpi-software/installed/desktop/icons/kodi-icon.png fi @@ -14197,7 +14216,8 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == -1 )); then Banner_Uninstalling - [[ -d '/var/www/ampache' ]] && G_EXEC rm -R /var/www/ampache + [[ -d '/var/www/ampache' || -L '/var/www/ampache' ]] && G_EXEC rm -R /var/www/ampache + [[ -d '/mnt/dietpi_userdata/ampache' ]] && G_EXEC rm -R /mnt/dietpi_userdata/ampache # Drop database systemctl start mariadb @@ -14327,6 +14347,7 @@ _EOF_ [[ -f '/etc/default/isc-dhcp-server' ]] && G_EXEC rm /etc/default/isc-dhcp-server [[ -f '/etc/etc/default/hostapd' ]] && G_EXEC rm /etc/default/hostapd [[ -f '/etc/iptables.ipv4.nat' ]] && G_EXEC rm /etc/iptables.ipv4.nat + [[ -f '/etc/iptables.ipv6.nat' ]] && G_EXEC rm /etc/iptables.ipv6.nat # Remove binary (used a -f trigger to detect WiFi hotspot mode in dietpi-config). [[ -f '/usr/sbin/hostapd' ]] && G_EXEC rm /usr/sbin/hostapd [[ -f '/usr/sbin/hostapd_cli' ]] && G_EXEC rm /usr/sbin/hostapd_cli @@ -14337,7 +14358,7 @@ _EOF_ # Set WiFi interface back to inactive and ready for use with dietpi-config. local wifi_iface=$(G_GET_NET -t wlan iface) # - Remove WLAN block, so we can recreate it - G_EXEC sed -i '/allow-hotplug wlan/q0' /etc/network/interfaces + G_EXEC sed -Ei '/(allow-hotplug|auto)[[:blank:]]+wlan/q0' /etc/network/interfaces # - Disable G_EXEC sed -i "/allow-hotplug wlan/c\#allow-hotplug $wifi_iface" /etc/network/interfaces # - Add default WiFi settings to network interfaces config @@ -14346,13 +14367,15 @@ iface $wifi_iface inet dhcp address 192.168.0.101 netmask 255.255.255.0 gateway 192.168.0.1 +#dns-nameservers 9.9.9.9 149.112.112.112 wireless-power off wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf -#dns-nameservers 8.8.8.8 8.8.4.4 _EOF_ # - Flush iptables iptables -F iptables -t nat -F + ip6tables -F + ip6tables -t nat -F fi @@ -14477,7 +14500,7 @@ _EOF_ fi [[ -d '/etc/systemd/system/openbazaar.service.d' ]] && G_EXEC rm -R /etc/systemd/system/openbazaar.service.d getent passwd openbazaar > /dev/null && G_EXEC userdel openbazaar - getent group openbazaar > /dev/null &&G_EXEC groupdel openbazaar + getent group openbazaar > /dev/null && G_EXEC groupdel openbazaar [[ -f '/usr/local/bin/openbazaar-go' ]] && G_EXEC rm /usr/local/bin/openbazaar-go [[ -d '/mnt/dietpi_userdata/openbazaar' ]] && G_EXEC rm -R /mnt/dietpi_userdata/openbazaar # Pre-v7.1 @@ -14697,7 +14720,9 @@ _EOF_ G_AGP 'chromium*' # Files [[ -d '/etc/chromium.d' ]] && G_EXEC rm -R /etc/chromium.d - G_EXEC rm -f /{root,home/*}/.chromium-browser.init + [[ -d '/usr/lib/chromium' ]] && G_EXEC rm -R /usr/lib/chromium + [[ -d '/usr/lib/chromium-browser' ]] && G_EXEC rm -R /usr/lib/chromium-browser + G_EXEC rm -Rf /{root,home/*}/{.chromium-browser.init,.{cache,config}/chromium,Desktop/chromium{,-browser}.desktop} [[ -f '/var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh' ]] && G_EXEC rm /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh # Autostart index: If currently Chromium, revert to console login [[ -f '/boot/dietpi/.dietpi-autostart_index' && $( /dev/null && npm r -g --unsafe-perm n yarn npm + command -v npm > /dev/null && npm r -g n yarn npm # Old install via repo G_AGP nodejs diff --git a/dietpi/dietpi-survey b/dietpi/dietpi-survey old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-sync b/dietpi/dietpi-sync old mode 100644 new mode 100755 diff --git a/dietpi/dietpi-update b/dietpi/dietpi-update old mode 100644 new mode 100755 index 4579075853..5721aafeed --- a/dietpi/dietpi-update +++ b/dietpi/dietpi-update @@ -305,14 +305,10 @@ G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" 'Installing new DietPi code' G_EXEC_DESC='Downloading update archive' G_EXEC curl -sSfLO "https://github.com/$GITOWNER_TARGET/DietPi/archive/$GITBRANCH_TARGET.tar.gz" G_EXEC_DESC='Unpacking update archive' G_EXEC tar xf "$GITBRANCH_TARGET.tar.gz" - rm "$GITBRANCH_TARGET.tar.gz" - - # Remove files from Git archive that are not to be installed on client - rm "DietPi-$GITBRANCH_TARGET/dietpi/"{pre-patch_file,server_version-6} - - G_EXEC_DESC='Installing new DietPi scripts' G_EXEC cp -Rf "DietPi-$GITBRANCH_TARGET/dietpi" /boot/ - G_EXEC_DESC='Installing new DietPi system files' G_EXEC cp -Rf "DietPi-$GITBRANCH_TARGET/rootfs/." / - G_EXEC_DESC='Setting execute permissions for DietPi scripts' G_EXEC chmod -R +x /boot/dietpi /var/lib/dietpi/services /etc/cron.*/dietpi "DietPi-$GITBRANCH_TARGET/.update/patches" + G_EXEC_DESC='Removing unused files' G_EXEC rm "$GITBRANCH_TARGET.tar.gz" "DietPi-$GITBRANCH_TARGET/dietpi/"{pre-patch_file,server_version-6} + G_EXEC_DESC='Hardening update archive mode' G_EXEC chmod -R g-w "DietPi-$G_GITBRANCH" + G_EXEC_DESC='Installing new DietPi scripts' G_EXEC cp -a "DietPi-$GITBRANCH_TARGET/dietpi" /boot/ + G_EXEC_DESC='Installing new DietPi system files' G_EXEC cp -a "DietPi-$GITBRANCH_TARGET/rootfs/." / # Save version + Git info now for sub scripts to pull from correct branch G_GITOWNER=$GITOWNER_TARGET diff --git a/dietpi/dietpi-vpn b/dietpi/dietpi-vpn old mode 100644 new mode 100755 diff --git a/dietpi/func/change_hostname b/dietpi/func/change_hostname old mode 100644 new mode 100755 diff --git a/dietpi/func/create_mysql_db b/dietpi/func/create_mysql_db old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-banner b/dietpi/func/dietpi-banner old mode 100644 new mode 100755 index b6b9e9f1ef..277844782e --- a/dietpi/func/dietpi-banner +++ b/dietpi/func/dietpi-banner @@ -24,12 +24,11 @@ # Import DietPi-Globals -------------------------------------------------------------- . /boot/dietpi/func/dietpi-globals # - Allow concurrent banner prints but a single menu call only - if [[ $1 == 2 ]]; then - + if [[ $1 == 2 ]] + then readonly G_PROGRAM_NAME='DietPi-Banner' G_CHECK_ROOT_USER # Required to store settings G_INIT - fi # Import DietPi-Globals -------------------------------------------------------------- @@ -120,16 +119,16 @@ Save(){ # Custom entry description - echo "aDESCRIPTION[10]='${aDESCRIPTION[10]}'" > $FP_SAVEFILE + echo "aDESCRIPTION[10]='${aDESCRIPTION[10]}'" for i in "${!aDESCRIPTION[@]}" do - echo "aENABLED[$i]=${aENABLED[$i]}" >> $FP_SAVEFILE + echo "aENABLED[$i]=${aENABLED[$i]}" done for i in "${!aCOLOUR[@]}" do - echo "aCOLOUR[$i]='${aCOLOUR[$i]}'" >> $FP_SAVEFILE + echo "aCOLOUR[$i]='${aCOLOUR[$i]}'" done } @@ -137,25 +136,22 @@ Print_Header(){ # DietPi update available? - if Check_DietPi_Update; then - + if Check_DietPi_Update + then local text_update_available_date="${aCOLOUR[3]}Update available" # New DietPi live patches available? - elif Check_DietPi_Live_Patches; then - + elif Check_DietPi_Live_Patches + then local text_update_available_date="${aCOLOUR[3]}New live patches available" # APT update available? - elif Check_APT_Updates; then - + elif Check_APT_Updates + then local text_update_available_date="${aCOLOUR[3]}$PACKAGE_COUNT APT updates available" - else - local locale=$(sed -n '/^[[:blank:]]*AUTO_SETUP_LOCALE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt) local text_update_available_date=$(LC_ALL=${locale:-C.UTF-8} date +"%R - %a %x") - fi echo -e "$GREEN_LINE @@ -176,30 +172,29 @@ $GREEN_LINE" Print_Credits(){ - echo -e " ${aCOLOUR[2]}DietPi Team : MichaIng (lead), Daniel Knight (founder), Joulinar (support)" + echo -e " ${aCOLOUR[2]}DietPi Team : https://github.com/MichaIng/DietPi#the-dietpi-project-team" [[ -f '/boot/dietpi/.prep_info' ]] && mawk 'NR==1 {sub(/^0$/,"DietPi Core Team");a=$0} NR==2 {print " Image by : "a" (pre-image: "$0")"}' /boot/dietpi/.prep_info - echo -e " Web : https://dietpi.com | https://twitter.com/DietPi_ - Patreon Legends : Camry2731 + echo -e " Patreon Legends : Camry2731, Chris Gelatt + Website : https://dietpi.com/ | https://twitter.com/DietPi_ Contribute : https://dietpi.com/contribute.html - DietPi Hosting : Powered by https://myvirtualserver.com$COLOUR_RESET\n" + Web Hosting by : https://myvirtualserver.com$COLOUR_RESET\n" # DietPi update available? - if [[ $AVAILABLE_UPDATE ]]; then - + if [[ $AVAILABLE_UPDATE ]] + then echo -e " ${aCOLOUR[1]}dietpi-update$COLOUR_RESET $GREEN_SEPARATOR ${aCOLOUR[3]}Run now to update DietPi from v$DIETPI_VERSION to v$AVAILABLE_UPDATE$COLOUR_RESET\n" # New DietPi live patches available? - elif (( $LIVE_PATCHES )); then - + elif (( $LIVE_PATCHES )) + then echo -e " ${aCOLOUR[1]}dietpi-update$COLOUR_RESET $GREEN_SEPARATOR ${aCOLOUR[3]}Run now to check out new available DietPi live patches$COLOUR_RESET\n" # APT updates available? - elif (( $PACKAGE_COUNT )); then - + elif (( $PACKAGE_COUNT )) + then echo -e " ${aCOLOUR[1]}apt upgrade$COLOUR_RESET $GREEN_SEPARATOR ${aCOLOUR[3]}Run now to apply $PACKAGE_COUNT available APT package upgrades$COLOUR_RESET\n" - fi } @@ -246,12 +241,11 @@ $GREEN_LINE" # Custom (( ${aENABLED[10]} == 1 )) && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[10]} $GREEN_SEPARATOR $(bash $FP_CUSTOM 2>&1)" # MOTD - if (( ${aENABLED[12]} == 1 )); then - + if (( ${aENABLED[12]} == 1 )) + then local motd fp_motd='/run/dietpi/.dietpi_motd' [[ -f $fp_motd ]] || curl -sSfLm 3 'https://dietpi.com/motd' -o $fp_motd [[ -f $fp_motd ]] && . $fp_motd &> /dev/null && [[ $motd ]] && echo -e "$GREEN_BULLET ${aCOLOUR[1]}${aDESCRIPTION[12]} $GREEN_SEPARATOR $motd" - fi echo -e "$GREEN_LINE\n" @@ -298,27 +292,26 @@ NB: It is executed as bash script, so it needs to be in bash compatible syntax. [[ -f $FP_CUSTOM ]] || aENABLED[10]=0 - Save + Save > $FP_SAVEFILE } #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// - if (( $INPUT == 0 )); then - + if (( $INPUT == 0 )) + then Print_Header Print_Local_Ip - elif (( $INPUT == 1 )); then - + elif (( $INPUT == 1 )) + then Print_Banner - elif (( $INPUT == 2 )); then - + elif (( $INPUT == 2 )) + then Menu_Main Print_Banner - fi #----------------------------------------------------------------------------------- diff --git a/dietpi/func/dietpi-benchmark b/dietpi/func/dietpi-benchmark old mode 100644 new mode 100755 index 9f18517342..c6a5b8d7ba --- a/dietpi/func/dietpi-benchmark +++ b/dietpi/func/dietpi-benchmark @@ -27,13 +27,8 @@ G_INIT # Import DietPi-Globals -------------------------------------------------------------- + [[ $1 ]] || { G_DIETPI-NOTIFY 1 'Invalid command, please see source code'; exit 1; } INPUT=$1 - if [[ ! $INPUT ]]; then - - G_DIETPI-NOTIFY 1 'Invalid command, please see sourcecode' - exit 1 - - fi #///////////////////////////////////////////////////////////////////////////////////// # Global @@ -42,7 +37,7 @@ SHOW_RESULTS=${SHOW_RESULTS:-1} # Optional input: Show results for individual tests? CPUBENCH_INT_MAX=${CPUBENCH_INT_MAX:-1000000} # Optional input BENCH_FILESIZE=${BENCH_FILESIZE:-0} # Optional input for automated - [[ ${FP_BENCHFILE:=/} == '/'* ]] || { G_DIETPI-NOTIFY 1 'FP_BENCHFILE must be an absolute file path, aborting...'; exit 1; } # Optional input + [[ ${FP_BENCHFILE:=/} == '/'* ]] || { G_DIETPI-NOTIFY 1 'FP_BENCHFILE must be an absolute directory path, aborting...'; exit 1; } # Optional input BENCH_ROOTFS_WRITE='Not tested' BENCH_ROOTFS_READ='Not tested' @@ -78,21 +73,20 @@ _EOF_ Upload_Survey(){ - if grep -q '^[[:blank:]]*SURVEY_OPTED_IN=1$' /boot/dietpi.txt; then - + if grep -q '^[[:blank:]]*SURVEY_OPTED_IN=1$' /boot/dietpi.txt + then /boot/dietpi/dietpi-survey 1 - elif G_WHIP_YESNO 'To upload and compare your results against other users, you must be opted in to the DietPi-Survey.\n\nWould you like to run DietPi-Survey now, allowing you to opt in?'; then - + elif G_WHIP_YESNO 'To upload and compare your results against other users, you must be opted in to the DietPi-Survey.\n\nWould you like to run DietPi-Survey now, allowing you to opt in?' + then /boot/dietpi/dietpi-survey - fi } CPU_Benchmark(){ - G_DIETPI-NOTIFY 0 "Running DietPi-CPU Benchmark with max value of 1000000 over $G_HW_CPU_CORES cores, please wait..." + G_DIETPI-NOTIFY 2 "Running CPU benchmark with max value of 1000000 over $G_HW_CPU_CORES cores, please wait..." cat << _EOF_ > bench #!/bin/bash @@ -105,20 +99,16 @@ aEnd_Int=() # Split the max int target based on total cores for ((i=0; i<\$cores; i++)) do - aEnd_Int[\$i]=\$(( (\$i + 1) * \$int_split )) aStart_Int[\$i]=\$(( \${aEnd_Int[\$i]} - \$int_split )) echo \${aStart_Int[\$i]} \${aEnd_Int[\$i]} - done Run_Bench(){ while (( \${aStart_Int[\$1]} < \${aEnd_Int[\$1]} )) do - ((aStart_Int[\$1]++)) - done } @@ -126,18 +116,14 @@ Run_Bench(){ # Launch benchmark threads for ((i=0; i<\$cores; i++)) do - Run_Bench \$i & - done # Wait for jobs to finish -for job in \`jobs -p\` +for job in \$(jobs -p) do - echo \$job wait \$job - done _EOF_ G_EXEC chmod +x bench @@ -152,12 +138,12 @@ _EOF_ BENCH_CPU_TEMP_END=$(G_OBTAIN_CPU_TEMP) BENCH_CPU=$(mawk '/real/{print $2;exit}' bench_result) - if (( $SHOW_RESULTS )); then - - G_WHIP_MSG "CPU Benchmark Results:\n - - Total time = $BENCH_CPU Seconds + if (( $SHOW_RESULTS )) + then + G_WHIP_MSG "CPU benchmark results:\n + - Total time = $BENCH_CPU seconds - Value to reach = $CPUBENCH_INT_MAX - - CPU temps = Start: ${BENCH_CPU_TEMP_START}'c | End: ${BENCH_CPU_TEMP_END}'c + - CPU temps = Start: ${BENCH_CPU_TEMP_START} °C | End: ${BENCH_CPU_TEMP_END} °C \n\nNB: A lower 'Total time' is faster" fi @@ -166,19 +152,15 @@ _EOF_ Filesystem_Benchmark(){ - G_EXEC mkdir -p "$FP_BENCHFILE" # Failsafe + [[ -d $FP_BENCHFILE ]] || G_EXEC mkdir "$FP_BENCHFILE" # Failsafe local min_benchmark_size=10 local max_benchmark_size=$(( $(G_CHECK_FREESPACE "$FP_BENCHFILE") - 50 )) # Assure 50 MiB stays free - #(( $max_benchmark_size > 10000 )) && max_benchmark_size=10000 - - local benchmark_file_name='benchmark.file' + local benchmark_file_name='dietpi-benchmark_testfile' FP_BENCHFILE="${FP_BENCHFILE%/}/$benchmark_file_name" - G_TERM_CLEAR - # Obtain user benchmark size - if (( $BENCH_FILESIZE == 0 )); then - + if (( $BENCH_FILESIZE == 0 )) + then G_WHIP_DEFAULT_ITEM=$min_benchmark_size G_WHIP_INPUTBOX "Please enter a filesize test value (MiB). A value of 100 is recommended. - Minimum value: $min_benchmark_size @@ -191,94 +173,95 @@ _EOF_ (( $BENCH_FILESIZE > $max_benchmark_size )) && BENCH_FILESIZE=$max_benchmark_size # Run benchmark - G_DIETPI-NOTIFY 2 "Performing Read/Write benchmark on $FP_BENCHFILE, please wait..." + G_DIETPI-NOTIFY 2 "Running read/write benchmark on $FP_BENCHFILE ($BENCH_FILESIZE MiB)" - G_DIETPI-NOTIFY 2 "Testing Seq Write Speed ($BENCH_FILESIZE MiB)" + G_DIETPI-NOTIFY 2 'Testing seq write speed, please wait...' sleep 1 - local bench_write_result=$(dd bs=4K count=$(( $BENCH_FILESIZE * 256 )) if=/dev/zero of="$FP_BENCHFILE" conv=fdatasync 2>&1 | grep -m1 'copied') - bench_write_result=$(mawk '{printf "%.0f",$1/$8/1024^2}' <<< "$bench_write_result") + local bench_write_result=$(dd bs=4K count=$(( $BENCH_FILESIZE * 256 )) if=/dev/zero of="$FP_BENCHFILE" conv=fdatasync 2>&1 | mawk '/copied/{printf "%.0f",$1/$8/1024^2;exit}') + G_DIETPI-NOTIFY 0 "Result: $bench_write_result MiB/s" - # - Clear cache + G_DIETPI-NOTIFY 2 'Clearing filesystem cache...' sync echo 3 > /proc/sys/vm/drop_caches - G_DIETPI-NOTIFY 2 "Testing Seq Read Speed ($BENCH_FILESIZE MiB)" + G_DIETPI-NOTIFY 2 'Testing seq read speed, please wait...' sleep 1 - local bench_read_result=$(dd bs=4K count=$(( $BENCH_FILESIZE * 256 )) if="$FP_BENCHFILE" of=/dev/null 2>&1 | grep -m1 'copied') - bench_read_result=$(mawk '{printf "%.0f",$1/$8/1024^2}' <<< "$bench_read_result") + local bench_read_result=$(dd bs=4K count=$(( $BENCH_FILESIZE * 256 )) if="$FP_BENCHFILE" of=/dev/null 2>&1 | mawk '/copied/{printf "%.0f",$1/$8/1024^2;exit}') + G_DIETPI-NOTIFY 0 "Result: $bench_read_result MiB/s" # - RootFS - if [[ $FP_BENCHFILE == '/'$benchmark_file_name ]]; then - + if [[ $FP_BENCHFILE == "/$benchmark_file_name" ]] + then BENCH_ROOTFS_WRITE=$bench_write_result BENCH_ROOTFS_READ=$bench_read_result # - RAM - elif [[ $FP_BENCHFILE == '/tmp/'$benchmark_file_name ]]; then - + elif [[ $FP_BENCHFILE == "/tmp/$benchmark_file_name" ]] + then BENCH_RAM_WRITE=$bench_write_result BENCH_RAM_READ=$bench_read_result # - Custom else - BENCH_CUSTOMFS_WRITE=$bench_write_result BENCH_CUSTOMFS_READ=$bench_read_result - fi - if (( $SHOW_RESULTS )); then - - G_WHIP_MSG "Filesystem Benchmark Results:\n - - Filepath = $FP_BENCHFILE + if (( $SHOW_RESULTS )) + then + G_WHIP_MSG "Filesystem benchmark results:\n + - File path = $FP_BENCHFILE - Test size = $BENCH_FILESIZE MiB - WRITE = $bench_write_result MiB/s - READ = $bench_read_result MiB/s" fi - [[ -f $FP_BENCHFILE ]] && rm -v "$FP_BENCHFILE" + [[ -f $FP_BENCHFILE ]] && G_EXEC rm "$FP_BENCHFILE" } Benchmark_Survey(){ SHOW_RESULTS=0 - G_EXEC mkdir -p /var/lib/dietpi/dietpi-benchmark - - if (( $G_INTERACTIVE )); then - - if G_WHIP_YESNO "$G_PROGRAM_NAME will now run the following benchmarks:\n - CPU performance\n - RootFS read/write performance\n - RAM read/write performance. -The test duration will depend on hardware specs, however, most devices will not exceed 40 seconds.\n\nIf you are opted in to the DietPi-Survey, your scores will uploaded automatically. -You can compare results against other users and hardware using the following link:\n - https://dietpi.com/survey#benchmark\n\nPlease select 'Ok' to begin the benchmark tests."; then - + [[ -d '/var/lib/dietpi/dietpi-benchmark' ]] || G_EXEC mkdir /var/lib/dietpi/dietpi-benchmark + + if (( $G_INTERACTIVE )) + then + if G_WHIP_YESNO "$G_PROGRAM_NAME will now run the following benchmarks:\n - CPU performance\n - RootFS read/write performance\n - RAM read/write performance +\nThe test duration will depend on hardware specs, however, most devices will not exceed 40 seconds.\n\nIf you are opted in to the DietPi-Survey, your scores will uploaded automatically. +You can compare results against other users and hardware using the following link:\n - https://dietpi.com/survey#benchmark\n\nPlease select 'Ok' to begin the benchmark tests." + then # Additional checks (( $G_HW_CPU_CORES > 2 )) || G_WHIP_YESNO "We have detected a low CPU core count ($G_HW_CPU_CORES). The tests may take up to 5 minutes to complete.\n\nDo you wish to continue?" || exit 0 - else - - G_DIETPI-NOTIFY 0 'Benchmark aborted' + G_DIETPI-NOTIFY 2 'Benchmark aborted' exit 0 - fi - fi - G_DIETPI-NOTIFY 0 'Running benchmark suite tests, please wait...' + G_DIETPI-NOTIFY 2 'Running benchmark suite tests, please wait...' CPU_Benchmark # FS/RAM # - RAM - if df -t tmpfs /tmp &> /dev/null; then + if df -t tmpfs /tmp &> /dev/null + then + # Apply performance CPU governor to avoid low frequency affecting RAM I/O results: https://github.com/MichaIng/DietPi/issues/5039#issuecomment-1021459310 + G_DIETPI-NOTIFY 2 'Temporarily applying performance CPU governor for RAM I/O benchmark...' + for i in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor + do + echo 'performance' > "$i" + done FP_BENCHFILE='/tmp' BENCH_FILESIZE=$(mawk '/^MemFree:/{printf "%.0f",$2/2048;exit}' /proc/meminfo) # Assure 50% of physical mem stays free, so swapping can be ruled out: KiB => MiB / 2 Filesystem_Benchmark + G_DIETPI-NOTIFY 2 'Restoring original CPU governor...' + /boot/dietpi/func/dietpi-set_cpu else - - G_DIETPI-NOTIFY 1 '/tmp does not seem to be mounted as tmpfs (RAMdisk). Skipping RAM benchmark...' - + G_DIETPI-NOTIFY 1 '/tmp does not seem to be mounted as tmpfs (RAMdisk). Skipping RAM I/O benchmark...' fi # - RootFS @@ -289,10 +272,10 @@ You can compare results against other users and hardware using the following lin SHOW_RESULTS=1 G_WHIP_MSG "Benchmarks completed: - - CPU Performance : Duration = $BENCH_CPU seconds (lower is faster) - - CPU Temp : Idle = ${BENCH_CPU_TEMP_START}'c | Full load = ${BENCH_CPU_TEMP_END}'c - - RootFS : Write = $BENCH_ROOTFS_WRITE MiB/s | Read = $BENCH_ROOTFS_READ MiB/s - - RAM : Write = $BENCH_RAM_WRITE MiB/s | Read = $BENCH_RAM_READ MiB/s + - CPU performance : Duration = $BENCH_CPU seconds (lower is faster) + - CPU temps : Idle = ${BENCH_CPU_TEMP_START} °C | Full load = ${BENCH_CPU_TEMP_END} °C + - RootFS I/O : Write = $BENCH_ROOTFS_WRITE MiB/s | Read = $BENCH_ROOTFS_READ MiB/s + - RAM I/O : Write = $BENCH_RAM_WRITE MiB/s | Read = $BENCH_RAM_READ MiB/s Compare these results online with other users, using the link below: - https://dietpi.com/survey#benchmark" @@ -312,25 +295,20 @@ Compare these results online with other users, using the link below: Benchmark_Lan_Client(){ - G_AG_CHECK_INSTALL_PREREQ iperf - if G_WHIP_INPUTBOX 'Please enter the IP address of the system running the network benchmark server:\n - eg: 192.168.0.100'; then - - IPERF_SERVER_IP=$G_WHIP_RETURNED_VALUE - - G_DIETPI-NOTIFY 2 "Benchmarking network performance to $IPERF_SERVER_IP. Please wait..." - BENCH_NET_LAN_SPEED=$(iperf -c "$IPERF_SERVER_IP" -p 5001 -t 5 -y C | sed 's/.*,//g') - if disable_error=1 G_CHECK_VALIDINT "$BENCH_NET_LAN_SPEED"; then - - BENCH_NET_LAN_SPEED=$(( $BENCH_NET_LAN_SPEED / 8 / 1024**2 )) - G_WHIP_MSG "Network LAN benchmark completed:\n - Transfer rate = $BENCH_NET_LAN_SPEED MiB/s" - - else + G_WHIP_INPUTBOX 'Please enter the IP address of the system running the network benchmark server:\n - E.g.: 192.168.0.100' || return 0 + IPERF_SERVER_IP=$G_WHIP_RETURNED_VALUE - G_WHIP_MSG 'Network LAN benchmark failed, please verify:\n - Server is running on the other system\n - Server IP address is correct' - BENCH_NET_LAN_SPEED='Not tested' - - fi + G_AG_CHECK_INSTALL_PREREQ iperf + G_DIETPI-NOTIFY 2 "Benchmarking network performance to $IPERF_SERVER_IP, please wait..." + BENCH_NET_LAN_SPEED=$(iperf -c "$IPERF_SERVER_IP" -p 5001 -t 5 -y C | sed 's/.*,//g') + if disable_error=1 G_CHECK_VALIDINT "$BENCH_NET_LAN_SPEED" + then + BENCH_NET_LAN_SPEED=$(( $BENCH_NET_LAN_SPEED / 8 / 1024**2 )) + G_WHIP_MSG "Network LAN benchmark completed:\n - Transfer rate = $BENCH_NET_LAN_SPEED MiB/s" + else + G_WHIP_MSG 'Network LAN benchmark failed, please verify:\n - Server is running on the other system\n - Server IP address is correct' + BENCH_NET_LAN_SPEED='Not tested' fi } @@ -344,36 +322,34 @@ Compare these results online with other users, using the link below: ionice -p $$ -c 1 -n 0 #----------------------------------------------------------------------------------- # Init vars for sourcing - if (( $INPUT == 0 )); then - + if (( $INPUT == 0 )) + then Save_Results # LAN bench server - elif (( $INPUT == 3 )); then - + elif (( $INPUT == 3 )) + then Benchmark_Lan_Server # Run benchmarks else - #----------------------------------------------------------------------------------- /boot/dietpi/dietpi-services stop #----------------------------------------------------------------------------------- # Reuse existing results if done Load_Results #----------------------------------------------------------------------------------- - if (( $INPUT == 1 )); then - + if (( $INPUT == 1 )) + then Filesystem_Benchmark - elif (( $INPUT == 2 )); then - + elif (( $INPUT == 2 )) + then Benchmark_Survey - elif (( $INPUT == 4 )); then - + elif (( $INPUT == 4 )) + then Benchmark_Lan_Client - fi #----------------------------------------------------------------------------------- # Export results data for other scripts: @@ -384,7 +360,6 @@ Compare these results online with other users, using the link below: #----------------------------------------------------------------------------------- /boot/dietpi/dietpi-services start #----------------------------------------------------------------------------------- - fi #----------------------------------------------------------------------------------- exit 0 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index c39b765817..97d8f20221 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -56,7 +56,7 @@ [[ -f '/boot/dietpi/.version' ]] && . /boot/dietpi/.version # - Assign defaults/code version as fallback [[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=8 - [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=0 + [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=1 [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=2 [[ $G_GITBRANCH ]] || G_GITBRANCH='master' [[ $G_GITOWNER ]] || G_GITOWNER='MichaIng' diff --git a/dietpi/func/dietpi-logclear b/dietpi/func/dietpi-logclear old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-optimal_mtu b/dietpi/func/dietpi-optimal_mtu old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-print_large b/dietpi/func/dietpi-print_large old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-ramlog b/dietpi/func/dietpi-ramlog old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-set_cpu b/dietpi/func/dietpi-set_cpu old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware old mode 100644 new mode 100755 index 2f8908c562..a41ca6cfd3 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -56,20 +56,24 @@ $FP_SCRIPT rpi-eeprom G_INIT # Import DietPi-Globals -------------------------------------------------------------- - # ARMbian uses armbianEnv.txt instead which requires different syntax - if [[ -f '/boot/armbianEnv.txt' ]]; then - + ARMBIAN=0 + DIETPIENV=0 + # New mainline kernel U-Boot images with dietpiEnv.txt + if [[ -f '/boot/dietpiEnv.txt' ]] + then + DIETPIENV=1 + FP_UENV='/boot/dietpiEnv.txt' + + # Armbian uses armbianEnv.txt instead which requires different syntax + elif [[ -f '/boot/armbianEnv.txt' ]] + then ARMBIAN=1 FP_UENV='/boot/armbianEnv.txt' # Sparky SBC uEnv.txt has been renamed to uenv.txt, lets support both variants else - - ARMBIAN=0 - FP_UENV='/tmp/uEnv.txt' - for i in /boot/u{e,E}nv.txt; do [[ -f $i ]] && FP_UENV=$i && break; done - unset -v i - + FP_UENV='/boot/uEnv.txt' + [[ -f '/boot/uenv.txt' ]] && FP_UENV='/boot/uenv.txt' fi EXIT_CODE=0 @@ -257,29 +261,14 @@ _EOF_ (( $gpu_mem > 192 )) && gpu_mem=192 G_CONFIG_INJECT 'gpu_mem_256=' "gpu_mem_256=$gpu_mem" /boot/config.txt - # Disable VCSM if less than 32M are applied, since it is doomed to fail with cut-down firmware loaded. + # Disable VideoCore CMA Shared Memory Driver if less than 32 MiB are applied, as it is doomed to fail with cut-down firmware loaded. if (( $gpu_mem < 32 )) then - # Blacklist kernel module G_EXEC eval 'echo '\''blacklist vc_sm_cma'\'' > /etc/modprobe.d/dietpi-disable_vcsm.conf' - # Disable device via dtoverlay - G_EXEC_DESC='Compiling device tree overlay: /boot/overlays/dietpi-disable_vcsm.dtbo' - G_EXEC eval 'dtc -I dts -O dtb -o /boot/overlays/dietpi-disable_vcsm.dtbo <<< '\''/dts-v1/; -/plugin/; -/ { - compatible = "brcm,bcm2835"; - fragment@0 { - target-path = "/soc/vcsm"; - __overlay__ { - status = "disabled"; - }; - }; -};'\''' - G_CONFIG_INJECT 'dtoverlay=dietpi-disable_vcsm' 'dtoverlay=dietpi-disable_vcsm' /boot/config.txt - else - grep -q 'dtoverlay=dietpi-disable_vcsm' /boot/config.txt && G_EXEC sed -i '/dtoverlay=dietpi-disable_vcsm/d' /boot/config.txt - [[ -f '/boot/overlays/dietpi-disable_vcsm.dtbo' ]] && G_EXEC rm /boot/overlays/dietpi-disable_vcsm.dtbo - [[ -f '/etc/modprobe.d/dietpi-disable_vcsm.conf' ]] && G_EXEC rm /etc/modprobe.d/dietpi-disable_vcsm.conf + + elif [[ -f '/etc/modprobe.d/dietpi-disable_vcsm.conf' ]] + then + G_EXEC rm /etc/modprobe.d/dietpi-disable_vcsm.conf fi else Unknown_Input_Mode @@ -1209,12 +1198,12 @@ _EOF_ G_CONFIG_INJECT 'dtoverlay=disable-bt' 'dtoverlay=disable-bt' /boot/config.txt # ASUS TB - elif (( $G_HW_MODEL == 52 )); then + elif (( $G_HW_MODEL == 52 )) && systemctl list-unit-files 'hciuart.service' > /dev/null; then systemctl -q is-enabled hciuart 2> /dev/null || systemctl -q is-active hciuart && G_EXEC systemctl disable --now hciuart # Broadcom-based models that need brcm_patchram_plus - elif [[ $G_HW_MODEL == 6[12] ]]; then + elif [[ $G_HW_MODEL == 6[12] ]] && systemctl list-unit-files 'brcm_patchram_plus.service' > /dev/null; then systemctl -q is-enabled brcm_patchram_plus 2> /dev/null || systemctl -q is-active brcm_patchram_plus && G_EXEC systemctl disable --now brcm_patchram_plus @@ -1226,18 +1215,15 @@ _EOF_ > /etc/modprobe.d/dietpi-disable_bluetooth.conf for ((i=$(( ${#aBLUETOOTH_MODULES[@]} - 1 )); i>=0; i--)) do - modprobe -r "${aBLUETOOTH_MODULES[$i]}" 2> /dev/null echo "blacklist ${aBLUETOOTH_MODULES[$i]}" >> /etc/modprobe.d/dietpi-disable_bluetooth.conf - done # Purge packages - if (( $G_DIETPI_INSTALL_STAGE >= 0 )); then - + if (( $G_DIETPI_INSTALL_STAGE >= 0 )) + then G_AGP bluez bluez-firmware pi-bluetooth rtl8723ds-firmware G_AGA - fi elif [[ $INPUT_DEVICE_VALUE == 'enable' ]]; then @@ -1276,20 +1262,14 @@ Do you want to continue and disable the serial login console?' || return 1 # Load kernel modules, bluetooth first for i in "${aBLUETOOTH_MODULES[@]}" do - modprobe "$i" 2> /dev/null - done # Failsafe: Unblock all Bluetooth adapters if rfkill is installed command -v rfkill > /dev/null && rfkill unblock bluetooth # Broadcom-based models that need brcm_patchram_plus - if [[ $G_HW_MODEL == 6[12] ]]; then - - G_EXEC systemctl enable --now brcm_patchram_plus - - fi + [[ $G_HW_MODEL == 6[12] ]] && systemctl list-unit-files 'brcm_patchram_plus.service' > /dev/null && G_EXEC systemctl enable --now brcm_patchram_plus G_EXEC systemctl enable --now bluetooth @@ -1535,24 +1515,29 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 grep -q "console=$INPUT_ADDITIONAL" /boot/cmdline.txt || sed -i "/root=/s/[[:blank:]]*$/ console=$INPUT_ADDITIONAL,115200/" /boot/cmdline.txt - # - Odroid C2 + # - Odroid C2 legacy elif [[ $G_HW_MODEL == 12 && -f '/boot/boot.ini' ]]; then local old= - [[ -f '/boot/boot.ini' ]] && old=$(grep -Em1 '^[[:blank:]]*setenv[[:blank:]]+condev[[:blank:]]' /boot/boot.ini) || return 0 + old=$(grep -Em1 '^[[:blank:]]*setenv[[:blank:]]+condev[[:blank:]]' /boot/boot.ini) || return 0 [[ $old == *"console=$INPUT_ADDITIONAL"* ]] && return 0 old=$(cut -d \" -f 2 <<< "$old") G_CONFIG_INJECT 'setenv[[:blank:]]+condev[[:blank:]]' "setenv condev \"$old console=$INPUT_ADDITIONAL,115200n8\"" /boot/boot.ini 'ODROIDC2-UBOOT-CONFIG' - # - Odroid XU4 - elif (( $G_HW_MODEL == 11 )); then + # - Odroid XU4 legacy + elif [[ $G_HW_MODEL == 11 && -f '/boot/boot.ini' ]]; then local old= - [[ -f '/boot/boot.ini' ]] && old=$(grep -Em1 '^[[:blank:]]*setenv[[:blank:]]+bootrootfs[[:blank:]]' /boot/boot.ini) || return 0 + old=$(grep -Em1 '^[[:blank:]]*setenv[[:blank:]]+bootrootfs[[:blank:]]' /boot/boot.ini) || return 0 [[ $old == *"console=$INPUT_ADDITIONAL"* ]] && return 0 old=$(cut -d \" -f 2 <<< "$old") G_CONFIG_INJECT 'setenv[[:blank:]]+bootrootfs[[:blank:]]' "setenv bootrootfs \"$old console=$INPUT_ADDITIONAL,115200n8\"" /boot/boot.ini 'ODROIDXU-UBOOT-CONFIG' + # - dietpiEnv.txt + elif (( $DIETPIENV )); then + + grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" $FP_UENV || sed -i "/^consoleargs=/s/[[:blank:]]*$/ console=$INPUT_ADDITIONAL,115200/" $FP_UENV + # - Armbian: armbianEnv.txt only allows to toggle a fixed serial console depending on device elif (( $ARMBIAN )); then @@ -1567,11 +1552,10 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 fi - # - PINE A64: On Armbian ttyS0 boot output is forced and custom console is not possible via armbianEnv.txt - elif (( $G_HW_MODEL == 40 )); then + # - PINE A64 legacy + elif [[ $G_HW_MODEL == 40 && -f $FP_UENV ]]; then - [[ ! -f $FP_UENV ]] || grep -q "console=$INPUT_ADDITIONAL" $FP_UENV && return 0 - echo "console=$INPUT_ADDITIONAL,115200n8" >> $FP_UENV + grep -q "console=$INPUT_ADDITIONAL" $FP_UENV || echo "console=$INPUT_ADDITIONAL,115200n8" >> $FP_UENV fi @@ -1579,7 +1563,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 else # ttyFIQ[0-9]: https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 - for i in /dev/tty{S,AMA,SAC}[0-9] + for i in /dev/tty{S,AMA,SAC,AML}[0-9] do [[ -e $i ]] || continue INPUT_ADDITIONAL=${i/\/dev\/} Serial_Main @@ -1615,13 +1599,19 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 # - RPi if (( $G_HW_MODEL < 10 )); then - sed -Ei "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//" /boot/cmdline.txt + sed -Ei "/root=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" /boot/cmdline.txt - # - Odroid C1/C2/XU4 + # - Odroid C1/C2/XU4 legacy elif [[ $G_HW_MODEL -le 12 && -f '/boot/boot.ini' ]]; then - sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//" /boot/boot.ini + sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" /boot/boot.ini + + # - dietpiEnv.txt + elif (( $DIETPIENV )); then + grep -q "^consoleargs=.*console=$INPUT_ADDITIONAL" $FP_UENV && sed -Ei -e "/^consoleargs=/s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^[:blank:]]*([[:blank:]]*$)?//g" -e 's/^consoleargs=[[:blank:]]+/consoleargs=/' $FP_UENV + + # - Armbian: armbianEnv.txt only allows to toggle a fixed serial console depending on device elif (( $ARMBIAN )); then grep -q "console=$INPUT_ADDITIONAL" /boot/boot.cmd || return 0 @@ -1635,11 +1625,11 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 fi - # - PINE A64: On Armbian ttyS0 boot output is forced and custom console is not possible via armbianEnv.txt - elif (( $G_HW_MODEL == 40 )); then + # - PINE A64 legacy + elif [[ $G_HW_MODEL == 40 && -f $FP_UENV ]]; then sed -i "/^[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*[[:blank:]]*$/d" $FP_UENV # New style: One variable each line - sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//" $FP_UENV # Old style: Multiple variables possible each line + sed -i "s/[[:blank:]]*console=${INPUT_ADDITIONAL}[^\"[:blank:]]*//g" $FP_UENV # Old style: Multiple variables possible each line fi @@ -1647,7 +1637,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 else # ttyFIQ[0-9]: https://github.com/MichaIng/DietPi/issues/1829#issuecomment-398302497 - for i in /dev/tty{S,AMA,SAC}[0-9] + for i in /dev/tty{S,AMA,SAC,AML}[0-9] do [[ -e $i ]] || continue INPUT_ADDITIONAL=${i/\/dev\/} Serial_Main @@ -1706,6 +1696,11 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 Soundcard_Reset_RPi + # - Odroid N2: Modern image + elif [[ $G_HW_MODEL == 15 && -f '/boot/dietpiEnv.txt' ]]; then + + Soundcard_Reset_OdroidN2 + # - Odroid elif (( $G_HW_MODEL < 20 )); then @@ -1761,6 +1756,9 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 local kms=$(grep -Em1 '^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?(,|$)' /boot/config.txt) [[ $kms && ! $kms =~ ',noaudio'(,|$) ]] && G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?(,|$)/s/$/,noaudio/' /boot/config.txt + # Use "auto" as default + [[ $INPUT_DEVICE_VALUE == 'default' ]] && INPUT_DEVICE_VALUE='rpi-bcm2835-auto' + } Soundcard_Reset_Odroid(){ @@ -1775,16 +1773,22 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 sed -i '/^[[:blank:]]*snd-soc-pcm512x/d' /etc/modules sed -i '/^[[:blank:]]*snd-soc-pcm512x-i2c/d' /etc/modules sed -i '/^[[:blank:]]*snd-soc-odroid-dac2/d' /etc/modules - if [[ -f '/etc/systemd/system/odroid-hifishield2.service' ]]; then - + if [[ -f '/etc/systemd/system/odroid-hifishield2.service' ]] + then G_EXEC systemctl disable --now odroid-hifishield2 G_EXEC rm /etc/systemd/system/odroid-hifishield2.service - fi [[ -d '/etc/systemd/system/odroid-hifishield2.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-hifishield2.service.d } + Soundcard_Reset_OdroidN2(){ + + # Use HDMI as default + [[ $INPUT_DEVICE_VALUE == 'default' ]] && INPUT_DEVICE_VALUE='OdroidN2_HDMI' + + } + Soundcard_Reset_H3(){ # Set HDMI @@ -1828,7 +1832,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 # Save selection to dietpi.txt G_CONFIG_INJECT 'CONFIG_SOUNDCARD=' "CONFIG_SOUNDCARD=$INPUT_DEVICE_VALUE" /boot/dietpi.txt # Return now if no sound card has been selected - [[ $INPUT_DEVICE_VALUE == 'none' ]] && return + [[ $INPUT_DEVICE_VALUE == 'none' ]] && return 0 #----------------------------------------------------------------------------- # Apply specific asound.conf and additional settings # - ALSA equalizer enabled? @@ -1852,15 +1856,14 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 # --------------- Generic --------------- # Specific card + device, e.g. from auto-detection - hw:*) + 'hw:'*) SOUNDCARD_TARGET_CARD=$(mawk -F, '{print $1}' <<< "${INPUT_DEVICE_VALUE#hw:}") SOUNDCARD_TARGET_DEVICE=$(mawk -F, '{print $2}' <<< "${INPUT_DEVICE_VALUE#hw:}") - ;; # Auto detect USB DAC - usb-dac*) + 'usb-dac'*) local usb_detection_card_index=$([[ -f '/proc/asound/cards' ]] && mawk '/USB/ && $1 == /[0-9]/ {print $1;exit}' /proc/asound/cards) if [[ $usb_detection_card_index ]]; then @@ -1875,7 +1878,7 @@ Do you want to continue and DISABLE Bluetooth now?' || return 1 [[ $INPUT_DEVICE_VALUE == *'1.1' ]] && G_EXEC sed -i 's/aotg\.aotg1_speed=0/aotg.aotg1_speed=1/' $FP_UENV # Odroid C2: https://github.com/MichaIng/DietPi/issues/2101 - elif (( $G_HW_MODEL == 12 )); then + elif (( $G_HW_MODEL == 12 )) && grep -q '^[[:blank:]]*63:.*dwc_otg' /proc/interrupts; then cat << '_EOF_' > /var/lib/dietpi/postboot.d/c2_smp.sh #!/bin/dash @@ -1895,17 +1898,16 @@ _EOF_ return fi - ;; # Intel SST DSP - intel-sst-dsp) G_AG_CHECK_INSTALL_PREREQ 'firmware-intel-sound';; + 'intel-sst-dsp') G_AG_CHECK_INSTALL_PREREQ 'firmware-intel-sound';; # --------------- Sparky SBC ------------ # Allo Piano DAC (firmware + module) # snd-soc-allo-piano-dac # snd-soc-allo-piano-dac-plus (2.1) - snd-soc-allo-piano-dac*) + 'snd-soc-allo-piano-dac'*) if [[ ! -d '/lib/firmware/allo' ]] then @@ -1921,13 +1923,12 @@ _EOF_ SOUNDCARD_TARGET_CARD=1 SOUNDCARD_TARGET_DEVICE=0 G_EXEC amixer -c 0 set 'audio output mode switch' i2s - ;; # Allo Cheapo # allo-cheapo-analogue # 3.5mm/RCA # allo-cheapo-optical # Optical out - allo-cheapo*) + 'allo-cheapo-'*) SOUNDCARD_TARGET_CARD=0 SOUNDCARD_TARGET_DEVICE=0 @@ -1945,7 +1946,6 @@ _EOF_ SOUNDCARD_TARGET_DEVICE=2 fi - ;; # --------------- RPi ------------------- @@ -1953,7 +1953,7 @@ _EOF_ # rpi-bcm2835-auto # rpi-bcm2835-3.5mm # rpi-bcm2835-hdmi - rpi-bcm2835-*) + 'rpi-bcm2835-'*) # Enable onboard audio G_CONFIG_INJECT 'dtparam=audio=' 'dtparam=audio=on' /boot/config.txt @@ -2003,13 +2003,12 @@ _EOF_ local kms=$(grep -Em1 '^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?,(noaudio|.+,noaudio)(,|$)' /boot/config.txt) [[ $kms ]] && G_EXEC sed -Ei '/^[[:blank:]]*dtoverlay=vc4-kms-v3d(-pi4)?,/s/,noaudio(,|$)/\1/' /boot/config.txt fi - ;; # Allo Piano DAC (DSP firmware + dtoverlay) # allo-piano-dac-pcm512x-audio # allo-piano-dac-plus-pcm512x-audio (2.1) - allo-piano-dac*) + 'allo-piano-dac'*) if [[ ! -d '/lib/firmware/allo' ]] then @@ -2024,7 +2023,6 @@ _EOF_ fi G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE" /boot/config.txt - ;; # dtoverlay @@ -2039,35 +2037,32 @@ _EOF_ # applepi-dac # iqaudio-* # dionaudio-loco(-v2) - hifiberry-*|justboom-*|allo-*|rpi-dac|i-sabre-q2m|applepi*|iqaudio-*|dionaudio-loco*) + 'hifiberry-'*|'justboom-'*|'allo-'*|'rpi-dac'|'i-sabre-q2m'|'applepi'*|'iqaudio-'*|'dionaudio-loco'*) # Enable dtoverlay G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE" /boot/config.txt - ;; # dtoverlay + I2S # googlevoicehat-soundcard - googlevoicehat-soundcard*) + 'googlevoicehat-soundcard'*) # Enable dtoverlay + I2S G_CONFIG_INJECT 'dtparam=i2s=' 'dtparam=i2s=on' /boot/config.txt G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE" /boot/config.txt - ;; # --------------- Odroid ---------------- - odroid-hifishield-plus) + 'odroid-hifishield-plus') G_CONFIG_INJECT 'snd-soc-pcm5102' 'snd-soc-pcm5102' /etc/modules G_CONFIG_INJECT 'snd-soc-odroid-dac' 'snd-soc-odroid-dac' /etc/modules G_EXEC modprobe snd-soc-pcm5102 snd-soc-odroid-dac SOUNDCARD_TARGET_CARD=1 - ;; - odroid-hifishield-2) + 'odroid-hifishield-2') G_CONFIG_INJECT 'aml_i2c' 'aml_i2c' /etc/modules G_CONFIG_INJECT 'snd-soc-pcm512x' 'snd-soc-pcm512x' /etc/modules @@ -2094,30 +2089,54 @@ WantedBy=sound.target _EOF_ G_EXEC systemctl daemon-reload G_EXEC systemctl enable --now odroid-hifishield2 - ;; - # --------------- H3 -------------------- - h3-analogue) - - SOUNDCARD_TARGET_CARD=0 - + 'OdroidN2_HDMI') + + # Enable HDMI output + G_EXEC amixer -c 0 set 'TOHDMITX' 'on' + # Use I2S B as source for HDMI output, I2C A is somehow not usable + G_EXEC amixer -c 0 set 'TOHDMITX I2S SRC' 'I2S B' + # Use ALSA device 0 as input for I2S B + G_EXEC amixer -c 0 set 'TDMOUT_B SRC SEL' 'IN 0' + # Enable I2S B (SRC 2) on device 0 (_A) + G_EXEC amixer -c 0 set 'FRDDR_A SRC 2 EN' 'on' + # Set output channels for device 0 (_A) + G_EXEC amixer -c 0 set 'FRDDR_A SINK 1 SEL' 'OUT 0' + G_EXEC amixer -c 0 set 'FRDDR_A SINK 2 SEL' 'OUT 1' + G_EXEC amixer -c 0 set 'FRDDR_A SINK 3 SEL' 'OUT 2' + # Set master volume to 85% + G_EXEC amixer -c 0 set 'ACODEC' '85%' + ;; - # --------------- NanoPi M2/M3 ---------- - s5pxx18-hdmi) - - SOUNDCARD_TARGET_CARD=1 - + 'OdroidN2_3.5mm') + + # Enable 3.5mm output + G_EXEC amixer -c 0 set 'TOACODEC OUT EN' 'on' + # Use I2S B as source for 3.5mm output, I2C A is somehow not usable + G_EXEC amixer -c 0 set 'TOACODEC SRC' 'I2S B' + # Use ALSA device 0 as input for I2S B + G_EXEC amixer -c 0 set 'TDMOUT_B SRC SEL' 'IN 0' + # Enable I2S B (SRC 2) on device 0 (_A) + G_EXEC amixer -c 0 set 'FRDDR_A SRC 2 EN' 'on' + # Set output channels for device 0 (_A) + G_EXEC amixer -c 0 set 'FRDDR_A SINK 1 SEL' 'OUT 0' + G_EXEC amixer -c 0 set 'FRDDR_A SINK 2 SEL' 'OUT 1' + G_EXEC amixer -c 0 set 'FRDDR_A SINK 3 SEL' 'OUT 2' + # Set master volume to 85% + G_EXEC amixer -c 0 set 'ACODEC' '85%' + ;; - # --------------- ASUS TB --------------- - asus-tb-analogue) + # --------------- H3 -------------------- + 'h3-analogue') SOUNDCARD_TARGET_CARD=0;; - SOUNDCARD_TARGET_CARD=0 - SOUNDCARD_TARGET_DEVICE=2 + # --------------- NanoPi M2/M3 ---------- + 's5pxx18-hdmi') SOUNDCARD_TARGET_CARD=1;; - ;; + # --------------- ASUS TB --------------- + 'asus-tb-analogue') SOUNDCARD_TARGET_CARD=0 SOUNDCARD_TARGET_DEVICE=2;; esac @@ -2158,7 +2177,7 @@ _EOF_ G_AG_CHECK_INSTALL_PREREQ libasound2-plugin-equal # Pre-create config dir - G_EXEC mkdir -p /var/lib/dietpi/dietpi-config + [[ -d '/var/lib/dietpi/dietpi-config' ]] || G_EXEC mkdir -p /var/lib/dietpi/dietpi-config G_EXEC chmod 0775 /var/lib/dietpi/dietpi-config G_EXEC chown dietpi:dietpi /var/lib/dietpi/dietpi-config cat << _EOF_ > /etc/asound.conf @@ -2227,8 +2246,8 @@ _EOF_ G_EXEC alsactl -g store # Buster: Avoid alsa-state.service start if its config file does not exist: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932209 - (( $G_DISTRO == 5 )) || return - G_EXEC mkdir -p /etc/systemd/system/alsa-state.service.d + (( $G_DISTRO == 5 )) || return 0 + [[ -d '/etc/systemd/system/alsa-state.service.d' ]] || G_EXEC mkdir /etc/systemd/system/alsa-state.service.d echo -e '[Unit]\nConditionPathExists=\nConditionPathExists=/etc/alsa/state-daemon.conf' > /etc/systemd/system/alsa-state.service.d/dietpi.conf } diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-set_swapfile b/dietpi/func/dietpi-set_swapfile old mode 100644 new mode 100755 index 5566d5365a..01ce84f394 --- a/dietpi/func/dietpi-set_swapfile +++ b/dietpi/func/dietpi-set_swapfile @@ -62,6 +62,9 @@ Update_Tmp(){ + # Skip if /tmp is not dedicated mount + grep -q '[[:blank:]]/tmp[[:blank:]]' /etc/fstab || return 0 + # Set /tmp to 50% of RAM+SWAP: https://github.com/MichaIng/DietPi/issues/1027#issuecomment-369373082 local tmp_size=$(( $(free -tm | mawk '/^Total:/{print $2;exit}') / 2 )) diff --git a/dietpi/func/dietpi-set_userdata b/dietpi/func/dietpi-set_userdata old mode 100644 new mode 100755 diff --git a/dietpi/func/dietpi-wifidb b/dietpi/func/dietpi-wifidb old mode 100644 new mode 100755 diff --git a/dietpi/func/run_ntpd b/dietpi/func/run_ntpd old mode 100644 new mode 100755 diff --git a/dietpi/misc/dietpi-arr_to_RAM b/dietpi/misc/dietpi-arr_to_RAM old mode 100644 new mode 100755 diff --git a/dietpi/misc/dietpi-justboom b/dietpi/misc/dietpi-justboom old mode 100644 new mode 100755 diff --git a/dietpi/misc/start_kodi b/dietpi/misc/start_kodi old mode 100644 new mode 100755 index d7ce72ad3c..2f9dae4689 --- a/dietpi/misc/start_kodi +++ b/dietpi/misc/start_kodi @@ -16,14 +16,19 @@ # - /boot/dietpi/misc/start_kodi #//////////////////////////////////// - # Load $G_HW_MODEL + # Load $G_HW_MODEL and $G_DISTRO . /boot/dietpi/.hw_model #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// + standalone=0 # Bullseye + RPi 32-bit + Odroid N2 + Odroid C4: Kodi starts without X server - if [ "$G_HW_MODEL" -lt 10 ] && [ "$(dpkg --print-architecture)" = 'armhf' ] || [ "$G_DISTRO" -ge 6 ] || [ "$G_HW_MODEL" = 15 ] || [ "$G_HW_MODEL" = 16 ] + [ "$G_DISTRO" -ge 6 ] || { [ "$G_HW_MODEL" -le 9 ] && [ "$(dpkg --print-architecture)" = 'armhf' ]; } || [ "$G_HW_MODEL" = 15 ] || [ "$G_HW_MODEL" = 16 ] && standalone=1 + # Odroids from Bullseye on (no Amlogic fbdev Kodi build available) require an X server when no DRM is available. + { [ "$G_HW_MODEL" = 15 ] || [ "$G_HW_MODEL" = 16 ]; } && [ "$G_DISTRO" -ge 6 ] && [ ! -e '/dev/dri' ] && standalone=0 + + if [ "$standalone" = 1 ] then exec kodi --standalone "$@" diff --git a/dietpi/patch_file b/dietpi/patch_file old mode 100644 new mode 100755 diff --git a/dietpi/postboot b/dietpi/postboot old mode 100644 new mode 100755 diff --git a/dietpi/pre-patch_file b/dietpi/pre-patch_file old mode 100644 new mode 100755 diff --git a/dietpi/preboot b/dietpi/preboot old mode 100644 new mode 100755 diff --git a/rootfs/etc/cron.daily/dietpi b/rootfs/etc/cron.daily/dietpi old mode 100644 new mode 100755 diff --git a/rootfs/etc/cron.hourly/dietpi b/rootfs/etc/cron.hourly/dietpi old mode 100644 new mode 100755 diff --git a/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh b/rootfs/var/lib/dietpi/services/dietpi-wifi-monitor.sh old mode 100644 new mode 100755 diff --git a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh old mode 100644 new mode 100755