debmaker/ressources/glpi/debmaker

60 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
VERSION=10.0.1
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=glpi
DEPOT=https://github.com/glpi-project/glpi.git
GIT_VERSION=${VERSION}
DEB_VERSION=10.0.1-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
STEP="envinit prebuild build makedeb"
envinit() {
apt-get update
if [ $(dpkg -l | grep -e 'ii composer ' | wc -l) -eq 1 ];
then
apt-get dist-upgrade -y
else
apt install -y --no-install-recommends git fakeroot dpkg patch composer php-json php-xml php-curl php-gd php-intl php-ldap php-zip php-mysql wget gettext
wget -qO - https://deb.nodesource.com/setup_16.x | bash
apt install nodejs
fi
}
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/${APP} ] || mkdir /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
cp -fr /tmp/git/. /tmp/${APP}
}
build(){
cd /tmp/${APP}
./tools/make_release.sh -y . ${VERSION}
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
tar -zxvf /tmp/${APP}-${VERSION}.tgz -C ${PATH_DEB}/usr/share/
mv ${PATH_DEB}/usr/share/glpi/*.md ${PATH_DEB}/usr/share/doc/glpi/
gzip ${PATH_DEB}/usr/share/doc/glpi/*
mv ${PATH_DEB}/usr/share/glpi/files ${PATH_DEB}/var/lib/glpi/
ln -s /var/lib/glpi/files ${PATH_DEB}/usr/share/glpi/files
mv ${PATH_DEB}/usr/share/glpi/marketplace ${PATH_DEB}/var/lib/glpi/
ln -s /var/lib/glpi/marketplace ${PATH_DEB}/usr/share/glpi/marketplace
cp -r ${PATH_DEB}/usr/share/glpi/config/. ${PATH_DEB}/etc/glpi/
rm -fr ${PATH_DEB}/usr/share/glpi/config/
ln -s /etc/glpi/ ${PATH_DEB}/usr/share/glpi/config
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}