diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index dd40cbc50f..1f4f5fde66 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -45,6 +45,8 @@ GITBRANCH='master' GITOWNER='MichaIng' EDITION= SUFFIX= +ADD_DOS_PART=1 +SIGN_PASS= while (( $# )) do case $1 in @@ -59,6 +61,8 @@ do '-o') shift; GITOWNER=$1;; '-e') shift; EDITION=$1;; '-s') shift; SUFFIX=$1;; + '--no-dos-part') ADD_DOS_PART=0;; + '--sign') shift; SIGN_PASS=$1;; *) G_DIETPI-NOTIFY 1 "Invalid input \"$1\", aborting..."; exit 1;; esac shift @@ -170,6 +174,10 @@ case $PTTYPE in *) G_DIETPI-NOTIFY 1 "Invalid partition table type \"$PTTYPE\" passed, aborting..."; exit 1;; esac +# Do not add trailing FAT partitions for VM, container and (Clonezilla) installer images, and if there is a boot FAT partition already +[[ $HW_MODEL == 20 || $HW_MODEL == 75 || $ITYPE == 'Installer' ]] && ADD_DOS_PART=0 +[[ $boot_size -gt 0 && $boot_fstype == 'fat'* ]] && ADD_DOS_PART=0 + fsname='' apackages=() afs_opts=() afsck=() aresize=() case $FSTYPE in 'ext4') apackages+=('e2fsprogs') afs_opts=('-e' 'remount-ro') afsck=('e2fsck' '-fyD') aresize=('resize2fs');; @@ -204,11 +212,7 @@ fi # Virtual machine disk conversion [[ $VMTYPE && $VMTYPE != 'raw' ]] && apackages+=('qemu-utils') -# p7zip vs 7zip package -# shellcheck disable=SC2015 -(( $G_DISTRO < 7 )) && apackages+=('p7zip') c7zz='7zr' || apackages+=('7zip') c7zz='7zz' - -G_AG_CHECK_INSTALL_PREREQ parted debootstrap dbus systemd-container "${apackages[@]}" +G_AG_CHECK_INSTALL_PREREQ parted debootstrap dbus systemd-container xz-utils "${apackages[@]}" # Bootstrap archive keyring if missing if [[ ! -f $keyring ]] @@ -242,9 +246,8 @@ then 79) series=6;; *) :;; esac - G_EXEC curl -sSfO "https://dietpi.com/downloads/nanopi$series.7z" - G_EXEC "$c7zz" x "nanopi$series.7z" - G_EXEC rm "nanopi$series.7z" + G_EXEC curl -sSfO "https://dietpi.com/downloads/nanopi$series.img.xz" + G_EXEC xz -d "nanopi$series.img.xz" G_EXEC truncate -s "$(( 140 + $root_size ))M" "nanopi$series.img" G_EXEC_OUTPUT=1 G_EXEC sgdisk -e "nanopi$series.img" G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN8 'nanopi$series.img' <<< ',+'" @@ -419,6 +422,7 @@ _EOF_ cat << _EOF_ >> rootfs/etc/rc.local export GITOWNER='$GITOWNER' GITBRANCH='$GITBRANCH' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO=0 WIFI_REQUIRED=1 DISTRO_TARGET=$DISTRO +echo '[ INFO ] Running DietPi-Installer for $G_GITOWNER/$G_GITBRANCH' bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || poweroff _EOF_ @@ -464,13 +468,21 @@ G_EXEC losetup -d "$FP_LOOP" # Do not pack and upload raw VM image if not explicitly requested [[ $VMTYPE && ! $VMTYPE =~ ^(raw|all)$ ]] && SKIP_ARCHIVE=1 || SKIP_ARCHIVE=0 export FP_ROOT_DEV CLONING_TOOL OUTPUT_IMG_NAME MOUNT_IT='Off' SKIP_ARCHIVE SKIP_FIRSTBOOT_RESIZE=1 -[[ $EDITION && $EDITION != 'all' ]] || bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 +IMAGER_ARGS=("$OUTPUT_IMG_NAME.img") +(( $ADD_DOS_PART )) && IMAGER_ARGS+=('--add-dos-part') +[[ $SIGN_PASS ]] && IMAGER_ARGS+=('--sign' "$SIGN_PASS") +if [[ ! $EDITION || $EDITION == 'all' ]] +then + G_DIETPI-NOTIFY 2 "Running DietPi-Imager for $G_GITOWNER/$G_GITBRANCH" + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "${IMAGER_ARGS[@]}" || exit 1 +fi # Amiberry edition: Install automatically on first boot, enable autostart option and onboard audio on RPi if [[ $EDITION == 'Amiberry' || ( $EDITION == 'all' && $HW_MODEL == 0 ) ]] then G_EXEC mv "$OUTPUT_IMG_NAME.img" "${OUTPUT_IMG_NAME}_Amiberry.img" OUTPUT_IMG_NAME="${OUTPUT_IMG_NAME}_Amiberry" + IMAGER_ARGS[0]="$OUTPUT_IMG_NAME.img" # Create loop device FP_LOOP=$(losetup -f) @@ -478,6 +490,15 @@ then G_EXEC partprobe "$FP_LOOP" G_EXEC partx -u "$FP_LOOP" + # Remove added DOS partition, it will be re-added by DietPi-Imager + if (( $ADD_DOS_PART )) && [[ $(lsblk -nrbo FSTYPE,LABEL "$FP_LOOP" | tail -1) == 'vfat DIETPISETUP' ]] + then + SETUP_PART=$(sfdisk -lqo DEVICE "$FP_LOOP" | tail -1) + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread --no-tell-kernel --delete "$FP_LOOP" "${SETUP_PART: -1}" + G_EXEC partprobe "$FP_LOOP" + G_EXEC partx -u "$FP_LOOP" + fi + # Mount filesystems G_EXEC mkdir rootfs if (( $boot_size )) @@ -502,7 +523,8 @@ then G_EXEC rmdir rootfs G_EXEC losetup -d "$FP_LOOP" - bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 + G_DIETPI-NOTIFY 2 "Running DietPi-Imager for $G_GITOWNER/$G_GITBRANCH" + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "${IMAGER_ARGS[@]}" || exit 1 fi # AlloGUI edition: Pre-install Allo GUI with all managed audiophile software @@ -510,6 +532,7 @@ if [[ $EDITION == 'AlloGUI' || ( $EDITION == 'all' && $HW_MODEL =~ ^(0|70)$ ) ]] then G_EXEC mv "$OUTPUT_IMG_NAME.img" "${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI.img" OUTPUT_IMG_NAME="${OUTPUT_IMG_NAME%_Amiberry}_AlloGUI" + IMAGER_ARGS[0]="$OUTPUT_IMG_NAME.img" # Raise image size to 2.5 GiB and create loop device G_EXEC truncate -s '2560M' "$OUTPUT_IMG_NAME.img" @@ -517,7 +540,17 @@ then G_EXEC losetup "$FP_LOOP" "$OUTPUT_IMG_NAME.img" G_EXEC partprobe "$FP_LOOP" G_EXEC partx -u "$FP_LOOP" - # Raise partition and filesystem size as well, since resize2fs within the image returns "Nothing to do!" + + # Remove added DOS partition, it will be re-added by DietPi-Imager + if (( $ADD_DOS_PART )) && [[ $(lsblk -nrbo FSTYPE,LABEL "$FP_LOOP" | tail -1) == 'vfat DIETPISETUP' ]] + then + SETUP_PART=$(sfdisk -lqo DEVICE "$FP_LOOP" | tail -1) + G_EXEC_OUTPUT=1 G_EXEC sfdisk --no-reread --no-tell-kernel --delete "$FP_LOOP" "${SETUP_PART: -1}" + G_EXEC partprobe "$FP_LOOP" + G_EXEC partx -u "$FP_LOOP" + fi + + # Raise partition and filesystem sizes as well, since partprobe cannot inform the host kernel about the changed size from within the container G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN2 '$FP_LOOP' <<< ',+'" G_EXEC partprobe "$FP_LOOP" G_EXEC partx -u "$FP_LOOP" @@ -625,7 +658,8 @@ _EOF_ G_EXEC rmdir rootfs G_EXEC losetup -d "$FP_LOOP" - bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "$OUTPUT_IMG_NAME.img" || exit 1 + G_DIETPI-NOTIFY 2 "Running DietPi-Imager for $G_GITOWNER/$G_GITBRANCH" + bash -c "$(curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-imager")" 'DietPi-Imager' "${IMAGER_ARGS[@]}" || exit 1 fi [[ $VMTYPE && $VMTYPE != 'raw' ]] || exit 0 @@ -633,11 +667,9 @@ fi ########################################## # Virtual machines ########################################## -G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSf "https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/README.md" -o README.md - # NB: LZMA2 ultra compression requires much memory per thread. 1 GiB is not sufficient for >2 threads, hence use "-mmt2" to limit used CPU threads to "2" on 1 GiB devices with more than two cores. limit_threads=() -(( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads=('-mmt2') +(( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads=('-T2') # Since qemu-img does not support VMDK and VHDX resizing, we need to resize the raw .img. It is usually done as sparse file, hence the actual disk usage does not change. G_EXEC qemu-img resize "$OUTPUT_IMG_NAME.img" 8G @@ -692,25 +724,14 @@ ethernet0.virtualDev = "e1000" ethernet0.present = "TRUE" extendedConfigFile = "$image_name.vmxf" floppy0.present = "FALSE" -_EOF_ - G_DIETPI-NOTIFY 2 'Generating hashes to pack with VMware appliance, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.vmdk -DATE: $(date) -MD5: $(md5sum "$image_name.vmdk" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.vmdk" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.vmdk" | mawk '{print $1}') - -FILE: $image_name.vmx -DATE: $(date) -MD5: $(md5sum "$image_name.vmx" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.vmx" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.vmx" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VMware 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.vmdk" "$image_name.vmx" hash.txt README.md + G_EXEC_DESC='Creating VMware tar.xz archive' XZ_OPT="-e9 ${limit_threads[*]}" G_EXEC tar -cJf "$image_name.tar.xz" "$image_name.vmdk" "$image_name.vmx" G_EXEC rm "$image_name.vmdk" "$image_name.vmx" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.tar.xz' > '$image_name.tar.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.tar.xz" || exit 1; signature=("$image_name.tar.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.tar.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.tar.xz"{,.sha256} "${signature[@]}" fi ####### ESXi ############################# @@ -834,18 +855,12 @@ _EOF_ [[ $VMTYPE == 'all' ]] || G_EXEC rm "$image_name.vmdk" G_EXEC rm "$image_name."{ovf,mf} - G_DIETPI-NOTIFY 2 'Generating hashes to pack with ESXi appliance, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.ova -DATE: $(date) -MD5: $(md5sum "$image_name.ova" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.ova" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.ova" | mawk '{print $1}') -_EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.ova" hash.txt README.md - G_EXEC rm "$image_name.ova" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Creating ESXi xz archive' G_EXEC xz -9e "${limit_threads[@]}" "$image_name.ova" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.ova.xz' > '$image_name.ova.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.ova.xz" || exit 1; signature=("$image_name.ova.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.ova.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.ova.xz"{,.sha256} "${signature[@]}" fi ####### VirtualBox ####################### @@ -992,18 +1007,12 @@ _EOF_ G_EXEC tar -cf "$image_name.ova" "$image_name."{ovf,vmdk,mf} G_EXEC rm "$image_name."{ovf,vmdk,mf} - G_DIETPI-NOTIFY 2 'Generating hashes to pack with VMware appliance, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.ova -DATE: $(date) -MD5: $(md5sum "$image_name.ova" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.ova" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.ova" | mawk '{print $1}') -_EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating VirtualBox 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.ova" hash.txt README.md - G_EXEC rm "$image_name.ova" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Creating VirtualBox xz archive' G_EXEC xz -9e "${limit_threads[@]}" "$image_name.ova" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.ova.xz' > '$image_name.ova.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.ova.xz" || exit 1; signature=("$image_name.ova.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.ova.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.ova.xz"{,.sha256} "${signature[@]}" fi ####### Hyper-V ########################## @@ -1013,18 +1022,12 @@ then # Convert raw image to VHDX G_EXEC qemu-img convert -O vhdx "$OUTPUT_IMG_NAME.img" "$image_name.vhdx" - G_DIETPI-NOTIFY 2 'Generating hashes to pack with Hyper-V image, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.vhdx -DATE: $(date) -MD5: $(md5sum "$image_name.vhdx" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.vhdx" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.vhdx" | mawk '{print $1}') -_EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating Hyper-V 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.vhdx" hash.txt README.md - G_EXEC rm "$image_name.vhdx" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Creating Hyper-V xz archive' G_EXEC xz -9e "${limit_threads[@]}" "$image_name.vhdx" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.vhdx.xz' > '$image_name.vhdx.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.vhdx.xz" || exit 1; signature=("$image_name.vhdx.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.vhdx.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.vhdx.xz"{,.sha256} "${signature[@]}" fi ####### Proxmox ############################ @@ -1034,18 +1037,16 @@ then # Convert raw image to QCOW2 G_EXEC qemu-img convert -c -O qcow2 "$OUTPUT_IMG_NAME.img" "$image_name.qcow2" - G_DIETPI-NOTIFY 2 'Generating hashes to pack with Proxmox image, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.qcow2 -DATE: $(date) -MD5: $(md5sum "$image_name.qcow2" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.qcow2" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.qcow2" | mawk '{print $1}') -_EOF_ + # Keep QCOW2 in compression when UTM appliance shall be generated from it as well. + keep=() + [[ $VMTYPE == 'all' ]] && keep=('-k') + [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating Proxmox 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.qcow2" hash.txt README.md - [[ $VMTYPE == 'all' ]] || G_EXEC rm "$image_name.qcow2" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Creating Proxmox xz archive' G_EXEC xz -9e "${limit_threads[@]}" "${keep[@]}" "$image_name.qcow2" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.qcow2.xz' > '$image_name.qcow2.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.qcow2.xz" || exit 1; signature=("$image_name.qcow2.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.qcow2.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.qcow2.xz"{,.sha256} "${signature[@]}" fi ####### UTM ############################## @@ -1210,35 +1211,18 @@ _EOF_ -_EOF_ - G_DIETPI-NOTIFY 2 'Generating hashes to pack with UTM appliance, please wait...' - cat << _EOF_ > hash.txt -FILE: $image_name.utm/Images/data.qcow2 -DATE: $(date) -MD5: $(md5sum "$image_name.utm/Images/data.qcow2" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.utm/Images/data.qcow2" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.utm/Images/data.qcow2" | mawk '{print $1}') - -FILE: $image_name.utm/config.plist -DATE: $(date) -MD5: $(md5sum "$image_name.utm/config.plist" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.utm/config.plist" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.utm/config.plist" | mawk '{print $1}') - -FILE: $image_name.utm/view.plist -DATE: $(date) -MD5: $(md5sum "$image_name.utm/view.plist" | mawk '{print $1}') -SHA1: $(sha1sum "$image_name.utm/view.plist" | mawk '{print $1}') -SHA256: $(sha256sum "$image_name.utm/view.plist" | mawk '{print $1}') _EOF_ [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - G_EXEC_DESC='Creating UTM 7-Zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$image_name.7z" "$image_name.utm" hash.txt README.md + G_EXEC_DESC='Creating UTM tar.xz archive' XZ_OPT="-e9 ${limit_threads[*]}" G_EXEC tar -cJf "$image_name.tar.xz" "$image_name.utm" G_EXEC rm -R "$image_name.utm" - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.7z" && G_EXEC rm "$image_name.7z" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$image_name.tar.xz' > '$image_name.tar.xz.sha256'" + signature=() + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$image_name.tar.xz" || exit 1; signature=("$image_name.tar.xz.asc"); } + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$image_name.tar.xz"{,.sha256} "${signature[@]}" && G_EXEC rm "$image_name.tar.xz"{,.sha256} "${signature[@]}" fi # Cleanup -G_EXEC rm hash.txt README.md "$OUTPUT_IMG_NAME.img" +G_EXEC rm "$OUTPUT_IMG_NAME.img" exit 0 } diff --git a/.build/images/dietpi-imager b/.build/images/dietpi-imager index 29d309d052..f4caf1b807 100755 --- a/.build/images/dietpi-imager +++ b/.build/images/dietpi-imager @@ -13,7 +13,7 @@ # or use an existing .img file # or use Clonezilla to generate a bootable installer ISO from drive for x86_64 systems # - Minimises root partition and filesystem - # - Hashes and 7z's the final image ready for release + # - Compresses the final image ready for release #//////////////////////////////////// # Import DietPi-Globals --------------------------------------------------------------- @@ -46,22 +46,11 @@ exit 1 } - # Inputs + ########################################## + # Process inputs + ########################################## SOURCE_TYPE='Drive' FP_SOURCE_IMG= - if [[ -b $1 ]] - then - FP_SOURCE=$1 - - elif [[ -f $1 ]] - then - SOURCE_TYPE='Image' - FP_SOURCE_IMG=$1 - - elif [[ $1 ]] - then - Error_Exit "Input source $1 does not exist, aborting..." - fi PART_TABLE_TYPE= #FP_ROOT_DEV= ROOT_FS_TYPE= @@ -69,9 +58,34 @@ OUTPUT_IMG_EXT='img' #OUTPUT_IMG_NAME= [[ $MOUNT_IT == 'On' ]] || MOUNT_IT='Off' + [[ $SKIP_FIRSTBOOT_RESIZE == 1 ]] || SKIP_FIRSTBOOT_RESIZE=0 [[ $SHRINK_ONLY == 1 ]] || SHRINK_ONLY=0 [[ $SKIP_ARCHIVE == 1 ]] || SKIP_ARCHIVE=0 - [[ $SKIP_FIRSTBOOT_RESIZE == 1 ]] || SKIP_FIRSTBOOT_RESIZE=0 + ADD_DOS_PART=0 + SIGN_PASS= + while (( $# )) + do + case $1 in + '--add-dos-part') ADD_DOS_PART=1;; + '--sign') shift; SIGN_PASS=$1;; + *) + if [[ -b $1 ]] + then + FP_SOURCE=$1 + + elif [[ -f $1 ]] + then + SOURCE_TYPE='Image' + FP_SOURCE_IMG=$1 + + elif [[ $1 ]] + then + Error_Exit "Input source $1 does not exist, aborting..." + fi + ;; + esac + shift + done Unmount_tmp() { @@ -277,9 +291,7 @@ Main(){ # Dependencies - local p7zip='7zip' c7zz='7zz' - (( $G_DISTRO < 7 )) && p7zip='p7zip' c7zz='7zr' - G_AG_CHECK_INSTALL_PREREQ parted fdisk zerofree "$p7zip" + G_AG_CHECK_INSTALL_PREREQ parted fdisk zerofree xz-utils # Skip menu if all inputs are provided via environment variables if [[ ( $SOURCE_TYPE$FP_SOURCE == 'Drive'?* || $SOURCE_TYPE$FP_SOURCE_IMG == 'Image'?* ) && $FP_ROOT_DEV && $CLONING_TOOL =~ ^(dd|Clonezilla)$ && $OUTPUT_IMG_NAME ]] @@ -494,13 +506,61 @@ G_EXEC partx -u "$FP_SOURCE" fi + # Derive target image size from last partition end + # - WARNING: this assumes that the partitions in the table are in order (which we do in other places as well) + local last_part_end=$(sfdisk -qlo End "$FP_SOURCE" | tail -1) # 512 byte sectors + IMAGE_SIZE=$last_part_end + # Add 34 sectors for GPT backup partition table and 1 sector for MBR + # shellcheck disable=SC2015 + [[ $PART_TABLE_TYPE == 'gpt' ]] && ((IMAGE_SIZE+=34)) || ((IMAGE_SIZE++)) + ((IMAGE_SIZE*=512)) # 512 byte sectors => bytes + + # Add trailing FAT partition to simplify first run setup if requested + if (( $ADD_DOS_PART )) + then + G_DIETPI-NOTIFY 2 'Adding a 1 MiB FAT partition to simplify first run setup' + ((IMAGE_SIZE+=1048576)) + # Increase source image size if required + [[ $SOURCE_TYPE == 'Image' ]] && (( $(stat -c '%s' "$FP_SOURCE_IMG") < $IMAGE_SIZE )) && G_EXEC truncate -s "$IMAGE_SIZE" "$FP_SOURCE_IMG" && G_EXEC losetup -c "$FP_SOURCE" + # Add new DOS partition + local start=$(( $last_part_end + 1 )) + local type='EBD0A0A2-B9E5-4433-87C0-68B6B72699C7' # https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs + [[ $PART_TABLE_TYPE == 'dos' ]] && type='c' + G_EXEC eval "sfdisk -a '$FP_SOURCE' <<< 'start=$start,size=2048,type=$type'" # size in sectors + G_EXEC partprobe "$FP_SOURCE" + G_EXEC partx -u "$FP_SOURCE" + # create a FAT filesystem and add config files to it + local new_dos_part=$(sfdisk -l "$FP_SOURCE" | mawk "/ $start /{print \$1;exit}") + G_EXE_OUTPUT=1 G_EXEC mkfs.fat -n DIETPISETUP "$new_dos_part" + local fat_mountpoint=$(mktemp -d) + local root_mountpoint=$(mktemp -d) + G_EXEC mount "$new_dos_part" "$fat_mountpoint" + G_EXEC mount "$FP_ROOT_DEV" "$root_mountpoint" + G_DIETPI-NOTIFY 2 'Copying dietpi.txt and other config files to the DIETPISETUP partition' + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + do + [[ -f $root_mountpoint/boot/$f ]] && G_EXEC cp "$root_mountpoint/boot/$f" "$fat_mountpoint/" + done + cat << '_EOF_' > "$fat_mountpoint/Readme-DietPi-Config.txt" +DietPi pre-boot configuration + +You can edit the files in this folder to setup some configuration options +or even a completely automated install. Please check the documentation and +dietpi.txt for details: https://dietpi.com/docs/install/ + +This folder also supports the following additional files. Please ensure that +they have UNIX style LF line endings: +- unattended_pivpn.conf +- Automation_Custom_PreScript.sh +- Automation_Custom_Script.sh +_EOF_ + G_EXEC umount "$root_mountpoint" "$fat_mountpoint" + G_EXEC rmdir "$root_mountpoint" "$fat_mountpoint" + fi + # Exit now if source shall be shrunk only (( $SHRINK_ONLY )) && exit 0 - # Finished: Derive final image size from last partition end + 1 sector - IMAGE_SIZE=$(( ( $(sfdisk -qlo End "$FP_SOURCE" | tail -1) + 1 ) * 512 )) # 512 byte sectors => bytes - [[ $PART_TABLE_TYPE == 'gpt' ]] && IMAGE_SIZE=$(( $IMAGE_SIZE + 33*512 )) # Add 33 (34 overall) sectors for GPT backup partition table - # Image file source and dd target if [[ $FP_SOURCE_IMG && $CLONING_TOOL == 'dd' ]] then @@ -514,13 +574,15 @@ [[ $(readlink -f "$PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT") != "$(readlink -f "$FP_SOURCE_IMG")" ]] && G_EXEC mv "$FP_SOURCE_IMG" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" # Check for sufficient free disk space to store the 7z archive with 100 MiB buffer - G_CHECK_FREESPACE . $(( $IMAGE_SIZE * 15/100 / 1024**2 + 100 )) || exit 1 + (( $SKIP_ARCHIVE )) || G_CHECK_FREESPACE . $(( $IMAGE_SIZE * 15/100 / 1024**2 + 100 )) || exit 1 # Drive source and dd target elif [[ $CLONING_TOOL == 'dd' ]] then - # Check for sufficient free disk space to store the image and the 7z archive with 100 MiB buffer - G_CHECK_FREESPACE . $(( $IMAGE_SIZE * 115/100 / 1024**2 + 100 )) || exit 1 + # Check for sufficient free disk space to store the image and in case the 7z archive with 100 MiB buffer + local free_space_percent=100 + (( $SKIP_ARCHIVE )) || free_space_percent=115 # 15% image size for 7z archive + G_CHECK_FREESPACE . $(( $IMAGE_SIZE * $free_space_percent/100 / 1024**2 + 100 )) || exit 1 G_DIETPI-NOTIFY 2 "Creating final image with actually used size: $(( $IMAGE_SIZE / 1024**2 + 1 )) MiB" G_EXEC_OUTPUT=1 G_EXEC dd if="$FP_SOURCE" of="$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" bs=1M status=progress count=$(( $IMAGE_SIZE / 1024**2 + 1 )) @@ -661,34 +723,24 @@ _EOF_ # Exit now when archive shall be skipped (( $SKIP_ARCHIVE )) && exit 0 - # Generate hashes: MD5, SHA1, SHA256 - G_DIETPI-NOTIFY 2 'Generating hashes to pack with image, please wait...' - cat << _EOF_ > hash.txt -FILE: $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT -DATE: $(date) -MD5: $(md5sum "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" | mawk '{print $1}') -SHA1: $(sha1sum "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" | mawk '{print $1}') -SHA256: $(sha256sum "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" | mawk '{print $1}') -_EOF_ - # Download current README - G_EXEC_DESC='Downloading current README.md to pack with image...' G_EXEC curl -sSf "$DIETPI_REPO/README.md" -o README.md - - # Generate 7z archive + # Generate xz archive # NB: LZMA2 ultra compression requires much memory per thread. 1 GiB is not sufficient for >2 threads, hence use "-mmt2" to limit used CPU threads to "2" on 1 GiB devices with more than two cores. local limit_threads=() - (( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads=('-mmt2') - [[ -f $OUTPUT_IMG_NAME.7z ]] && G_EXEC rm "$OUTPUT_IMG_NAME.7z" + (( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads=('-T2') + [[ -f $OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz ]] && G_EXEC rm "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz" [[ ( -t 0 || -t 1 ) && $TERM != 'dumb' ]] && G_EXEC_OUTPUT=1 - # Add "-bsp1 -bso1 -bse2" to print output to regular STDOUT and STDERR, else the pipe to "tee" makes it omit at least the progress output. - G_EXEC_DESC='Creating final 7zip archive' G_EXEC "$c7zz" a -mx=9 "${limit_threads[@]}" "$OUTPUT_IMG_NAME.7z" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" hash.txt README.md + G_EXEC_DESC='Creating final xz archive' G_EXEC xz -9e "${limit_threads[@]}" "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT" + G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz' > '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz.sha256'" + local signature=() sig_text='' + [[ $SIGN_PASS ]] && { G_DIETPI-NOTIFY 2 'Signing archive ...'; gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz" || exit 1; signature=("$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz.asc") sig_text="\nSignature: $PWD/${signature[*]}"; } - G_EXEC_NOHALT=1 G_EXEC rm hash.txt README.md G_DIETPI-NOTIFY 0 "DietPi-Imager has successfully finished. -Final image file: $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT -Final 7z archive: $PWD/$OUTPUT_IMG_NAME.7z" +Image file: $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT +xz archive: $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz +SHA256 hash: $PWD/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz.sha256$sig_text" # Upload archive automatically if there is an upload.sh in the same directory - [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$OUTPUT_IMG_NAME.7z" && G_EXEC rm -R "$OUTPUT_IMG_NAME.7z" + [[ -x 'upload.sh' ]] && G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz"{,.sha256} "${signature[@]}" && G_EXEC rm -R "$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz"{,.sha256} "${signature[@]}" } diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer index 509df364ac..96ea0ca5f2 100755 --- a/.build/images/dietpi-installer +++ b/.build/images/dietpi-installer @@ -969,6 +969,16 @@ _EOF_ # DietPi-Build with Armbian kernel/bootloader/firmware elif (( $armbian_repo )) then + # Prevent any unintended packages from being installed from Armbian's APT repository, like base-files: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian +Package: * +Pin: origin apt.armbian.com +Pin-Priority: -1 + +Package: armbian-firmware* linux-* +Pin: origin apt.armbian.com +Pin-Priority: 500 +_EOF_ # 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 @@ -990,13 +1000,13 @@ _EOF_ 40) model='pine64' kernel='sunxi64';; 42) model='rockpro64' kernel='rockchip64';; 43) model='rock64' kernel='rockchip64';; - 44) model='pinebook-a64' kernel='sunxi64' dietpi_com=1;; + 44) model='pinebook-a64' kernel='sunxi64';; 45) model='pineh64-b' kernel='sunxi64';; - 46) model='pinebook-pro' kernel='rockchip64' dietpi_com=1;; + 46) model='pinebook-pro' kernel='rockchip64';; 47) model='nanopi-r4s' kernel='rockchip64';; 48) model='nanopi-r1' kernel='sunxi' arch='arm';; 52) model='tinkerboard' kernel='rockchip' arch='arm';; - 54) model='nanopik2-s905' dietpi_com=1;; + 54) model='nanopik2-s905';; 55) model='nanopi-r2s' kernel='rockchip64';; 56) model='nanopineo3' kernel='rockchip64';; 57) model='nanopineoplus2' kernel='sunxi64';; @@ -1007,10 +1017,9 @@ _EOF_ case $HW_VARIANT in 2) model='nanopifire3';; *) model='nanopim3';; - esac - dietpi_com=1;; + esac;; 63) model='nanopim1' kernel='sunxi' arch='arm' dietpi_com=1;; - 64) model='nanopiair' kernel='sunxi' arch='arm' dietpi_com=1;; + 64) model='nanopiair' kernel='sunxi' arch='arm';; 65) kernel='sunxi64' case $HW_VARIANT in 2) model='nanopineo2black';; @@ -1021,11 +1030,11 @@ _EOF_ 68) kernel='rockchip64' case $HW_VARIANT in 1) model='nanopim4';; - 3) model='nanopineo4' dietpi_com=1;; + 3) model='nanopineo4';; *) model='nanopct4';; esac;; 72) model='rockpi-4b' kernel='rockchip64';; - 73) model='rockpi-s' kernel='rockchip64' dietpi_com=1;; + 73) model='rockpi-s' kernel='rockchip64';; 74) model='radxa-zero';; 77) model='rock-3a' kernel='rk35xx' branch='edge';; 78) model='rock-5b' kernel='rk35xx' branch='legacy';; @@ -1033,8 +1042,8 @@ _EOF_ 82) model='orangepi5-plus' kernel='rk35xx' branch='legacy';; *) :;; esac - # Download and pre-install U-Boot hosted on dietpi.com where it has not been ported (and probably never will) to the Armbian Bookworm repo or where it provides a too old version - if (( $dietpi_com && $G_DISTRO > 6 || $G_HW_MODEL == 62 || $G_HW_MODEL == 72 || $G_HW_MODEL == 80 || $G_HW_MODEL == 82 )) + # Download and pre-install U-Boot hosted on dietpi.com where it has not been ported to the Armbian Bookworm repo or has been removed completely + if (( $dietpi_com && $G_DISTRO > 6 || $G_HW_MODEL == 62 )) then G_EXEC curl -sSfo package.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb" G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb @@ -1056,19 +1065,19 @@ _EOF_ # Install initramfs-tools first to have an initramfs generated on kernel install, and configure it to use zstd if supported for better compression and faster decompression [[ $kernel == 'rockchip64' || $kernel == 'rk35xx' || $kernel == 'meson64' || $kernel == 'sunxi64' || $kernel == 'sunxi' ]] && zstd=('zstd') # - Download and pre-install a more recent armbian-firmware package from our server - G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb 'https://dietpi.com/downloads/binaries/armbian-firmware.deb' - G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb - G_EXEC rm package.deb + #G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb 'https://dietpi.com/downloads/binaries/armbian-firmware.deb' + #G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb + #G_EXEC rm package.deb G_AGI initramfs-tools u-boot-tools armbian-firmware "${zstd[@]}" [[ ${zstd[0]} ]] && G_CONFIG_INJECT 'COMPRESS=' 'COMPRESS=zstd' /etc/initramfs-tools/initramfs.conf # Download and pre-install kernel hosted on dietpi.com where the Armbian APT repo provides a too old version - if [[ $G_HW_MODEL =~ ^(78|80|82)$ || ( $kernel == 'rockchip64' && $branch == 'current' ) ]] - then - G_EXEC_OUTPUT=1 G_EXEC curl -fo package1.deb "https://dietpi.com/downloads/binaries/linux-image-$branch-$kernel.deb" - G_EXEC_OUTPUT=1 G_EXEC curl -fo package2.deb "https://dietpi.com/downloads/binaries/linux-dtb-$branch-$kernel.deb" - G_EXEC_OUTPUT=1 G_EXEC dpkg -i package1.deb package2.deb - G_EXEC rm package1.deb package2.deb - fi + #if [[ $G_HW_MODEL =~ ^(78|80|82)$ || ( $kernel == 'rockchip64' && $branch == 'current' ) ]] + #then + # G_EXEC_OUTPUT=1 G_EXEC curl -fo package1.deb "https://dietpi.com/downloads/binaries/linux-image-$branch-$kernel.deb" + # G_EXEC_OUTPUT=1 G_EXEC curl -fo package2.deb "https://dietpi.com/downloads/binaries/linux-dtb-$branch-$kernel.deb" + # G_EXEC_OUTPUT=1 G_EXEC dpkg -i package1.deb package2.deb + # G_EXEC rm package1.deb package2.deb + #fi G_AGI linux-{image,dtb}-"$branch-$kernel" "linux-u-boot-$model-$branch" # Cleanup [[ $G_HW_MODEL != 10 && -f '/boot/uImage' ]] && G_EXEC rm /boot/uImage @@ -1962,8 +1971,8 @@ _EOF_ G_DIETPI-NOTIFY 2 'Enabling NanoPi R4S Ethernet LEDs' G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules -SUBSYSTEM=="leds", KERNEL=="lan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" -SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" +SUBSYSTEM=="leds", KERNEL=="green:lan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" +SUBSYSTEM=="leds", KERNEL=="green:wan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" _EOF_ # NanoPi R2S elif (( $G_HW_MODEL == 55 )) diff --git a/.build/software/shairport-sync/build.bash b/.build/software/shairport-sync/build.bash index fb0b9e5e55..52a88fdfa2 100755 --- a/.build/software/shairport-sync/build.bash +++ b/.build/software/shairport-sync/build.bash @@ -487,7 +487,11 @@ find "$DIR" ! \( -path "$DIR/DEBIAN" -prune \) -type f -exec md5sum {} + | sed " # - Add dependencies adeps+=('libplist3' 'libsodium23' 'libgcrypt20') -(( $G_DISTRO > 6 )) && adeps+=('libavcodec59') || adeps+=('libavcodec58') +case $G_DISTRO in + 5|6) adeps+=('libavcodec58');; + 7) adeps+=('libavcodec59');; + *) adeps+=('libavcodec60');; +esac DEPS_APT_VERSIONED= for i in "${adeps[@]}" do diff --git a/.github/workflows/dietpi-build.yml b/.github/workflows/dietpi-build.yml index 0eb5b6e43f..83bcfddf04 100644 --- a/.github/workflows/dietpi-build.yml +++ b/.github/workflows/dietpi-build.yml @@ -111,8 +111,14 @@ jobs: sudo dash -c 'umask 377; echo '\''${{ secrets.KNOWN_HOSTS }}'\'' > /root/.ssh/known_hosts; echo '\''${{ secrets.SSH_KEY }}'\'' > /root/.ssh/id_ed25519; > upload.sh; chmod 0711 upload.sh' echo '#!/bin/dash set -e - curl -T "${1:-EMPTY}" --key /root/.ssh/id_ed25519 '\''${{ secrets.UPLOAD_URL }}testing/'\'' - curl '\''https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache'\'' -H '\''Authorization: Bearer ${{ secrets.CF_TOKEN }}'\'' -H '\''Content-Type: application/json'\'' \ - --data "{\"files\":[\"https://dietpi.com/downloads/images/testing/\",\"https://dietpi.com/downloads/images/testing/${1##*/}\"]}"' | sudo tee upload.sh > /dev/null + urls="\"https://dietpi.com/downloads/images/testing/\"" + for i in "$@"; do urls="$urls,\"https://dietpi.com/downloads/images/testing/${i##*/}\""; done + IFS=, + curl -T "{$*}" --key /root/.ssh/id_ed25519 '\''${{ secrets.UPLOAD_URL }}testing/'\'' + curl -H '\''Authorization: Bearer ${{ secrets.CF_TOKEN }}'\'' -H '\''Content-Type: application/json'\'' -d "{\"files\":[$urls]}" '\''https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache'\'' + echo' | sudo tee upload.sh > /dev/null + sudo gpg --batch --import << _EOF_ + ${{ secrets.GPG_KEY }} + _EOF_ - name: Run DietPi-Build - run: sudo bash -c "G_GITOWNER=$GITHUB_REPOSITORY_OWNER G_GITBRANCH=${GITHUB_REF#refs/heads/}; $(curl -sSf "https://raw.githubusercontent.com/$GITHUB_REPOSITORY_OWNER/DietPi/${GITHUB_REF#refs/heads/}/.build/images/dietpi-build")" 'DietPi-Build' ${{ matrix.buildargs }} + run: sudo bash -c "G_GITOWNER=$GITHUB_REPOSITORY_OWNER G_GITBRANCH=${GITHUB_REF#refs/heads/}; $(curl -sSf "https://raw.githubusercontent.com/$GITHUB_REPOSITORY_OWNER/DietPi/${GITHUB_REF#refs/heads/}/.build/images/dietpi-build")" 'DietPi-Build' ${{ matrix.buildargs }} --sign '${{ secrets.GPG_PASS }}' diff --git a/.github/workflows/dietpi-software.bash b/.github/workflows/dietpi-software.bash index 7d54933e14..b30f7f3520 100644 --- a/.github/workflows/dietpi-software.bash +++ b/.github/workflows/dietpi-software.bash @@ -232,8 +232,8 @@ for i in $SOFTWARE do case $i in 205) Process_Software webserver;; - 27|56|63|64|107|132) Process_Software 89 webserver;; # 93 (Pi-hole) cannot be installed non-interactively - 38|40|48|54|55|57|59|90|141|160) Process_Software 88 89 webserver;; + 27|56|63|64|75|78|81|107|132) Process_Software 89 webserver;; # 93 (Pi-hole) cannot be installed non-interactively + 38|40|48|54|55|57|59|76|79|82|90|160|210) Process_Software 88 89 webserver;; 159) Process_Software 36 37 65 88 89 96 121 124 128 129 152 160 163 webserver;; 47|114|168) Process_Software 88 89 91 webserver;; 8|33|131|179|206) Process_Software 196;; diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index a18e8c5d4a..133655760e 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Setup tmpfs run: sudo mount -t tmpfs -o "noatime,lazytime,uid=$(id -u)" tmpfs "$GITHUB_WORKSPACE" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup DietPi-Globals run: | sudo mkdir -p /boot/dietpi/func diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 707baaa300..5a06fdf49d 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -683,13 +683,16 @@ shopt -s extglob aSOFTWARE_NAME8_20[211]='Homebridge' aSOFTWARE_NAME8_21=() + aSOFTWARE_NAME8_22=() for i in "${!aSOFTWARE_NAME8_20[@]}" do aSOFTWARE_NAME8_21[i]=${aSOFTWARE_NAME8_20[i]} + aSOFTWARE_NAME8_22[i]=${aSOFTWARE_NAME8_21[i]} done + aSOFTWARE_NAME8_22[141]='ADS-B Feeder' # Pre-create software counter array so that we can see also software (available in newest version) with 0 installs - for i in "${aSOFTWARE_NAME8_21[@]}" + for i in "${aSOFTWARE_NAME8_22[@]}" do aSOFTWARE[$i]=0 done diff --git a/.update/patches b/.update/patches index cefd175279..fed74700ed 100755 --- a/.update/patches +++ b/.update/patches @@ -1162,15 +1162,6 @@ Patch_8_17() [[ -f '/etc/systemd/system/roonbridge.service.d/dietpi-no-caps.conf' ]] && G_EXEC rm /etc/systemd/system/roonbridge.service.d/dietpi-no-caps.conf [[ -f '/etc/systemd/system/roonbridge.service.d' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/systemd/system/roonbridge.service.d - # NanoPi R4S - elif (( $G_HW_MODEL == 47 )) - then - G_DIETPI-NOTIFY 2 'Updating udev rule for NanoPi R4S Ethernet LEDs' - G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' - cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules -SUBSYSTEM=="leds", KERNEL=="lan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" -SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" -_EOF_ # NanoPi R2S elif (( $G_HW_MODEL == 55 )) then @@ -1470,6 +1461,32 @@ Patch_8_21() fi } +Patch_8_22() +{ + # Remove obsolete configs from pre-patches + [[ -f '/etc/apt/preferences.d/dietpi-armbian-tmp' ]] && G_EXEC rm /etc/apt/preferences.d/dietpi-armbian-tmp + [[ -f '/etc/apt/apt.conf.d/dietpi-armbian' ]] && G_EXEC rm /etc/apt/apt.conf.d/dietpi-armbian + + # NanoPi R4S: Fix Ethernet LEDs: https://github.com/MichaIng/DietPi/issues/6342#issuecomment-1697669420 + if (( $G_HW_MODEL == 47 )) + then + G_DIETPI-NOTIFY 2 'Updating udev rule for NanoPi R4S Ethernet LEDs' + G_EXEC eval 'echo '\''ledtrig-netdev'\'' > /etc/modules-load.d/dietpi-eth-leds.conf' + cat << '_EOF_' > /etc/udev/rules.d/dietpi-eth-leds.rules +SUBSYSTEM=="leds", KERNEL=="green:lan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth0", RUN+="/bin/ip l s down dev eth0" +SUBSYSTEM=="leds", KERNEL=="green:wan", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" +_EOF_ + fi + + # Migrate Armbian keyring from /etc/apt/trusted.gpg to /etc/apt/trusted.gpg.d for old images + if [[ -f '/etc/apt/trusted.gpg' && $(apt-key --keyring /etc/apt/trusted.gpg list 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5' 2> /dev/null) ]] + then + G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes' + G_EXEC apt-key --keyring /etc/apt/trusted.gpg del 'DF00FAF1C577104B50BF1D0093D6889F9F0E78D5' + [[ $(apt-key --keyring /etc/apt/trusted.gpg list 2> /dev/null) ]] || G_EXEC rm /etc/apt/trusted.gpg + fi +} + # 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 index a66bead827..98f23da6ab 100755 --- a/.update/pre-patches +++ b/.update/pre-patches @@ -264,5 +264,35 @@ then fi fi +# v8.22 +if (( $G_DIETPI_VERSION_CORE < 8 || ( $G_DIETPI_VERSION_CORE == 8 && $G_DIETPI_VERSION_SUB < 22 ) )) +then + # Block and enforce downgrade of Armbian's base-files package to Debian's: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 + [[ -f '/etc/apt/sources.list.d/armbian.list' ]] && G_EXEC mv /etc/apt/sources.list.d/{,dietpi-}armbian.list + if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] + then + G_DIETPI-NOTIFY 2 'Preventing any unintended packages from being installed from Armbian'\''s APT repository' + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian +Package: * +Pin: origin apt.armbian.com +Pin-Priority: -1 + +Package: armbian-firmware* linux-* +Pin: origin apt.armbian.com +Pin-Priority: 500 +_EOF_ + fi + if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20 + then + G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s' + cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp +Package: base-files +Pin: release o=Debian +Pin-Priority: 1000 +_EOF_ + G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian' + fi +fi + exit 0 } diff --git a/.update/version b/.update/version index 3450adc4ff..ee1494577d 100644 --- a/.update/version +++ b/.update/version @@ -2,8 +2,8 @@ # shellcheck disable=SC2034 # Available DietPi version G_REMOTE_VERSION_CORE=8 -G_REMOTE_VERSION_SUB=21 -G_REMOTE_VERSION_RC=1 +G_REMOTE_VERSION_SUB=22 +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 fa470b7c44..6fcc3d5f5d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,26 @@ +v8.22 +(2023-09-23) + +New software: +- ADS-B Feeder | Track airplanes using SDRs and feed the data to ADS-B aggregators. Many thanks to @dirkhh for maintaining and implementing this software option: https://github.com/MichaIng/DietPi/pull/6587 + +Enhancements: +- Images | DietPi images are now shipped with a trailing FAT partition which contains dietpi.txt and other config files for easier pre-configuration and automation from Windows and macOS hosts. The partition is removed automatically on first boot, after copying all supported config files/scripts. Related CLI flags have been added to our build scripts: "--add-fat-part" for dietpi-imager and "--no-fat-part" for dietpi-build. Many thanks to @dirkhh for implementing this feature: https://github.com/MichaIng/DietPi/pull/6602 +- Images | All our images are now compressed via xz instead of 7z. These are a little easier to handle, especially on Linux hosts, and many flashing utilities allow to flash zx-compressed images directly to disk, without the need to manually decompress them first. As xz compresses files and no directories, the dedicated README.md and hash text files are not included anymore. The hashes for integrity checks within an archive have no real purpose, as the compression algorithms imply hashes internally (CRC64 in case of xz), which are checked and integrity of the content assured as part of the decompression. +- Images | SHA256 hashes and GPG signatures are now provided for all our images, linked from our download page or found here: https://dietpi.com/downloads/images/. Our public GPG keyring can be found at https://github.com/MichaIng.gpg. +- DietPi-Software | Docker: Enabled for Trixie and RISC-V via "docker.io" package from Debian repository. +- DietPi-Software | Portainer: Enabled for RISC-V as Docker is now supported on RISC-V as well. + +Bug fixes: +- NanoPi R4S | Resolved a v8.20 regression where the Ethernet LEDs did not react correctly after the kernel upgrade. Many thanks to @idaanx for reporting this issue: https://github.com/MichaIng/DietPi/issues/6342#issuecomment-1697669420 +- dietpi-bookworm-upgrade | Resolved an issue on systems with Armbian repository, where the system was still identified as Bullseye after the distribution upgrade to Bookworm. Reason was Armbian's base-files package, which was not upgraded as intended. On all DietPi systems, the original base-files package from Debian will now be enforced to prevent this and similar issues. Many thanks to @rogerthn2019 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577 +- DietPi-Config | The menu option to update the SPI bootloader is now shown on Orange Pi 5 Plus as well, as intended. Many thanks for @zappydood for reporting its absence: https://github.com/MichaIng/DietPi/issues/6501#issuecomment-1697175109 +- DietPi-Software | Ampache: Resolved an issue where the latest version was not successfully detected on install, so that an older fallback version was installed instead. Many thanks to @bartolus39 for reporting this issue: https://github.com/MichaIng/DietPi/issues/6598 + +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/6580 + +----------------------------------------------------------------------------------------------------------- + v8.21 (2023-08-26) @@ -7,7 +30,7 @@ New images: Enhancements: - Orange Pi 5/ROCK 5B | An update of the kernel to Linux 5.10.160 will be applied automatically as part of the DietPi update. - Orange Pi 5 | An update of the U-Boot package will be applied. When flashing it to SPI via dietpi-config > Advanced Options > Update SPI bootloader, it enables booting DietPi via NVMe and USB. -- 64-bit Rockchip SBCs | All SBCs with Armbian's 64-bit Rockchip kernel package "linux-image-current-rockchip64" will receive a major kernel upgrade to Linux 6.1.46, including lots of fixes and enhancements that have been applied upstream and by Armbian in the meantime. Since Armbian's APT repository has not seen any update since February 2023, we started compiling and hosting own builds. An own APT repository is being worked on to better distribute our own package builds. Until the, headers for this kernel package can be downloaded at: https://dietpi.com/downloads/binaries/linux-headers-current-rockchip64.deb +- RK33xx SBCs | All SBCs with RK33xx SoC and Armbian's "linux-image-current-rockchip64" kernel package will receive a major kernel upgrade to Linux 6.1.46, including lots of fixes and enhancements that have been applied upstream and by Armbian in the meantime. Since Armbian's APT repository has not seen any update since February 2023, we started compiling and hosting own builds. An own APT repository is being worked on to better distribute our own package builds. Until then, headers for this kernel package can be downloaded at: https://dietpi.com/downloads/binaries/linux-headers-current-rockchip64.deb - DietPi-Config | WiFi Hotspot: When applying settings, manually changed IP addresses in /etc/network/interfaces will now be preserved. Additionally, it is now assured that changing interface names, e.g. due to an additionally attached WiFi adapter, are now aligned across /etc/network/interfaces, hostapd and DHCP server configs. - DietPi-Config | WiFi Hotspot: Toggles for enabling 802.11ac/WiFi 5, 802.11ax/WiFi 6 (Bookworm only) and 5 GHz WiFi respectively have been added to the menu. - DietPi-Software | WiFi Hotspot: We added new dietpi.txt settings "SOFTWARE_WIFI_HOTSPOT_WIFI4", "SOFTWARE_WIFI_HOTSPOT_WIFI5", "SOFTWARE_WIFI_HOTSPOT_WIFI6" and "SOFTWARE_WIFI_HOTSPOT_5G" to have 802.11n/WiFi 4, 802.11ac/WiFi 5, 802.11ax/WiFi 6 (Bookworm only) and 5 GHz support respectively enabled on install. @@ -1507,7 +1530,7 @@ Bug Fixes: - DietPi-Software | Home Assistant: Resolved on issue where fresh install failed to started to start due to missing permissions. Many thanks to @slopsjon, @tyjtyj and @pakikje for reporting this issue. - DietPi-Software | Google AIY: Resolved an issue where fresh install failed to start due to missing permissions - DietPi-Software | Grafana: Resolved an issue where install failed on RPi 1/Zero Buster systems. The fix includes an update of Grafana to the latest official version for those models. Many thanks to @TBail for reporting this issue: https://github.com/MichaIng/DietPi/issues/3213 -- DietPi-Software | Jackett: Resolved an issue where the internal updater broke the Jackett instance. Automated updates can be safely enabled again. Many thanks to @ngosang for providing the workaround: https://github.com/MichaIng/DietPi/issues/2593 +- DietPi-Software | Jackett: Resolved an issue where the internal updater broke the Jackett instance. Automated updates can be safely enabled again. Many thanks to @ezekini for reporting this issue: https://github.com/MichaIng/DietPi/issues/2593 - DietPi-Software | Pi-hole: Resolved an issue where choosing to block public admin panel access on Nginx failed. Many thanks to @anubis-genix for reporting this issue: https://github.com/MichaIng/DietPi/issues/3024#issuecomment-550342684 - DietPi-Software | Java: Resolved an issue where install on ARMv6 RPis (1/Zero) on Buster system failed, since Java 11 is not ARMv6-compatible. On these system, Java 8 is now installed instead. Many thanks to @maartenlangeveld for reporting this issue: https://github.com/MichaIng/DietPi/issues/3182 - DietPi-Software | rTorrent: Resolved an issue where rTorrent and the webserver didn't have sufficient permissions to read and write ruTorrent web UI settings and data. Many thanks to @notDavid for reporting this issue: https://github.com/MichaIng/DietPi/issues/3244 diff --git a/README.md b/README.md index a30c71f33d..f14488ca3e 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ Links to hardware and software manufacturers, sources and build instructions use - [Restic](https://github.com/restic/restic) - [MediaWiki](https://github.com/wikimedia/mediawiki) - [Homebridge](https://github.com/homebridge/homebridge) +- [ADS-B Feeder](https://github.com/dirkhh/adsb-feeder-image) --- diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index e1098d07e5..492aabb158 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -1068,8 +1068,8 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the G_WHIP_MENU_ARRAY+=('Update RPi4 EEPROM firmware' ': Install rpi-eeprom APT package') fi - # Orange Pi 5: https://dietpi.com/forum/t/orange-pi-5-boot-from-nvme/16457 - elif (( $G_HW_MODEL == 80 )) + # Orange Pi 5 (Plus): https://dietpi.com/forum/t/orange-pi-5-boot-from-nvme/16457 + elif [[ $G_HW_MODEL == 8[02] ]] then [[ -b '/dev/mtdblock0' && -f '/usr/lib/u-boot/platform_install.sh' ]] && G_WHIP_MENU_ARRAY+=('Update SPI bootloader' ': Flash current U-Boot to /dev/mtdblock0') diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index d8e5f558b5..04b8758ae3 100755 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -268,6 +268,8 @@ _EOF_ 'fahclient' 'ipfs' 'yacy' + 'adsb-setup' + 'adsb-docker' ) # Additional services: https://github.com/MichaIng/DietPi/issues/1869#issuecomment-401017251 diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index e2b28211ab..7ad2784ab8 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -1122,8 +1122,6 @@ Available commands: aSOFTWARE_DESC[$software_id]='Build, ship, and run distributed applications' aSOFTWARE_CATX[$software_id]=8 aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/programming/#docker' - # - RISC-V: Missing package: https://download.docker.com/linux/debian/dists/ - aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,11]=0 #------------------ software_id=185 aSOFTWARE_NAME[$software_id]='Portainer' @@ -1133,8 +1131,6 @@ Available commands: aSOFTWARE_DEPS[$software_id]='162' # - ARMv6: https://dietpi.com/forum/t/armv6-bookworm-software-test-matrix-question/16380/11 aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,1]=0 - # - RISC-V: Missing Docker package: https://download.docker.com/linux/debian/dists/ - aSOFTWARE_AVAIL_G_HW_ARCH[$software_id,11]=0 #------------------ software_id=134 aSOFTWARE_NAME[$software_id]='Docker Compose' @@ -1595,6 +1591,13 @@ Available commands: aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/distributed_projects/#yacy' aSOFTWARE_DEPS[$software_id]='196' #------------------ + software_id=141 + aSOFTWARE_NAME[$software_id]='ADS-B Feeder' + aSOFTWARE_DESC[$software_id]='track airplanes using SDRs and feed the data to ADS-B aggregators' + aSOFTWARE_CATX[$software_id]=19 + aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/distributed_projects/#adsb-feeder' + aSOFTWARE_DEPS[$software_id]='17 130 134 162' # Git, Python, Docker & Docker Compose + #------------------ software_id=184 aSOFTWARE_NAME[$software_id]='Tor Relay' aSOFTWARE_DESC[$software_id]='add a node to the Tor network' @@ -6966,7 +6969,7 @@ _EOF_ if To_Install 98 haproxy # HAProxy then - local version='2.7.6' # https://www.haproxy.org/download/ + local version='2.8.2' # https://www.haproxy.org/download/ aDEPS=('make' 'gcc' 'libpcre3-dev' 'libssl-dev' 'zlib1g-dev' 'libsystemd-dev') Download_Install "https://www.haproxy.org/download/${version%.*}/src/haproxy-$version.tar.gz" @@ -7500,8 +7503,8 @@ _EOF_ then Download_Install 'https://github.com/gotson/komga/releases/download/v0.165.0/komga-0.165.0.jar' /mnt/dietpi_userdata/komga/komga.jar else - local fallback_url='https://github.com/gotson/komga/releases/download/v1.3.1/komga-1.3.1.jar' - Download_Install "$(curl -sSfL 'https://api.github.com/repos/gotson/komga/releases/latest' | mawk -F\" '/"browser_download_url": .*\/komga-[^"\/]*\.jar"/{print $4}')" /mnt/dietpi_userdata/komga/komga.jar + local fallback_url='https://github.com/gotson/komga/releases/download/v1.4.0/komga-1.4.0.jar' + Download_Install "$(curl -sSfL 'https://api.github.com/repos/gotson/komga/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/komga-[^"\/]*\.jar"$/{print $4}')" /mnt/dietpi_userdata/komga/komga.jar fi # User @@ -7598,8 +7601,8 @@ _EOF_ # Bullseye+ if (( $G_DISTRO > 5 )) then - local fallback_url='https://github.com/ampache/ampache/releases/download/5.5.3/ampache-5.5.3_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 + local fallback_url="https://github.com/ampache/ampache/releases/download/6.0.2/ampache-6.0.2_all_php$PHP_VERSION.zip" + Download_Install "$(curl -sSfL 'https://api.github.com/repos/ampache/ampache/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/ampache-[0-9\.]*_all_php$PHP_VERSION.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' @@ -8664,7 +8667,7 @@ _EOF_ # Install ruTorrent: Web UI for rTorrent # - Grab current version local version=$(curl -sSfL 'https://api.github.com/repos/Novik/ruTorrent/releases/latest' | mawk -F\" '/^ *"tag_name": "[^"]*",$/{print $4}') - [[ $version ]] || { version='v4.2.4'; G_DIETPI-NOTIFY 1 "Automatic latest ruTorrent version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } + [[ $version ]] || { version='v4.2.6'; G_DIETPI-NOTIFY 1 "Automatic latest ruTorrent version detection failed. Version \"$version\" will be installed as fallback, but a newer version might be available. Please report this at: https://github.com/MichaIng/DietPi/issues"; } Download_Install "https://github.com/Novik/ruTorrent/archive/$version.tar.gz" # - Reinstall freshly with preserved configs and 3rd party plugins @@ -9055,7 +9058,7 @@ _EOF_ *) local arch='arm';; esac - local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.23.7/syncthing-linux-$arch-v1.23.7.tar.gz" + local fallback_url="https://github.com/syncthing/syncthing/releases/download/v1.24.0/syncthing-linux-$arch-v1.24.0.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/syncthing/syncthing/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/syncthing-linux-$arch-[^\"\/]*\.tar\.gz\"/{print \$4}")" G_EXEC mv syncthing-* /opt/syncthing fi @@ -10133,7 +10136,7 @@ _EOF_ *) local arch='x64';; esac - local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.7.4.3769/Prowlarr.master.1.7.4.3769.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.8.6.3946/Prowlarr.master.1.8.6.3946.linux-core-$arch.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest' | mawk -F\" "/\"browser_download_url\": .*linux-core-$arch\.tar\.gz\"/{print \$4}")" G_EXEC mv Prowlarr /opt/prowlarr fi @@ -10208,7 +10211,7 @@ _EOF_ *) local arch='x64';; esac - local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.3.2171/Readarr.develop.0.3.3.2171.linux-core-$arch.tar.gz" + local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.4.2207/Readarr.develop.0.3.4.2207.linux-core-$arch.tar.gz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/Readarr/Readarr/releases' | mawk -F\" "/\"browser_download_url\": .*linux-core-$arch\.tar\.gz\"/{print \$4}" | head -1)" G_EXEC mv Readarr /opt/readarr fi @@ -10535,23 +10538,32 @@ _EOF_ if To_Install 162 docker # Docker then - # Detect distro - local distro='debian' - (( $G_RASPBIAN )) && distro='raspbian' + # APT package name + # - RISC-V: Use "docker.io" from Debian repo as the official Docker repo does not support RISC-V yet: https://download.docker.com/linux/debian/dists/ + local package='docker.io' + if (( $G_HW_ARCH != 11 )) + then + # Detect distro + local distro='debian' + (( $G_RASPBIAN )) && distro='raspbian' - # APT key - local url="https://download.docker.com/linux/$distro/gpg" - G_CHECK_URL "$url" - G_EXEC eval "curl -sSfL '$url' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-docker.gpg --yes" + # APT key + local url="https://download.docker.com/linux/$distro/gpg" + G_CHECK_URL "$url" + G_EXEC eval "curl -sSfL '$url' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-docker.gpg --yes" - # APT list - G_EXEC eval "echo 'deb https://download.docker.com/linux/$distro/ $G_DISTRO_NAME stable' > /etc/apt/sources.list.d/docker.list" - G_AGUP + # APT list + G_EXEC eval "echo 'deb https://download.docker.com/linux/$distro/ ${G_DISTRO_NAME/trixie/bookworm} stable' > /etc/apt/sources.list.d/docker.list" + G_AGUP + + # APT package name + package='docker-ce' + fi # APT package # - Mask service to prevent iptables related startup failure: https://github.com/MichaIng/DietPi/issues/6013 G_EXEC systemctl mask --now docker - G_AGI docker-ce + G_AGI "$package" G_EXEC systemctl unmask docker G_EXEC systemctl start docker.socket @@ -10563,7 +10575,7 @@ _EOF_ # - Move Docker containers to dietpi_userdata # - Log to systemd-journald (journalctl) by default with reduced log level: https://github.com/MichaIng/DietPi/issues/2388 # + containerd: https://github.com/docker/docker.github.io/issues/9091 - [[ -d '/mnt/dietpi_userdata/docker-data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/docker-data + G_EXEC mkdir -p /mnt/dietpi_userdata/docker-data if [[ -f '/etc/docker/daemon.json' ]] then GCI_PRESERVE=1 G_CONFIG_INJECT '"data-root":' ' "data-root": "/mnt/dietpi_userdata/docker-data",' /etc/docker/daemon.json '^\{([[:space:]]|$)' @@ -10699,7 +10711,7 @@ _EOF_ *) local arch='arm-6';; esac - local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.20.3/gitea-1.20.3-linux-$arch.xz" + local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.20.4/gitea-1.20.4-linux-$arch.xz" Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | mawk -F\" "/\"browser_download_url\": \".*\/gitea-[^\"\/]*-linux-$arch\.xz\"/{print \$4}")" /mnt/dietpi_userdata/gitea/gitea # User @@ -11234,7 +11246,7 @@ _EOF_ # v3 drops PHP 7.4 support: https://github.com/TasmoAdmin/TasmoAdmin/releases/tag/v3.0.0 if (( $G_DISTRO > 6 )) then - local fallback_url='https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v3.1.0/tasmoadmin_v3.1.0.tar.gz' + local fallback_url='https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v3.1.1/tasmoadmin_v3.1.1.tar.gz' Download_Install "$(curl -sSfL 'https://api.github.com/repos/TasmoAdmin/TasmoAdmin/releases/latest' | mawk -F\" '/^ *"browser_download_url": ".*\/tasmoadmin_v[^"\/]*\.tar\.gz"$/{print $4}')" # v2 drops PHP <7.4 support: https://github.com/TasmoAdmin/TasmoAdmin/releases/tag/v2.0.0 @@ -11683,8 +11695,8 @@ _EOF_ *) local arch='amd64';; esac - local fallback_url="https://github.com/rclone/rclone/releases/download/v1.63.1/rclone-v1.63.1-linux-$arch.deb" - Download_Install "$(curl -sSfL 'https://api.github.com/repos/rclone/rclone/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/rclone-v[^\"\/]*linux-$arch.deb\"/{print \$4}")" + local fallback_url="https://github.com/rclone/rclone/releases/download/v1.64.0/rclone-v1.64.0-linux-$arch-v6.deb" + Download_Install "$(curl -sSfL 'https://api.github.com/repos/rclone/rclone/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/rclone-v[^\"\/]*-linux-$arch.deb\"$/{print \$4}")" fi fi @@ -11698,7 +11710,7 @@ _EOF_ esac local fallback_url="https://github.com/restic/restic/releases/download/v0.15.2/restic_0.15.2_linux_$arch.bz2" - Download_Install "$(curl -sSfL 'https://api.github.com/repos/restic/restic/releases/latest' | mawk -F\" "/^ * \"browser_download_url\": \".*\/restic_[^\"\/]*_linux_$arch\.bz2\"$/{print \$4}")" /usr/local/bin/restic + Download_Install "$(curl -sSfL 'https://api.github.com/repos/restic/restic/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/restic_[^\"\/]*_linux_$arch\.bz2\"$/{print \$4}")" /usr/local/bin/restic G_EXEC chmod +x /usr/local/bin/restic fi @@ -11814,8 +11826,8 @@ _EOF_ *) local arch='amd64';; esac - local fallback_url="https://github.com/filebrowser/filebrowser/releases/download/v2.24.2/linux-$arch-filebrowser.tar.gz" - Download_Install "$(curl -sSfL 'https://api.github.com/repos/filebrowser/filebrowser/releases/latest' | mawk -F\" "/\"browser_download_url\": .*\/linux-$arch-filebrowser\.tar\.gz\"/{print \$4}")" ./filebrowser/ + local fallback_url="https://github.com/filebrowser/filebrowser/releases/download/v2.25.0/linux-$arch-filebrowser.tar.gz" + Download_Install "$(curl -sSfL 'https://api.github.com/repos/filebrowser/filebrowser/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/linux-$arch-filebrowser\.tar\.gz\"$/{print \$4}")" ./filebrowser/ # Reinstall [[ -d '/opt/filebrowser' ]] && G_EXEC rm -R /opt/filebrowser @@ -11824,7 +11836,7 @@ _EOF_ G_EXEC mv filebrowser /opt/ # User - [[ -d '/mnt/dietpi_userdata/filebrowser' ]] || G_EXEC mkdir /mnt/dietpi_userdata/filebrowser + G_EXEC mkdir -p /mnt/dietpi_userdata/filebrowser Create_User -g dietpi -d /mnt/dietpi_userdata/filebrowser filebrowser # Config if not exist @@ -11930,6 +11942,56 @@ _EOF_ G_EXEC_OUTPUT=1 G_EXEC docker run -d -p '9002:9000' --name=portainer --restart=always -v '/run/docker.sock:/var/run/docker.sock' -v 'portainer_data:/data' 'portainer/portainer-ce' fi + if To_Install 141 adsb-setup adsb-docker # ADS-B Feeder + then + # clone the adsb-feeder repo into /tmp + G_EXEC_OUTPUT=1 G_EXEC git clone -b dietpi 'https://github.com/dirkhh/adsb-feeder-image.git' /tmp/adsb-feeder + + # remove the service that isn't needed for an app install on DietPi and install the rest + G_EXEC cd /tmp/adsb-feeder/src/modules/adsb-feeder/filesystem/root + G_EXEC rm ./usr/lib/systemd/system/adsb-bootstrap.service + G_EXEC mv ./usr/lib/systemd/system/* /etc/systemd/system/ + + # determine the version + local ADSB_FEEDER_DATE_COMPONENT=$(git log -20 --date='format:%y%m%d' --format='%ad' | uniq -c | mawk '{print $2"."$1;exit}') + local ADSB_FEEDER_TAG_COMPONENT=$(git describe --match 'v[0-9]*' | cut -d- -f1) + local ADSB_FEEDER_VERSION="$ADSB_FEEDER_TAG_COMPONENT(dietpi)-$ADSB_FEEDER_DATE_COMPONENT" + + # create the target directory for the app and populated with the code from the git checkout + [[ -d '/opt/adsb' ]] && G_EXEC rm -R /opt/adsb + G_EXEC mv /tmp/adsb-feeder/src/modules/adsb-feeder/filesystem/root/opt/adsb /opt/ + G_EXEC cd /opt/adsb + + # remove the git clone of the repo we installed from + G_EXEC rm -R /tmp/adsb-feeder + + # create a symlink so the config files reside where they should be in /mnt/dietpi_userdata/adsb-feeder + G_EXEC mkdir -p /mnt/dietpi_userdata/adsb-feeder/config + G_EXEC ln -s /mnt/dietpi_userdata/adsb-feeder/config . + + # set the 'image name' and version that are shown in the footer of the Web UI + G_EXEC eval 'echo '\''ADSB Feeder app running on DietPi'\'' > feeder-image.name' + G_EXEC eval "echo '$ADSB_FEEDER_VERSION' > adsb.im.version" + + # get the Python module + # for older distros we need to install via pip in order to get flask 2 + if (( $G_DISTRO < 7 )) + then + G_EXEC_OUTPUT=1 G_EXEC pip3 install -U flask + else + G_AGI python3-flask + fi + + # finally ensure that /run allows executables (this is needed for the containers to be able to not do excessive + # writes to physical storage - which might be an SD card) + G_EXEC mount -o remount,exec /run + + # now that everything is in place, run the one time service to get the software pre-configured + # running this as a service allows it to do a bit of housekeeping in the background without disrupting + # the software install flow + G_EXEC systemctl start adsb-nonimage + fi + if To_Install 172 # WireGuard then # Packages available on Buster backports and Bullseye: On Raspbian Buster add Bullseye repo @@ -12684,6 +12746,17 @@ If no WireGuard (auto)start is included, but you require it, please do the follo [[ -d '/etc/yacy' ]] && G_EXEC rm -R /etc/yacy fi + if To_Uninstall 141 # ADS-B Feeder + then + G_EXEC_NOHALT=1 G_EXEC_OUTPUT=1 G_EXEC /opt/adsb/docker-compose-adsb down + Remove_Service adsb-bootstrap + Remove_Service adsb-feeder-update + Remove_Service adsb-setup + Remove_Service adsb-update + command -v docker &> /dev/null && G_EXEC docker image prune -a -f + G_EXEC rm -Rf /opt/adsb /mnt/dietpi_userdata/adsb-feeder /opt/adsb-feeder-update + fi + if To_Uninstall 2 # Folding@Home then # Un-check out all work units, so they can be picked up by other donors prior to timeout: https://github.com/FoldingAtHome/fah-issues/issues/1255 diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 511e5c5f99..d90ec52a45 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -58,8 +58,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=21 - [[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1 + [[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=22 + [[ $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/rootfs/var/lib/dietpi/services/fs_partition_resize.sh b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh index 5495eb128a..7140597829 100755 --- a/rootfs/var/lib/dietpi/services/fs_partition_resize.sh +++ b/rootfs/var/lib/dietpi/services/fs_partition_resize.sh @@ -39,6 +39,23 @@ exit 1 fi + # Check if the last partition contains a FAT filesystem with DIETPISETUP label + if [[ $(lsblk -nrbo FSTYPE,LABEL "$ROOT_DRIVE" | tail -1) == 'vfat DIETPISETUP' ]] + then + # Mount it and copy files if present and newer + SETUP_PART=$(sfdisk -lqo DEVICE "$ROOT_DRIVE" | tail -1) + TMP_MOUNT=$(mktemp -d) + mount "$SETUP_PART" "$TMP_MOUNT" + for f in 'dietpi.txt' 'dietpi-wifi.txt' 'dietpiEnv.txt' 'unattended_pivpn.conf' 'Automation_Custom_PreScript.sh' 'Automation_Custom_Script.sh' + do + [[ -f $TMP_MOUNT/$f ]] && cp -u "$TMP_MOUNT/$f" /boot/ + done + umount "$SETUP_PART" + rmdir "$TMP_MOUNT" + # Finally delete the partition so the resizing works + sfdisk --no-reread --no-tell-kernel --delete "$ROOT_DRIVE" "${SETUP_PART: -1}" + fi + # Only increase partition size if not yet done on first boot if [[ -f '/dietpi_skip_partition_resize' ]] then