Configuring Beyond Compare

DebstepFRB
New Contributor II

Im wondering if anyone has deployed Beyond Compare and also tried to lockdown any settings ?
Beyond Compare stores the settings in an XML file under the Users location in /Users/Username/Application Support/Beyond Compare/BCPreferences.xml

The file doesnt exist until the user starts the program so I tried to create the file if it didnt already exist for each user, after the install in a post install script -- this is what it should look like:
[ I dont know how to make the format in these post look like the script ! soemone please educate me on that ! ]

<?xml version="1.0" encoding="UTF-8"?>
<!-- Produced by Beyond Compare 4 from Scooter Software -->
<BCPreferences Version="1" MinVersion="1"> <TBcPrefs> <CheckForUpdatesDayAmt Value="0"/> </TBcPrefs>
</BCPreferences>
I'm using a loop to try to edit or create the file

UserAccounts=`dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'`

for userName in "$UserAccounts"; do

file="/Users/$userName/Library/Application Support/Beyond Compare/BCPreferences.xml"

if [ ! -f "$file" ]; then

{

fileDIR=$(dirname "$file")

if [ ! -d "$fileDIR" ]; then

mkdir -p "$fileDIR"

fi

cat <<EOF >> "$file"

<?xml version="1.0" encoding="UTF-8"?>

<!-- Produced by Beyond Compare 4 from Scooter Software -->

<BCPreferences Version="1" MinVersion="1">

<TBcPrefs>

<CheckForUpdatesDayAmt Value="0"/>

</TBcPrefs>

</BCPreferences>

EOF

}

else

{

if grep -c '<CheckForUpdatesDayAmt Value="0"/>' "$file"

## returns 0 if file exists with the value

then

dummy=true

else

sed -i '' 's|<CheckForUpdatesDayAmt Value=".*"/>|<CheckForUpdatesDayAmt Value="0"/>|g' "$file"

fi

}

fi

chown "$userName" "$file"

chmod 600 "$file"

done

My apologies-- i really dont know how to get the formatting correct in this post.

The file is not getting created, does anyone have a suggestion ? Thank you

0 REPLIES 0