about summary refs log tree commit diff
path: root/launchd_scripts/process_files.sh
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2016-08-15T15·14-0400
committerWilliam Carroll <wpcarro@gmail.com>2016-08-15T15·14-0400
commit4563550969467223f422df1eda9c15165d24607c (patch)
treecbdf9570a5ffa0176e79eff3df63690cfa443624 /launchd_scripts/process_files.sh
parent6021ad31941203dafc2abd643a98fb549b620c6a (diff)
Trims fat and renames files
Diffstat (limited to 'launchd_scripts/process_files.sh')
-rwxr-xr-xlaunchd_scripts/process_files.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/launchd_scripts/process_files.sh b/launchd_scripts/process_files.sh
new file mode 100755
index 000000000000..a5e330d7705b
--- /dev/null
+++ b/launchd_scripts/process_files.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# This script processes certain files and replaces
+# {{<IDENTIFIER>}} with the entries in vars.json
+
+output_path="./watch_volumes.plist"
+template_file="watch_volumes.plist.tpl"
+usb_drive_path=$(jq < ./vars.json '.USB_DRIVE_PATH' | \
+  sed 's/\//\\\//g' | sed 's/"//g')
+
+cat "$template_file" | perl -p -e 's/(\{\{[^}]+\}\})/'$usb_drive_path'/g' \
+  >"$output_path"
+
+echo "Done."
+