2022-02-12 18:30:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-02-28 23:26:47 +01:00
|
|
|
[ -e ./lib/function.sh ] && source ./lib/function.sh
|
|
|
|
|
|
|
|
APP=vaultwarden-web
|
2022-05-26 16:27:16 +02:00
|
|
|
VERSION=2.28.1
|
2022-02-28 23:26:47 +01:00
|
|
|
GIT_VERSION=v$VERSION
|
2022-05-26 16:27:16 +02:00
|
|
|
DEB_VERSION=$VERSION-$(date +%Y%m%d%H%M)
|
2022-02-28 23:26:47 +01:00
|
|
|
DEBIAN_VERSION_CODENAME=bullseye
|
|
|
|
IMAGE_SIZE=
|
2022-05-26 16:27:16 +02:00
|
|
|
DEPOT=https://github.com/bitwarden/web.git
|
2022-02-28 23:26:47 +01:00
|
|
|
|
2022-02-20 15:02:18 +01:00
|
|
|
STEP="envinit prebuild build makedeb"
|
|
|
|
|
2022-02-12 18:30:28 +01:00
|
|
|
envinit() {
|
2022-05-26 16:27:16 +02:00
|
|
|
apt-get update
|
|
|
|
apt-get dist-upgrade -y
|
2022-02-21 22:18:59 +01:00
|
|
|
apt install -y --no-install-recommends wget fakeroot dpkg ca-certificates build-essential git python
|
2022-02-12 18:30:28 +01:00
|
|
|
wget -qO - https://deb.nodesource.com/setup_16.x | bash
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y nodejs
|
2022-05-26 16:27:16 +02:00
|
|
|
apt clean
|
2022-02-12 18:30:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
prebuild(){
|
2022-05-26 16:27:16 +02:00
|
|
|
[ -e /tmp/${APP} ] && rm -fr /tmp/${APP}
|
|
|
|
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP}
|
2022-02-12 18:30:28 +01:00
|
|
|
|
2022-05-26 16:27:16 +02:00
|
|
|
cd /tmp/${APP}
|
2022-02-12 18:30:28 +01:00
|
|
|
git submodule update --init --recursive
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
git clone https://github.com/dani-garcia/bw_web_builds.git
|
|
|
|
cd bw_web_builds
|
|
|
|
PATCH=$(git tag --sort=v:refname | tail -n1)
|
|
|
|
git checkout ${PATCH}
|
2022-02-21 22:18:59 +01:00
|
|
|
PATCH_FILE=$(ls patches/ | sort -V | tail -n 1)
|
|
|
|
cp patches/${PATCH_FILE} ../web-vault/
|
2022-02-12 18:30:28 +01:00
|
|
|
|
2022-05-26 16:27:16 +02:00
|
|
|
/tmp/${APP}
|
2022-02-21 22:18:59 +01:00
|
|
|
git apply ${PATCH_FILE}
|
2022-02-12 18:30:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2022-05-26 16:27:16 +02:00
|
|
|
cd /tmp/${APP}
|
2022-02-12 18:30:28 +01:00
|
|
|
npm install
|
|
|
|
npm run dist:oss:selfhost
|
|
|
|
}
|
|
|
|
|
|
|
|
makedeb(){
|
2022-02-24 00:02:53 +01:00
|
|
|
PATH_DEB=/tmp/src/rootfs
|
2022-02-12 18:30:28 +01:00
|
|
|
|
2022-05-26 16:27:16 +02:00
|
|
|
cp -fr /tmp/${APP}/build/* ${PATH_DEB}/usr/share/vaultwarden-web
|
2022-02-24 00:02:53 +01:00
|
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
|
|
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
2022-02-12 18:30:28 +01:00
|
|
|
}
|