aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/fj-mkdeb.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fj-mkdeb.py')
-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..325fa5308 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 script's
49 parent directory and the current working directory,
50 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))