debmaker/ressources/wallabag/debmaker

59 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=wallabag
VERSION=2.5.1
GIT_VERSION=$VERSION
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
DEPOT=https://github.com/wallabag/wallabag.git
STEP="envinit prebuild build makedeb"
envinit() {
apt-get update
apt-get dist-upgrade -y
apt-get install -y --no-install-recommends wget ca-certificates git php-common php-xml php-json php-gd php-mbstring php-xml php-tidy php-curl php-tokenizer php-bcmath php-intl php-fpm unzip fakeroot dpkg gpg make
wget -qO - https://deb.nodesource.com/setup_16.x | bash
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list
apt-get update
apt-get install -y yarn nodejs
}
prebuild(){
[ -e /tmp/${APP} ] && rm -fr /tmp/${APP}
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP}
cd /tmp/${APP}
wget https://getcomposer.org/download/2.2.13/composer.phar
}
build() {
cd /tmp/${APP}
SYMFONY_ENV=prod php composer.phar install --no-dev -o --prefer-dist -n --no-scripts
ENV=PROD make build
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp -fr /tmp/${APP}/app ${PATH_DEB}/usr/share/wallabag/app
cp -fr /tmp/${APP}/src ${PATH_DEB}/usr/share/wallabag/src
cp -fr /tmp/${APP}/vendor ${PATH_DEB}/usr/share/wallabag/vendor
cp -fr /tmp/${APP}/web ${PATH_DEB}/usr/share/wallabag/web
cp -fr /tmp/${APP}/bin ${PATH_DEB}/usr/share/wallabag/bin
echo need by synfony to find project directory > ${PATH_DEB}/usr/share/wallabag/composer.json
cp -fr /tmp/${APP}/data ${PATH_DEB}/var/lib/wallabag/data
cp -fr /tmp/${APP}/var ${PATH_DEB}/var/lib/wallabag/var
cp /tmp/wallabag/app/config/parameters.yml.dist ${PATH_DEB}/etc/wallabag/parameters.yml
ln -s /var/lib/${APP}/data ${PATH_DEB}/usr/share/wallabag/data
ln -s /var/lib/${APP}/var ${PATH_DEB}/usr/share/wallabag/var
ln -s /etc/${APP}/parameters.yml ${PATH_DEB}/usr/share/wallabag/app/config/parameters.yml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}