Skip to content

Commit 20ca775

Browse files
authored
Merge pull request #75 from kbrewersq/add_valid_shebangs
update shebangs and allow for more passed in
2 parents f39601b + fb72f43 commit 20ca775

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ After adding a hook to your pre-commit config, it's not a bad idea to run `pre-c
114114
- Choose to just warn on missing icons with a flag, note if no other issues exist this will allow pre-commit to pass without seeing the warnings:
115115
`args: ['--warn-on-missing-icons]`
116116

117+
- Add additional shebangs that are valid for your environment:
118+
`args: ['--valid-shebangs', '#!/bin/macadmin/python37', '#!/bin/macadmin/python42', '--']`
119+
117120
- __check-munkiadmin-scripts__
118121

119122
This hook ensures MunkiAdmin scripts are executable.

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def build_argument_parser():
4444
action="store_true",
4545
default=False,
4646
)
47+
parser.add_argument(
48+
"--valid-shebangs",
49+
nargs="+",
50+
default=[],
51+
help="Add other valid shebangs for your environment"
52+
)
4753
return parser
4854

4955

@@ -210,17 +216,19 @@ def main(argv=None):
210216
retval = 1
211217

212218
# Ensure all pkginfo scripts have a proper shebang.
213-
shebangs = (
219+
builtin_shebangs = [
214220
"#!/bin/bash",
215221
"#!/bin/sh",
216222
"#!/bin/zsh",
217223
"#!/usr/bin/osascript",
218224
"#!/usr/bin/perl",
225+
"#!/usr/bin/python3",
219226
"#!/usr/bin/python",
220227
"#!/usr/bin/ruby",
221228
"#!/usr/local/munki/munki-python",
222229
"#!/usr/local/munki/Python.framework/Versions/Current/bin/python3",
223-
)
230+
]
231+
shebangs = builtin_shebangs + args.valid_shebangs
224232
script_types = (
225233
"installcheck_script",
226234
"uninstallcheck_script",

0 commit comments

Comments
 (0)