forked from irods/irods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preinst
45 lines (40 loc) · 1.4 KB
/
preinst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# determine whether this is an upgrade
if [ "$1" -eq "$1" ] 2>/dev/null ; then
# integer, therefore rpm
if [ $1 -gt 1 ] ; then
PACKAGEUPGRADE="true"
else
PACKAGEUPGRADE="false"
fi
else
# string, therefore deb
if [ "$1" = "upgrade" ] ; then
PACKAGEUPGRADE="true"
else
PACKAGEUPGRADE="false"
fi
fi
if [ "$PACKAGEUPGRADE" = "true" ] ; then
if [ -f /etc/irods/service_account.config ] ; then
# get service account information
. /etc/irods/service_account.config 2> /dev/null
else
IRODS_SERVICE_ACCOUNT_NAME=`ls -ld /var/lib/irods | awk '{print $3}'`
fi
# Stop server to prevent db plugin / irods server mismatch
HIDE_OUTPUT=`su - ${IRODS_SERVICE_ACCOUNT_NAME:?} -c "python3 -c 'from scripts.irods.controller import IrodsController; IrodsController().stop()'"`
# Upgrade
echo "Upgrading Existing iRODS Installation"
UPGRADE_TEMP_FILE="/var/lib/irods/upgrade.tmp"
touch $UPGRADE_TEMP_FILE
fi
if [ -f "/var/lib/irods/VERSION" ] ; then
mv /var/lib/irods/VERSION /var/lib/irods/VERSION.previous
fi
if [ -f "/var/lib/irods/version.json" ] ; then
mv /var/lib/irods/version.json /var/lib/irods/version.json.previous
fi
if [ -f "/var/lib/irods/VERSION.json" ] ; then
cp /var/lib/irods/VERSION.json /var/lib/irods/VERSION.json.previous
mv /var/lib/irods/VERSION.json /var/lib/irods/version.json.previous
fi