-
Notifications
You must be signed in to change notification settings - Fork 566
/
mkdeb.sh.in
executable file
·70 lines (60 loc) · 2.35 KB
/
mkdeb.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# This file is part of Firejail project
# Copyright (C) 2014-2021 Firejail Authors
# License GPL v2
# based on https://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/
# a code archive should already be available
set -e
NAME=@PACKAGE_NAME@
VERSION=@PACKAGE_VERSION@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
HAVE_APPARMOR=@HAVE_APPARMOR@
HAVE_SELINUX=@HAVE_SELINUX@
EXTRA_VERSION=$1
CONFIG_ARGS="--prefix=/usr"
if [ -n "$HAVE_APPARMOR" ]; then
CONFIG_ARGS="$CONFIG_ARGS --enable-apparmor"
fi
if [ -n "$HAVE_SELINUX" ]; then
CONFIG_ARGS="$CONFIG_ARGS --enable-selinux"
fi
TOP="$PWD"
CODE_ARCHIVE="$NAME-$VERSION.tar.xz"
CODE_DIR="$NAME-$VERSION"
INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian"
DEBIAN_CTRL_DIR="${DEBIAN_CTRL_DIR}${CODE_DIR}/debian/DEBIAN"
echo "*****************************************"
echo "code archive: $CODE_ARCHIVE"
echo "code directory: $CODE_DIR"
echo "install directory: $INSTALL_DIR"
echo "debian control directory: $DEBIAN_CTRL_DIR"
echo "*****************************************"
tar -xJvf "$CODE_ARCHIVE"
#mkdir -p "$INSTALL_DIR"
cd "$CODE_DIR"
./configure $CONFIG_ARGS
make -j2
mkdir debian
DESTDIR=debian make install-strip
cd ..
echo "*****************************************"
SIZE="$(du -s "$INSTALL_DIR")"
echo "install size $SIZE"
echo "*****************************************"
mv "$INSTALL_DIR/usr/share/doc/firejail/RELNOTES" "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian"
gzip -9 -n "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian"
rm "$INSTALL_DIR/usr/share/doc/firejail/COPYING"
install -m644 "$CODE_DIR/platform/debian/copyright" "$INSTALL_DIR/usr/share/doc/firejail/."
mkdir -p "$DEBIAN_CTRL_DIR"
sed "s/FIREJAILVER/$VERSION/g" "$CODE_DIR/platform/debian/control.$(dpkg-architecture -qDEB_HOST_ARCH)" > "$DEBIAN_CTRL_DIR/control"
mkdir -p "$INSTALL_DIR/usr/share/lintian/overrides/"
install -m644 "$CODE_DIR/platform/debian/firejail.lintian-overrides" "$INSTALL_DIR/usr/share/lintian/overrides/firejail"
find "$INSTALL_DIR/etc" -type f | sed "s,^$INSTALL_DIR,," | LC_ALL=C sort > "$DEBIAN_CTRL_DIR/conffiles"
chmod 644 "$DEBIAN_CTRL_DIR/conffiles"
find "$INSTALL_DIR" -type d -exec chmod 755 '{}' +
cd "$CODE_DIR"
fakeroot dpkg-deb --build debian
lintian --no-tag-display-limit debian.deb
mv debian.deb "../firejail_${VERSION}${EXTRA_VERSION}_1_$(dpkg-architecture -qDEB_HOST_ARCH).deb"
cd ..
rm -fr "$CODE_DIR"