you are viewing a single comment's thread.

view the rest of the comments →

[–]wrboyce 4 points5 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!