debmaker/ressources/grocy/debmaker

51 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=grocy
VERSION=3.2.0
GIT_VERSION=v$VERSION
DEB_VERSION=$VERSION-5
DEBIAN_VERSION_CODENAME=sid
IMAGE_SIZE=
STEP="envinit prebuild build makedeb"
envinit() {
apt-get install -y --no-install-recommends wget ca-certificates gnupg2 composer git php-simplexml php-gd fakeroot dpkg unzip
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
apt-get -y dist-upgrade
}
prebuild(){
GIT_VERSION=$1
[ -d /tmp/grocy/ ] && rm -fr /tmp/grocy/
git clone --depth 1 -b ${GIT_VERSION} https://github.com/grocy/grocy.git /tmp/grocy/
}
build() {
set +x
cd /tmp/grocy
composer install -n
yarn install
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
find /tmp/grocy -name .gitignore -exec rm {} \;
mv /tmp/grocy/data ${PATH_DEB}/var/lib/grocy/
cp -fr /tmp/grocy/* ${PATH_DEB}/usr/share/grocy/
cp ${PATH_DEB}/usr/share/grocy/config-dist.php ${PATH_DEB}/etc/grocy/config.php
ln -s /var/lib/grocy/data/ ${PATH_DEB}/usr/share/grocy/data
ln -s /etc/grocy/config.php ${PATH_DEB}/var/lib/grocy/data/config.php
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}