LukeSmithxyz / LARBS

Luke's Auto-Rice Bootstrapping Scripts: Installation Scripts for My Arch Linux Meta-Distribution
GNU General Public License v3.0
2.02k stars 797 forks source link

Install dash and make it the default #!/bin/sh symlink. #540

Open emrakyz opened 7 months ago

emrakyz commented 7 months ago

Luke Smith Video: Bash is Bloated!

In the linked video Luke has Dash symlinked to /bin/sh.

Extra Information for people:

We have #!/bin/bash exclusively for the needed scripts so there won't be any problems.

CheesyChocolate commented 7 months ago

tell me this is possible without breaking the system!!!!

 IFS=:; grep -Irl '#!/bin/sh' /usr/bin |xargs -r checkbashisms
emrakyz commented 7 months ago

@CheesyChocolate

You don't need to check bashisms. Exclusive Bash scripts have a starting line with #!/bin/bash so it won't break your system.

I have used Dash as a /bin/sh symlink on Arch, Artix, Debian, LFS and now I use it on Gentoo without a problem. So you are good to go.

For example on Gentoo, Portage uses Bash and some Open-RC related scripts have bashisms but it's not related with your /bin/sh symlink. Your /bin/sh symlink is only valid for scripts that start with #!/bin/sh so they won't break scripts starting with #!/bin/zsh or #!/bin/bash lines.

EDIT: checkbashisms is also too old at this point and gives false positives. I use a very customized Gentoo setup and I have always used Dash as a /bin/sh replacement. An example of unrelated bashism reports:

possible bashism in /usr/bin/mailsync line 75 ($_):
                    perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
possible bashism in /usr/bin/mailsync line 77 ($_):
                    perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
possible bashism in /usr/bin/gentoo-pipewire-launcher line 39 ('command' with option other than -p):
    if command -v pidwait > /dev/null ; then
possible bashism in /usr/bin/gentoo-pipewire-launcher line 41 ('command' with option other than -p):
    elif command -v pwait > /dev/null ; then
possible bashism in /usr/bin/zdiff line 159 (type):
                        if type mktemp >/dev/null 2>&1; then