#!/bin/sh # Avalaible functions function usage { echo "Usage:" echo " ./bootPanel.sh set newPanel.pdf" echo " ./bootPanel.sh reset" } # Check sript usage if [ $# == 0 ]; then usage exit -1 elif [ $# == 1 ]; then if [ $1 != "reset" ]; then usage exit -1 fi elif [ $# == 2 ]; then if [ $1 != "set" ]; then usage exit -1 fi elif [ $# > 2 ]; then usage exit -1 fi # Then we have to check for existing backup if [ -e /Library/Application\ Support/macMorph/BootPanel.pdf ]; then echo "Backup file found" else echo "Backup file NOT found" echo "macMorph will create a backup file right now" echo "Creating backup directory in /Library/Application\ Support/macMorph" echo "Executing 'sudo mkdir /Library/Application\ Support/macMorph'" #sudo mkdir /Library/Application\ Support/macMorph echo "Copying backup file" echo "Executing 'sudo cp /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf /Library/Application\ Support/macMorph/BootPanel.pdf'" #sudo cp /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf /Library/Application\ Support/macMorph/BootPanel.pdf fi # Now we can do the user's will if [ $1 == "set" ]; then ####################################################### # WARNING: file control needed on the second argument # # (at least a working one... :) # ####################################################### FLAG=0 for i in $(file $2); do if [ $i == "PDF" ]; then FLAG=1 fi done if [ $FLAG == 1 ]; then # We have to set a new bot panel echo "Setting the new boot panel" echo "Executing 'sudo cp "$2" /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf'" #sudo cp $2 /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf exit 0 else echo "WARNING!" echo "--> "$2 echo "Selected file is not a .pdf file" exit -1 fi elif [ $1 == "reset" ]; then # We have to reset the old boot panel echo "Resetting the old boot panel" echo "Executing 'sudo cp /Library/Application\ Support/macMorph/BootPanel.pdf /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf'" #sudo cp /Library/Application\ Support/macMorph/BootPanel.pdf /System/Library/CoreServices/SystemStarter/QuartzDisplay.bundle/Resources/BootPanel.pdf exit 0 fi