forked from RainLoop/rainloop-webmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedeb.sh
executable file
·69 lines (58 loc) · 1.63 KB
/
makedeb.sh
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
69
#!/bin/bash
#Build RainLoop Webmail Debian Package
PACKAGEVERSION="0";
#Build rainloop
gulp build;
cd build/dist/releases/webmail;
cd $(ls -t); #Most recent build folder
#Working directory
mkdir rainloop-deb-build;
cd rainloop-deb-build;
#Prepare zip file
unzip ../rainloop-community-latest.zip;
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
#Set up package directory
VERSION=$(cat data/VERSION);
DIR="rainloop_$VERSION-$PACKAGEVERSION";
mkdir -m 0755 -p $DIR;
mkdir -m 0755 -p $DIR/usr;
mkdir -m 0755 -p $DIR/usr/share;
mkdir -m 0755 -p $DIR/usr/share/rainloop;
mkdir -m 0755 -p $DIR/var;
mkdir -m 0755 -p $DIR/var/lib;
#Move files into package directory
mv rainloop $DIR/usr/share/rainloop/rainloop;
mv index.php $DIR/usr/share/rainloop/index.php;
mv data $DIR/var/lib/rainloop;
#Update settings for Debian package
sed -i "s/\$sCustomDataPath = '';/\$sCustomDataPath = '\/var\/lib\/rainloop';/" $DIR/usr/share/rainloop/rainloop/v/$VERSION/include.php
#Set up Debian packaging tools
cd $DIR;
mkdir -m 0755 DEBIAN;
#Create Debian packging control file
cat >> DEBIAN/control <<-EOF
Package: rainloop
Version: $VERSION
Section: web
Priority: optional
Architecture: all
Depends: php5-fpm (>= 5.4), php5-curl, php5-json
Maintainer: Rainloop <[email protected]>
Installed-Size: 20330
Description: Rainloop Webmail
A modern PHP webmail client.
EOF
#Create Debian packaging post-install script
cat >> DEBIAN/postinst <<-EOF
#!/bin/sh
chown -R www-data:www-data /var/lib/rainloop
EOF
chmod +x DEBIAN/postinst;
#Build Debian package
cd ..;
fakeroot dpkg-deb -b $DIR;
#Clean up
mv $DIR.deb ..;
cd ..;
rm -rf rainloop-deb-build;