From ec168ada57d57e530b34aa34711f68ffac33ef00 Mon Sep 17 00:00:00 2001 From: LinuxSquare <7436714-OfficialLinuxSquare@users.noreply.gitlab.com> Date: Fri, 29 Sep 2023 18:34:29 +0200 Subject: [PATCH] Add grub-config generation --- noveriablcgen | 12 ++++++++++-- noveriablcgen.json | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/noveriablcgen b/noveriablcgen index 0c24570..6427cbe 100755 --- a/noveriablcgen +++ b/noveriablcgen @@ -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 <> "${grubdir}/$(getValueByKey 'filename')" + +grub-mkconfig -o $(getValueByKey 'grub_cfg') + +less $(getValueByKey 'grub_cfg') + ## # SCRIPT END ## \ No newline at end of file diff --git a/noveriablcgen.json b/noveriablcgen.json index aae3599..1bd645a 100644 --- a/noveriablcgen.json +++ b/noveriablcgen.json @@ -2,5 +2,6 @@ "be_env_dir": "/btrfs", "grub_conf_dir": "", "filename": "", - "root_uuid": "" + "root_uuid": "", + "grub_cfg": "" } \ No newline at end of file