aboutsummaryrefslogtreecommitdiff
path: root/postfixadmin-dl
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-10-29 18:17:28 -0200
committerSilvio Rhatto <rhatto@riseup.net>2014-10-29 18:17:28 -0200
commit0e23c1fd10453c9993d02d693e82ef574c9f24bf (patch)
treebd84692b4d005366905a4b4f95effe1bb625bafa /postfixadmin-dl
parent4903b014901303201b477352d54be36ddbd43376 (diff)
downloaddownloaders-0e23c1fd10453c9993d02d693e82ef574c9f24bf.tar.gz
downloaders-0e23c1fd10453c9993d02d693e82ef574c9f24bf.tar.bz2
Adding postfixadmin-dl
Diffstat (limited to 'postfixadmin-dl')
-rwxr-xr-xpostfixadmin-dl60
1 files changed, 60 insertions, 0 deletions
diff --git a/postfixadmin-dl b/postfixadmin-dl
new file mode 100755
index 0000000..6a36cf9
--- /dev/null
+++ b/postfixadmin-dl
@@ -0,0 +1,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