Skip to content

Commit d58f37c

Browse files
authored
Release v9.13 (#7540)
2 parents b913e5a + 8ad12ac commit d58f37c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1248
-1313
lines changed

.build/images/NanoPiM3/boot.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if ext4load mmc ${devnum} ${kernel_addr_r} ${prefix}dietpiEnv.txt; then
2222
fi
2323

2424
# Define kernel command-line arguments
25-
setenv bootargs "root=${rootdev} rootfstype=${rootfstype} rootwait ${consoleargs} consoleblank=0 systemd.unified_cgroup_hierarchy=0 usb-storage.quirks=${usbstoragequirks} ${extraargs}"
25+
setenv bootargs "root=${rootdev} rootfstype=${rootfstype} rootwait ${consoleargs} consoleblank=0 systemd.unified_cgroup_hierarchy=0 ${extraargs}"
2626

2727
# Add bootargs for Docker
2828
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi

.build/images/U-Boot/boot.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if load "${devtype}" "${devnum}" "${scriptaddr}" "${prefix}dietpiEnv.txt"; then
2525
fi
2626

2727
# Define kernel command-line arguments
28-
setenv bootargs "root=${rootdev} rootfstype=${rootfstype} rootwait ${consoleargs} consoleblank=0 coherent_pool=2M usb-storage.quirks=${usbstoragequirks} ${extraargs}"
28+
setenv bootargs "root=${rootdev} rootfstype=${rootfstype} rootwait ${consoleargs} consoleblank=0 coherent_pool=2M ${extraargs}"
2929

3030
# Add bootargs for Docker
3131
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory"; fi

.build/images/U-Boot/dietpiEnv.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ rootdev=/dev/mmcblk0p1
22
rootfstype=ext4
33
# The init system logs to the console defined last.
44
consoleargs=console=ttyAML0,115200 console=tty1
5-
usbstoragequirks=
65
extraargs=net.ifnames=0
76
docker_optimizations=off
87
overlay_path=amlogic

.build/images/dietpi-build

Lines changed: 96 additions & 104 deletions
Large diffs are not rendered by default.

.build/images/dietpi-imager

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
ADD_DOS_PART=0 # trailing FAT partition for first boot config files, automatically imported and partition removed on first boot
7575
CONFIGS_TO_BOOT=0 # for new RPi kernel/firmware stack where a boot FAT partition exists, but is mounted to /boot/firmware instead of /boot
7676
SIGN_PASS=
77+
RAW_HASH_SIZE=0 # store SHA256 and size for the uncompressed image, mainly used for Raspberry Pi Imager JSON
7778
while (( $# ))
7879
do
7980
case $1 in
@@ -82,6 +83,7 @@
8283
'--add-dos-part') ADD_DOS_PART=1;;
8384
'--configs-to-boot') CONFIGS_TO_BOOT=1;;
8485
'--sign') shift; SIGN_PASS=$1;;
86+
'--raw-hash-size') RAW_HASH_SIZE=1;;
8587
*)
8688
if [[ -b $1 ]]
8789
then
@@ -201,9 +203,7 @@
201203
G_EXEC modprobe loop
202204
Delete_Loopback # Prevent doubled loop device
203205
FP_SOURCE=$(losetup -f)
204-
G_EXEC_NOEXIT=1 G_EXEC losetup "$FP_SOURCE" "$FP_SOURCE_IMG" || return 1
205-
G_EXEC_NOEXIT=1 G_EXEC partprobe "$FP_SOURCE" || return 1
206-
G_EXEC_NOEXIT=1 G_EXEC partx -u "$FP_SOURCE" || return 1
206+
G_EXEC_NOEXIT=1 G_EXEC losetup -P "$FP_SOURCE" "$FP_SOURCE_IMG" || return 1
207207
G_DIETPI-NOTIFY 0 "Attached the image ($FP_SOURCE_IMG) as loopback device: $FP_SOURCE"
208208
G_SLEEP 0.5 # Give the root filesystem a little time to be detected
209209
fi
@@ -316,13 +316,11 @@
316316
G_EXEC modprobe loop
317317
Delete_Loopback # Prevent doubled loop device
318318
FP_SOURCE=$(losetup -f)
319-
G_EXEC losetup "$FP_SOURCE" "$FP_SOURCE_IMG"
320-
G_EXEC partprobe "$FP_SOURCE"
321-
G_EXEC partx -u "$FP_SOURCE"
319+
G_EXEC losetup -P "$FP_SOURCE" "$FP_SOURCE_IMG"
322320
G_DIETPI-NOTIFY 0 "Mounted the image ($FP_SOURCE_IMG) as loopback device: $FP_SOURCE"
323321
FP_ROOT_DEV="${FP_SOURCE}p${FP_ROOT_DEV: -1}"
324322
fi
325-
[[ $CLONING_TOOL == 'dd' ]] && OUTPUT_IMG_EXT='img' || OUTPUT_IMG_EXT='iso' SKIP_ARCHIVE=1 # Flashing tools do not support xz-compressed ISOs
323+
[[ $CLONING_TOOL == 'dd' ]] && OUTPUT_IMG_EXT='img' || OUTPUT_IMG_EXT='iso'
326324
G_DIETPI-NOTIFY 0 "\e[0mCreating minified image from:
327325
- $SOURCE_TYPE: ${FP_SOURCE_IMG:-$FP_SOURCE}
328326
- Root device: $FP_ROOT_DEV
@@ -341,6 +339,9 @@
341339

