LetUserSetUpDVDROMRegionCode: Difference between revisions

From Wurst-Wasser.net
Jump to navigation Jump to search
m (link fix)
Line 29: Line 29:
  # -Taking over the world, Pinky!
  # -Taking over the world, Pinky!
  #
  #
 
  # Globals
  # Globals
  #  
  #  
Line 39: Line 39:
  GAPPMV="/bin/mv"
  GAPPMV="/bin/mv"
  GAPPWHOAMI="/usr/bin/whoami"
  GAPPWHOAMI="/usr/bin/whoami"
 
  # Unmain
  # Unmain
  #
  #
 
  if [ "`${GAPPWHOAMI}`" = "root" ]; then
  if [ "`${GAPPWHOAMI}`" = "root" ]; then
 
   ${GAPPCP} -pr ${GFILEPLIST} ${GFILETEMPPLIST}
   ${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>"
   ${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}
   ${GAPPMV} ${GFILETEMPPLIST} ${GFILEPLIST}
 
  else
  else
   echo "This script can only be run as root. No changes made."
   echo "This script can only be run as root. No changes made."
  fi
  fi

Revision as of 21:05, 7 January 2010

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
  • 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