aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--Makefile.in2
-rwxr-xr-xcontrib/fj-mkdeb.py40
-rwxr-xr-xmkdeb.sh.in12
4 files changed, 18 insertions, 38 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4871ef031..af590e2e1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,7 +54,7 @@ build_apparmor:
54 script: 54 script:
55 - apt-get update -qq 55 - apt-get update -qq
56 - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential lintian libapparmor-dev pkg-config gawk 56 - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential lintian libapparmor-dev pkg-config gawk
57 - ./configure --prefix=/usr --enable-apparmor && make deb-apparmor && dpkg -i firejail*.deb 57 - ./configure && make deb-apparmor && dpkg -i firejail*.deb
58 - command -V firejail && firejail --version 58 - command -V firejail && firejail --version
59 - firejail --version | grep -F 'AppArmor support is enabled' 59 - firejail --version | grep -F 'AppArmor support is enabled'
60 60
diff --git a/Makefile.in b/Makefile.in
index 0e80fb43a..7d961213a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -222,7 +222,7 @@ deb: dist
222 ./mkdeb.sh 222 ./mkdeb.sh
223 223
224deb-apparmor: dist 224deb-apparmor: dist
225 ./mkdeb.sh -apparmor 225 ./mkdeb.sh -apparmor --enable-apparmor
226 226
227test-compile: dist 227test-compile: dist
228 cd test/compile; ./compile.sh $(NAME)-$(VERSION) 228 cd test/compile; ./compile.sh $(NAME)-$(VERSION)
diff --git a/contrib/fj-mkdeb.py b/contrib/fj-mkdeb.py
index 75fb6cbc8..f6611bee8 100755
--- a/contrib/fj-mkdeb.py
+++ b/contrib/fj-mkdeb.py
@@ -3,9 +3,10 @@
3# Copyright (C) 2014-2022 Firejail Authors 3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2 4# License GPL v2
5 5
6# This script automates the workaround for https://github.com/netblue30/firejail/issues/772 6# This script automates the creation of a .deb package. It was originally
7# created to work around https://github.com/netblue30/firejail/issues/772
7 8
8import os, shlex, subprocess, sys 9import os, subprocess, sys
9 10
10 11
11def run(srcdir, args): 12def run(srcdir, args):
@@ -15,41 +16,29 @@ def run(srcdir, args):
15 print('Error: Not a firejail source tree? Exiting.') 16 print('Error: Not a firejail source tree? Exiting.')
16 return 1 17 return 1
17 18
18 dry_run = False 19 # Ignore unsupported arguments.
19 escaped_args = []
20 # We need to modify the list as we go. So be sure to copy the list to be iterated!
21 for a in args[:]: 20 for a in args[:]:
22 if a.startswith('--prefix'): 21 if a.startswith('--prefix'):
23 # prefix should ALWAYS be /usr here. Discard user-set values 22 # prefix should ALWAYS be /usr here. Discard user-set values
24 args.remove(a) 23 args.remove(a)
25 elif a == '--only-fix-mkdeb':
26 # for us, not configure
27 dry_run = True
28 args.remove(a)
29 else:
30 escaped_args.append(shlex.quote(a))
31 24
32 # Remove generated files. 25 # Remove generated files.
33 if not dry_run: 26 distclean = subprocess.call(['make', 'distclean'])
34 distclean = subprocess.call(['make', 'distclean']) 27 if distclean != 0:
35 if distclean != 0: 28 return distclean
36 return distclean
37 29
38 # Run configure to generate mkdeb.sh. 30 # Run configure to generate mkdeb.sh.
39 first_config = subprocess.call(['./configure', '--prefix=/usr'] + args) 31 first_config = subprocess.call(['./configure', '--prefix=/usr'] + args)
40 if first_config != 0: 32 if first_config != 0:
41 return first_config 33 return first_config
42 34
43 # Fix up dynamically-generated mkdeb.sh to include custom configure options. 35 # Create the dist file used by mkdeb.sh.
44 with open('mkdeb.sh', 'rb') as f: 36 make_dist = subprocess.call(['make', 'dist'])
45 sh = str(f.read(), 'utf_8') 37 if make_dist != 0:
46 with open('mkdeb.sh', 'wb') as f: 38 return make_dist
47 f.write(bytes(sh.replace('./configure $CONFIG_ARGS',
48 './configure $CONFIG_ARGS ' + (' '.join(escaped_args))), 'utf_8'))
49
50 if dry_run: return 0
51 39
52 return subprocess.call(['make', 'deb']) 40 # Run mkdeb.sh with the custom configure options.
41 return subprocess.call(['./mkdeb.sh'] + args)
53 42
54 43
55if __name__ == '__main__': 44if __name__ == '__main__':
@@ -57,13 +46,12 @@ if __name__ == '__main__':
57 print('''Build a .deb of firejail with custom configure options 46 print('''Build a .deb of firejail with custom configure options
58 47
59usage: 48usage:
60{script} [--fj-src=SRCDIR] [--only-fix-mkdeb] [CONFIGURE_OPTIONS [...]] 49{script} [--fj-src=SRCDIR] [CONFIGURE_OPTIONS [...]]
61 50
62 --fj-src=SRCDIR: manually specify the location of firejail source tree 51 --fj-src=SRCDIR: manually specify the location of firejail source tree
63 as SRCDIR. If not specified, looks in the parent directory 52 as SRCDIR. If not specified, looks in the parent directory
64 of the directory where this script is located, and then the 53 of the directory where this script is located, and then the
65 current working directory, in that order. 54 current working directory, in that order.
66 --only-fix-mkdeb: don't run configure or make after modifying mkdeb.sh
67 CONFIGURE_OPTIONS: arguments for configure 55 CONFIGURE_OPTIONS: arguments for configure
68'''.format(script=sys.argv[0])) 56'''.format(script=sys.argv[0]))
69 sys.exit(0) 57 sys.exit(0)
diff --git a/mkdeb.sh.in b/mkdeb.sh.in
index a18ff8021..79f8d748c 100755
--- a/mkdeb.sh.in
+++ b/mkdeb.sh.in
@@ -9,17 +9,9 @@
9set -e 9set -e
10NAME=@PACKAGE_NAME@ 10NAME=@PACKAGE_NAME@
11VERSION=@PACKAGE_VERSION@ 11VERSION=@PACKAGE_VERSION@
12HAVE_APPARMOR=@HAVE_APPARMOR@
13HAVE_SELINUX=@HAVE_SELINUX@
14EXTRA_VERSION=$1 12EXTRA_VERSION=$1
15 13
16CONFIG_ARGS="--prefix=/usr" 14test "$#" -gt 0 && shift
17if [ -n "$HAVE_APPARMOR" ]; then
18 CONFIG_ARGS="$CONFIG_ARGS --enable-apparmor"
19fi
20if [ -n "$HAVE_SELINUX" ]; then
21 CONFIG_ARGS="$CONFIG_ARGS --enable-selinux"
22fi
23 15
24CODE_ARCHIVE="$NAME-$VERSION.tar.xz" 16CODE_ARCHIVE="$NAME-$VERSION.tar.xz"
25CODE_DIR="$NAME-$VERSION" 17CODE_DIR="$NAME-$VERSION"
@@ -36,7 +28,7 @@ echo "*****************************************"
36tar -xJvf "$CODE_ARCHIVE" 28tar -xJvf "$CODE_ARCHIVE"
37#mkdir -p "$INSTALL_DIR" 29#mkdir -p "$INSTALL_DIR"
38cd "$CODE_DIR" 30cd "$CODE_DIR"
39./configure $CONFIG_ARGS 31./configure --prefix=/usr "$@"
40make -j2 32make -j2
41mkdir debian 33mkdir debian
42DESTDIR=debian make install-strip 34DESTDIR=debian make install-strip