run shfmt on installer

This commit is contained in:
CJ van den Berg 2025-02-11 19:25:32 +01:00
parent 30d1c9ee11
commit 2844db19a4
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

40
install
View file

@ -5,13 +5,24 @@ install_dir="/usr/local/bin"
add_alias=0
nightly=0
while true
do
while true; do
case "${1}" in
-a|--alias) add_alias=1; shift 1;;
-n|--nightly) nightly=1; shift 1;;
-p|--prefix) install_dir=/$2; shift 2;;
--) shift 1; break ;;
-a | --alias)
add_alias=1
shift 1
;;
-n | --nightly)
nightly=1
shift 1
;;
-p | --prefix)
install_dir=/$2
shift 2
;;
--)
shift 1
break
;;
*) break ;;
esac
done
@ -39,15 +50,18 @@ fi
arch="$(uname -m)"
case "$arch" in
x86_64) arch="x86_64" ;;
arm64) arch="aarch64" ;;
i686) arch="x86" ;;
i386) arch="x86" ;;
x86_64) arch="x86_64" ;;
arm64) arch="aarch64" ;;
i686) arch="x86" ;;
i386) arch="x86" ;;
esac
# get latest version tag from github releases api
version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | cut -d'"' -f4)
[ -z "$version" ] && { echo "failed to fetch latest version"; exit 1; }
[ -z "$version" ] && {
echo "failed to fetch latest version"
exit 1
}
# construct download url
# note: nightly assets are named like "flow-<version>-<os>-<arch>.<ext>"
@ -73,7 +87,7 @@ if [ "$filesize" -lt 100 ]; then
exit 1
fi
echo "installing $( [ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow')..."
echo "installing $([ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow')..."
if [ "$ext" = "tar.gz" ]; then
tar -xzf "/tmp/$filename.$ext" -C "$install_dir"
else
@ -82,7 +96,7 @@ fi
chmod +x "$install_dir/flow"
rm "/tmp/$filename.$ext"
echo "$( [ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow') installed successfully!"
echo "$([ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow') installed successfully!"
create_alias() {
if [ -e "$install_dir/f" ]; then