2022-04-12 12:38:01 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# glacier-cache
|
|
|
|
# Script used to download a package and cache it
|
|
|
|
|
2022-05-02 12:42:08 -04:00
|
|
|
# Glacier preloading
|
|
|
|
|
2022-05-27 14:08:54 -04:00
|
|
|
source /etc/glacier/hooks.sh
|
2022-05-02 12:42:08 -04:00
|
|
|
|
|
|
|
# Require the script to be run as root
|
2022-04-12 12:38:01 -04:00
|
|
|
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
2022-04-20 15:36:05 -04:00
|
|
|
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root."
|
2022-04-12 12:38:01 -04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2022-04-20 15:36:05 -04:00
|
|
|
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
|
2022-05-03 12:54:09 -04:00
|
|
|
printf "\033[1;34m [ i ] \033[m Caching $input.tar.gz...\n"
|
2022-05-06 10:02:35 -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-20 15:36:05 -04:00
|
|
|
printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
|
2022-04-12 12:38:01 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mv $input.tar.gz /var/cache/glacier
|
2022-04-20 15:36:05 -04:00
|
|
|
printf "\033[1;32m [ $check ] \033[m Operation completed."
|