342340
FP_FINAL="$FP_ORIGIN/$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT"
343341

342+
# Flashing tools do not support xz-compressed ISOs
343+
[[ $OUTPUT_IMG_EXT == 'iso' ]] && SKIP_ARCHIVE=1
344+
344345
# Detect partition table type, failsafe detection of MBR to debug possibly other/unknown wording/partition table types
345346
PART_TABLE_TYPE=$(lsblk -no PTTYPE "$FP_ROOT_DEV")
346347
if [[ $PART_TABLE_TYPE == 'dos' ]]
@@ -389,10 +390,12 @@
389390
# Failsafe
390391
G_EXEC partprobe "$FP_SOURCE"
391392
G_EXEC partx -u "$FP_SOURCE"
392-
Run_fsck
393393

394394
# Shrink last filesystem to minimum
395-
local last_part_dev=$(lsblk -rnpo NAME "$FP_SOURCE" | tail -1)
395+
# - resize2fs: "Please run 'e2fsck -f /dev/loop0p1' first."
396+
Run_fsck
397+
# - Use sfdisk to detect last partition, as lsblk with "-r" option on Bullseye does not sort partitions well: https://github.com/MichaIng/DietPi/issues/7527
398+
local last_part_dev=$(sfdisk -qlo Device "$FP_SOURCE" | tail -1)
396399
local last_fs_type=$(lsblk -no FSTYPE "$last_part_dev")
397400
if [[ $last_fs_type == 'ext4' ]]
398401
then
@@ -479,8 +482,6 @@
479482
FS_SIZE=$(( $FS_SIZE / 512 )) # bytes => 512 byte sectors
480483
fi
481484

482-
Run_fsck
483-
484485
G_DIETPI-NOTIFY 2 'Overriding filesystems free space with zeros to purge removed data and allow better compression...'
485486
while read -r path type
486487
do
@@ -762,37 +763,54 @@ _EOF_
762763
G_EXEC sync
763764
fi
764765

