This commit is contained in:
Your Name 2024-02-17 11:28:42 -07:00
parent f3b7843ed1
commit 5d0a65562f

View File

@ -316,24 +316,11 @@ snapshots() {
btrfs sub snapshot / /.snapshots/snapshot-root-${DATE}
echo
MACHINE_ID=$(cat /etc/machine-id)
KERNEL=$(eselect kernel list | cut -d ']' -f2 | cut -d "*" -f1 | cut -d "-" -f2 | tail -1)
KERNEL_VERSION=$(uname -r)
ROOT_NAME=$HARD_DISK
BTRFS=$BTRFS
TEMPLATE="/efi/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
LOADER_FILE="/efi/loader/entries/snapshot-$MACHINE_ID-$KERNEL_VERSION.conf"
echo "MachineID=$MACHINE_ID"
echo "KERNEL IS $KERNEL"
echo "Root_Name=$ROOT_NAME"
echo "BTRFS=$BTRFS"
echo "UEFI Kernel: $KERNEL_VERSION"
echo "title Gentoo snapshot-root-${DATE}" >$LOADER_FILE
echo "version $KERNEL_VERSION" >>$LOADER_FILE
echo "options root=UUID=$(/sbin/blkid -s UUID -o value $BTRFS) rootflags=subvol=@.snapshots/snapshot-root-${DATE} rw " >>$LOADER_FILE
echo "machine-id $MACHINE_ID" >>$LOADER_FILE
echo "linux /$MACHINE_ID/$KERNEL_VERSION/linux" >>$LOADER_FILE
echo "initrd /$MACHINE_ID/$KERNEL_VERSION/initrd" >>$LOADER_FILE
cp -f $TEMPLATE $LOADER_FILE
sed -i "s/${ROOT_NAME}/snapshot-root-${DATE}/" $LOADER_FILE
}
remove-snapshots() {