mirror of
https://github.com/nadrad/h-m-m.git
synced 2024-06-03 03:02:12 +02:00
Installer automatically download h-m-m
If h-m-m doesn't exist in the same directory as this script, tries to download the application from github repository.
This commit is contained in:
parent
e8475243e0
commit
ccd72c5339
21
install.sh
21
install.sh
|
@ -9,10 +9,22 @@ if [ ! -d "$DESTINATION_DIR" ]; then
|
||||||
DESTINATION_DIR="/usr/bin"
|
DESTINATION_DIR="/usr/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If h-m-m doesn't exist in the same directory as this script, exit
|
# If h-m-m doesn't exist in the same directory as this script, tries to download from github repository
|
||||||
if [ ! -f "$HMM_PATH" ]; then
|
if [ ! -f "$HMM_PATH" ]; then
|
||||||
echo -e "ERROR: h-m-m not found in the same directory as this script.\n"
|
|
||||||
exit 1
|
if [[ $(curl --write-out '%{http_code}' --silent https://raw.githubusercontent.com/nadrad/h-m-m/main/h-m-m --output /dev/null) == 200 ]]; then
|
||||||
|
curl --silent https://raw.githubusercontent.com/nadrad/h-m-m/main/h-m-m --output /tmp/h-m-m
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "ERROR: Could not download h-m-m\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
HMM_PATH="/tmp/h-m-m"
|
||||||
|
else
|
||||||
|
echo -e "ERROR: Online repository not available or Internet is down\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n> Installer for h-m-m\n"
|
echo -e "\n> Installer for h-m-m\n"
|
||||||
|
@ -63,6 +75,9 @@ if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Delete temporary file, if exists.
|
||||||
|
rm -f /tmp/h-m-m
|
||||||
|
|
||||||
# Make the copied file executable
|
# Make the copied file executable
|
||||||
sudo chmod +x $DESTINATION_DIR/h-m-m
|
sudo chmod +x $DESTINATION_DIR/h-m-m
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue