LetUserSetUpDVDROMRegionCode: Difference between revisions

From Wurst-Wasser.net
Jump to navigation Jump to search
No edit summary
 
Line 9: Line 9:
== The script ==
== The script ==


* tested on 10.4.8
* tested on 10.4.8-10.6.8, probably working on 10.7 as well!
* must be run as root, might be delivered with [[FileWave]] or launched when admin is setting up the computer.
* must be run as root, might be delivered with [[FileWave]] or launched when admin is setting up the computer.



Latest revision as of 21:18, 30 November 2011

This is just a little script I wrote because many users are not allowed to administrate their computers, but should be able to set up the DVD-ROM-drive for the first time a video-DVD is played:

Attention

You use this script at your own risk! Everything can happen, when messing around with system configuration, even data loss.

The script

  • tested on 10.4.8-10.6.8, probably working on 10.7 as well!
  • must be run as root, might be delivered with FileWave or launched when admin is setting up the computer.

#!/bin/sh
#
# Script : regionCodeSetupAllow.sh
# Author : Heiko Kretschmer
# Purpose: Setting /etc/authorization up, so that unprivileged users can set the dvd region code (initial)
#
#
# History: 
# 2006-12-12, 15:20: Inital creation of this script.
#
#
# ToDo:
#
# -Taking over the world, Pinky!
#

# Globals
# 
GFILETEMP="/tmp/authorization" 
GFILETEMPPLIST="${GFILETEMP}.plist"
GFILEPLIST="/etc/authorization"
GAPPCP="/bin/cp"
GAPPDEFAULTS="/usr/bin/defaults"
GAPPMV="/bin/mv"
GAPPWHOAMI="/usr/bin/whoami"

# Unmain
#

if [ "`${GAPPWHOAMI}`" = "root" ]; then

  ${GAPPCP} -pr ${GFILEPLIST} ${GFILETEMPPLIST}

  ${GAPPDEFAULTS} write ${GFILETEMP} rights -dict-add system.device.dvd.setregion.initial "<dict><key>class</key><string>allow</string><key>shared</key><true/><key>comment</key><string>This dictionary has changed, so that unprivileged users can setup inital dvd region code.</string><key>group></key><string>admin</string></dict>"

  ${GAPPMV} ${GFILETEMPPLIST} ${GFILEPLIST}

else
  echo "This script can only be run as root. No changes made."
fi