File debian.rules of Package roundcubemail-plugins-kolab
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
override_dh_auto_build:
mkdir -p $(CURDIR)/config/
find plugins -type d -name helpdocs -exec rm -rvf {} \; 2>/dev/null || :
find plugins -type d -name tests -exec rm -rvf {} \; 2>/dev/null || :
ls -l $(CURDIR)
mkdir -p $(CURDIR)/skins
cp -avf /usr/share/roundcubemail/skins/elastic/ $(CURDIR)/skins/.
# Compile the CSS
for file in `find $(CURDIR) -type f -name "styles.less" -o -name "print.less" -o -name "embed.less" -o -name "libkolab.less"`; do \
lessc --relative-urls $${file} > $$(dirname $${file})/$$(basename $${file} .less).css ; \
sed -i \
-e "s|../../../skins/elastic/images/contactpic.png|../../../../skins/elastic/images/contactpic.png|" \
-e "s|../../../skins/elastic/images/watermark.jpg|../../../../skins/elastic/images/watermark.jpg|" \
$$(dirname $${file})/$$(basename $${file} .less).css ; \
done
# Compress the CSS
for file in `find $(CURDIR) -type f -name "*.css"`; do \
asset_loc=$$(dirname $$(echo $${file} | sed \
-e "s|$(CURDIR)/plugins/|$(CURDIR)/public_html/assets/plugins/|g" \
-e "s|$(CURDIR)/plugins/$${plugin}/skins/|$(CURDIR)/public_html/assets/plugins/$${plugin}/skins/|g") ; \
) ; \
echo "$${file} -> $${asset_loc}/$$(basename $${file})" ; \
mkdir -p $${asset_loc} ; \
cat $${file} | cssmin > $${asset_loc}/$$(basename $${file}) ; \
done
# Compress the JS, but not the already minified
for file in `find $(CURDIR) -type f -name "*.js" ! -name "*.min.js"`; do \
asset_loc=$$(dirname $$(echo $${file} | sed \
-e "s|$(CURDIR)/plugins/|$(CURDIR)/public_html/assets/plugins/|g" \
-e "s|$(CURDIR)/plugins/$${plugin}/skins/|$(CURDIR)/public_html/assets/plugins/$${plugin}/skins/|g") ; \
) ; \
echo "$${file} -> $${asset_loc}/$$(basename $${file})" ; \
mkdir -p $${asset_loc} ; \
uglifyjs $${file} > $${asset_loc}/$$(basename $${file}) ; \
done
# The already minied JS can just be copied over to the assets location
for file in `find $(CURDIR) -type f -name "*.min.js"`; do \
asset_loc=$$(dirname $$(echo $${file} | sed \
-e "s|$(CURDIR)/plugins/|$(CURDIR)/public_html/assets/plugins/|g" \
-e "s|$(CURDIR)/plugins/$${plugin}/skins/|$(CURDIR)/public_html/assets/plugins/$${plugin}/skins/|g") ; \
) ; \
mkdir -p $${asset_loc} ; \
cp -avf $${file} $${asset_loc}/$$(basename $${file}) ; \
done
# Other assets
for file in $$(find $(CURDIR) -type f \
-name "*.eot" -o \
-name "*.gif" -o \
-name "*.ico" -o \
-name "*.jpg" -o \
-name "*.mp3" -o \
-name "dummy.pdf" -o \
-name "*.png" -o \
-name "*.svg" -o \
-name "*.swf" -o \
-name "*.tif" -o \
-name "*.tiff" -o \
-name "*.ttf" -o \
-name "*.wav" -o \
-name "*.woff" \
); do \
asset_loc=$$(dirname $$(echo $${file} | sed \
-e "s|$(CURDIR)/plugins/|$(CURDIR)/public_html/assets/plugins/|g" \
-e "s|$(CURDIR)/plugins/$${plugin}/skins/|$(CURDIR)/public_html/assets/plugins/$${plugin}/skins/|g") ; \
) ; \
mkdir -p $${asset_loc} ; \
mv -vf $${file} $${asset_loc}/$$(basename $${file}); \
done
for plugin in `find $(CURDIR)/plugins/ -type d -mindepth 1 -maxdepth 1 -exec basename {} \;)`; do \
pkgname=$$(echo $${plugin} | sed -e 's/_/-/g') ; \
if [ -f "$(CURDIR)/plugins/$${plugin}/config.inc.php.dist" ]; then \
mv $(CURDIR)/plugins/$${plugin}/config.inc.php.dist $(CURDIR)/config/$${plugin}.inc.php ; \
echo "etc/roundcubemail/$${plugin}.inc.php usr/share/roundcubemail/plugins/$${plugin}/config.inc.php" >> debian/roundcubemail-plugin-$${pkgname}.links ; \
echo "config/$${plugin}.inc.php etc/roundcubemail/" >> debian/roundcubemail-plugin-$${pkgname}.install ; \
fi ; \
if [ -d "public_html/assets/plugins/$${plugin}" ]; then \
echo "public_html/assets/plugins/$${plugin} usr/share/roundcubemail/public_html/assets/plugins" >> debian/roundcubemail-plugin-$${pkgname}.install ; \
fi ; \
echo "usr/share/roundcubemail/plugins/$${plugin}" >> debian/roundcubemail-plugin-$${pkgname}.dirs ; \
echo "plugins/$${plugin} usr/share/roundcubemail/plugins/" >> debian/roundcubemail-plugin-$${pkgname}.install ; \
done
if [ -f "/etc/plesk-release" ]; then \
cp -v ../SOURCES/plesk.calendar.inc.php config/calendar.inc.php ; \
cp -v ../SOURCES/plesk.kolab_addressbook.inc.php config/kolab_addressbook.inc.php ; \
cp -v ../SOURCES/plesk.kolab_chat.inc.php config/kolab_chat.inc.php ; \
cp -v ../SOURCES/plesk.kolab_folders.inc.php config/kolab_folders.inc.php ; \
cp -v ../SOURCES/plesk.libkolab.inc.php config/libkolab.inc.php ; \
fi
dh_auto_build
override_dh_compress:
dh_compress -Xsql
override_dh_auto_install:
for plugin in `find $(CURDIR)/plugins/ -type d -mindepth 1 -maxdepth 1 -exec basename {} \;)`; do \
pkgname=$$(echo $${plugin} | sed -e 's/_/-/g') ; \
if [ -z "$$(find $(CURDIR)/plugins/$${plugin} -type d -name SQL)" ]; then \
continue ; \
fi ; \
( \
echo "#!/bin/sh" ; \
echo "" ; \
echo "for dir in \$$(find /usr/share/roundcubemail/plugins/$${plugin}/ -type d -name SQL); do" ; \
echo " # Skip plugins with multiple drivers and no kolab driver" ; \
echo " if [ ! -z \"\$$(echo \$${dir} | grep driver)\" ]; then" ; \
echo " if [ -z \"\$$(echo \$${dir} | grep kolab)\" ]; then" ; \
echo " continue" ; \
echo " fi" ; \
echo " fi" ; \
echo "" ; \
echo " /usr/share/roundcubemail/bin/updatedb.sh \\" ; \
echo " --dir \$${dir} \\" ; \
echo " --package $${plugin} \\" ; \
echo " >/dev/null 2>&1 || :" ; \
echo "" ; \
echo "done" ; \
) > $(CURDIR)/debian/roundcubemail-plugin-$${pkgname}.postinst ; \
done
dh_auto_install