From b12b06eeddf8092b5d6dcdb33e25d18497a6248d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Aug 2022 07:30:55 +0000 Subject: [PATCH] refactor(posix): don't run scripts with bash unnecessarily --- _webi/bootstrap.sh | 2 +- _webi/template.sh | 6 +----- archiver/install.sh | 2 +- git-gpg-init/install.sh | 2 +- gnupg/install.sh | 2 +- go/install.sh | 2 +- iterm-color-schemes/install.sh | 2 +- iterm-themes/install.sh | 2 +- iterm-utils/install.sh | 2 +- iterm/install.sh | 2 +- iterm2-color-schemes/install.sh | 2 +- nerd-font/install.sh | 2 +- postgresql/install.sh | 2 +- pwsh/install.sh | 2 +- python3/install.sh | 2 +- ripgrep/install.sh | 2 +- rust/install.sh | 2 +- ssh-adduser/ssh-adduser.sh | 8 ++++---- ziglang/install.sh | 2 +- 19 files changed, 22 insertions(+), 26 deletions(-) diff --git a/_webi/bootstrap.sh b/_webi/bootstrap.sh index d6d8973..6d67b32 100644 --- a/_webi/bootstrap.sh +++ b/_webi/bootstrap.sh @@ -118,7 +118,7 @@ __webi_main() { ( cd "\$WEBI_BOOT" 2>&1 > /dev/null - bash "\$my_package-bootstrap.sh" + sh "\$my_package-bootstrap.sh" ) rm -rf "\$WEBI_BOOT" diff --git a/_webi/template.sh b/_webi/template.sh index bdb6e08..60395bd 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -1,9 +1,5 @@ #!/bin/sh -# shellcheck disable=2001 -# because I prefer to use sed rather than bash replace -# (there's too little space in my head to learn both syntaxes) - __bootstrap_webi() { set -e @@ -259,7 +255,7 @@ __bootstrap_webi() { # in case pathman was recently installed and the PATH not updated mkdir -p "$_webi_tmp" - # 'true' to prevent "too few arguments" output on bash + # 'true' to prevent "too few arguments" output # when there are 0 lines of stdout "$HOME/.local/bin/pathman" add "$1" | grep "export" 2> /dev/null \ diff --git a/archiver/install.sh b/archiver/install.sh index ebbcdb2..601c9a0 100644 --- a/archiver/install.sh +++ b/archiver/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_arc() { echo "'archiver@${WEBI_TAG:-stable}' is an alias for 'arc@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/arc@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/arc@${WEBI_VERSION:-}" | sh } __redirect_alias_arc diff --git a/git-gpg-init/install.sh b/git-gpg-init/install.sh index 7647c71..2f45e28 100644 --- a/git-gpg-init/install.sh +++ b/git-gpg-init/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_git_config_gpg() { echo "'git-gpg-init' is a deprecated alias for 'git-config-gpg'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/git-config-gpg" | bash + curl -fsSL "$WEBI_HOST/git-config-gpg" | sh } __redirect_alias_git_config_gpg diff --git a/gnupg/install.sh b/gnupg/install.sh index dbddc6d..b69f30c 100644 --- a/gnupg/install.sh +++ b/gnupg/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_gpg() { echo "'gnupg@${WEBI_TAG:-stable}' is an alias for 'gpg@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/gpg@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/gpg@${WEBI_VERSION:-}" | sh } __redirect_alias_gpg diff --git a/go/install.sh b/go/install.sh index 364e240..6ad5caa 100644 --- a/go/install.sh +++ b/go/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_golang() { echo "'go@${WEBI_TAG:-stable}' is an alias for 'golang@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/golang@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/golang@${WEBI_VERSION:-}" | sh } __redirect_alias_golang diff --git a/iterm-color-schemes/install.sh b/iterm-color-schemes/install.sh index 938096f..a4f14ba 100644 --- a/iterm-color-schemes/install.sh +++ b/iterm-color-schemes/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_iterm2_themes() { echo "'iterm-color-schemes@${WEBI_TAG:-stable}' is an alias for 'iterm2-themes@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | sh } __redirect_alias_iterm2_themes diff --git a/iterm-themes/install.sh b/iterm-themes/install.sh index 77f5f5a..bc5fda7 100644 --- a/iterm-themes/install.sh +++ b/iterm-themes/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_iterm2_themes() { echo "'iterm-themes@${WEBI_TAG:-stable}' is an alias for 'iterm2-themes@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | sh } __redirect_alias_iterm2_themes diff --git a/iterm-utils/install.sh b/iterm-utils/install.sh index 48d67c2..2eaf34f 100644 --- a/iterm-utils/install.sh +++ b/iterm-utils/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_iterm2_utils() { echo "'iterm-utils@${WEBI_TAG:-stable}' is an alias for 'iterm2-utils@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/iterm2-utils@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/iterm2-utils@${WEBI_VERSION:-}" | sh } __redirect_alias_iterm2_utils diff --git a/iterm/install.sh b/iterm/install.sh index 97425de..6eb1b04 100644 --- a/iterm/install.sh +++ b/iterm/install.sh @@ -4,4 +4,4 @@ set -u echo "'iterm@${WEBI_TAG:-stable}' is an alias for 'iterm2@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} -curl -fsSL "$WEBI_HOST/iterm2@${WEBI_VERSION:-}" | bash +curl -fsSL "$WEBI_HOST/iterm2@${WEBI_VERSION:-}" | sh diff --git a/iterm2-color-schemes/install.sh b/iterm2-color-schemes/install.sh index d6f916b..68cff11 100644 --- a/iterm2-color-schemes/install.sh +++ b/iterm2-color-schemes/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_iterm2_themes() { echo "'iterm2-color-schemes@${WEBI_TAG:-stable}' is an alias for 'iterm2-themes@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/iterm2-themes@${WEBI_VERSION:-}" | sh } __redirect_alias_iterm2_themes diff --git a/nerd-font/install.sh b/nerd-font/install.sh index c85f3d5..d5ca6c1 100644 --- a/nerd-font/install.sh +++ b/nerd-font/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_nerdfont() { echo "'nerd-font' is an alias for 'nerdfont'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/nerdfont@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/nerdfont@${WEBI_VERSION:-}" | sh } __redirect_alias_nerdfont diff --git a/postgresql/install.sh b/postgresql/install.sh index 31686cf..40523c0 100644 --- a/postgresql/install.sh +++ b/postgresql/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_postgres() { echo "'postgresql' is an alias for 'postgres'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/postgres@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/postgres@${WEBI_VERSION:-}" | sh } __redirect_alias_postgres diff --git a/pwsh/install.sh b/pwsh/install.sh index c20cd3c..4760b1c 100644 --- a/pwsh/install.sh +++ b/pwsh/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_powershell() { echo "'pwsh@${WEBI_TAG:-stable}' is an alias for 'powershell@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/powershell@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/powershell@${WEBI_VERSION:-}" | sh } __redirect_alias_powershell diff --git a/python3/install.sh b/python3/install.sh index 15477bd..dac6fb4 100644 --- a/python3/install.sh +++ b/python3/install.sh @@ -6,7 +6,7 @@ set -u __redirect_alias_python() { echo "'python@${WEBI_TAG:-stable}' is an alias for 'python@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/python@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/python@${WEBI_VERSION:-}" | sh } __redirect_alias_python diff --git a/ripgrep/install.sh b/ripgrep/install.sh index 66e6754..c884d90 100644 --- a/ripgrep/install.sh +++ b/ripgrep/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_rg() { echo "'ripgrep@${WEBI_TAG:-}' (project) is an alias for 'rg@${WEBI_VERSION:-}' (command)" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/rg@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/rg@${WEBI_VERSION:-}" | sh } __redirect_alias_rg diff --git a/rust/install.sh b/rust/install.sh index 96aa6d5..dd3596d 100644 --- a/rust/install.sh +++ b/rust/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_rustlang() { echo "'rust' is an alias for 'rustlang'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/rustlang@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/rustlang@${WEBI_VERSION:-}" | sh } __redirect_alias_rustlang diff --git a/ssh-adduser/ssh-adduser.sh b/ssh-adduser/ssh-adduser.sh index 567285d..3171277 100644 --- a/ssh-adduser/ssh-adduser.sh +++ b/ssh-adduser/ssh-adduser.sh @@ -21,7 +21,7 @@ main() { echo " You must add a key to ~/.ssh/authorized_keys before adding a new ssh user." echo "" echo "To fix:" - echo " Run 'curl https://webinstall.dev/ssh-pubkey | bash' on your local system, " + echo " Run 'curl https://webinstall.dev/ssh-pubkey | sh' on your local system, " echo " then add that key to ~/.ssh/authorized_keys on this (the remote) system. " echo "" exit 1 @@ -45,13 +45,13 @@ main() { chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/" # ensure that 'app' has an SSH Keypair - sudo -i -u "$my_new_user" bash -c "ssh-keygen -b 2048 -t rsa -f '/home/$my_new_user/.ssh/id_rsa' -q -N ''" + sudo -i -u "$my_new_user" sh -c "ssh-keygen -b 2048 -t rsa -f '/home/$my_new_user/.ssh/id_rsa' -q -N ''" chown -R "$my_new_user":"$my_new_user" "/home/$my_new_user/.ssh/" # Install webi for the new 'app' user WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - sudo -i -u "$my_new_user" bash -c "curl -fsSL '$WEBI_HOST/webi' | bash" || - sudo -i -u "$my_new_user" bash -c "wget -q -O - '$WEBI_HOST/webi' | bash" + sudo -i -u "$my_new_user" sh -c "curl -fsSL '$WEBI_HOST/webi' | sh" || + sudo -i -u "$my_new_user" sh -c "wget -q -O - '$WEBI_HOST/webi' | sh" # TODO ensure that ssh-password login is off my_pass="$(grep 'PasswordAuthentication yes' /etc/ssh/sshd_config)" diff --git a/ziglang/install.sh b/ziglang/install.sh index 3f007ae..22cc3db 100644 --- a/ziglang/install.sh +++ b/ziglang/install.sh @@ -5,7 +5,7 @@ set -u __redirect_alias_zig() { echo "'ziglang@${WEBI_TAG:-stable}' is an alias for 'zig@${WEBI_VERSION:-}'" WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - curl -fsSL "$WEBI_HOST/zig@${WEBI_VERSION:-}" | bash + curl -fsSL "$WEBI_HOST/zig@${WEBI_VERSION:-}" | sh } __redirect_alias_zig