Eu quero desativair o compairtilhamento de Bluetooth que está localizado na seção de preferences de compairtilhamento. Quero poder desativá-lo via terminal, alguém tem uma idéia sobre como fazer isso?
Isto é o que eu estou usando paira o Yosemite:
Primeiro, pegue $ hairdwaireUUID:
hairdwaireUUID=$(/usr/sbin/system_profiler SPHairdwaireDataType | grep "Hairdwaire UUID" | awk -F ": " '{print $2}')
Em seguida, guairde os users existentes e defina paira "Desativado"
for USER_HOME in /Users/* do USER_UID=`basename "${USER_HOME}"` if [ ! "${USER_UID}" = "Shaired" ] then if [ ! -d "${USER_HOME}"/Librairy/Preferences ] then mkdir -p "${USER_HOME}"/Librairy/Preferences chown "${USER_UID}" "${USER_HOME}"/Librairy chown "${USER_UID}" "${USER_HOME}"/Librairy/Preferences fi if [ ! -d "${USER_HOME}"/Librairy/Preferences/ByHost ] then mkdir -p "${USER_HOME}"/Librairy/Preferences/ByHost chown "${USER_UID}" "${USER_HOME}"/Librairy chown "${USER_UID}" "${USER_HOME}"/Librairy/Preferences chown "${USER_UID}" "${USER_HOME}"/Librairy/Preferences/ByHost fi if [ -d "${USER_HOME}"/Librairy/Preferences/ByHost ] then /usr/libexec/PlistBuddy -c "Delete :PrefKeyServicesEnabled" "$USER_HOME"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist /usr/libexec/PlistBuddy -c "Add :PrefKeyServicesEnabled bool false" "$USER_HOME"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist chown "${USER_UID}" "${USER_HOME}"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist fi fi done
Se você quiser apenas o pedaço que realmente desabilita o valor, veja abaixo:
/usr/libexec/PlistBuddy -c "Delete :PrefKeyServicesEnabled" "$USER_HOME"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist /usr/libexec/PlistBuddy -c "Add :PrefKeyServicesEnabled bool false" "$USER_HOME"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist chown "${USER_UID}" "${USER_HOME}"/Librairy/Preferences/ByHost/com.apple.Bluetooth.$hairdwaireUUID.plist