Add grub-config generation
This commit is contained in:
parent
aff2230f5a
commit
ec168ada57
2 changed files with 12 additions and 3 deletions
|
@ -81,14 +81,22 @@ for arrval in $(find $bedir -mindepth 1 -maxdepth 1 -type d | grep @root | cut -
|
|||
bootenvs+=("$arrval")
|
||||
done
|
||||
|
||||
rm -f "$grubdir/*"
|
||||
rm -f $grubdir/*
|
||||
for be in ${bootenvs[@]}; do
|
||||
parseTimestampHuman "$be"
|
||||
parseTimestamp "$be"
|
||||
|
||||
TIMESTAMP_HUMAN=$(parseTimestampHuman "$be") CURRENT_SUBVOLUME_TIMESTAMP=$(parseTimestamp "$be") ROOT_UUID=$(getValueByKey "root_uuid") envsubst '$TIMESTAMP_HUMAN:$CURRENT_SUBVOLUME_TIMESTAMP:$ROOT_UUID' < "${ROOTPATH}/grub-config.in" >> "${grub_conf_dir}/$(getValueByKey 'filename')"
|
||||
TIMESTAMP_HUMAN=$(parseTimestampHuman "$be") CURRENT_SUBVOLUME_TIMESTAMP=$(parseTimestamp "$be") ROOT_UUID=$(getValueByKey "root_uuid") envsubst '$TIMESTAMP_HUMAN:$CURRENT_SUBVOLUME_TIMESTAMP:$ROOT_UUID' < "${ROOTPATH}/grub-config.in" >> "${grubdir}/$(getValueByKey 'filename')"
|
||||
done
|
||||
|
||||
# Prepend `cat <<EOF`, append `EOF` to $filename, for grub to handle
|
||||
sed -i -e "1i `echo 'cat <<EOF'`" "${grubdir}/$(getValueByKey 'filename')"
|
||||
echo "EOF" >> "${grubdir}/$(getValueByKey 'filename')"
|
||||
|
||||
grub-mkconfig -o $(getValueByKey 'grub_cfg')
|
||||
|
||||
less $(getValueByKey 'grub_cfg')
|
||||
|
||||
##
|
||||
# SCRIPT END
|
||||
##
|
|
@ -2,5 +2,6 @@
|
|||
"be_env_dir": "/btrfs",
|
||||
"grub_conf_dir": "",
|
||||
"filename": "",
|
||||
"root_uuid": ""
|
||||
"root_uuid": "",
|
||||
"grub_cfg": ""
|
||||
}
|
Loading…
Reference in a new issue