refactor(posix): don't run scripts with bash unnecessarily

This commit is contained in:
AJ ONeal
2022-08-21 07:30:55 +00:00
parent d2fdc7b41a
commit b12b06eedd
19 changed files with 22 additions and 26 deletions

View File

@@ -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"

View File

@@ -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 \

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)"

View File

@@ -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