forked from erikng/adminscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetFavoriteServers.sh
More file actions
30 lines (25 loc) · 894 Bytes
/
setFavoriteServers.sh
File metadata and controls
30 lines (25 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Jacob Salmela
# Sets Favorite Servers
bud='/usr/libexec/Plistbuddy'
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist'
servers=('afp://servername'
'smb://servername'
'vnc://servername'
'ftp://servername')
killall cfprefsd
echo "Setting servers for $plist"
echo "Removing previous entries..."
${bud} -c "Delete favoriteservers" ${plist}
echo "Creating new list..."
${bud} -c "Add favoriteservers:Controller string CustomListItems" ${plist}
${bud} -c "Add favoriteservers:CustomListItems array" ${plist}
for i in "${!servers[@]}"
do
echo "Adding to Favorite Servers: ${servers[$i]}..."
${bud} -c "Add favoriteservers:CustomListItems:$i:Name string ${servers[$i]}" ${plist}
${bud} -c "Add favoriteservers:CustomListItems:$i:URL string ${servers[$i]}" ${plist}
done
echo "Finalizing settings..."
killall cfprefsd
defaults read ${plist} favoriteservers > /dev/null