Skip to content

Instantly share code, notes, and snippets.

@loic-roux-404
Last active May 5, 2020 21:36
Show Gist options
  • Save loic-roux-404/e9b972dc0d933c8645dc796aaf29a7d3 to your computer and use it in GitHub Desktop.
Save loic-roux-404/e9b972dc0d933c8645dc796aaf29a7d3 to your computer and use it in GitHub Desktop.
manala fixed install script
#!/bin/sh
CURL=$(which curl)
if [ "$?" = "1" ]; then
echo "You need curl to use this script."
exit 1
fi
VERSION=$(curl -sI https://github.com/manala/manala/releases/latest | grep location | awk -F"/" '{ printf "%s", $NF }' | tr -d '\r')
if [ ! ${VERSION} ]; then
echo "Failed while attempting to install manala. Please manually install:"
echo ""
echo "1. Open your web browser and go to https://github.com/nervo/manala/releases"
echo "2. Download the latest release for your platform. Call it 'manala'."
echo "3. chmod +x ./manala"
echo "4. mv ./manala /usr/local/bin"
exit 1
fi
HAS=$(which manala)
if [ "$?" = "0" ]; then
echo
echo "You already have manala!"
export N=3
echo "Overwriting in ${N} seconds.. Press Control+C to cancel."
echo
sleep ${N}
fi
case $(uname) in
"Darwin")
OS="darwin"
ARCH="amd64"
;;
"Linux")
OS="linux"
ARCH="amd64"
;;
esac
URL=https://github.com/nervo/manala/releases/download/${VERSION}/manala_${OS}_${ARCH}
DST=/usr/local/bin/manala
echo "Downloading package ${URL} as ${DST}"
curl -sSL ${URL} --output ${DST}
chmod +x ${DST}
echo "Download complete, happy manaling!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment