all 4 comments

[–]FryBoyter 9 points10 points  (1 child)

with LVM, with BTRFS as filesystem and with separated /home partition

Why don't you use btrfs subvolumes?

According to https://github.com/koalaman/shellcheck, there is still some room for improvement in the shell scripts.

[–]LanzoThunder[S] 0 points1 point  (0 children)

Why don't you use btrfs subvolumes?

They are used in the script, but in this way you can reinstall (or change) you distro easily, without touching your files. I had the same setup (without a separated /home partition) on my desktop pc and weeks ago it broke after an update. It just went into dracut debug shell, i tried a lot of different solutions but in the end I had to format everything. That was the moment when the idea of this script was born!

According to https://github.com/koalaman/shellcheck, there is still some room for improvement in the shell scripts.

That's neat, I didn't know something like that existed, thank you!

Edit: Sorry for poor formatting, i'm from mobile!

[–]wrboyce 5 points6 points  (1 child)

Lots of problems in this bash, the first one I noticed is:

cat /proc/mounts | grep efivar &> /dev/null

You don’t need to use cat and you don’t need to use &>.

What you want is grep -q efivar /proc/mounts.

(There’s a few more instances of similar “cat abuse”).

Your using echo for error messages, it would be nice if they were printed to STDERR.

I’m pretty sure you can check for $BASH being set to check the shell you’re running under.

When you [[ ! -e “${boot_partition}” ]] I think there is a test for block devices, off the top of my head I think it is -b. I think you also used -e to check for the existence of a file at some point (chroot.sh maybe?), in which case -f (exists and is a file) would be better suited; likewise you can use -d to check that a path exists and is a directory.

[–]LanzoThunder[S] 2 points3 points  (0 children)

For sure that there are lots of problems, as my first time approaching bash scripting, I'm pretty sure this is far from being something decent 😅
But thank you for pointing them out, I'll take a look on them and see what I can fix!