glacier-old/scripts/glacier-install.sh

52 lines
1.9 KiB
Bash
Raw Normal View History

2022-04-12 12:38:01 -04:00
#!/bin/sh
# glacier-install
# Script used to fetch installation scripts and run them
2022-04-19 17:20:32 -04:00
# Define colors
2022-04-19 17:44:36 -04:00
export red="\033[1;31m"
export green="\033[1;32m"
export yellow="\033[1;33m"
export blue="\033[1;34m"
2022-04-20 15:00:52 -04:00
export reset="\033[m"
2022-04-19 17:20:32 -04:00
# Define unicode symbols
2022-04-19 17:44:36 -04:00
export check="\xE2\x9C\x93"
export error="\xE2\x9C\x95"
export warning="\x21"
export question="\x3F"
2022-04-19 17:20:32 -04:00
2022-05-02 12:40:57 -04:00
# Glacier preloading
2022-05-27 14:07:04 -04:00
source /etc/glacier/hooks.sh
2022-05-02 12:40:57 -04:00
2022-04-12 12:38:01 -04:00
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
2022-04-26 09:57:10 -04:00
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Please run Glacier as root."
2022-04-12 12:38:01 -04:00
exit
fi
2022-04-20 15:10:13 -04:00
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
2022-05-03 11:37:28 -04:00
printf "\033[1;34m [ i ] \033[m Installing $input.tar.gz...\n"
2022-05-06 10:01:25 -04:00
printf "\033[1;34m [ i ] \033[m Checking databases... " && wget $GREPO1/$input.tar.gz -q --show-progress || wget $GREPO2/$input.tar.gz -q --show-progress || wget $GREPO3/$input.tar.gz -q --show-progress || wget $GREPO4/$input.tar.gz -q --show-progress || wget $GREPO5/$input.tar.gz -q --show-progress || wget $GREPO6/$input.tar.gz -q --show-progress || wget $GREPO7/$input.tar.gz -q --show-progress || wget $GREPO8/$input.tar.gz -q --show-progress
2022-04-12 12:38:01 -04:00
if [ "$?" != "0" ]; then
2022-04-26 09:57:10 -04:00
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Package not found. " 1>&2
2022-04-12 16:39:37 -04:00
exit 1
2022-04-12 12:38:01 -04:00
fi
2022-05-03 11:37:28 -04:00
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz...\n"
2022-04-20 15:10:13 -04:00
mkdir $input && mv $input.tar.gz $input && cd $input
tar -xf $input.tar.gz
2022-04-12 12:38:01 -04:00
if [ "$?" != "0" ]; then
2022-04-26 09:57:10 -04:00
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Could not unpack $input.tar.gz. " 1>&2
2022-04-12 12:38:01 -04:00
exit 1
fi
chmod +x INSTALL.sh
chmod +x $input.ts.sh
2022-05-03 11:37:28 -04:00
printf "\033[1;34m [ i ] \033[m Executing installation instructions...\n"
2022-04-12 12:38:01 -04:00
./INSTALL.sh # Actually executes installation script
./$input.ts.sh
2022-05-03 11:37:28 -04:00
printf "\033[1;34m [ i ] \033[m Cleaning up...\n" # Status message
2022-04-20 15:10:13 -04:00
mv $input-pkginfo.json /etc/glacier/pkginfo
2022-04-12 12:38:01 -04:00
cd ..
2022-04-20 15:10:13 -04:00
rm -rf $input
2022-05-03 11:37:28 -04:00
printf "\033[1;32m [ \xE2\x9C\x93 ] \033[m Operation completed.\n"