e2k: add label check to write.sh

...so that it's more applicable to a wider set of images
(those lacking e2k-alt-linux' specific labels just won't
get broken default boot target label name for no reason).
This commit is contained in:
Michael Shigorin 2021-10-08 19:42:45 +03:00 committed by Anton Midyukov
parent c688933213
commit 153b19dc2b

View File

@ -42,9 +42,12 @@ case "$2" in
rsync -Pavc --inplace --delete --numeric-ids "$src/" "$dst/" ||
cp -avt "$dst" -- "$src"/{.disk,*}
grep -q "^default=.*_flash$" "$dst/boot.conf" || {
echo -n "updating default boot target... "
sed -i 's,default=.*$,&_flash,' "$dst/boot.conf"
echo "done"
cur="$(sed -rn 's/^default=(.*)$/\1/p' "$dst/boot.conf")"
grep -q "^label=${cur}_flash$" "$dst/boot.conf" && {
echo -n "updating default boot target... "
sed -i 's,^default=.*$,&_flash,' "$dst/boot.conf"
echo "done"
} ||:
}
echo -n "unmounting media... "