glacier-old/install/build.sh

63 lines
1.5 KiB
Bash
Raw Normal View History

#!/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