Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
comparing to dev this removes an odd whitespace change; it also tightens
some of the code to be more in line with the rest of the file, and
remove some remaining debug output that otherwise just clutters the user
experience when manually building an image.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
dirkhh authored and MichaIng committed Sep 10, 2023
1 parent 87843d0 commit b64d923
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .build/images/dietpi-imager
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@
# Remount image for any required edits
G_EXEC mkdir "$FP_MNT_TMP"
G_EXEC mount "$FP_ROOT_DEV" "$FP_MNT_TMP"

# - Remove bash history and DHCP leases, which are stored on shutdown, hence cannot be removed via DietPi-PREP
G_EXEC rm -f "$FP_MNT_TMP/"{root,home/*}/.bash_history "$FP_MNT_TMP/var/lib/dhcp/"*.leases
# - Enable DietPi-FS_partition_resize to have both, old and new image being resized on next boot automatically
Expand Down Expand Up @@ -497,22 +496,17 @@
[[ -z ${ADD_DOS_PART+x} ]] && ADD_DOS_PART="0"
if [[ $ADD_DOS_PART == 1 ]]
then
G_DIETPI-NOTIFY 2 'Adding a 1MB FAT partition to the DOS partition table'
G_DIETPI-NOTIFY 2 'Adding a 1MB FAT partition to the partition table'
# figure out where the new partition starts
# WARNING: this assumes that the partitions in the table are in order (which we do in other places as well)
if [[ $SOURCE_TYPE == 'Image' ]]
then
G_DIETPI-NOTIFY 2 "working on a filesystem image, so adding 1MB to $FP_SOURCE_IMG"
G_EXEC_OUTPUT=1 G_EXEC dd if=/dev/zero bs=1M count=1 >> "$FP_SOURCE_IMG"
fi
[[ $SOURCE_TYPE == 'Image' ]] && G_EXEC_OUTPUT=1 G_EXEC dd if=/dev/zero bs=1M count=1 >> "$FP_SOURCE_IMG"
local root_part=$(sfdisk -qlo DEVICE "$FP_SOURCE" | tail -1)
local np_start=$(($(sfdisk -qlo END "$FP_SOURCE" | tail -1) + 1))
local type='EBD0A0A2-B9E5-4433-87C0-68B6B72699C7'
[[ $PART_TABLE_TYPE == 'dos' ]] && type='c'
# now we know where the new partition needs to start... so let's add it to the partition table
G_EXEC losetup -c "$FP_SOURCE"
G_DIETPI-NOTIFY 2 "/:${root_part}, np_start:${np_start}, FP_SOURCE:${FP_SOURCE}"
echo "start=$np_start,size=2048,type=$type" | sfdisk -a "$FP_SOURCE"
sfdisk -a "$FP_SOURCE" <<< "start=$np_start,size=2048,type=$type"
G_EXEC partprobe "$FP_SOURCE"
G_EXEC losetup -c "$FP_SOURCE"
# create a fat filesystem and add the two config files to it
Expand Down

0 comments on commit b64d923

Please sign in to comment.