From df29eb85cdb67f6e57d35c37881069b529f3da8e Mon Sep 17 00:00:00 2001 From: Techwolf Date: Wed, 4 Jan 2017 17:06:34 -0800 Subject: [PATCH 1/2] Added basic script for creating a Debian-style package. --- makedeb.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 makedeb.sh diff --git a/makedeb.sh b/makedeb.sh new file mode 100755 index 0000000000..367d2c230d --- /dev/null +++ b/makedeb.sh @@ -0,0 +1,70 @@ +#!/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 +sed -i "s/\$sCustomDataPath = \(.*\) : '';/\$sCustomDataPath = \1 : \$sCustomDataPath;/" $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 + 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; From 0dcbac882083af0d0f7f167dce7405f3dbcea3ee Mon Sep 17 00:00:00 2001 From: Techwolf Date: Wed, 4 Jan 2017 19:01:26 -0800 Subject: [PATCH 2/2] Allow a custom data path to be set directly in `include.php`. --- makedeb.sh | 1 - rainloop/v/0.0.0/include.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/makedeb.sh b/makedeb.sh index 367d2c230d..7e576bb52a 100755 --- a/makedeb.sh +++ b/makedeb.sh @@ -33,7 +33,6 @@ 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 -sed -i "s/\$sCustomDataPath = \(.*\) : '';/\$sCustomDataPath = \1 : \$sCustomDataPath;/" $DIR/usr/share/rainloop/rainloop/v/$VERSION/include.php #Set up Debian packaging tools cd $DIR; diff --git a/rainloop/v/0.0.0/include.php b/rainloop/v/0.0.0/include.php index 56e0d2646e..bf53ad0b81 100644 --- a/rainloop/v/0.0.0/include.php +++ b/rainloop/v/0.0.0/include.php @@ -55,7 +55,7 @@ include_once APP_INDEX_ROOT_PATH.'include.php'; } - $sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : ''; + $sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath; define('APP_DATA_FOLDER_PATH', 0 === strlen($sCustomDataPath) ? APP_INDEX_ROOT_PATH.'data/' : $sCustomDataPath.'/'); unset($sCustomDataPath);