mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Updating install.sh
This commit is contained in:
parent
62a4fe695d
commit
f952392c34
56
install.sh
56
install.sh
@ -7,29 +7,30 @@ DOWNLOAD_LOCATION="/tmp/ouch"
|
|||||||
INSTALLATION_LOCATION="/usr/bin/ouch"
|
INSTALLATION_LOCATION="/usr/bin/ouch"
|
||||||
REPO_URL="https://github.com/vrmiguel/ouch"
|
REPO_URL="https://github.com/vrmiguel/ouch"
|
||||||
|
|
||||||
|
# Panicks script if anything fails
|
||||||
|
set -e
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
echo "error occurred, aborting." ; exit 1
|
echo "error occurred, aborting." ; exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Panicks script if anything fails
|
install() {
|
||||||
set -e
|
echo "Ouch v$VERSION."
|
||||||
|
|
||||||
echo "Ouch v$VERSION."
|
|
||||||
|
|
||||||
printf "Detected system: "
|
|
||||||
# System detection from https://stackoverflow.com/a/27776822/9982477
|
|
||||||
# Go there to see a full table of what `uname -s` might output
|
|
||||||
case "$(uname -s)" in
|
|
||||||
Darwin)
|
|
||||||
system_suffix="-macOS"
|
|
||||||
echo "Mac OS X."
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
printf "Detected system: "
|
||||||
|
# System detection from https://stackoverflow.com/a/27776822/9982477
|
||||||
|
# Go there to see a full table of what `uname -s` might output
|
||||||
|
case "$(uname -s)" in
|
||||||
Linux)
|
Linux)
|
||||||
echo "Linux."
|
echo "Linux."
|
||||||
system_suffix="-ubuntu-18.04-glibc"
|
system_suffix="-ubuntu-18.04-glibc"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Darwin)
|
||||||
|
echo "Mac OS X."
|
||||||
|
system_suffix="-macOS"
|
||||||
|
;;
|
||||||
|
|
||||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||||
echo "Windows."
|
echo "Windows."
|
||||||
system_suffix=".exe"
|
system_suffix=".exe"
|
||||||
@ -46,33 +47,36 @@ case "$(uname -s)" in
|
|||||||
echo "If you think this is an error, please open an issue"
|
echo "If you think this is an error, please open an issue"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
binary_url="https://github.com/vrmiguel/ouch/releases/download/${VERSION}/ouch${system_suffix}"
|
binary_url="https://github.com/vrmiguel/ouch/releases/download/${VERSION}/ouch${system_suffix}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -f "$DOWNLOAD_LOCATION" ]; then
|
if [ -f "$DOWNLOAD_LOCATION" ]; then
|
||||||
echo "Reusing downloaded binary at '$DOWNLOAD_LOCATION'."
|
echo "Reusing downloaded binary at '$DOWNLOAD_LOCATION'."
|
||||||
else
|
else
|
||||||
echo "Downloading binary to '$DOWNLOAD_LOCATION' with curl."
|
echo "Downloading binary to '$DOWNLOAD_LOCATION' with curl."
|
||||||
echo "From $binary_url"
|
echo "From $binary_url"
|
||||||
curl -fSL $binary_url -o $DOWNLOAD_LOCATION
|
curl -fSL $binary_url -o $DOWNLOAD_LOCATION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "$USER" = "root" ]; then
|
if [ "$USER" = "root" ]; then
|
||||||
echo "Detected root user, trying to copy $DOWNLOAD_LOCATION to $INSTALLATION_LOCATION."
|
echo "Detected root user, trying to copy $DOWNLOAD_LOCATION to $INSTALLATION_LOCATION."
|
||||||
cp $DOWNLOAD_LOCATION $INSTALLATION_LOCATION || abort
|
cp $DOWNLOAD_LOCATION $INSTALLATION_LOCATION || abort
|
||||||
else
|
else
|
||||||
echo "Asking for \"sudo\" permissions to finish installation."
|
echo "Asking for \"sudo\" permissions to finish installation."
|
||||||
echo "Permission is needed to copy '$DOWNLOAD_LOCATION' to '$INSTALLATION_LOCATION'"
|
echo "Permission is needed to copy '$DOWNLOAD_LOCATION' to '$INSTALLATION_LOCATION'"
|
||||||
|
|
||||||
sudo cp $DOWNLOAD_LOCATION $INSTALLATION_LOCATION || abort
|
sudo cp $DOWNLOAD_LOCATION $INSTALLATION_LOCATION || abort
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "Successfully installed!"
|
echo "Successfully installed!"
|
||||||
echo "See $REPO_URL for usage instructions."
|
echo "See $REPO_URL for usage instructions."
|
||||||
|
}
|
||||||
|
|
||||||
|
install
|
||||||
|
Loading…
x
Reference in New Issue
Block a user