blob: 6a36cf96204ce38a8607b3f1c953e81f7148a69f (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/bash
#
# Postfixadmin software upgrader.
#
# Config parameters
BASENAME="`basename $0`"
OLD_VERSION="$1"
VERSION="$2"
# Syntax check
if [ -z "$2" ]; then
echo "usage: $BASENAME <old-version> <new-version>"
exit 1
fi
# Check installed versions
if [ ! -d "postfixadmin-$OLD_VERSION" ]; then
echo "error: postfixadmin-$OLD_VERSION is not installed, aborting."
exit 1
elif [ -d "postfixadmin-$VERSION" ]; then
echo "error: postfixadmin-$VERSION already installed, aborting."
exit 1
fi
# Download package
wget -c http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-$VERSION/postfixadmin-$VERSION.tar.gz
# Download signature
wget -c http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-$VERSION/postfixadmin-$VERSION.tar.gz.asc
# Check signature
#gpg --verify postfixadmin-$VERSION.tar.gz.asc postfixadmin-$VERSION.tar.gz || exit 1
# Decompress
(
mkdir tmp
cd tmp
tar xvf ../postfixadmin-$VERSION.tar.gz
mv postfixadmin-$VERSION ../postfixadmin-$VERSION
cd ..
rmdir tmp
)
# Remove package
rm postfixadmin-$VERSION.tar.gz
rm postfixadmin-$VERSION.tar.gz.asc
# Sync configuration
chown -R root. postfixadmin-$VERSION
cp postfixadmin-$VERSION/config.inc.php postfixadmin-$VERSION/config.inc.php.dist
cp -a postfixadmin-$OLD_VERSION/config.inc.php postfixadmin-$VERSION/config.inc.php
# Pivot
rm postfixadmin && ln -s postfixadmin-$VERSION postfixadmin
# Audit
echo "Audit:" && \
du -hs postfixadmin-$OLD_VERSION && \
du -hs postfixadmin-$VERSION
|