39 lines
1.2 KiB
Bash
Executable file
39 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
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
|
|
}
|
|
|
|
prebuild(){
|
|
GIT_VERSION=$1
|
|
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/dist/rootfs
|
|
|
|
find /tmp/grocy -name .gitignore -exec rm {} \;
|
|
cp -fr /tmp/grocy/* ${PATH_DEB}/usr/share/grocy/
|
|
cp ${PATH_DEB}/usr/share/grocy/config-dist.php ${PATH_DEB}/etc/grocy/config.php
|
|
mv ${PATH_DEB}/usr/share/grocy/data ${PATH_DEB}/var/lib/grocy/
|
|
ln -s /var/lib/grocy/data/ ${PATH_DEB}/usr/share/grocy/data
|
|
ln -s /etc/grocy/config.php ${PATH_DEB}/usr/share/grocy/data/config.php
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" /tmp/dist/rootfs/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/
|
|
}
|
|
|