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/desktop/apps/dietpi-backup.desktop b/.conf/desktop/apps/dietpi-backup.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-bugreport.desktop b/.conf/desktop/apps/dietpi-bugreport.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-cleaner.desktop b/.conf/desktop/apps/dietpi-cleaner.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-config.desktop b/.conf/desktop/apps/dietpi-config.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-cron.desktop b/.conf/desktop/apps/dietpi-cron.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-drive_manager.desktop b/.conf/desktop/apps/dietpi-drive_manager.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-justboom.desktop b/.conf/desktop/apps/dietpi-justboom.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-launcher.desktop b/.conf/desktop/apps/dietpi-launcher.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-services.desktop b/.conf/desktop/apps/dietpi-services.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-software.desktop b/.conf/desktop/apps/dietpi-software.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-sync.desktop b/.conf/desktop/apps/dietpi-sync.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/dietpi-update.desktop b/.conf/desktop/apps/dietpi-update.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/es2_gears.desktop b/.conf/desktop/apps/es2_gears.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/es2_info.desktop b/.conf/desktop/apps/es2_info.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/glx_gears.desktop b/.conf/desktop/apps/glx_gears.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/glx_info.desktop b/.conf/desktop/apps/glx_info.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/kodi.desktop b/.conf/desktop/apps/kodi.desktop
old mode 100644
new mode 100755
diff --git a/.conf/desktop/apps/opentyrian.desktop b/.conf/desktop/apps/opentyrian.desktop
old mode 100644
new mode 100755
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/.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..2c3d6115ec
--- a/.update/patches
+++ b/.update/patches
@@ -619,6 +619,27 @@ 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_
+}
+
# 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..f7dcfc24d1 100644
--- a/.update/version
+++ b/.update/version
@@ -1,7 +1,7 @@
# Available DietPi version
G_REMOTE_VERSION_CORE=8
-G_REMOTE_VERSION_SUB=0
-G_REMOTE_VERSION_RC=2
+G_REMOTE_VERSION_SUB=1
+G_REMOTE_VERSION_RC=0
# Minimum DietPi version to allow update
G_MIN_VERSION_CORE=6
G_MIN_VERSION_SUB=14
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 9e827c4ab6..9aa1a775f1 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,32 @@
+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
+
+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 | 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
+
+As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX
+
+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 +65,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
@@ -82,8 +106,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..0286a33e4a
--- 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
@@ -523,24 +523,32 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then
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
@@ -562,10 +570,9 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then
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 +615,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 +812,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 +873,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 +883,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 +906,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 +930,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 +1058,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 +1372,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 +1539,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 +1603,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 +1627,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 +1638,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 +1833,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 +1843,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 +1943,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
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..a6cc633095
--- 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
@@ -3752,6 +3752,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..eb54fef33f
--- 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
@@ -2225,32 +2229,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 +2298,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 +2309,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 +2436,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 +2471,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 +2485,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
@@ -2663,15 +2637,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 +2655,59 @@ _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.
+ # 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'
# 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
-
+ elif (( $G_HW_MODEL == 12 )) && [[ $G_DISTRO -le 5 || ! -e '/dev/dri' ]]
+ then
DEPS_LIST=
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'
+ apt-cache dumpavail | grep -q '^Package: xf86-video-fbturbo-odroid$' && DEPS_LIST+=' libump-odroid xf86-video-fbturbo-odroid' || DEPS_LIST+=' xserver-xorg-video-fbdev'
G_BACKUP_FP /etc/X11/xorg.conf
dps_index=$software_id Download_Install 'xorg_c2.conf' /etc/X11/xorg.conf
# 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
@@ -3120,8 +3088,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 +3248,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 +3477,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 +3651,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 +3743,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 +3823,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 +3865,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 +3882,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 +3894,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 +3918,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 +3948,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 +3980,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 +4008,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 +4017,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 +4036,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
@@ -4612,7 +4582,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 +4595,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 +4609,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 +4676,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 +4686,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 +4813,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 +4825,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 +4838,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 +4855,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 +4935,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
@@ -5601,8 +5538,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}')
@@ -6548,7 +6485,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
@@ -7262,10 +7199,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 +7284,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
@@ -7568,7 +7505,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 +7525,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
@@ -8045,7 +7985,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 +8018,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 +8066,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
@@ -8596,9 +8547,6 @@ If no WireGuard (auto)start is included, but you require it, please do the follo
# Enable WiFi modules
/boot/dietpi/func/dietpi-set_hardware wifimodules enable
- # Unmask hostapd service: https://github.com/MichaIng/DietPi/issues/2962
- G_EXEC systemctl unmask hostapd
-
local eth_iface=$(G_GET_NET -t eth iface)
local wifi_iface=$(G_GET_NET -t wlan iface)
@@ -8755,10 +8703,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 +8716,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 +8725,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 +8735,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 +8747,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
@@ -8907,7 +8853,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 +9002,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 +9026,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 +9038,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 +9049,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 +9062,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 +9092,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
@@ -9889,10 +9847,10 @@ _EOF_
cat << '_EOF_' > /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 +9858,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 +9868,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
@@ -10415,7 +10373,10 @@ _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'
@@ -10435,7 +10396,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 +10441,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 +10457,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
@@ -11148,7 +11109,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
@@ -12008,7 +11969,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' ]]
@@ -12613,8 +12574,8 @@ _EOF_
# RPi: Define minimal memory split based on installed software
local gpu_memory=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
@@ -12631,18 +12592,21 @@ _EOF_
gpu_memory=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
fi
+ # RPi Bullseye: No need to raise GPU memory above default with CMA
+ (( $G_DISTRO > 5 && $gpu_memory > 1 )) && gpu_memory=1
+
# Disable headless/enable GPU when graphics software was installed
(( $gpu_memory )) || return 0
@@ -12959,6 +12923,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 +12955,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 +13108,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 +13176,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 +13773,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 +14163,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
@@ -14697,7 +14664,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..e6be64dca9
--- a/dietpi/dietpi-update
+++ b/dietpi/dietpi-update
@@ -310,9 +310,8 @@
# 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='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
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..509d97fea3 100644
--- a/dietpi/func/dietpi-globals
+++ b/dietpi/func/dietpi-globals
@@ -56,8 +56,8 @@
[[ -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_RC ]] || G_DIETPI_VERSION_RC=2
+ [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=1
+ [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=0
[[ $G_GITBRANCH ]] || G_GITBRANCH='master'
[[ $G_GITOWNER ]] || G_GITOWNER='MichaIng'
# - Save current version and Git branch
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..2f76020120
--- 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
@@ -1535,24 +1524,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 +1561,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 +1572,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 +1608,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 +1634,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 +1646,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 +1705,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 +1765,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 +1782,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 +1841,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 +1865,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
@@ -1895,17 +1907,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 +1932,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 +1955,6 @@ _EOF_
SOUNDCARD_TARGET_DEVICE=2
fi
-
;;
# --------------- RPi -------------------
@@ -1953,7 +1962,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 +2012,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 +2032,6 @@ _EOF_
fi
G_CONFIG_INJECT "dtoverlay=$INPUT_DEVICE_VALUE" "dtoverlay=$INPUT_DEVICE_VALUE" /boot/config.txt
-
;;
# dtoverlay
@@ -2039,35 +2046,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 +2098,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 +2186,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 +2255,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