765-
# Generate xz archive if requested
766-
local archive_text=''
767-
if (( ! $SKIP_ARCHIVE ))
766+
# Generate hashes, size info and compress image if requested
767+
local result_test="\nImage file: $FP_FINAL"
768+
local upload_list=()
769+
if (( $RAW_HASH_SIZE ))
770+
then
771+
G_EXEC_DESC='Generating image size file' G_EXEC eval "stat -c '%s' '$FP_FINAL' > '$FP_FINAL.size'"
772+
result_test+="\nImage size: $FP_FINAL.size"
773+
upload_list+=("$FP_FINAL.size")
774+
fi
775+
if (( $SKIP_ARCHIVE ))
768776
then
777+
G_EXEC_DESC='Generating image hash' G_EXEC eval "sha256sum '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT' > '$FP_FINAL.sha256'"
778+
result_test+="\nImage hash: $FP_FINAL.sha256"
779+
upload_list+=("$FP_FINAL" "$FP_FINAL.sha256")
780+
else
781+
if (( $RAW_HASH_SIZE ))
782+
then
783+
G_EXEC_DESC='Generating image hash' G_EXEC eval "sha256sum '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT' > '$FP_FINAL.sha256'"
784+
result_test+="\nImage hash: $FP_FINAL.sha256"
785+
upload_list+=("$FP_FINAL.sha256")
786+
fi
769787
[[ -f $FP_FINAL.xz ]] && G_EXEC rm "$FP_FINAL.xz"
770-
G_EXEC_DESC='Creating final xz archive' G_EXEC xz -9e -T0 -M75% -k "$FP_FINAL"
788+
G_EXEC_DESC='Generating xz-compressed image' G_EXEC xz -9e -T0 -M75% -k "$FP_FINAL"
789+
result_test+="\nxz file: $FP_FINAL.xz"
790+
upload_list+=("$FP_FINAL.xz")
791+
792+
G_EXEC_DESC='Generating xz hash' G_EXEC eval "sha256sum '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT.xz' > '$FP_FINAL.xz.sha256'"
793+
result_test+="\nxz hash: $FP_FINAL.xz.sha256"
794+
upload_list+=("$FP_FINAL.xz.sha256")
771795
FP_FINAL+='.xz'
772-
archive_text="\nxz archive: $FP_FINAL"
773796
fi
774797

775-
# Generate SHA256 hash
776-
G_EXEC_DESC='Generating SHA256 hash' G_EXEC eval "sha256sum '$OUTPUT_IMG_NAME.$OUTPUT_IMG_EXT' > '$FP_FINAL.sha256'"
777-
778798
# Generate GPG signature if requested
779-
local sig_text='' signature=()
780799
if [[ $SIGN_PASS ]]
781800
then
782801
G_DIETPI-NOTIFY 2 "Signing $FP_FINAL ..."
783802
gpg --batch --pinentry-mode loopback --passphrase "$SIGN_PASS" -b --armor "$FP_FINAL" || exit 1
784-
sig_text="\nSignature: $FP_FINAL.asc" signature=("$FP_FINAL.asc")
803+
result_test+="\nSignature: $FP_FINAL.asc"
804+
upload_list+=("$FP_FINAL.asc")
785805
fi
786806

787-
G_DIETPI-NOTIFY 0 "DietPi-Imager has successfully finished.
788-
Image file: ${FP_FINAL%.xz}$archive_text
789-
SHA256 hash: $FP_FINAL.sha256$sig_text"
807+
G_DIETPI-NOTIFY 0 "DietPi-Imager has successfully finished.$result_test"
790808

791809
# Upload if requested
792810
if [[ $UPLOAD_SCRIPT ]]
793811
then
794812
[[ -x "$UPLOAD_SCRIPT" ]] || { G_DIETPI-NOTIFY 1 "Upload script $UPLOAD_SCRIPT does not exist or is not executable. Aborting ..."; exit 1; }
795-
G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "$FP_FINAL"{,.sha256} "${signature[@]}" && (( ! $SKIP_ARCHIVE )) && G_EXEC rm -R "$FP_FINAL"{,.sha256} "${signature[@]}"
813+
G_EXEC_OUTPUT=1 G_EXEC ./upload.sh "${upload_list[@]}"
796814
fi
797815
}
798816

0 commit comments

Comments
 (0)