Skip to content

Commit

Permalink
Merge pull request #75 from kbrewersq/add_valid_shebangs
Browse files Browse the repository at this point in the history
update shebangs and allow for more passed in
  • Loading branch information
homebysix authored Mar 10, 2024
2 parents f39601b + fb72f43 commit 20ca775
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ After adding a hook to your pre-commit config, it's not a bad idea to run `pre-c
- 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:
`args: ['--warn-on-missing-icons]`

- Add additional shebangs that are valid for your environment:
`args: ['--valid-shebangs', '#!/bin/macadmin/python37', '#!/bin/macadmin/python42', '--']`

- __check-munkiadmin-scripts__

This hook ensures MunkiAdmin scripts are executable.
Expand Down
12 changes: 10 additions & 2 deletions pre_commit_hooks/check_munki_pkgsinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ def build_argument_parser():
action="store_true",
default=False,
)
parser.add_argument(
"--valid-shebangs",
nargs="+",
default=[],
help="Add other valid shebangs for your environment"
)
return parser


Expand Down Expand Up @@ -210,17 +216,19 @@ def main(argv=None):
retval = 1

# Ensure all pkginfo scripts have a proper shebang.
shebangs = (
builtin_shebangs = [
"#!/bin/bash",
"#!/bin/sh",
"#!/bin/zsh",
"#!/usr/bin/osascript",
"#!/usr/bin/perl",
"#!/usr/bin/python3",
"#!/usr/bin/python",
"#!/usr/bin/ruby",
"#!/usr/local/munki/munki-python",
"#!/usr/local/munki/Python.framework/Versions/Current/bin/python3",
)
]
shebangs = builtin_shebangs + args.valid_shebangs
script_types = (
"installcheck_script",
"uninstallcheck_script",
Expand Down

0 comments on commit 20ca775

Please sign in to comment.