debmaker/ressources/authelia/authelia

52 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
VERSION=4.34.2
RELEASE=1
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=authelia
GIT_VERSION=v${VERSION}
DEB_VERSION=${VERSION}-${RELEASE}
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=4
STEP="envinit prebuild build makedeb"
envinit() {
if [ $(dpkg -l | grep -e 'ii nodejs ' | wc -l) -eq 1 ];
then
apt-get update
apt-get dist-upgrade -y
else
apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot
wget -qO - https://deb.nodesource.com/setup_16.x | bash
apt-get update
apt-get install -y nodejs
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
wget -qO - https://get.pnpm.io/install.sh | sh -
fi
}
prebuild(){
[ -e /tmp/git ] && rm -fr /tmp/git
[ -e /tmp/element-web ] || mkdir /tmp/element-web
git clone --depth 1 -b ${GIT_VERSION} https://github.com/authelia/authelia.git /tmp/git
cp -r /tmp/git/. /tmp/authelia
}
build() {
cd /tmp/authelia/
PATH=$PATH:/usr/local/go/bin:/root/.local/share/pnpm
./cmd/authelia-scripts/authelia-scripts build
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
cp /tmp/authelia/dist/authelia ${PATH_DEB}/usr/bin/authelia
cp /tmp/authelia/config.template.yml ${PATH_DEB}/etc/authelia/configuration.yml
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}