10/4/22 - iron out tons of bugs
This commit is contained in:
49
src/glacier
49
src/glacier
@@ -17,8 +17,25 @@
|
||||
|
||||
# Preloading
|
||||
/usr/bin/gscripts preload
|
||||
source /etc/glacier.conf
|
||||
export input
|
||||
# Define messages
|
||||
# Errors
|
||||
GLACIER_ERROR_NO_ROOT=$(printf "$red [ $error ]$reset Please run Glacier as root.\n")
|
||||
GLACIER_ERROR_DOES_NOT_EXIST=$(printf "$red [ $error ]$reset Package $input either does not exist, or is in a repository that is not enabled.\n")
|
||||
GLACIER_ERROR_CANNOT_UNPACK=$(printf "$red [ $error ]$reset Package archive cannot be unpacked.\n")
|
||||
GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE=$(printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n")
|
||||
GLACIER_ERROR_NO_SUCH_OPTION=$(printf "$red [ $error ]$reset Unknown option, see 'glacier -h' for usage.\n")
|
||||
|
||||
# Status
|
||||
GLACIER_STATUS_INSTALLING=$(printf "$blue [ i ]$reset Installing $input...\n")
|
||||
GLACIER_STATUS_UPDATING=$(printf "$blue [ i ]$reset Updating $input...\n")
|
||||
GLACIER_STATUS_REMOVING=$(printf "$blue [ i ]$reset Removing $input...\n")
|
||||
GLACIER_STATUS_CACHING=$(printf "$blue [ i ]$reset Caching $input...\n")
|
||||
GLACIER_STATUS_UNPACKING=$(printf "$blue [ i ]$reset Unpacking $input.tar.gz...\n")
|
||||
GLACIER_STATUS_INTEGRITY_CHECK=$(printf "$blue [ i ]$reset Verifying integrity of package...\n")
|
||||
GLACIER_STATUS_EXECUTING=$(printf "$blue [ i ]$reset Executing instructions...\n")
|
||||
GLACIER_WHICH_PKG=$(printf "$blue [ $question ]$reset Enter package name: ")
|
||||
# Main Script
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
@@ -40,7 +57,7 @@
|
||||
printf "$blue=== Licensing ======================================================================================$reset\n"
|
||||
printf "This program is freely distributable under the terms of the GNU General Public License version 3 or later.\n"
|
||||
printf "You should have recieved a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
|
||||
printf "======================================================================================================\n"
|
||||
printf "$blue======================================================================================================\n"
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
@@ -50,41 +67,41 @@
|
||||
install|-f)
|
||||
# Require script to be run as root
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
$GLACIER_ERROR_NO_ROOT
|
||||
echo ${GLACIER_ERROR_NO_ROOT}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$GLACIER_WHICH_PKG && read input
|
||||
echo $GLACIER_WHICH_PKG && read input
|
||||
export input
|
||||
$GLACIER_STATUS_INSTALLING
|
||||
echo $GLACIER_STATUS_INSTALLING
|
||||
/usr/bin/gscripts download
|
||||
if [ "$?" != "0" ]; then
|
||||
$GLACIER_ERROR_DOES_NOT_EXIST
|
||||
echo $GLACIER_ERROR_DOES_NOT_EXIST
|
||||
exit 1
|
||||
fi
|
||||
$GLACIER_STATUS_INTEGRITY_CHECK
|
||||
echo $GLACIER_STATUS_INTEGRITY_CHECK
|
||||
mkdir $input && mv $input.tar.gz $input && cd $input
|
||||
/usr/bin/gscripts integrity-check
|
||||
if [ "$?" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
$GLACIER_STATUS_UNPACKING
|
||||
echo $GLACIER_STATUS_UNPACKING
|
||||
tar -xvf $input.tar.gz
|
||||
if [ "$?" != "0" ]; then
|
||||
$GLACIER_ERROR_CANNOT_UNPACK
|
||||
echo $GLACIER_ERROR_CANNOT_UNPACK
|
||||
exit 1
|
||||
fi
|
||||
chmod +x INSTALL.sh
|
||||
chmod +x $input.ts.sh
|
||||
$GLACIER_STATUS_EXECUTING
|
||||
echo $GLACIER_STATUS_EXECUTING
|
||||
./INSTALL.sh
|
||||
if [ "$?" != "0" ]; then
|
||||
$GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
|
||||
echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
|
||||
exit 1
|
||||
fi
|
||||
./$input.ts.sh
|
||||
/usr/bin/gscripts post-install
|
||||
$GLACIER_SUCCESS
|
||||
echo $GLACIER_SUCCESS
|
||||
exit 0
|
||||
;;
|
||||
update|-u)
|
||||
@@ -264,10 +281,10 @@
|
||||
printf "$error\n"
|
||||
printf "$warning\n"
|
||||
printf "$question\n"
|
||||
printf "$red This is a test.$reset\n"
|
||||
printf "$green This is a test.$reset\n"
|
||||
printf "$yellow This is a test.$reset\n"
|
||||
printf "$blue This is a test.$reset\n"
|
||||
printf "$red Red.$reset\n"
|
||||
printf "$green Green.$reset\n"
|
||||
printf "$yellow Yellow.$reset\n"
|
||||
printf "$blue Blue.$reset\n"
|
||||
printf ">> Checking repositories...\n"
|
||||
echo $GREPO1
|
||||
echo $GREPO2
|
||||
@@ -292,5 +309,3 @@
|
||||
esac
|
||||
done
|
||||
|
||||
$GLACIER_ERROR_NO_SUCH_OPTION
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user