blob: 2c02ba7619070ca7f00e46bed30704ee0e4e66b7 (
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
61
62
63
64
65
66
67
68
|
#!/bin/bash
#
# Roundcube software upgrader.
#
# Config parameters
BASENAME="`basename $0`"
OLD_VERSION="$1"
VERSION="$2"
SHA256="$3"
# Syntax check
if [ -z "$3" ]; then
echo "usage: $BASENAME <old-version> <new-version> <sha256>"
exit 1
fi
# Check installed versions
if [ ! -d "roundcubemail-$OLD_VERSION" ]; then
echo "error: roundcubemail-$OLD_VERSION is not installed, aborting."
exit 1
elif [ -d "roundcubemail-$VERSION" ]; then
echo "error: roundcubemail-$VERSION already installed, aborting."
exit 1
fi
# Download package
wget -c http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/$VERSION/roundcubemail-$VERSION.tar.gz
# Check integrity
echo "$SHA256 roundcubemail-$VERSION.tar.gz" | sha256sum -c
if [ "$?" != "0" ]; then
echo "error: roundcubemail-$VERSION.tar.gz doesn't match SHA256 $SHA256, aborting"
exit
fi
# Decompress
tar xvf roundcubemail-$VERSION.tar.gz
# Remove package
rm roundcubemail-$VERSION.tar.gz
# Fix permissions
chown -R root. roundcubemail-$VERSION
# Sync configuration
for section in db config custom logs temp; do
rsync -av roundcubemail-$OLD_VERSION/$section/ roundcubemail-$VERSION/$section/
done
# Symlink skins
(
cd roundcubemail-$VERSION/skins
for skin in `ls ../custom/skins`; do
ln -s ../custom/skins/$skin
done
)
# Pivot
rm roundcube && ln -s roundcubemail-$VERSION roundcube
# Audit
echo "Audit:" && \
du -hs roundcubemail-$OLD_VERSION && \
du -hs roundcubemail-$VERSION
# Manual steps
echo "Please update plugin symlinks manually."
|