-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shfmt and shellcheck compliance #368
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,13 @@ set -e -x -o pipefail | |
export OWNER="openfaas" | ||
export REPO="faasd" | ||
|
||
# On CentOS /usr/local/bin is not included in the PATH when using sudo. | ||
# On CentOS /usr/local/bin is not included in the PATH when using sudo. | ||
# Running arkade with sudo on CentOS requires the full path | ||
# to the arkade binary. | ||
# to the arkade binary. | ||
export ARKADE=/usr/local/bin/arkade | ||
|
||
# When running as a startup script (cloud-init), the HOME variable is not always set. | ||
# As it is required for arkade to properly download tools, | ||
# As it is required for arkade to properly download tools, | ||
# set the variable to /usr/local so arkade will download binaries to /usr/local/.arkade | ||
if [ -z "${HOME}" ]; then | ||
export HOME=/usr/local | ||
|
@@ -25,7 +25,7 @@ echo "Finding latest version from GitHub" | |
version=$(curl -sI https://github.com/$OWNER/$REPO/releases/latest | grep -i "location:" | awk -F"/" '{ printf "%s", $NF }' | tr -d '\r') | ||
echo "$version" | ||
|
||
if [ ! $version ]; then | ||
if [ ! "$version" ]; then | ||
echo "Failed while attempting to get latest version" | ||
exit 1 | ||
fi | ||
|
@@ -60,17 +60,17 @@ has_pacman() { | |
} | ||
|
||
install_required_packages() { | ||
if $(has_apt_get); then | ||
if has_apt_get; then | ||
# Debian bullseye is missing iptables. Added to required packages | ||
# to get it working in raspberry pi. No such known issues in | ||
# other distros. Hence, adding only to this block. | ||
# reference: https://github.com/openfaas/faasd/pull/237 | ||
$SUDO apt-get update -y | ||
$SUDO apt-get install -y curl runc bridge-utils iptables | ||
elif $(has_yum); then | ||
elif has_yum; then | ||
$SUDO yum check-update -y | ||
$SUDO yum install -y curl runc iptables-services | ||
elif $(has_pacman); then | ||
elif has_pacman; then | ||
$SUDO pacman -Syy | ||
$SUDO pacman -Sy curl runc bridge-utils | ||
else | ||
|
@@ -79,7 +79,7 @@ install_required_packages() { | |
fi | ||
} | ||
|
||
install_arkade(){ | ||
install_arkade() { | ||
curl -sLS https://get.arkade.dev | $SUDO sh | ||
arkade --help | ||
} | ||
|
@@ -95,8 +95,8 @@ install_containerd() { | |
|
||
arch=$(uname -m) | ||
|
||
$SUDO $ARKADE system install containerd --systemd --version v${CONTAINERD_VER} --progress=false | ||
$SUDO $ARKADE system install containerd --systemd --version v${CONTAINERD_VER} --progress=false | ||
|
||
sleep 5 | ||
} | ||
|
||
|
@@ -118,8 +118,8 @@ install_faasd() { | |
$SUDO curl -fSLs "https://github.com/openfaas/faasd/releases/download/${version}/faasd${suffix}" --output "/usr/local/bin/faasd" | ||
$SUDO chmod a+x "/usr/local/bin/faasd" | ||
|
||
mkdir -p /tmp/faasd-${version}-installation/hack | ||
cd /tmp/faasd-${version}-installation | ||
mkdir -p /tmp/faasd-"$version"-installation/hack | ||
cd /tmp/faasd-"$version"-installation | ||
$SUDO curl -fSLs "https://raw.githubusercontent.com/openfaas/faasd/${version}/docker-compose.yaml" --output "docker-compose.yaml" | ||
$SUDO curl -fSLs "https://raw.githubusercontent.com/openfaas/faasd/${version}/prometheus.yml" --output "prometheus.yml" | ||
$SUDO curl -fSLs "https://raw.githubusercontent.com/openfaas/faasd/${version}/resolv.conf" --output "resolv.conf" | ||
|
@@ -129,19 +129,19 @@ install_faasd() { | |
} | ||
|
||
install_caddy() { | ||
if [ ! -z "${FAASD_DOMAIN}" ]; then | ||
if [ -n "${FAASD_DOMAIN}" ]; then | ||
CADDY_VER=v2.4.3 | ||
arkade get --progress=false caddy -v ${CADDY_VER} | ||
|
||
# /usr/bin/caddy is specified in the upstream service file. | ||
$SUDO install -m 755 $HOME/.arkade/bin/caddy /usr/bin/caddy | ||
|
||
$SUDO curl -fSLs https://raw.githubusercontent.com/caddyserver/dist/master/init/caddy.service --output /etc/systemd/system/caddy.service | ||
|
||
$SUDO mkdir -p /etc/caddy | ||
$SUDO mkdir -p /var/lib/caddy | ||
if $(id caddy >/dev/null 2>&1); then | ||
|
||
if id caddy >/dev/null 2>&1; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This syntax does not look right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree is looks funky, but removing the parens fixes the SC2091 warning in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a shellcheck user so this doesn't bother me. I prefer the clarity we had originally. |
||
echo "User caddy already exists." | ||
else | ||
$SUDO useradd --system --home /var/lib/caddy --shell /bin/false caddy | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be fine with this change being added.