Skip to content

Commit

Permalink
fix: update installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph0enixKM committed Sep 7, 2023
1 parent d9f0de8 commit 9dfef1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 116 deletions.
29 changes: 11 additions & 18 deletions setup/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ function hasFailed__18_v0 {
${command} > /dev/null 2>&1
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
__AMBER_FUN_hasFailed18_v0=$(echo $__AMBER_STATUS '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//');
Expand All @@ -16,22 +15,19 @@ __3_place="/opt/amber";
__AMBER_VAL_0=$(uname -s);
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
os=$(if [ $([ "_${__AMBER_VAL_0}" != "_Darwin" ]; echo $?) != 0 ]; then echo "macos"; else echo "linux"; fi);
__AMBER_VAL_1=$(uname -m);
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
arch=$(if [ $([ "_${__AMBER_VAL_1}" != "_arm64" ]; echo $?) != 0 ]; then echo "aarch64"; else echo "x86_64"; fi);
url="https://github.com/Ph0enixKM/${__0_name}/releases/download/${__2_tag}/amber_${os}_${arch}";
test -d "${__3_place}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
if [ $(echo $__AMBER_STATUS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
Expand All @@ -42,40 +38,42 @@ fi;
exit 0
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
fi;
echo "Installing Amber";
hasFailed__18_v0 "ruby -v";
__AMBER_FUN_hasFailed18_v0__36 = ${__AMBER_FUN_hasFailed18_v0};
__AMBER_FUN_hasFailed18_v0__36=${__AMBER_FUN_hasFailed18_v0};
hasFailed__18_v0 "curl -v";
__AMBER_FUN_hasFailed18_v0__41 = ${__AMBER_FUN_hasFailed18_v0};
__AMBER_FUN_hasFailed18_v0__45=${__AMBER_FUN_hasFailed18_v0};
hasFailed__18_v0 "wget -V";
__AMBER_FUN_hasFailed18_v0__45 = ${__AMBER_FUN_hasFailed18_v0};
__AMBER_FUN_hasFailed18_v0__49=${__AMBER_FUN_hasFailed18_v0};
if [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__36} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
code="require \"open-uri\"; open(\"${__1_target}\", \"wb\") do |file|; file << open(\"${url}\").read; end";
echo "Using ruby as a download method...";
sudo ruby -e "${code}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
echo "Ruby failed to download amber.";
echo "Please try again or use another download method.";
exit 1
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
:
fi
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__41} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
fi
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__45} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
echo "Using curl as a download method...";
curl -o "${__1_target}" "${url}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__45} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__49} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
echo "Using wget as a download method...";
wget -O "${__1_target}" "${url}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
else
Expand All @@ -84,32 +82,27 @@ else
exit 1
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
fi;
sudo mkdir "${__3_place}" > /dev/null
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo mv "${__1_target}" "${__3_place}/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo chmod +x "${__3_place}/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo ln -s "${__3_place}/${__1_target}" "/usr/local/bin/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
echo "Amber has been installed successfully. 🎉"
107 changes: 9 additions & 98 deletions setup/uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,115 +1,26 @@
function hasFailed__18_v0 {
local command=$1
${command} > /dev/null 2>&1
place="/opt/amber";
test -d "${place}" > /dev/null
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
__AMBER_FUN_hasFailed18_v0=$(echo $__AMBER_STATUS '!=' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//');
return 0
}
__0_name="AmberNative";
__1_target="amber";
__2_tag="0.3.1-alpha";
__3_place="/opt/amber";
__AMBER_VAL_0=$(uname -s);
__AMBER_VAL_0=$(echo $?);
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
os=$(if [ $([ "_${__AMBER_VAL_0}" != "_Darwin" ]; echo $?) != 0 ]; then echo "macos"; else echo "linux"; fi);
__AMBER_VAL_1=$(uname -m);
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
arch=$(if [ $([ "_${__AMBER_VAL_1}" != "_arm64" ]; echo $?) != 0 ]; then echo "aarch64"; else echo "x86_64"; fi);
url="https://github.com/Ph0enixKM/${__0_name}/releases/download/${__2_tag}/amber_${os}_${arch}";
test -d "${__3_place}"
if [ $([ "_${__AMBER_VAL_0}" != "_0" ]; echo $?) != 0 ]; then
sudo rm -rf "${place}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
if [ $(echo $__AMBER_STATUS '==' 0 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
echo "Amber already installed";
echo "It seems that Amber is already installed on your system. (${__3_place})";
echo "If you want to reinstall Amber, uninstall it first.";
echo "(Find out more at https://amber.marbl.cc)";
exit 0
sudo rm "/usr/local/bin/amber"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
fi;
echo "Installing Amber";
hasFailed__18_v0 "ruby -v";
__AMBER_FUN_hasFailed18_v0__36 = __AMBER_FUN_hasFailed18_v0;
hasFailed__18_v0 "curl -v";
__AMBER_FUN_hasFailed18_v0__41 = __AMBER_FUN_hasFailed18_v0;
hasFailed__18_v0 "wget -V";
__AMBER_FUN_hasFailed18_v0__45 = __AMBER_FUN_hasFailed18_v0;
if [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__36} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
code="require \"open-uri\"; open(\"${__1_target}\", \"wb\") do |file|; file << open(\"${url}\").read; end";
echo "Using ruby as a download method...";
sudo ruby -e "${code}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__41} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
echo "Using curl as a download method...";
curl -o "${__1_target}" "${url}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
elif [ $(echo '!' ${__AMBER_FUN_hasFailed18_v0__45} | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]; then
echo "Using wget as a download method...";
wget -O "${__1_target}" "${url}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
echo "Uninstalled Amber successfully 🎉"
else
echo "Neither ruby, curl or wget are installed on your system.";
echo "Please install one of them and try again.";
exit 1
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi
fi;
sudo mkdir "${__3_place}" > /dev/null
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo mv "${__1_target}" "${__3_place}/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo chmod +x "${__3_place}/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
sudo ln -s "${__3_place}/${__1_target}" "/usr/local/bin/${__1_target}"
__AMBER_STATUS=$?;
if [ $__AMBER_STATUS != 0 ]; then
$(exit $__AMBER_STATUS)
:
fi;
echo "Amber has been installed successfully. 🎉"
echo "Amber is not installed"
fi

0 comments on commit 9dfef1d

Please sign in to comment.