summaryrefslogtreecommitdiff
path: root/src/unix/MacSupport/SLA-dmg.sh
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
commit6a777afc079c2a8d3af3ecd2145fe8dd50567a39 (patch)
tree520f4489cebf8564ef6cb27064ceea45cbc005b3 /src/unix/MacSupport/SLA-dmg.sh
Funko sources as released by Rotacak.HEADmaster
Diffstat (limited to 'src/unix/MacSupport/SLA-dmg.sh')
-rw-r--r--src/unix/MacSupport/SLA-dmg.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/unix/MacSupport/SLA-dmg.sh b/src/unix/MacSupport/SLA-dmg.sh
new file mode 100644
index 0000000..51c6e42
--- /dev/null
+++ b/src/unix/MacSupport/SLA-dmg.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# This script appends a SLA.r (Software License Agreement) resource to a .dmg
+#
+# usage is './SLA-dmg.sh SLA.r /path/to/ioquake3.dmg'
+#
+
+if [ "x$1" = "x" ] || [ "x$2" = "x"]; then
+ echo "usage: ./SLA-dmg.sh SLAFILE DMGFILE"
+ exit 1;
+fi
+
+if [ ! -r $1 ]; then
+ echo "$1 is not a readable .r file"
+ exit 1;
+fi
+if [ ! -w $2 ]; then
+ echo "$2 is not writable .dmg file"
+ exit 1;
+fi
+
+hdiutil convert -format UDCO -o tmp.dmg $2 || exit 1
+hdiutil unflatten tmp.dmg || exit 1
+/Developer/Tools/Rez /Developer/Headers/FlatCarbon/*.r $1 -a -o tmp.dmg \
+ || exit 1
+hdiutil flatten tmp.dmg || exit 1
+hdiutil internet-enable -yes tmp.dmg || exit 1
+mv tmp.dmg $2 || (echo "Could not copy tmp.dmg to $2" && exit 1)
+rm tmp.dmg
+echo "SLA $1 successfully added to $2"