Skip to content

Commit

Permalink
Merge pull request #43 from salopensource/feature_salv4_support
Browse files Browse the repository at this point in the history
Feature salv4 support
  • Loading branch information
sheagcraig authored Aug 15, 2019
2 parents 3d131e9 + 157417a commit e759d26
Show file tree
Hide file tree
Showing 28 changed files with 861 additions and 6,451 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
USE_PKGBUILD=1
include /usr/local/share/luggage/luggage.make
PACKAGE_VERSION:=$(shell sed -n -e '/^VERSION/p' payload/usr/local/sal/bin/sal-submit | cut -d "'" -f 2)
PACKAGE_VERSION:=$(shell sed -n -e '/^VERSION/p' payload/usr/local/sal/utils.py | cut -d "'" -f 2)
TITLE=sal_scripts
PACKAGE_NAME=sal_scripts
REVERSE_DOMAIN=com.github.salopensource
Expand Down
5 changes: 5 additions & 0 deletions payload/usr/local/munki/postflight.d/sal-postflight
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python


import os
import subprocess
import sys
Expand All @@ -10,6 +11,7 @@ sys.path[:0] = ['/usr/local/munki', '/usr/local/sal']
import utils
from munkilib import FoundationPlist, munkicommon


TOUCH_FILE_PATH = '/Users/Shared/.com.salopensource.sal.run'
LAUNCHD = 'com.salopensource.sal.runner'
LAUNCHD_PATH = '/Library/LaunchDaemons/{}.plist'.format(LAUNCHD)
Expand Down Expand Up @@ -77,6 +79,7 @@ def write_touch_file():
with open(TOUCH_FILE_PATH, 'a'):
os.utime(TOUCH_FILE_PATH, None)


def ensure_launchd_loaded():
cmd =[
'/bin/launchctl',
Expand All @@ -92,6 +95,7 @@ def ensure_launchd_loaded():
]
subprocess.check_call(cmd)


def main():
check_server_online()
write_touch_file()
Expand All @@ -100,5 +104,6 @@ def main():
if not os.path.exists(LAUNCHD_PATH):
subprocess.check_call(SUBMIT_SCRIPT)


if __name__ == '__main__':
main()
6 changes: 6 additions & 0 deletions payload/usr/local/sal/bin/randomizer
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/python


import subprocess
import optparse
import os
import time
import random
import stat


def get_options():
"""Return commandline options."""
usage = "%prog [options]"
Expand All @@ -21,6 +23,7 @@ def get_options():
opts, _ = option_parser.parse_args()
return opts


def random_delay(delay):
if delay == 0:
print 'No delay set'
Expand All @@ -29,6 +32,7 @@ def random_delay(delay):
print "Delaying run by %s seconds" % randomized_delay
time.sleep(randomized_delay)


def execute_path(path):
path_stat = os.stat(path)
if not path_stat.st_mode & stat.S_IWOTH:
Expand All @@ -39,6 +43,7 @@ def execute_path(path):
else:
print "'{}' is not executable or has bad permissions".format(path)


def main():
opts = get_options()
path = opts.path
Expand All @@ -49,5 +54,6 @@ def main():

execute_path(path)


if __name__ == '__main__':
main()
Loading

0 comments on commit e759d26

Please sign in to comment.