-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackageMaker.bash
More file actions
executable file
·53 lines (40 loc) · 2.11 KB
/
PackageMaker.bash
File metadata and controls
executable file
·53 lines (40 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#* Automate PKG build, a bit of a hacked up script. Not clean but it works.
WORKING_DIR=$(/usr/bin/dirname "${0}")
PATHTO="/Applications"
#+ Move to directory, maybe make this dynamic
cd ${WORKING_DIR}
for pkg in `ls "${WORKING_DIR}" | grep "_Postflight"`
do
#+ VARS
IDENTIFIER=$(echo "${pkg}" | sed 's/_Postflight.sh//g')
DESCRIPTION=$(cat "${WORKING_DIR}/${pkg}" | grep "Description:" | sed 's/#+ Description: //g')
VERSION=$(cat "${WORKING_DIR}/${pkg}" | grep "Version:" | sed 's/#+ Version: //g')
ROOTVOLUMEONLY=$(cat "${WORKING_DIR}/${pkg}" | grep "Boot Volume Only:" | sed 's/#+ Boot Volume Only: //g')
#+ postflight
mkdir "${WORKING_DIR}/SCRIPTS"
cp -f "${WORKING_DIR}/${pkg}" "${WORKING_DIR}/SCRIPTS/postflight"
echo "Copying ${WORKING_DIR}/${pkg} ${WORKING_DIR}/SCRIPTS/postflight"
#+ Payload
mkdir "${WORKING_DIR}/ROOT"
mkdir "${WORKING_DIR}/ROOT/Library"
#+ Resources
if [ -r "${WORKING_DIR}/${IDENTIFIER}_RESOURCES" ]; then
cp -Rf "${WORKING_DIR}/${IDENTIFIER}_RESOURCES" "${WORKING_DIR}/RESOURCES"
else
mkdir "${WORKING_DIR}/RESOURCES/"
fi
#+ Build it.... hopefully
if [ "${ROOTVOLUMEONLY}" == "Yes" ]; then
"${PATHTO}/PackageMaker.app/Contents/MacOS/PackageMaker" --root-volume-only --id "com.chrisgerke.${IDENTIFIER}" --title "${IDENTIFIER}" --version "${VERSION}" --resources "${WORKING_DIR}/RESOURCES" --scripts "${WORKING_DIR}/SCRIPTS" --root "${WORKING_DIR}/ROOT" --out "${WORKING_DIR}/${IDENTIFIER}.pkg" --verbose
else
"${PATHTO}/PackageMaker.app/Contents/MacOS/PackageMaker" --id "com.chrisgerke.${IDENTIFIER}" --title "${IDENTIFIER}" --version "${VERSION}" --resources "${WORKING_DIR}/RESOURCES" --scripts "${WORKING_DIR}/SCRIPTS" --root "${WORKING_DIR}/ROOT" --out "${WORKING_DIR}/${IDENTIFIER}.pkg" --verbose
fi
defaults write "${WORKING_DIR}/${IDENTIFIER}.pkg/Contents/Resources/en.lproj/Description" IFPkgDescriptionDescription "${DESCRIPTION}"
cp "${WORKING_DIR}/README.md" "${WORKING_DIR}/${IDENTIFIER}.pkg/Contents/Resources/README.txt"
#+ Cleanup for the next one
rm -Rf "${WORKING_DIR}/RESOURCES"
rm -Rf "${WORKING_DIR}/ROOT"
rm -Rf "${WORKING_DIR}/SCRIPTS"
done
exit 0