Skip to content

Commit 9d08620

Browse files
committed
update shebangs and allow for more passed in
1 parent 5f6f1f0 commit 9d08620

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def build_argument_parser():
4646
action="store_true",
4747
default=False,
4848
)
49+
parser.add_argument(
50+
"--valid-shebangs",
51+
nargs="+",
52+
default=[],
53+
help="Add other valid shebangs for your environment"
54+
)
4955
return parser
5056

5157

@@ -210,17 +216,18 @@ 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",
219-
"#!/usr/bin/python",
225+
"#!/usr/bin/python3",
220226
"#!/usr/bin/ruby",
221227
"#!/usr/local/munki/munki-python",
222228
"#!/usr/local/munki/Python.framework/Versions/Current/bin/python3",
223-
)
229+
]
230+
shebangs = builtin_shebangs + args.valid_shebangs
224231
script_types = (
225232
"installcheck_script",
226233
"uninstallcheck_script",

0 commit comments

Comments
 (0)