summaryrefslogtreecommitdiff
path: root/bin/buildDebian.sh
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2013-11-24 02:42:50 +0000
committerJohn McLear <john@mclear.co.uk>2013-11-24 02:42:50 +0000
commit61df1facd2a7f25af352f48180be92db8a89fe66 (patch)
tree82fe1b675b157b1329fb73c1d91bbe60525081e7 /bin/buildDebian.sh
parent8b821d42a22646a4727bbd7a003e5eeea5aa369c (diff)
downloadetherpad-lite-61df1facd2a7f25af352f48180be92db8a89fe66.zip
semi-working build script for deb packages
Diffstat (limited to 'bin/buildDebian.sh')
-rwxr-xr-xbin/buildDebian.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/bin/buildDebian.sh b/bin/buildDebian.sh
new file mode 100755
index 00000000..b78cb53d
--- /dev/null
+++ b/bin/buildDebian.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+# IMPORTANT
+# Protect agaisnt mispelling a var and rm -rf /
+set -u
+set -e
+
+SRC=/tmp/etherpad-deb-src
+DIST=/tmp/etherpad-deb-dist
+SYSROOT=${SRC}/sysroot
+DEBIAN=${SRC}/DEBIAN
+
+rm -rf ${DIST}
+mkdir -p ${DIST}/
+
+rm -rf ${SRC}
+rsync -a deb-src/ ${SRC}/
+mkdir -p ${SYSROOT}/opt/
+
+rsync -a ../ ${SYSROOT}/opt/etherpad/ --delete
+
+find ${SRC}/ -type d -exec chmod 0755 {} \;
+find ${SRC}/ -type f -exec chmod go-w {} \;
+chown -R root:root ${SRC}/
+
+let SIZE=`du -s ${SYSROOT} | sed s'/\s\+.*//'`+8
+pushd ${SYSROOT}/
+tar czf ${DIST}/data.tar.gz [a-z]*
+popd
+sed s"/SIZE/${SIZE}/" -i ${DEBIAN}/control
+pushd ${DEBIAN}
+tar czf ${DIST}/control.tar.gz *
+popd
+
+pushd ${DIST}/
+echo 2.0 > ./debian-binary
+
+find ${DIST}/ -type d -exec chmod 0755 {} \;
+find ${DIST}/ -type f -exec chmod go-w {} \;
+chown -R root:root ${DIST}/
+ar r ${DIST}/etherpad-1.deb debian-binary control.tar.gz data.tar.gz
+popd
+rsync -a ${DIST}/etherpad-1.deb ./