fedimovies/scripts/build_deb.sh

47 lines
1.2 KiB
Bash
Raw Normal View History

2022-04-29 20:10:53 +00:00
#!/bin/sh
set -e
set -x
VERSION=$(cargo metadata --quiet --no-deps --offline | jq -r ".packages[0].version")
ARCH=$(dpkg --print-architecture)
PACKAGE_DIR="target/debian/tmp"
WEB_DIR="$1"
2022-04-30 23:12:45 +00:00
# Package info
2022-04-29 20:10:53 +00:00
rm -rf $PACKAGE_DIR
mkdir -p $PACKAGE_DIR/debian
cp contrib/debian/* $PACKAGE_DIR/debian/
sed -i "s/0.0.0/${VERSION}/" $PACKAGE_DIR/debian/changelog
echo "Architecture: $ARCH" >> $PACKAGE_DIR/debian/control
2022-04-29 20:10:53 +00:00
# Service
cp contrib/mitra.service $PACKAGE_DIR/debian/mitra.service
2022-04-29 20:10:53 +00:00
# Config file
2022-04-30 23:12:45 +00:00
mkdir -p $PACKAGE_DIR/etc/mitra
cp contrib/mitra_config.yaml $PACKAGE_DIR/etc/mitra/config.yaml
2022-04-30 23:12:45 +00:00
# Config example
mkdir -p $PACKAGE_DIR/usr/share/mitra/examples
cp contrib/mitra_config.yaml $PACKAGE_DIR/usr/share/mitra/examples/config.yaml
2022-04-30 23:12:45 +00:00
# Binaries
mkdir -p $PACKAGE_DIR/usr/bin
cp target/release/mitra $PACKAGE_DIR/usr/bin/mitra
cp target/release/mitractl $PACKAGE_DIR/usr/bin/mitractl
2022-04-30 23:12:45 +00:00
2022-06-03 20:25:21 +00:00
# Contracts
mkdir -p $PACKAGE_DIR/usr/share/mitra
cp -r contracts $PACKAGE_DIR/usr/share/mitra/contracts
2022-04-30 23:12:45 +00:00
# Webapp
2022-04-29 20:10:53 +00:00
mkdir -p $PACKAGE_DIR/usr/share/mitra
# https://people.debian.org/~neilm/webapps-policy/ch-issues.html#s-issues-fhs
cp -r $WEB_DIR $PACKAGE_DIR/usr/share/mitra/www
# Build
cd $PACKAGE_DIR
dpkg-buildpackage --build=binary --unsigned-changes