2017-05-23 15:51:19 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## Create file path variables ##
|
2018-03-20 07:19:27 -05:00
|
|
|
settingsFilePath='/tmp/sym_settings.txt'
|
|
|
|
permissionsFilePath='/tmp/sym_permissions.txt'
|
2017-05-23 15:51:19 -05:00
|
|
|
installPath="$2"
|
2020-06-13 01:12:57 -05:00
|
|
|
configPath="/Symphony.app/Contents/config"
|
|
|
|
configFilePath="${installPath}${configPath}/Symphony.config"
|
|
|
|
installVariantPath="${installPath}${configPath}/InstallVariant.info"
|
|
|
|
newPath=${configFilePath}
|
2017-11-07 01:53:31 -06:00
|
|
|
|
2017-05-23 15:51:19 -05:00
|
|
|
## Get Symphony Settings from the temp file ##
|
2018-03-20 07:19:27 -05:00
|
|
|
pod_url=$(sed -n '1p' ${settingsFilePath});
|
2021-01-08 12:00:05 -06:00
|
|
|
context_origin_url=$(sed -n '2p' ${settingsFilePath});
|
|
|
|
minimize_on_close=$(sed -n '3p' ${settingsFilePath});
|
|
|
|
launch_on_startup=$(sed -n '4p' ${settingsFilePath});
|
|
|
|
always_on_top=$(sed -n '5p' ${settingsFilePath});
|
|
|
|
bring_to_front=$(sed -n '6p' ${settingsFilePath});
|
|
|
|
dev_tools_enabled=$(sed -n '7p' ${settingsFilePath});
|
2023-03-14 05:14:27 -05:00
|
|
|
enable_browser_login=$(sed -n '8p' ${settingsFilePath});
|
2023-03-28 08:10:18 -05:00
|
|
|
browser_login_autoconnect=$(sed -n '9p' ${settingsFilePath});
|
2017-05-23 15:51:19 -05:00
|
|
|
|
2020-04-27 06:04:56 -05:00
|
|
|
## If any of the above values turn out to be empty, set default values ##
|
2021-01-08 12:00:05 -06:00
|
|
|
if [ "$pod_url" = "" ]; then pod_url="https://my.symphony.com"; fi
|
|
|
|
if [ "$context_origin_url" = "" ]; then context_origin_url=""; fi
|
|
|
|
if [ "$minimize_on_close" = "" ] || [ "$minimize_on_close" = 'true' ]; then minimize_on_close='ENABLED'; else minimize_on_close='DISABLED'; fi
|
|
|
|
if [ "$launch_on_startup" = "" ] || [ "$launch_on_startup" = 'true' ]; then launch_on_startup='ENABLED'; else launch_on_startup='DISABLED'; fi
|
|
|
|
if [ "$always_on_top" = "" ] || [ "$always_on_top" = 'false' ]; then always_on_top='DISABLED'; else always_on_top='ENABLED'; fi
|
|
|
|
if [ "$bring_to_front" = "" ] || [ "$bring_to_front" = 'false' ]; then bring_to_front='DISABLED'; else bring_to_front='ENABLED'; fi
|
|
|
|
if [ "$dev_tools_enabled" = "" ]; then dev_tools_enabled=true; fi
|
2023-03-14 05:14:27 -05:00
|
|
|
if [ "$enable_browser_login" = "" ]; then enable_browser_login=false; fi
|
2023-03-28 08:10:18 -05:00
|
|
|
if [ "$browser_login_autoconnect" = "" ]; then browser_login_autoconnect=false; fi
|
|
|
|
|
2018-03-14 01:29:09 -05:00
|
|
|
pod_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$pod_url")
|
2021-01-08 12:00:05 -06:00
|
|
|
context_origin_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$context_origin_url")
|
2018-03-14 01:29:09 -05:00
|
|
|
|
2017-05-23 15:51:19 -05:00
|
|
|
## Replace the default settings with the user selected settings ##
|
2021-01-08 12:00:05 -06:00
|
|
|
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url_escaped\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"contextOriginUrl\" ?: ?\".*\"#\"contextOriginUrl\"\: \"$context_origin_url_escaped\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"minimizeOnClose\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"minimizeOnClose\":\ \"$minimize_on_close\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"alwaysOnTop\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"alwaysOnTop\":\ \"$always_on_top\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"launchOnStartup\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"launchOnStartup\":\ \"$launch_on_startup\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"bringToFront\" ?: ?\"([Ee][Nn][Aa][Bb][Ll][Ee][Dd]|[Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])\"#\"bringToFront\":\ \"$bring_to_front\"#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"devToolsEnabled\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"devToolsEnabled\":\ $dev_tools_enabled#g" "${newPath}"
|
2023-03-14 05:14:27 -05:00
|
|
|
sed -i "" -E "s#\"enableBrowserLogin\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"enableBrowserLogin\":\ $enable_browser_login#g" "${newPath}"
|
2023-03-28 08:10:18 -05:00
|
|
|
sed -i "" -E "s#\"browserLoginAutoConnect\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"browserLoginAutoConnect\":\ $browser_login_autoconnect#g" "${newPath}"
|
2017-05-23 15:51:19 -05:00
|
|
|
|
2018-03-20 07:19:27 -05:00
|
|
|
## Get Symphony Permissions from the temp file ##
|
|
|
|
media=$(sed -n '1p' ${permissionsFilePath});
|
|
|
|
geo_location=$(sed -n '2p' ${permissionsFilePath});
|
|
|
|
notifications=$(sed -n '3p' ${permissionsFilePath});
|
|
|
|
midi_sysex=$(sed -n '4p' ${permissionsFilePath});
|
|
|
|
pointer_lock=$(sed -n '5p' ${permissionsFilePath});
|
|
|
|
full_screen=$(sed -n '6p' ${permissionsFilePath});
|
|
|
|
open_external_app=$(sed -n '7p' ${permissionsFilePath});
|
|
|
|
|
2020-04-27 06:04:56 -05:00
|
|
|
## If any of the above values turn out to be empty, set default values ##
|
2021-01-08 12:00:05 -06:00
|
|
|
if [ "$media" = "" ]; then media=true; fi
|
|
|
|
if [ "$geo_location" = "" ]; then geo_location=true; fi
|
|
|
|
if [ "$notifications" = "" ]; then notifications=true; fi
|
|
|
|
if [ "$midi_sysex" = "" ]; then midi_sysex=true; fi
|
|
|
|
if [ "$pointer_lock" = "" ]; then pointer_lock=true;fi
|
|
|
|
if [ "$full_screen" = "" ]; then full_screen=true; fi
|
|
|
|
if [ "$open_external_app" = "" ]; then open_external_app=true; fi
|
2018-03-20 07:19:27 -05:00
|
|
|
|
|
|
|
## Replace the default permissions with the user selected permissions ##
|
2021-01-08 12:00:05 -06:00
|
|
|
sed -i "" -E "s#\"media\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"media\":\ $media#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"geolocation\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"geolocation\":\ $geo_location#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"notifications\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"notifications\":\ $notifications#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"midiSysex\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"midiSysex\":\ $midi_sysex#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"pointerLock\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"pointerLock\":\ $pointer_lock#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"fullscreen\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"fullscreen\":\ $full_screen#g" "${newPath}"
|
|
|
|
sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"openExternal\":\ $open_external_app#g" "${newPath}"
|
2018-03-20 07:19:27 -05:00
|
|
|
|
2020-04-27 06:04:56 -05:00
|
|
|
## Remove the temp settings & permissions file created ##
|
|
|
|
rm -f ${settingsFilePath}
|
2020-03-15 06:47:49 -05:00
|
|
|
rm -f ${permissionsFilePath}
|
2020-06-13 01:12:57 -05:00
|
|
|
|
2021-01-08 12:00:05 -06:00
|
|
|
uuidgen > "${installVariantPath}"
|