diff --git a/code/pkgtemplate/Resources/English.lproj/Description.plist b/code/pkgtemplate/Resources/English.lproj/Description.plist
deleted file mode 100644
index a0e5d599..00000000
--- a/code/pkgtemplate/Resources/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- munki tools
- IFPkgDescriptionDescription
- Software installation tools for OS X
-
-
diff --git a/code/pkgtemplate/Resources_admin/English.lproj/Description.plist b/code/pkgtemplate/Resources_admin/English.lproj/Description.plist
deleted file mode 100644
index a7b9fb88..00000000
--- a/code/pkgtemplate/Resources_admin/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Munki admin tools
- IFPkgDescriptionDescription
- Command-line munki admin tools.
-
-
diff --git a/code/pkgtemplate/Resources_app/English.lproj/Description.plist b/code/pkgtemplate/Resources_app/English.lproj/Description.plist
deleted file mode 100644
index 9441dd45..00000000
--- a/code/pkgtemplate/Resources_app/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Managed Software Center
- IFPkgDescriptionDescription
- Managed Software Center application.
-
-
diff --git a/code/pkgtemplate/Resources_app_usage/English.lproj/Description.plist b/code/pkgtemplate/Resources_app_usage/English.lproj/Description.plist
deleted file mode 100644
index b00872a0..00000000
--- a/code/pkgtemplate/Resources_app_usage/English.lproj/Description.plist
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Munki app usage monitoring tool
- IFPkgDescriptionDescription
- Munki app usage monitoring tool and launchdaemon.
-Optional install; if installed Munki can use data collected by this tool to automatically remove unused software.
-
-
diff --git a/code/pkgtemplate/Resources_core/English.lproj/Description.plist b/code/pkgtemplate/Resources_core/English.lproj/Description.plist
deleted file mode 100644
index fcb29e17..00000000
--- a/code/pkgtemplate/Resources_core/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Munki core tools
- IFPkgDescriptionDescription
- Core command-line tools used by munki.
-
-
diff --git a/code/pkgtemplate/Resources_launchd/English.lproj/Description.plist b/code/pkgtemplate/Resources_launchd/English.lproj/Description.plist
deleted file mode 100644
index 096e38c5..00000000
--- a/code/pkgtemplate/Resources_launchd/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Munki launchd agents
- IFPkgDescriptionDescription
- Munki launch daemons and launch agents.
-
-
diff --git a/code/pkgtemplate/Resources_no_python/English.lproj/Description.plist b/code/pkgtemplate/Resources_no_python/English.lproj/Description.plist
deleted file mode 100644
index db4ec7d2..00000000
--- a/code/pkgtemplate/Resources_no_python/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- System Python link
- IFPkgDescriptionDescription
- Creates symlink to system Python at /usr/local/munki/munki-python. Available for install if you choose not to install Munki's embedded Python.
-
-
diff --git a/code/pkgtemplate/Resources_python/English.lproj/Description.plist b/code/pkgtemplate/Resources_python/English.lproj/Description.plist
deleted file mode 100644
index b794fda5..00000000
--- a/code/pkgtemplate/Resources_python/English.lproj/Description.plist
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- IFPkgDescriptionTitle
- Munki embedded Python
- IFPkgDescriptionDescription
- Embedded Python 3 framework for Munki.
-
-
diff --git a/code/pkgtemplate/Scripts_distribution/launchctl.py b/code/pkgtemplate/Scripts_distribution/launchctl.py
deleted file mode 100755
index baeab4a7..00000000
--- a/code/pkgtemplate/Scripts_distribution/launchctl.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-"""
-Postinstall script to load munki's launchdaemons.
-"""
-
-
-def getconsoleuser():
- '''Uses Apple's SystemConfiguration framework to get the current
- console user'''
- from SystemConfiguration import SCDynamicStoreCopyConsoleUser
- cfuser = SCDynamicStoreCopyConsoleUser(None, None, None)
- return cfuser[0]
-
-
-def main():
- # This returns the conditions on whether or not a restart is required
- # for the launchd pkg.
- consoleuser = getconsoleuser()
- if consoleuser is None or consoleuser == u"loginwindow" or consoleuser == u"_mbsetupuser":
- exit(0)
- else:
- exit(1)
-
-if __name__ == '__main__':
- main()
diff --git a/code/pkgtemplate/Scripts_launchd/postinstall b/code/pkgtemplate/Scripts_launchd/postinstall
index 1ea56263..929c63a8 100755
--- a/code/pkgtemplate/Scripts_launchd/postinstall
+++ b/code/pkgtemplate/Scripts_launchd/postinstall
@@ -1,45 +1,49 @@
-#!/usr/bin/python
-"""
-Postinstall script to load munki's launchdaemons.
-"""
-import subprocess
-import sys
-import os
+#!/bin/sh
+# Lovingly lifted from Per Olofsson
+# https://github.com/MagerValp/Scripted-Mac-Package-Creation/blob/master/scripts/postinstall
-def getconsoleuser():
- '''Uses Apple's SystemConfiguration framework to get the current
- console user'''
- from SystemConfiguration import SCDynamicStoreCopyConsoleUser
- cfuser = SCDynamicStoreCopyConsoleUser(None, None, None)
- return cfuser[0]
+# this is intended for a new install of the Munki tools -- the tools will be
+# installed and the launchagents/daemons will be activated without the need for
+# a restart
+#
+# This should not be used for "upgrade" installs of the munkitools, or by
+# installs handled by Munki itself.
+export PATH=/usr/bin:/bin:/usr/sbin:/sbin
-def launchctld(identifier):
- launchd = identifier + '.plist'
- volume = sys.argv[3]
- if volume == "/":
- try:
- path = os.path.join('/Library', 'LaunchDaemons', launchd)
- cmd = ['/bin/launchctl', 'load', path]
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- output = proc.communicate()[0].decode("UTF-8")
- return output
- except KeyError:
- pass
+# Execute postinstall actions if we're installing on a live system.
+# This is useful for loading launch daemons and agents.
+if [ "$3" == "/" ]; then
+ # Load all launch daemons.
+ launchctl load /Library/LaunchDaemons/com.googlecode.munki.logouthelper.plist
+ launchctl load /Library/LaunchDaemons/com.googlecode.munki.managedsoftwareupdate-check.plist
+ launchctl load /Library/LaunchDaemons/com.googlecode.munki.managedsoftwareupdate-install.plist
+ launchctl load /Library/LaunchDaemons/com.googlecode.munki.managedsoftwareupdate-manualcheck.plist
+
+ loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
+ if [ "$loggedInUser" == "" ] ; then
+ # no-one is logged in; I.E. we're at the loginwindow.
+ # Load the loginwindow launchagents
+ launchctl load -S LoginWindow /Library/LaunchAgents/com.googlecode.munki.managedsoftwareupdate-loginwindow.plist
+ launchctl load -S LoginWindow /Library/LaunchAgents/com.googlecode.munki.MunkiStatus.plist
+ fi
-def main():
- # Only load the launch daemons if there isn't a console user or at the
- # loginwindow. launchctl.py will take care of the restart via the pkg
- # distribution.xml
- consoleuser = getconsoleuser()
- if consoleuser is None or consoleuser == u"loginwindow" or consoleuser == u"_mbsetupuser":
- launchctld('com.googlecode.munki.managedsoftwareupdate-check')
- launchctld('com.googlecode.munki.managedsoftwareupdate-install')
- launchctld('com.googlecode.munki.managedsoftwareupdate-manualcheck')
- launchctld('com.googlecode.munki.logouthelper')
+ # Load launch agents for all currently logged in users.
+ os_major_version=$(sw_vers -productVersion | cut -d. -f2)
+ for pid_uid in $(ps -axo pid,uid,args | grep -i "[l]oginwindow.app" | awk '{print $1 "," $2}'); do
+ pid=$(echo $pid_uid | cut -d, -f1)
+ uid=$(echo $pid_uid | cut -d, -f2)
+ if [[ $os_major_version -lt 10 ]] ; then
+ launchctl bsexec "$pid" chroot -u "$uid" / launchctl load /Library/LaunchAgents/com.googlecode.munki.ManagedSoftwareCenter.plist
+ launchctl bsexec "$pid" chroot -u "$uid" / launchctl load /Library/LaunchAgents/com.googlecode.munki.munki-notifier.plist
+ else
+ launchctl asuser "$uid" launchctl load /Library/LaunchAgents/com.googlecode.munki.ManagedSoftwareCenter.plist
+ launchctl asuser "$uid" launchctl load /Library/LaunchAgents/com.googlecode.munki.munki-notifier.plist
+ fi
+ done
-if __name__ == '__main__':
- main()
+fi
+
+exit 0
diff --git a/code/tools/make_munki_mpkg.sh b/code/tools/make_munki_mpkg.sh
index f7c65604..8f26a145 100755
--- a/code/tools/make_munki_mpkg.sh
+++ b/code/tools/make_munki_mpkg.sh
@@ -16,6 +16,7 @@ CONFPKG=""
# consistent with old SVN repo
MAGICNUMBER=482
BUILDPYTHON=NO
+MDMSTYLE=NO
# try to automagically find munki source root
TOOLSDIR=$(dirname "$0")
@@ -33,12 +34,16 @@ fi
usage() {
cat <&2
exit 1
fi
echo "Building Python.framework..."
- "${PYTHONBUILDTOOL}"
- if [ $? -ne 0 ]; then
+ if ! "${PYTHONBUILDTOOL}" ; then
echo "Building Python.framework failed!" 1>&2
exit 1
fi
@@ -149,14 +156,14 @@ cd "$MUNKIROOT"
# generate a pseudo-svn revision number for the core tools (and admin tools)
# from the list of Git revisions
GITREV=$(git log -n1 --format="%H" -- code/client)
-GITREVINDEX=$(git rev-list --count $GITREV)
+GITREVINDEX=$(git rev-list --count "$GITREV")
SVNREV=$(($GITREVINDEX + $MAGICNUMBER))
MPKGSVNREV=$SVNREV
VERSION=$MUNKIVERS.$SVNREV
# get a pseudo-svn revision number for the apps pkg
APPSGITREV=$(git log -n1 --format="%H" -- code/apps)
-GITREVINDEX=$(git rev-list --count $APPSGITREV)
+GITREVINDEX=$(git rev-list --count "$APPSGITREV")
APPSSVNREV=$(($GITREVINDEX + $MAGICNUMBER))
if [ $APPSSVNREV -gt $MPKGSVNREV ] ; then
MPKGSVNREV=$APPSSVNREV
@@ -168,7 +175,7 @@ APPSVERSION=$APPSVERSION.$APPSSVNREV
# get a pseudo-svn revision number for the launchd pkg
LAUNCHDGITREV=$(git log -n1 --format="%H" -- launchd/LaunchDaemons launchd/LaunchAgents)
-GITREVINDEX=$(git rev-list --count $LAUNCHDGITREV)
+GITREVINDEX=$(git rev-list --count "$LAUNCHDGITREV")
LAUNCHDSVNREV=$(($GITREVINDEX + $MAGICNUMBER))
if [ $LAUNCHDSVNREV -gt $MPKGSVNREV ] ; then
MPKGSVNREV=$LAUNCHDSVNREV
@@ -193,7 +200,7 @@ MPKGVERSION=$MUNKIVERS.$MPKGSVNREV
MPKG="$OUTPUTDIR/munkitools-$MPKGVERSION.pkg"
-if [ $(id -u) -ne 0 ]; then
+if [ "$(id -u)" -ne 0 ]; then
cat < "$DISTFILE" <${PKGPREFIX}munkitools_core-$VERSION.pkg
${PKGPREFIX}munkitools_admin-$VERSION.pkg
- ${PKGPREFIX}munkitools_app-$APPSVERSION.pkg
- ${PKGPREFIX}munkitools_launchd-$LAUNCHDVERSION.pkg
+ ${PKGPREFIX}munkitools_app-$APPSVERSION.pkg
+ ${PKGPREFIX}munkitools_launchd-$LAUNCHDVERSION.pkg
${PKGPREFIX}munkitools_app_usage-$VERSION.pkg
${PKGPREFIX}munkitools_python-$PYTHONVERSION.pkg
${PKGPREFIX}munkitools_no_python-$VERSION.pkg
@@ -715,6 +739,9 @@ for pkg in core admin app launchd app_usage python no_python; do
"launchd")
ver="$LAUNCHDVERSION"
SCRIPTS=""
+ if [ "$MDMSTYLE" == "YES" ] ; then
+ SCRIPTS="${MUNKIROOT}/code/pkgtemplate/Scripts_launchd"
+ fi
;;
"app_usage")
ver="$VERSION"