231 lines
7.2 KiB
Bash
Executable File
231 lines
7.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Builds LDAP Account Manager packages.
|
|
|
|
if [ $# -lt 1 ]
|
|
then
|
|
echo -e "Usage: buildPackage <tag>, buildPackage develop, buildPackage -b branch"
|
|
exit
|
|
fi
|
|
|
|
set -e
|
|
|
|
cd /daten/projekte/lam/pakete
|
|
|
|
if [ "$1" = "develop" ]
|
|
then
|
|
export REPO_BRANCH="develop"
|
|
elif [ "$1" = "-b" ]
|
|
then
|
|
export REPO_BRANCH="$2"
|
|
else
|
|
export REPO_BRANCH="tags/$1"
|
|
fi
|
|
|
|
# minifies the JavaScript files
|
|
function minify {
|
|
local dir="$1"
|
|
echo "Minify JS files in $dir"
|
|
local files=`ls $dir/*.js`
|
|
for file in $files; do
|
|
closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN
|
|
rm $file
|
|
mv ${file}-MIN $file
|
|
# add final new line to supress Debian warnings
|
|
echo "" >> $file
|
|
done
|
|
}
|
|
|
|
# minifies the CSS files
|
|
function minifyCSS {
|
|
local dir="$1"
|
|
echo "Minify CSS files in $dir"
|
|
local files=`ls $dir/*.css`
|
|
for file in $files; do
|
|
cleancss -o ${file}-MIN $file
|
|
rm $file
|
|
mv ${file}-MIN $file
|
|
# add final new line to supress Debian warnings
|
|
echo "" >> $file
|
|
done
|
|
}
|
|
|
|
echo "Getting files..."
|
|
git clone git@github.com:LDAPAccountManager/lam.git github
|
|
cd github
|
|
git checkout $REPO_BRANCH
|
|
mv lam ../
|
|
mv lam-packaging ../
|
|
cd ..
|
|
rm -rf github
|
|
|
|
git clone git@gitlab.com:LDAPAccountManager/lamPro.git lamPro
|
|
cd lamPro
|
|
git checkout $REPO_BRANCH
|
|
rm -rf .git
|
|
cd ..
|
|
|
|
cp lam-packaging/getVersion ./
|
|
export VERSION=`./getVersion`
|
|
|
|
# remove files which are not in the final release
|
|
rm -r lam/po
|
|
rm -r lam/tests
|
|
rm lam/lib/3rdParty/tcpdf/fonts/*.ttf
|
|
find . -name .svnignore -exec rm {} \;
|
|
find . -name .gitignore -exec rm {} \;
|
|
mv lam ldap-account-manager-$VERSION
|
|
|
|
# create LAM manual
|
|
cd ldap-account-manager-$VERSION/docs/manual-sources
|
|
./make.sh
|
|
cd ../../..
|
|
rm -r ldap-account-manager-$VERSION/docs/manual-sources
|
|
|
|
# create LAM Pro build directory
|
|
mkdir LAMPro
|
|
cp -a ldap-account-manager-$VERSION LAMPro/ldap-account-manager-$VERSION
|
|
cp -a lamPro/* LAMPro/ldap-account-manager-$VERSION
|
|
rm -r lamPro
|
|
|
|
# create Debian build dirs
|
|
mkdir Debian
|
|
mkdir LAMPro/Debian
|
|
|
|
rm ldap-account-manager-$VERSION/phpdoc.sh
|
|
rm LAMPro/ldap-account-manager-$VERSION/phpdoc.sh
|
|
|
|
# tar.bz2
|
|
cp lam-packaging/autoconf/configure.ac ldap-account-manager-$VERSION/
|
|
cp lam-packaging/autoconf/Makefile.in ldap-account-manager-$VERSION/
|
|
cd ldap-account-manager-$VERSION
|
|
touch install.sh
|
|
perl -pi -e "s/\\@\\@VERSION\\@\\@/$VERSION/g" configure.ac
|
|
autoconf
|
|
rm -r autom4te.cache
|
|
cd ..
|
|
# Debian gets orig.tar.bz2 with original JS files
|
|
tar cfj ldap-account-manager-$VERSION.tar.bz2 --owner=root --group=root --mtime=now ldap-account-manager-$VERSION
|
|
mv ldap-account-manager-$VERSION.tar.bz2 Debian/ldap-account-manager_$VERSION.orig.tar.bz2
|
|
cp -ar ldap-account-manager-$VERSION Debian/
|
|
# build other packages with minified JS files
|
|
minify ldap-account-manager-$VERSION/templates/lib
|
|
minifyCSS ldap-account-manager-$VERSION/style
|
|
tar cfj ldap-account-manager-$VERSION.tar.bz2 --owner=root --group=root --mtime=now ldap-account-manager-$VERSION
|
|
rm -r ldap-account-manager-$VERSION
|
|
|
|
# tar.bz2 of LAM Pro
|
|
cd LAMPro
|
|
cp ../lam-packaging/autoconf/configure.ac ldap-account-manager-$VERSION/
|
|
cp ../lam-packaging/autoconf/Makefile.in ldap-account-manager-$VERSION/
|
|
cd ldap-account-manager-$VERSION
|
|
touch install.sh
|
|
perl -pi -e "s/\\@\\@VERSION\\@\\@/$VERSION/g" configure.ac
|
|
autoconf
|
|
rm -r autom4te.cache
|
|
cd ..
|
|
# Debian gets orig.tar.bz2 with original JS files
|
|
tar cfj ldap-account-manager-$VERSION.tar.bz2 --owner=root --group=root --mtime=now ldap-account-manager-$VERSION
|
|
mv ldap-account-manager-$VERSION.tar.bz2 Debian/ldap-account-manager_$VERSION.orig.tar.bz2
|
|
cp -ar ldap-account-manager-$VERSION Debian/
|
|
# build other packages with minified JS files
|
|
minify ldap-account-manager-$VERSION/templates/lib
|
|
minifyCSS ldap-account-manager-$VERSION/style
|
|
tar cfj ldap-account-manager-$VERSION.tar.bz2 --owner=root --group=root --mtime=now ldap-account-manager-$VERSION
|
|
rm -r ldap-account-manager-$VERSION
|
|
cd ..
|
|
|
|
# Debian
|
|
cp -r lam-packaging/debian Debian/ldap-account-manager-$VERSION/
|
|
cd Debian/ldap-account-manager-$VERSION
|
|
debuild
|
|
cd ..
|
|
rm -r ldap-account-manager-$VERSION
|
|
cd ..
|
|
|
|
# Debian for LAM Pro
|
|
cd LAMPro
|
|
cp -r ../lam-packaging/debian Debian/ldap-account-manager-$VERSION/
|
|
cd Debian/ldap-account-manager-$VERSION
|
|
debuild
|
|
cd ..
|
|
rm -r ldap-account-manager-$VERSION
|
|
cd ..
|
|
cd ..
|
|
|
|
# RPM
|
|
perl -pi -e "s/\\@\\@VERSION\\@\\@/$VERSION/g" lam-packaging/RPM/ldap-account-manager.spec
|
|
|
|
cp lam-packaging/RPM/ldap-account-manager.spec lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
perl -pi -e "s/\\@\\@DISTRIBUTION\\@\\@/fedora/g" lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
perl -pi -e "s/\\@\\@USER\\@\\@/apache/g" lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
perl -pi -e "s/\\@\\@GROUP\\@\\@/apache/g" lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
perl -pi -e "s/\\@\\@HTTP_CONF_DIR\\@\\@/\\/etc\\/httpd\\/conf.d/g" lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
|
|
cp lam-packaging/RPM/ldap-account-manager.spec lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
perl -pi -e "s/\\@\\@DISTRIBUTION\\@\\@/suse/g" lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
perl -pi -e "s/\\@\\@USER\\@\\@/wwwrun/g" lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
perl -pi -e "s/\\@\\@GROUP\\@\\@/www/g" lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
perl -pi -e "s/\\@\\@HTTP_CONF_DIR\\@\\@/\\/etc\\/apache2\\/conf.d/g" lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
|
|
mkdir RPM
|
|
mkdir LAMPro/RPM
|
|
|
|
|
|
# Fedora RPM
|
|
cp ldap-account-manager-$VERSION.tar.bz2 ~/rpmbuild/SOURCES
|
|
cp lam-packaging/RPM/lam.apache.conf ~/rpmbuild/SOURCES
|
|
cp lam-packaging/RPM/lam.nginx.conf ~/rpmbuild/SOURCES
|
|
rpmbuild --clean --rmsource -bb lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
mv ~/rpmbuild/RPMS/noarch/ldap-account-manager*-$VERSION-*1.noarch.rpm RPM/
|
|
|
|
# Fedora RPM for LAM Pro
|
|
cd LAMPro
|
|
cp ldap-account-manager-$VERSION.tar.bz2 ~/rpmbuild/SOURCES/ldap-account-manager-$VERSION.tar.bz2
|
|
cp ../lam-packaging/RPM/lam.apache.conf ~/rpmbuild/SOURCES
|
|
cp ../lam-packaging/RPM/lam.nginx.conf ~/rpmbuild/SOURCES
|
|
rpmbuild --clean --rmsource -bb ../lam-packaging/RPM/ldap-account-manager-fedora.spec
|
|
mv ~/rpmbuild/RPMS/noarch/ldap-account-manager*-$VERSION-*1.noarch.rpm RPM/
|
|
cd ..
|
|
|
|
# Suse RPM
|
|
cp ldap-account-manager-$VERSION.tar.bz2 ~/rpmbuild/SOURCES
|
|
cp lam-packaging/RPM/lam.apache.conf ~/rpmbuild/SOURCES
|
|
cp lam-packaging/RPM/lam.nginx.conf ~/rpmbuild/SOURCES
|
|
rpmbuild --clean --rmsource -bb lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
mv ~/rpmbuild/RPMS/noarch/ldap-account-manager*-$VERSION-*1.noarch.rpm RPM/
|
|
|
|
# Suse RPM for LAM Pro
|
|
cd LAMPro
|
|
cp ldap-account-manager-$VERSION.tar.bz2 ~/rpmbuild/SOURCES/ldap-account-manager-$VERSION.tar.bz2
|
|
cp ../lam-packaging/RPM/lam.apache.conf ~/rpmbuild/SOURCES
|
|
cp ../lam-packaging/RPM/lam.nginx.conf ~/rpmbuild/SOURCES
|
|
rpmbuild --clean --rmsource -bb ../lam-packaging/RPM/ldap-account-manager-suse.spec
|
|
mv ~/rpmbuild/RPMS/noarch/ldap-account-manager*-$VERSION-*1.noarch.rpm RPM/
|
|
cd ..
|
|
|
|
rpmsign --addsign RPM/*.rpm LAMPro/RPM/*.rpm
|
|
|
|
# generate checksum files
|
|
sha256sum *.tar.bz2 >> checksums.txt
|
|
cd RPM
|
|
sha256sum *.rpm >> ../checksums.txt
|
|
cd ../Debian
|
|
sha256sum *.deb >> ../checksums.txt
|
|
cd ..
|
|
|
|
# generate checksum files for LAM Pro
|
|
cd LAMPro
|
|
sha256sum *.tar.bz2 >> checksums.txt
|
|
cd RPM
|
|
sha256sum *.rpm >> ../checksums.txt
|
|
cd ../Debian
|
|
sha256sum *.deb >> ../checksums.txt
|
|
cd ../..
|
|
|
|
|
|
# clean up
|
|
rm -r lam-packaging
|
|
rm getVersion
|
|
rm -f *.log
|