Skip to content

Commit b44b329

Browse files
authored
Merge pull request #59 from Itxaka/config_oem_rpi
2 parents 53a7413 + 3c41959 commit b44b329

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

tools-image/build-arm-image.sh

+26-11
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ cleanup() {
7171
if [ -n "$oem" ]; then
7272
umount $oem || true
7373
fi
74-
losetup -D || true
74+
75+
if [ "$disable_lvm" == "false" ]; then
76+
lvremove --yes KairosVG
77+
fi
78+
MAPPER_LOOP=$(basename "$LOOP")
79+
for LOOPPART in $(ls /dev/mapper/"${MAPPER_LOOP}"*| awk -F'/' {'print $4'}); do
80+
dmsetup remove "${LOOPPART}" || true;
81+
done;
82+
losetup -d "${LOOP}" || true;
7583
}
7684

7785
ensure_dir_structure() {
@@ -423,23 +431,30 @@ fi
423431
mount $state $WORKDIR/state
424432
mount $efi $WORKDIR/efi
425433

426-
mkdir $WORKDIR/persistent
427-
mount $persistent $WORKDIR/persistent
428-
mkdir -p $WORKDIR/persistent/cloud-config
429434

430-
cp -rfv /defaults.yaml $WORKDIR/persistent/cloud-config/01_defaults.yaml
435+
if [ "$disable_lvm" == "false" ]; then
436+
mkdir $WORKDIR/oem
437+
mount $oem_lv $WORKDIR/oem
438+
439+
cp -rfv /defaults.yaml $WORKDIR/oem/01_defaults.yaml
440+
441+
# Set a OEM config file if specified
442+
if [ -n "$config" ]; then
443+
echo ">> Copying $config OEM config file"
444+
get_url $config $WORKDIR/oem/99_custom.yaml
445+
fi
446+
447+
umount $WORKDIR/oem
448+
else
449+
echo "LVM disabled: Not adding default config with default user/pass and custom config file"
450+
echo "Enable LVM to copy those files into /oem"
451+
fi
431452

432453
grub2-editenv $WORKDIR/state/grub_oem_env set "default_menu_entry=$menu_entry"
433454

434455
# We copy the file we saved earier to the STATE partition
435456
cp -rfv "${tmpgrubconfig}" $WORKDIR/state/grubmenu
436457

437-
# Set a OEM config file if specified
438-
if [ -n "$config" ]; then
439-
echo ">> Copying $config OEM config file"
440-
get_url $config $WORKDIR/persistent/cloud-config/99_custom.yaml
441-
fi
442-
umount $WORKDIR/persistent
443458

444459
# Copy over content
445460
cp -arf $EFI/* $WORKDIR/efi

0 commit comments

Comments
 (0)