btrfs detection for grub and associated btrfs cleanup

merge-requests/260/head
Evan James 5 years ago
parent 87fc00333a
commit 7616b62d58

@ -435,7 +435,7 @@ install_grub_uefi() {
[[ -f ${MOUNTPOINT}/usr/bin/grub_installer.sh ]] && rm ${MOUNTPOINT}/usr/bin/grub_installer.sh
# If root is on btrfs volume, amend grub
[[ -e /tmp/.btrfsroot ]] && \
[[ $(findmnt -no FSTYPE ${MOUNTPOINT}) == "btrfs" ]] && \
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# Enble manjaro grub theme
@ -615,7 +615,7 @@ bios_bootloader() {
[[ $(cat /tmp/.luks_dev) != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$(cat /tmp/.luks_dev)\"~g" ${MOUNTPOINT}/etc/default/grub
# If root is on btrfs volume, amend grub
[[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && \
[[ $(findmnt -no FSTYPE ${MOUNTPOINT}) == "btrfs" ]] && \
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# Same setting is needed for LVM

@ -1317,17 +1317,15 @@ mount_partitions() {
get_cryptroot
echo "$LUKS_DEV" > /tmp/.luks_dev
# If the root partition is btrfs, offer to create subvolumus
if [[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]]; then
if [[ $(findmnt -no FSTYPE ${MOUNTPOINT}) == btrfs ]]; then
# Check if there are subvolumes already on the btrfs partition
if [[ $(btrfs subvolume list /mnt | wc -l) -gt 1 ]] && DIALOG " The volume has already subvolumes " --yesno "\nFound subvolumes $(btrfs subvolume list /mnt | cut -d" " -f9)\n\nWould you like to mount them? \n " 0 0; then
if [[ $(btrfs subvolume list ${MOUNTPOINT} | wc -l) -gt 1 ]] && DIALOG " The volume has already subvolumes " --yesno "\nFound subvolumes $(btrfs subvolume list ${MOUNTPOUNT} | cut -d" " -f9)\n\nWould you like to mount them? \n " 0 0; then
# Pre-existing subvolumes and user wants to mount them
mount_existing_subvols
else
# No subvolumes present. Make some new ones
DIALOG " Your root volume is formatted in btrfs " --yesno "\nWould you like to create subvolumes in it? \n " 0 0 && btrfs_subvolumes && touch /tmp/.btrfsroot
DIALOG " Your root volume is formatted in btrfs " --yesno "\nWould you like to create subvolumes in it? \n " 0 0 && btrfs_subvolumes
fi
else
[[ -e /tmp/.btrfsroot ]] && rm /tmp/.btrfsroot
fi
fi

Loading…
Cancel
Save