debmaker/ressources/element-web/element-web
2022-02-24 00:02:53 +01:00

34 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
STEP="envinit prebuild build makedeb"
envinit() {
apt install -y --no-install-recommends build-essential git python wget ca-certificates
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
}
prebuild(){
GIT_VERSION=$1
git clone --depth 1 -b ${GIT_VERSION} https://github.com/vector-im/element-web.git /tmp/element-web
}
build() {
cd /tmp/element-web
yarn install
yarn dist
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
tar -zxf /tmp/element-web/dist/element-${GIT_VERSION}-dirty.tar.gz --strip-components=1 -C ${PATH_DEB}/usr/lib/element-web/
cp /tmp/element-web/config.sample.json ${PATH_DEB}/etc/element-web/config.json
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}