aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Fred Barclay <Fred-Barclay@users.noreply.github.com>2017-04-11 18:46:23 +0000
committerLibravatar GitHub <noreply@github.com>2017-04-11 18:46:23 +0000
commit849e757fed4b718ac2ff3f84f74db359e09b449d (patch)
tree644801a867cacf8cb986c1957aae4b286bee9a59
parentMerge pull request #1208 from SYN-cook/patch-1 (diff)
parentbetter wording of help message (diff)
downloadfirejail-849e757fed4b718ac2ff3f84f74db359e09b449d.tar.gz
firejail-849e757fed4b718ac2ff3f84f74db359e09b449d.tar.zst
firejail-849e757fed4b718ac2ff3f84f74db359e09b449d.zip
Merge pull request #1207 from laniakea64/master
Fix fj-mkdeb.py not functional when installed
-rwxr-xr-xcontrib/fj-mkdeb.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/contrib/fj-mkdeb.py b/contrib/fj-mkdeb.py
index 8027daa5b..3cc13b758 100755
--- a/contrib/fj-mkdeb.py
+++ b/contrib/fj-mkdeb.py
@@ -5,7 +5,7 @@
5import os, re, shlex, subprocess, sys 5import os, re, shlex, subprocess, sys
6 6
7def run(srcdir, args): 7def run(srcdir, args):
8 os.chdir(srcdir) 8 if srcdir: os.chdir(srcdir)
9 9
10 dry_run=False 10 dry_run=False
11 escaped_args=[] 11 escaped_args=[]
@@ -41,11 +41,34 @@ if __name__ == '__main__':
41 if len(sys.argv) == 2 and sys.argv[1] == '--help': 41 if len(sys.argv) == 2 and sys.argv[1] == '--help':
42 print('''Build a .deb of firejail with custom configure options 42 print('''Build a .deb of firejail with custom configure options
43 43
44usage: {script} [--only-fix-mkdeb] [CONFIGURE_OPTIONS [...]] 44usage:
45{script} [--fj-src=SRCDIR] [--only-fix-mkdeb] [CONFIGURE_OPTIONS [...]]
45 46
47 --fj-src=SRCDIR: manually specify the location of firejail source tree
48 as SRCDIR. If not specified, looks in the parent directory
49 of the directory where this script is located, and then the
50 current working directory, in that order.
46 --only-fix-mkdeb: don't run configure or make after modifying mkdeb.sh 51 --only-fix-mkdeb: don't run configure or make after modifying mkdeb.sh
47 CONFIGURE_OPTIONS: arguments for configure 52 CONFIGURE_OPTIONS: arguments for configure
48'''.format(script=sys.argv[0])) 53'''.format(script=sys.argv[0]))
49 sys.exit(0) 54 sys.exit(0)
50 else: 55 else:
51 sys.exit(run(os.path.dirname(os.path.abspath(sys.argv[0]+'/..')), sys.argv[1:])) 56 # Find the source directory
57 srcdir=None
58 args=sys.argv[1:]
59 for a in args:
60 if a.startswith('--fj-src='):
61 args.remove(a)
62 srcdir=a[9:]
63 break
64 if not(srcdir):
65 # srcdir not manually specified, try to auto-detect
66 srcdir=os.path.dirname(os.path.abspath(sys.argv[0]+'/..'))
67 if not(os.path.isfile(srcdir+'/mkdeb.sh')):
68 # Script is probably installed. Check the cwd.
69 if os.path.isfile('./mkdeb.sh'):
70 srcdir=None
71 else:
72 print('Error: Could not find the firejail source tree. Exiting.')
73 sys.exit(1)
74 sys.exit(run(srcdir, args))