v3.1.1 - Improved error handling and new build system

This commit is contained in:
lw-everestlinux 2022-11-03 12:36:39 -04:00
parent 1c62bd5b19
commit 64e58daf40
3 changed files with 65 additions and 53 deletions

5
README
View File

@ -43,9 +43,10 @@ Copy install.conf.def to install.conf
$ mv install.conf.def install.conf
Make necessary adjustments to install.conf, then run
INSTALL.sh as root.
build.sh as root.
# ./INSTALL.sh
# ./build.sh install # for first time installations
# ./build.sh update # for existing installations
+-----------------+
| [>_] Usage [>_] |

View File

@ -1,51 +0,0 @@
#!/bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "must be run as root\n"
exit 1
fi
WORKING_DIR=$(pwd)
SRC_DIR=$(pwd)/../src
printf "parsing install.conf\n"
source $WORKING_DIR/install.conf
if [ "$?" != 0 ]; then
printf "install.conf not found\n"
exit 1
fi
printf "installing executable\n"
mv $SRC_DIR/glacier $PREFIX/bin
if [ "$?" != 0 ]; then
mv $SRC_DIR/glacier $PREFIX
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
fi
printf "installing configuration files\n"
mv $SRC_DIR/glacier.conf $CONFDIR
if [ "$?" != 0 ]; then
printf "$CONFDIR does not exist\n"
printf "this can be corrected by running:\n"
printf "# mkdir -pv $CONFDIR\n"
exit 1
fi
mkdir /opt/glacier
mkdir /opt/glacier/workspace
mkdir /var/log/glacier
mkdir /var/cache/glacier
mkdir /etc/glacier
mkdir /etc/glacier/pkginfo
mv $SRC_DIR/hooks $CONFDIR/glacier
mv $SRC_DIR/post-hooks $CONFDIR/glacier
mv $SRC_DIR/hooks.sh $CONFDIR/glacier
mv $SRC_DIR/make.conf $CONFDIR
mv $SRC_DIR/glacier-integrity-check $PREFIX/bin
if [ "$?" != "0" ]; then
mv $SRC_DIR/glacier-integrity-check $PREFIX
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
fi
printf "finished installation\n"
exit 0

62
install/build.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "must be run as root\n"
exit 1
fi
WORKING_DIR=$(pwd)
SRC_DIR=$(pwd)/../src
printf "parsing install.conf\n"
source $WORKING_DIR/install.conf
if [ "$?" != 0 ]; then
printf "install.conf not found\n"
exit 1
fi
case $1 in
install)
printf "installing executable\n"
mv $SRC_DIR/glacier $PREFIX/bin
if [ "$?" != 0 ]; then
mv $SRC_DIR/glacier $PREFIX
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
fi
printf "installing configuration files\n"
mv $SRC_DIR/glacier.conf $CONFDIR
if [ "$?" != 0 ]; then
printf "$CONFDIR does not exist\n"
printf "this can be corrected by running:\n"
printf "# mkdir -pv $CONFDIR\n"
exit 1
fi
mkdir /opt/glacier
mkdir /opt/glacier/workspace
mkdir /var/log/glacier
mkdir /var/cache/glacier
mkdir /etc/glacier
mkdir /etc/glacier/pkginfo
mv $SRC_DIR/hooks $CONFDIR/glacier
mv $SRC_DIR/post-hooks $CONFDIR/glacier
mv $SRC_DIR/hooks.sh $CONFDIR/glacier
mv $SRC_DIR/make.conf $CONFDIR
mv $SRC_DIR/glacier-integrity-check $PREFIX/bin
if [ "$?" != "0" ]; then
mv $SRC_DIR/glacier-integrity-check $PREFIX
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
fi
printf "finished installation\n"
exit 0
;;
update)
printf "updating executable\n"
rm $PREFIX/bin/glacier || rm $PREFIX/glacier
mv $SRC_DIR/glacier $PREFIX || mv $SRC_DIR/glacier $PREFIX/bin
printf "finished updating\n"
exit 0
esac