Files
openbts/debian/preinst

53 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# preinst script for test
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
install()
{
INSTALL_DIR=/OpenBTS
DATE=$(date --rfc-3339='date')
BACKUP_DIR=$INSTALL_DIR/backup_$DATE
if [ -f $INSTALL_DIR/OpenBTS -a -f $INSTALL_DIR/transceiver ]; then
if [ ! -e $BACKUP_DIR ]; then
mkdir -p $BACKUP_DIR/
mv $INSTALL_DIR/OpenBTS $BACKUP_DIR/
mv $INSTALL_DIR/transceiver $BACKUP_DIR/
fi
fi
}
case "$1" in
install|upgrade)
install
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0