debmaker/ressources/bitwarden-desktop/debmaker

49 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
VERSION=2022.10.1
APP=bitwarden-desktop
DEPOT=https://github.com/bitwarden/clients.git
GIT_VERSION=desktop-v${VERSION}
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=8
PACKAGE_DEPENDENCY="pkg-config libsecret-1-dev yarn nodejs build-essential libglib2.0-dev"
STEP="base_package_upgrade configure_depot_yarn configure_depot_nodejs install_package_dependency install_rust get_git_source build makedeb"
build() {
source ~/.cargo/env
export PKG_CONFIG_ALL_STATIC=1
export PKG_CONFIG_ALLOW_CROSS=1
rustup target add x86_64-unknown-linux-musl
cd /tmp/${APP}
npm ci
cd /tmp/${APP}/apps/desktop/desktop_native/
npm run build -- --target x86_64-unknown-linux-musl
cd /tmp/${APP}/apps/desktop
PATH=$PATH:/tmp/${APP}/node_modules/.bin/
npm run clean:dist
npm run build
electron-builder --linux dir --x64 -p never
}
makedeb(){
PATH_DEB=/tmp/src/rootfs
mkdir -p ${PATH_DEB}/usr/lib/
mkdir -p ${PATH_DEB}/usr/bin/
mkdir -p ${PATH_DEB}/usr/share/doc/bitwarden/
cp -fr /tmp/${APP}/apps/desktop/dist/linux-unpacked ${PATH_DEB}/usr/lib/bitwarden-desktop
for tmp in /tmp/${APP}/apps/desktop/resources/icons/*
do
RESOLUTION=$(basename $tmp .png)
mkdir -p ${PATH_DEB}/usr/share/icons/hicolor/${RESOLUTION}/apps/
cp $tmp ${PATH_DEB}/usr/share/icons/hicolor/${RESOLUTION}/apps/bitwarden.png
done
ln -s /usr/lib/bitwarden-desktop/bitwarden ${PATH_DEB}/usr/bin/bitwarden
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}