2022-02-12 18:30:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-03-04 20:50:46 +01:00
|
|
|
VERSION=1.10.6
|
|
|
|
RELEASE=3
|
|
|
|
|
2022-02-28 23:26:47 +01:00
|
|
|
[ -e ./lib/function.sh ] && source ./lib/function.sh
|
|
|
|
|
|
|
|
APP=element-web
|
2022-03-04 21:47:14 +01:00
|
|
|
DEPOT=https://github.com/vector-im/element-web.git /tmp/git
|
2022-03-04 20:50:46 +01:00
|
|
|
GIT_VERSION=v${VERSION}
|
|
|
|
DEB_VERSION=${VERSION}-${RELEASE}
|
2022-02-28 23:26:47 +01:00
|
|
|
DEBIAN_VERSION_CODENAME=bullseye
|
2022-03-02 22:15:23 +01:00
|
|
|
IMAGE_SIZE=4
|
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-03-04 20:50:46 +01:00
|
|
|
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
|
|
|
|
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
|
|
|
|
fi
|
2022-02-12 18:30:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
prebuild(){
|
2022-03-04 20:50:46 +01:00
|
|
|
[ -e /tmp/git ] && rm -fr /tmp/git
|
2022-03-04 23:16:27 +01:00
|
|
|
[ -e /tmp/${APP} ] || mkdir /tmp/${APP}
|
2022-03-04 21:47:14 +01:00
|
|
|
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git
|
|
|
|
cp -r /tmp/git/. /tmp/${APP}
|
2022-02-12 18:30:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2022-03-04 21:47:14 +01:00
|
|
|
cd /tmp/${APP}
|
2022-02-12 18:30:28 +01:00
|
|
|
yarn install
|
|
|
|
yarn dist
|
|
|
|
}
|
|
|
|
|
|
|
|
makedeb(){
|
2022-02-24 00:02:53 +01:00
|
|
|
PATH_DEB=/tmp/src/rootfs
|
2022-02-20 15:02:18 +01:00
|
|
|
|
2022-03-04 21:47:14 +01:00
|
|
|
tar -zxf /tmp/${APP}/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/share/element-web/
|
|
|
|
cp /tmp/${APP}/config.sample.json ${PATH_DEB}/etc/element-web/config.json
|
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
|
|
|
}
|