diff options
author | laniakea64 <laniakea64@users.noreply.github.com> | 2017-04-09 17:58:12 -0400 |
---|---|---|
committer | laniakea64 <laniakea64@users.noreply.github.com> | 2017-04-09 17:58:12 -0400 |
commit | fda0b267ba6bf8c02ee1eb7ba573d16a18b55e61 (patch) | |
tree | 2650901204dc52e3f8ad430bb25e4cee10a08cac | |
parent | Add a script to build a .deb with custom configure options (diff) | |
download | firejail-fda0b267ba6bf8c02ee1eb7ba573d16a18b55e61.tar.gz firejail-fda0b267ba6bf8c02ee1eb7ba573d16a18b55e61.tar.zst firejail-fda0b267ba6bf8c02ee1eb7ba573d16a18b55e61.zip |
fj-mkdeb.py: don't require to be placed in contrib/ in the source tree
-rwxr-xr-x | contrib/fj-mkdeb.py | 29 |
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 @@ | |||
5 | import os, re, shlex, subprocess, sys | 5 | import os, re, shlex, subprocess, sys |
6 | 6 | ||
7 | def run(srcdir, args): | 7 | def 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 | ||
44 | usage: {script} [--only-fix-mkdeb] [CONFIGURE_OPTIONS [...]] | 44 | usage: |
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)) | ||