remove double brackets from scripts

This commit is contained in:
Tiago Conceição
2022-10-19 01:30:18 +01:00
parent 7322a56ba4
commit 73abc620df
4 changed files with 36 additions and 29 deletions
+7 -7
View File
@@ -24,16 +24,16 @@
## To auto install on Linux:
```bash
[[ "$(command -v apt-get)" && ! "$(command -v wget)" ]] && sudo apt-get install -y wget
[[ "$(command -v pacman)" && ! "$(command -v wget)" ]] && sudo pacman -S wget
[[ "$(command -v yum)" && ! "$(command -v wget)" ]] && sudo yum install -y wget
[ "$(command -v apt-get)" -a -z "$(command -v wget)" ] && sudo apt-get install -y wget
[ "$(command -v pacman)" -a -z "$(command -v wget)" ] && sudo pacman -S wget
[ "$(command -v yum)" -a -z "$(command -v wget)" ] && sudo yum install -y wget
wget -qO - https://raw.githubusercontent.com/sn4k3/UVtools/master/Scripts/install-uvtools.sh | bash
```
## To auto install on MacOS (homebrew):
```bash
[[ ! "$(command -v brew)" ]] && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
[ -z "$(command -v brew)" ] && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install --cask uvtools
```
@@ -276,9 +276,9 @@ The following commands are the old way and commands under the UI executable, the
**Copy the following script, paste and run on a terminal:**
```bash
[[ "$(command -v apt-get)" && ! "$(command -v wget)" ]] && sudo apt-get install -y wget
[[ "$(command -v pacman)" && ! "$(command -v wget)" ]] && sudo pacman -S wget
[[ "$(command -v yum)" && ! "$(command -v wget)" ]] && sudo yum install -y wget
[ "$(command -v apt-get)" -a -z "$(command -v wget)" ] && sudo apt-get install -y wget
[ "$(command -v pacman)" -a -z "$(command -v wget)" ] && sudo pacman -S wget
[ "$(command -v yum)" -a -z "$(command -v wget)" ] && sudo yum install -y wget
wget -qO - https://raw.githubusercontent.com/sn4k3/UVtools/master/Scripts/install-dependencies.sh | sudo bash
wget -qO - https://raw.githubusercontent.com/sn4k3/UVtools/master/Scripts/libdl-solver.sh | sudo bash
```
+4 -4
View File
@@ -8,7 +8,7 @@
echo "Script to install the dependencies in order to run the UVtools"
if [[ $EUID -ne 0 ]]; then
if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
@@ -16,13 +16,13 @@ fi
arch_name="$(uname -m)"
osVariant=""
if [[ "$arch_name" != "x86_64" && "$arch_name" != "arm64" ]]; then
echo "Error: Unsupported host arch: $arch_name"
if [ "$arch_name" != "x86_64" -a "$arch_name" != "arm64" ]; then
echo "Error: Unsupported host arch $arch_name"
exit -1
fi
#echo "- Detecting OS"
if [[ $OSTYPE == 'darwin'* ]]; then
if [ "${OSTYPE:0:6}" == "darwin" ]; then
osVariant="macOS"
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
#brew analytics off
+24 -17
View File
@@ -6,43 +6,50 @@
# usage 1: ./install-uvtools.sh
#
cd "$(dirname "$0")"
arch_name="$(uname -m)"
osVariant=""
arch_name="$(uname -m)" # x86_64 or arm64
osVariant="" # osx, linux, arch, rhel
api_url="https://api.github.com/repos/sn4k3/UVtools/releases/latest"
dependencies_url="https://raw.githubusercontent.com/sn4k3/UVtools/master/Scripts/install-dependencies.sh"
macOS_least_version=10.15
if [[ "$arch_name" != "x86_64" && "$arch_name" != "arm64" ]]; then
echo "Error: Unsupported host arch: $arch_name"
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [ "$arch_name" != "x86_64" -a "$arch_name" != "arm64" ]; then
echo "Error: Unsupported host arch $arch_name"
exit -1
fi
echo "Script to download and install UVtools"
echo "- Detecting OS"
if [[ $OSTYPE == 'darwin'* ]]; then
if [ "${OSTYPE:0:6}" == "darwin" ]; then
osVariant="osx"
if [ installDependencies == true ]; then
[[ ! "$(command -v brew)" ]] && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install --cask uvtools
exit 1
macOS_version="$(sw_vers -productVersion)"
if [ $(version $macOS_version) -lt $(version $macOS_least_version) ]; then
echo "Error: Unable to install, UVtools requires at least macOS $macOS_least_version."
exit -1
fi
[ -z "$(command -v brew)" ] && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install --cask uvtools
exit 1
elif command -v apt-get &> /dev/null
then
osVariant="linux"
[[ ! "$(command -v wget)" ]] && sudo apt-get install -y wget
[[ ! "$(command -v curl)" ]] && sudo apt-get install -y curl
[ -z "$(command -v wget)" ] && sudo apt-get install -y wget
[ -z "$(command -v curl)" ] && sudo apt-get install -y curl
elif command -v pacman &> /dev/null
then
osVariant="arch"
[[ ! "$(command -v wget)" ]] && sudo pacman -S wget
[[ ! "$(command -v curl)" ]] && sudo pacman -S curl
[ -z "$(command -v wget)" ] && sudo pacman -S wget
[ -z "$(command -v curl)" ] && sudo pacman -S curl
elif command -v yum &> /dev/null
then
osVariant="rhel"
[[ ! "$(command -v wget)" ]] && sudo yum install -y wget
[[ ! "$(command -v curl)" ]] && sudo yum install -y curl
[ -z "$(command -v wget)" ] && sudo yum install -y wget
[ -z "$(command -v curl)" ] && sudo yum install -y curl
fi
if [ -z "$osVariant" ]; then
@@ -52,7 +59,7 @@ fi
echo "- Detected: $osVariant $arch_name"
if [[ ! "$(ldconfig -p | grep libpng)" || ! "$(ldconfig -p | grep libgdiplus)" || ! "$(ldconfig -p | grep libavcodec)" ]]; then
if [ ! "$(ldconfig -p | grep libpng)" -o ! "$(ldconfig -p | grep libgdiplus)" -o ! "$(ldconfig -p | grep libavcodec)" ]; then
echo "- Missing dependencies found, installing..."
wget -qO - $dependencies_url | sudo bash
fi
+1 -1
View File
@@ -8,7 +8,7 @@
# Version: 1
#
if [[ $EUID -ne 0 ]]; then
if [ $EUID -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi