diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-19 18:18:14 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-19 18:18:14 +0300 |
commit | 657cbf607258535eef6fbeedb1acada9f2785f18 (patch) | |
tree | 977112fc59f0349c8e23bcd3cd8d4522a4f3d43e /Scripts | |
parent | c8e5bc9dbe4b1fbd37f2e6d6487e539f462693b6 (diff) |
Refactorings
Diffstat (limited to 'Scripts')
-rw-r--r-- | Scripts/install-dependencies.sh | 9 | ||||
-rw-r--r-- | Scripts/install-uvtools.sh | 40 |
2 files changed, 28 insertions, 21 deletions
diff --git a/Scripts/install-dependencies.sh b/Scripts/install-dependencies.sh index d8d4f13..e72ab05 100644 --- a/Scripts/install-dependencies.sh +++ b/Scripts/install-dependencies.sh @@ -47,10 +47,9 @@ then yum install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm yum install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm yum install -y libjpeg-devel libjpeg-turbo-devel libpng-devel libgeotiff-devel libdc1394-devel ffmpeg-devel tbb-devel mesa-libGL libgdiplus wget -fi - -if [ "$osVariant" == "" ]; then - echo "Error: Base operative system / package manager not identified, nothing was installed" else - echo "Completed: You can now run UVtools" + echo "Error: Base operative system / package manager not identified, nothing was installed" + exit -1 fi + +echo "Completed: You can now run UVtools" diff --git a/Scripts/install-uvtools.sh b/Scripts/install-uvtools.sh index 5bc30ee..e1b38c3 100644 --- a/Scripts/install-uvtools.sh +++ b/Scripts/install-uvtools.sh @@ -5,6 +5,7 @@ # Then run this script # usage 1: ./install-uvtools.sh # + cd "$(dirname "$0")" arch_name="$(uname -m)" # x86_64 or arm64 osVariant="" # osx, linux, arch, rhel @@ -34,7 +35,7 @@ if [ "${OSTYPE:0:6}" == "darwin" ]; then echo "Error: Unable to install, UVtools requires at least macOS $macOS_least_version." exit -1 fi - + if [ -z "$(command -v brew)" ]; then bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" if [ -f "/opt/homebrew/bin/brew" -a -z "$(command -v brew)" ]; then @@ -56,15 +57,22 @@ if [ "${OSTYPE:0:6}" == "darwin" ]; then # arm64: Create script on user desktop to run UVtools if [ "$arch_name" == "arm64" ]; then run_script="$HOME/Desktop/run-uvtools.sh" - echo "#!/bin/bash -bash '$appPath/Contents/MacOS/UVtools.sh' &" > "$run_script" + echo '#!/bin/bash +if [ -f "$appPath/Contents/MacOS/UVtools.sh" ]; then + bash "$appPath/Contents/MacOS/UVtools.sh" & +elif [ -f "UVtools.app/Contents/MacOS/UVtools.sh" ]; then + bash "UVtools.app/Contents/MacOS/UVtools.sh" & +else + echo "Error: UVtools.app not found on known paths" +fi +' > "$run_script" chmod a+x "$run_script" echo "Note: Always run 'bash run-uvtools.sh' from desktop to run UVtools on your mac arm64!" fi if [ -f "$appPath/Contents/MacOS/UVtools.sh" ]; then bash "$appPath/Contents/MacOS/UVtools.sh" & - else + elif [ -d "$appPath" ]; then open "$appPath" fi fi @@ -72,19 +80,19 @@ bash '$appPath/Contents/MacOS/UVtools.sh' &" > "$run_script" exit 1 elif command -v apt-get &> /dev/null then - osVariant="linux" + osVariant="linux" [ -z "$(command -v wget)" ] && sudo apt-get install -y wget - [ -z "$(command -v curl)" ] && sudo apt-get install -y curl + [ -z "$(command -v curl)" ] && sudo apt-get install -y curl elif command -v pacman &> /dev/null then - osVariant="arch" - [ -z "$(command -v wget)" ] && sudo pacman -S wget - [ -z "$(command -v curl)" ] && sudo pacman -S curl + osVariant="arch" + [ -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" - [ -z "$(command -v wget)" ] && sudo yum install -y wget - [ -z "$(command -v curl)" ] && sudo yum install -y curl + osVariant="rhel" + [ -z "$(command -v wget)" ] && sudo yum install -y wget + [ -z "$(command -v curl)" ] && sudo yum install -y curl fi if [ -z "$osVariant" ]; then @@ -95,7 +103,7 @@ fi echo "- Detected: $osVariant $arch_name" if [ -z "$(ldconfig -p | grep libpng)" -o -z "$(ldconfig -p | grep libgdiplus)" -o -z "$(ldconfig -p | grep libavcodec)" ]; then - echo "- Missing dependencies found, installing..." + echo "- Missing dependencies found, installing..." sudo bash -c "$(curl -fsSL $dependencies_url)" fi @@ -128,10 +136,10 @@ if [ -d "$HOME/Applications" ]; then rm -f "$HOME/Applications/UVtools_*.AppImage" echo "- Moving $filename to $HOME/Applications" - mv -f "$tmpfile" "$HOME/Applications" + mv -f "$tmpfile" "$HOME/Applications" - "$HOME/Applications/$filename" & - echo "If prompt for 'Desktop integration', click 'Integrate and run'" + "$HOME/Applications/$filename" & + echo "If prompt for 'Desktop integration', click 'Integrate and run'" else echo "- Removing old versions" rm -f UVtools_*.AppImage |