mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
Fix installation script + support wget
This commit is contained in:
parent
6085807ddf
commit
b918cb912d
14
README.md
14
README.md
@ -76,14 +76,20 @@ ouch list videos.tar.xz
|
|||||||
|
|
||||||
### Downloading the latest binary
|
### Downloading the latest binary
|
||||||
|
|
||||||
WARNING: SCRIPT TEMPORARILY DISABLED.
|
Download the script with `curl` and run it.
|
||||||
|
|
||||||
This script downloads the latest binary and copies it to `/usr/bin`.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -s https://raw.githubusercontent.com/vrmiguel/ouch/master/install.sh | sh
|
curl -s https://raw.githubusercontent.com/ouch-org/ouch/master/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or with `wget`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wget https://raw.githubusercontent.com/ouch-org/ouch/master/install.sh -O - | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The script will download the latest binary and copy it to `/usr/bin`.
|
||||||
|
|
||||||
### Installing from source code
|
### Installing from source code
|
||||||
|
|
||||||
For compiling, check [the wiki guide](https://github.com/ouch-org/ouch/wiki/Compiling-and-installing-from-source-code).
|
For compiling, check [the wiki guide](https://github.com/ouch-org/ouch/wiki/Compiling-and-installing-from-source-code).
|
||||||
|
38
install.sh
38
install.sh
@ -3,11 +3,11 @@
|
|||||||
# Needs to be updated each version bump
|
# Needs to be updated each version bump
|
||||||
VERSION="0.1.6"
|
VERSION="0.1.6"
|
||||||
|
|
||||||
DOWNLOAD_LOCATION="/tmp/ouch"
|
DOWNLOAD_LOCATION="/tmp/ouch-binary"
|
||||||
INSTALLATION_LOCATION="/usr/bin/ouch"
|
INSTALLATION_LOCATION="/usr/bin/ouch"
|
||||||
REPO_URL="https://github.com/vrmiguel/ouch"
|
REPO_URL="https://github.com/ouch-org/ouch"
|
||||||
|
|
||||||
# Panicks script if anything fails
|
# Panics script if anything fails
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
@ -23,17 +23,17 @@ install() {
|
|||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux)
|
Linux)
|
||||||
echo "Linux."
|
echo "Linux."
|
||||||
system_suffix="-ubuntu-18.04-glibc"
|
system_suffix="-linux-musl"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
Darwin)
|
Darwin)
|
||||||
echo "Mac OS X."
|
echo "Mac OS X."
|
||||||
system_suffix="-macOS"
|
system_suffix="-apple-darwin"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||||
echo "Windows."
|
echo "Windows."
|
||||||
system_suffix=".exe"
|
system_suffix="-pc-windows-msvc.exe"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
@ -49,28 +49,44 @@ install() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
binary_url="https://github.com/vrmiguel/ouch/releases/download/${VERSION}/ouch${system_suffix}"
|
binary_file_name="ouch-x86_64${system_suffix}"
|
||||||
|
binary_url="https://github.com/ouch-org/ouch/releases/download/${VERSION}/${binary_file_name}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Set $downloader
|
||||||
|
if [ $(which curl) ]; then
|
||||||
|
downloader="curl"
|
||||||
|
downloader_command="curl -fSL $binary_url -o $DOWNLOAD_LOCATION"
|
||||||
|
elif [ $(which wget) ]; then
|
||||||
|
downloader="wget"
|
||||||
|
downloader_command="wget $binary_url -O $DOWNLOAD_LOCATION"
|
||||||
|
else
|
||||||
|
echo "ERROR: have not found 'curl' nor 'wget' to donwload ouch binary."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
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 $downloader."
|
||||||
echo "From $binary_url"
|
echo "From $binary_url"
|
||||||
curl -fSL $binary_url -o $DOWNLOAD_LOCATION
|
# Run command to download binary
|
||||||
|
$downloader_command
|
||||||
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
|
||||||
|
chmod +x $INSTALLATION_LOCATION
|
||||||
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
|
||||||
|
sudo chmod +x $INSTALLATION_LOCATION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user