about summary refs log blame commit diff
path: root/launchd_scripts/process_files.sh
blob: a5e330d7705bdaff093de9b9daaa6dd93de3de3d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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."