File buildroundcubemailtarball.sh of Package roundcubemail-selfcontained
#!/bin/bash
set -e
VERSION=1.5.3
GIT_REF=1.5.3
NAME=roundcubemail-$VERSION
source buildroundcubemailtarball.config
if [ -x "/usr/local/bin/lessc" ]; then
LESSC=/usr/local/bin/lessc
else
LESSC=~/node_modules/less/bin/lessc
fi
ROOT_DIR=$(pwd)
rm -Rf /tmp/$NAME
mkdir /tmp/$NAME
cd /tmp/$NAME
cat << EOF > ./composer.json
{
"name": "roundcube/roundcubemail",
"description": "The Roundcube Webmail suite",
"license": "GPL-3.0+",
"config": {
"platform": {
"php": "7.2.24"
}
},
"repositories": [
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_activesync",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_addressbook",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_auth",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_config",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_delegation",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_files",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_folders",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_notes",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_tags",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_chat",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/odfviewer",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/pdfviewer",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/tasklist",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/calendar",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libcalendaring",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libkolab",
"options": {
"symlink": false
}
},
{
"type": "composer",
"url": "https://plugins.roundcube.net"
}
],
"require": {
"php": ">=5.4.0 <8",
"pear/pear-core-minimal": "~1.10.1",
"pear/auth_sasl": "~1.1.0",
"pear/net_idna2": "~0.2.0",
"pear/mail_mime": "~1.10.0",
"pear/http_request2": "~2.3.0",
"pear/net_smtp": "~1.8.1",
"pear/crypt_gpg": "~1.6.3",
"pear/net_sieve": "~1.4.3",
"roundcube/plugin-installer": "~0.2.0",
"masterminds/html5": "~2.5.0",
"endroid/qr-code": "~1.6.5",
"kolab/calendar": "~3.5.9",
"kolab/kolab_activesync": "~3.5.6",
"kolab/kolab_addressbook": "~3.5.6",
"kolab/kolab_auth": "~3.5.6",
"kolab/kolab_chat": "~3.5.2",
"kolab/kolab_config": "~3.4.0",
"kolab/kolab_delegation": "~3.5.11",
"kolab/kolab_files": "~3.5.2",
"kolab/kolab_folders": "~3.5.2",
"kolab/kolab_notes": "~3.5.5",
"kolab/kolab_tags": "~3.5.2",
"kolab/net_ldap3": "~1.1.1",
"kolab/odfviewer": "~3.4.0",
"kolab/pdfviewer": "~3.4.0",
"kolab/tasklist": "~3.5.9",
"johndoh/contextmenu": "~3.2.1",
"zf1/zend-json": "~1.12.11",
"zf1/zend-log": "~1.12.11",
"zf1/zend-controller": "~1.12.11",
"sabre/dav" : "~2.1.6",
"smarty/smarty" : "~3.1.7"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^5.7.21"
},
"suggest": {
"mkopinsky/zxcvbn-php": "^4.4.2 required for Zxcvbn password strength driver"
}
}
EOF
rm -f $NAME.tar.gz
[ -d "$NAME" ] && rm -rf "$NAME"
git clone --branch release-1.4 https://github.com/roundcube/roundcubemail.git $NAME
pushd $NAME
git reset --hard $GIT_REF
popd
[ -d roundcubemail-skin-elastic ] && rm -rf roundcubemail-skin-elastic
git clone --branch master ssh://git@git.kolab.org/source/roundcubemail-skin-elastic.git roundcubemail-skin-elastic
[ -d roundcubemail-plugins-kolab-latest ] && rm -rf roundcubemail-plugins-kolab-latest
git clone --branch master ssh://git@git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git roundcubemail-plugins-kolab-latest
# Run composer and other install processes
mv composer.json $NAME/composer.json
pushd $NAME
composer install
# composer dump autoload?
bin/install-jsdeps.sh
# May require an "npm install less" and "npm install less-plugin-clean-css"
pushd skins/elastic
$LESSC -x styles/styles.less > styles/styles.css
$LESSC -x styles/print.less > styles/print.css
$LESSC -x styles/embed.less > styles/embed.css
popd
$LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/elastic/libkolab.less > plugins/libkolab/skins/elastic/libkolab.min.css
bin/updatecss.sh --dir skins/elastic
popd
# Install skins
for skin in "${SKINS[@]}"; do
cp -r "roundcubemail-skin-elastic/$skin" $NAME/skins/
done
pushd $NAME
for skin in $(ls -1d skins/* | grep -vE '(classic|elastic|larry)'); do
skin=$(basename $skin)
# Copy elastic skin over $skin (but don't overwrite what already existis)
find \
./skins/elastic/ \
./plugins/libkolab/skins/elastic/ \
-type f | sort | while read file; do
target_dir=$(dirname ${file} | sed -e 's|%{datadir}|.|g' -e 's|./public_html/assets/|./|g' -e 's|./public_html/assets/plugins/libkolab/|./|g' -e "s/elastic/$skin/g")
file_name=$(basename ${file})
echo "Target: $target_dir, file $file_name"
if [ ! -d ${target_dir} ]; then
mkdir -p ${target_dir}
fi
if [ ! -f "${target_dir}/${file_name}" ]; then
cp -av "${file}" "${target_dir}"
fi
done
# Replace elastic references, but don't change the depends value in meta.json
sed -i -e "s/\"elastic\"/\"$skin\"/g" \
$(find skins/$skin/ plugins/libkolab/skins/$skin/ -type f -not -name "meta.json")
pushd skins/$skin
$LESSC -x styles/styles.less > styles/styles.css
$LESSC -x styles/print.less > styles/print.css
$LESSC -x styles/embed.less > styles/embed.css
popd
$LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/$skin/libkolab.less > plugins/libkolab/skins/$skin/libkolab.min.css
#find . | sort
# Compile and compress the CSS
#for file in `find . -type f -name "styles.less" -o -name "print.less" -o -name "embed.less" -o -name "libkolab.less"`; do
# %{_bindir}/lessc --relative-urls ${file} > $(dirname ${file})/$(basename ${file} .less).css
#
# sed -i \
# -e "s|../../../skins/plesk/images/contactpic.png|../../../../skins/plesk/images/contactpic.png|" \
# -e "s|../../../skins/plesk/images/watermark.jpg|../../../../skins/plesk/images/watermark.jpg|" \
# $(dirname ${file})/$(basename ${file} .less).css
#
# cat $(dirname ${file})/$(basename ${file} .less).css
#done
bin/updatecss.sh --dir skins/$skin
done
popd
tar --exclude="$NAME/.git" -czf "$ROOT_DIR/$NAME.tar.gz" $NAME
cd "$PWD"