forked from github.com_TecharoHQ/anubis
78 lines
1.7 KiB
Bash
Executable File
78 lines
1.7 KiB
Bash
Executable File
#!/bin/bash -e
|
|
set -e
|
|
|
|
good=true
|
|
|
|
require_env() {
|
|
var="$1"
|
|
contents="$2"
|
|
resolved="${!var}"
|
|
if [[ -z "$resolved" ]]; then
|
|
echo You must define "$contents" in the $var environment variable.
|
|
good=false
|
|
fi
|
|
}
|
|
|
|
require_env NAME "your name"
|
|
require_env EMAIL "your email"
|
|
|
|
if ! $good; then
|
|
echo failed. please see above errors.
|
|
exit 1
|
|
fi
|
|
|
|
|
|
|
|
# ensure in repo
|
|
git status > /dev/null
|
|
|
|
echo cleaning old builds
|
|
rm -vrf var/deb
|
|
|
|
mkdir -vp var/deb
|
|
|
|
echo generating control
|
|
mkdir -v var/deb/DEBIAN
|
|
cat << EOF > var/deb/DEBIAN/control
|
|
Package: anubis-dsep
|
|
Version: $(cat VERSION)
|
|
Section:
|
|
Priority: optional
|
|
Architecture: amd64
|
|
License: MIT
|
|
Maintainer: $NAME <$EMAIL>
|
|
Description: Fork of Anubis with dsep branding
|
|
EOF
|
|
|
|
echo mking dirs
|
|
mkdir -vp var/deb/etc/anubis
|
|
mkdir -vp var/deb/usr/bin
|
|
mkdir -vp var/deb/usr/lib/systemd/system
|
|
mkdir -vp var/deb/usr/share/doc/anubis
|
|
mkdir -vp var/deb/usr/share/doc/anubis/data
|
|
|
|
echo copying stuff
|
|
cp -v run/default.env var/deb/etc/anubis
|
|
cp -v var/anubis var/deb/usr/bin
|
|
cp -v var/robots2policy var/deb/usr/bin/anubis-robots2policy
|
|
cp -v 'run/anubis@.service' var/deb/usr/lib/systemd/system
|
|
|
|
cp -v data/botPolicies.yaml var/deb/usr/share/doc/anubis
|
|
cp -v LICENSE var/deb/usr/share/doc/anubis
|
|
cp -v README.md var/deb/usr/share/doc/anubis
|
|
|
|
cp -vr data/apps var/deb/usr/share/doc/anubis/data
|
|
cp -vr data/bots var/deb/usr/share/doc/anubis/data
|
|
cp -vr data/clients var/deb/usr/share/doc/anubis/data
|
|
cp -vr data/common var/deb/usr/share/doc/anubis/data
|
|
cp -vr data/crawlers var/deb/usr/share/doc/anubis/data
|
|
cp -vr data/meta var/deb/usr/share/doc/anubis/data
|
|
|
|
cp -vr docs/docs var/deb/usr/share/doc/anubis/docs
|
|
|
|
|
|
echo packaging
|
|
dpkg-deb --root-owner-group --build var/deb "var/anubis-dsep-v$(cat VERSION).deb"
|
|
|
|
|