wrap in control flow to fix piping issue

This commit is contained in:
2023-10-23 16:37:23 -07:00
parent 9efd83f313
commit cf3b6831c9

View File

@@ -24,14 +24,14 @@ esac
# install farmer
if [ ! -f /usr/local/bin/grlx-farmer ]; then
if [ -z "$UNINSTALL" ]; then
if [ ! -f /usr/local/bin/grlx-farmer ]; then
curl -f -L -s "https://artifacts.grlx.dev/linux/${machine_arch}/v0.0.7/farmer" > /usr/local/bin/grlx-farmer
chmod +x /usr/local/bin/grlx-farmer
fi
fi
# install systemd service
cat << EOF > /etc/systemd/system/grlx-farmer.service
# install systemd service
cat << EOF > /etc/systemd/system/grlx-farmer.service
[Unit]
Description=grlx farmer
Documentation=https://docs.grlx.dev
@@ -49,8 +49,8 @@ Group=farmer
WantedBy=multi-user.target
EOF
# configure farmer if it's not already configured
if [ ! -f /etc/grlx/farmer ]; then
# configure farmer if it's not already configured
if [ ! -f /etc/grlx/farmer ]; then
# install gum if it's not already installed for interactive config
if ! command -v gum >/dev/null 2>&1; then
tempdir=""
@@ -75,7 +75,6 @@ if [ ! -f /etc/grlx/farmer ]; then
curl -f -L -s "https://github.com/charmbracelet/gum/releases/download/v0.11.0/gum_0.11.0_Linux_arm.tar.gz" > "$tempdir/gum.tar.gz"
;;
esac
ls -ashil "$tempdir"
tar -C "$tempdir" -xzf "$tempdir/gum.tar.gz"
mv "$tempdir/gum" /usr/local/bin/gum
chmod +x /usr/local/bin/gum
@@ -135,9 +134,18 @@ pubkeys:
$(for key in "${ADMIN_PUBKEYS[@]}"; do echo " - $key"; done)
EOF
fi
PATH=$PATH:/usr/sbin:/usr/bin useradd -r -s /usr/sbin/nologin farmer >/dev/null || true
chown -R farmer:farmer /etc/grlx
chmod 700 /etc/grlx
systemctl daemon-reload
systemctl enable --now grlx-farmer
else
systemctl disable --now grlx-farmer
rm -f /usr/local/bin/gum
rm -f /etc/systemd/system/grlx-farmer.service
rm -f /usr/local/bin/grlx-farmer
rm -rf /etc/grlx
userdel farmer
fi
PATH=$PATH:/usr/sbin:/usr/bin useradd -r -s /usr/sbin/nologin farmer >/dev/null || true
chown -R farmer:farmer /etc/grlx
chmod 700 /etc/grlx
systemctl daemon-reload
systemctl enable --now grlx-farmer