mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 09:39:51 +00:00
refactor(posix): don't run scripts with bash unnecessarily
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user