After converting from ext4 to btrfs, /usr/share/tuxedo/grub-hook fails to execute
Hello,
recently I converted my OEM install from ext4 to btrfs to benefit from the superior snapshotting capabilities.
Default update-grub was failing though, given that the aforementioned script would fail because of the root subvolume being named '@' for compatibility with timeshift.
Below you can find the script, the line which fails is:
if [ $(diff -ruN /boot/efi/EFI/tuxedo/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg | awk '/@/{print $1}' 2>/dev/null) ]; then
The issue is that '@' is treated as a parameter expansion, to fix this I modified the script like this:
diff -ruN /boot/efi/EFI/tuxedo/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg | awk '/@/{print $1}' 2>/dev/null
if [ $? ]; then
Since tuxedoOS offers a btrfs install, and since I fear that this script is automatically generated and I'll have to redo my fixes in future updates, I wonder if there is a correct approach to this.
Other than that I am loving my new btrfs system! Timeshift rocks!
#!/bin/bash
if [ -d /boot/efi/EFI ]; then
if [ ! -d /fll ]; then
if [ -d /boot/efi/EFI/tuxedo ]; then
if [ ! -f /boot/efi/EFI/ubuntu/grub.cfg 2>/dev/null ]; then
mkdir -p /boot/efi/EFI/ubuntu
cp -af /boot/efi/EFI/tuxedo/grub.cfg /boot/efi/EFI/ubuntu/
fi
if [ -z $(efibootmgr -v | grep -i shim | awk '{ print $2 }'| grep -i tuxedo 2>/dev/null) ]; then
grub-install
fi
if [ $(diff -ruN /boot/efi/EFI/tuxedo/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg | awk '/@/{print $1}' 2>/dev/null) ]; then
/sbin/grub-install --bootloader-id tuxedo
mkdir -p /boot/efi/EFI/ubuntu
cp -af /boot/efi/EFI/tuxedo/grub.cfg /boot/efi/EFI/ubuntu/
fi
if [ ! $(efibootmgr -v | grep -i tuxedo-fallback | grep -i grubx | awk '{ print $2 }' 2>/dev/null) ]; then
/sbin/grub-install --bootloader-id tuxedo-fallback --no-uefi-secure-boot
/sbin/grub-install --bootloader-id tuxedo
fi
if [ $(efibootmgr -v | grep -i tuxedo-fallback | grep -i grubx | awk '{ print $2 }' 2>/dev/null) ] && [ ! -d /boot/efi/EFI/tuxedo-fallback ]; then
/sbin/grub-install --bootloader-id tuxedo-fallback --no-uefi-secure-boot
/sbin/grub-install --bootloader-id tuxedo
fi
if [ $(grep SUBMENU /etc/default/grub 2>/dev/null) ]; then
sed -i '/SUBMENU/d' /etc/default/grub
update-grub
fi
fi
fi
fi
if [ -e /etc/fwupd/remotes.d/lvfs.conf ]; then
if [ $(grep "Enabled=true" /etc/fwupd/remotes.d/lvfs.conf 2>/dev/null) ]; then
sed -i 's/Enabled=true/Enabled=false/' /etc/fwupd/remotes.d/lvfs.conf
fi
fi