debmaker/ressources/element-web/element-web

35 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/dist/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/" /tmp/dist/rootfs/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build /tmp/dist/rootfs/ /tmp/dist/
}