#!/bin/bash

# Variables - Edit these before deployment

#GROUP_NAME can contain only a-z, A-Z, 0-9,_ and -.
#DEVICE_TAG can contain only [0-9, A-Z, a-z, _, - ]
#ENCRYPTION_KEY must contain 6 to 250 characters

PLIST_PATH="/Library/Application Support/com.idrive360.packageinstaller.plist"
GROUP_NAME=""
ENCRYPTION_KEY=""
CONFIGURATION_ID=""
TRAY_HIDDEN=0
DEVICE_TAG=""

# Create plist file
cat <<EOF > "$PLIST_PATH"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>groupName</key>
    <string><![CDATA[$GROUP_NAME]]></string>
    <key>encryptionKey</key>
    <string><![CDATA[$ENCRYPTION_KEY]]></string>
    <key>configurationID</key>
    <string>$CONFIGURATION_ID</string>
    <key>trayHidden</key>
    <integer>$TRAY_HIDDEN</integer>
    <key>deviceTag</key>
    <string>$DEVICE_TAG</string>
</dict>
</plist>
EOF


echo "Pre-install script completed successfully."
exit 0 # Indicate success
