Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A simpler method of direct-to-console booting' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A simpler method of direct-to-console booting
Authored by: bluehz on Jul 21, '03 07:28:10PM
Thx darkshadow for the instructions. I gathered all the info into a litte script I wrote that allows you to easily switch back and forth between the two modes.

Does anyone know how to kill the gui - e.g drop from Aqua into console mode? I was unable to get it to work in my script.

#!/bin/sh

# Filename: bootchoice
# Version: 1.0
#
# This script can be used to change the startup mode [aqua |
# console]. It will also display the current settings. Prior
# to running this script you will need to duplicate your
# current /etc/ttys file twice and make modifications to one
# of them. This process assumes you have not previously
# altered your /etc/ttys file.
# 
# Setup
# -----
# 1. Save this script into /usr/local/bin and change permissions
#    chmod 750 /usr/bin/bootchoice
# 2. Duplicate the /etc/ttys file twice
#    sudo cp -p /etc/ttys /etc/ttys.aqua
#    sudo cp -p /etc/ttys /etc/ttys.console
#    
# 3. Now modify the /etc/ttys.console file to allow for console booting
#    pico /etc/ttys.console
#    Change line 8 by removing the # at the beginning of the file
#    Change line 9 by adding the # at the beginning of the line
#    Save the file
#
#    /etc/ttys.console should now look like this...
#
#       console        "/usr/libexec/getty std.9600"   vt100   on secure
#       #console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwin....... 
#
#    You do not need to modify /etc/ttys.aqua
#   
# Usage
# -----
# To boot into Aqua mode:
# 
#    bootchoice aqua
#    
# To boot into Console mode:
# 
#    bootchoice console
#    
# To check current mode:
# 
#    bootchoice current
#    
# To toggle between modes:
# 
#    bootchoice toggle
# 
# To display usage syntax:
#
#    bootchoice

#####################################################

# test current mode
test () {
   test="`diff /etc/ttys /etc/ttys.console`"
}

# reboot function
rebootq () {
   printf "Do you want to reboot now? [y/n]: "
   read fname
   if [ "$fname" = "y" ] || [ "$fname" = "Y" ]; then
      echo "Rebooting the system now..."
      reboot
   else  
      echo "Reboot later."
   fi
} 

case "$1" in

console)
# change to console mode
   test
   if [ "$test" = "" ]; then
      echo "Your system is already in Console mode"
      rebootq
   else
      sudo cp -p /etc/ttys.console /etc/ttys
      sudo nvram boot-args="-v"
      echo "Your System has been modified and will"
      echo "now boot into console only mode"
      rebootq
   fi
;;

aqua)
# change to aqua mode
   test
   if [ "$test" = "" ]; then
      sudo cp -p /etc/ttys.aqua /etc/ttys
      sudo nvram boot-args=""
      echo "Your System has been modified and will"             
      echo "now boot into standard Aqua mode"
      rebootq
   else
      echo "Your system is already in Aqua mode"
      rebootq
   fi
;;

current)
# display current settings
   test
   if [ "$test" = "" ]; then
      echo "Currently set to Console mode."
   else
      echo "Currently set to Aqua mode."
   fi
;;

toggle)
# toggles current mode aqua <> console
# this is experimental - currently only console > aqua works
   test
   if [ "$test" = "" ]; then
   # we are in console, switch to aqua
      /System/Library/CoreServices/loginwindow.app/loginwindow console &
      /System/Library/CoreServices/WindowServer console &
   else
   # we must be in aqua, switch to console
      killall loginwindow && killall WindowServer
   fi
;;

*)

echo "Usage: bootchoice (console | aqua | current | toggle)"
echo "          console       start in console mode"
echo "          aqua          start in aqua mode"
echo "          current       displays current settings"
echo "          toggle        switch from console to aqua"
esac


[ Reply to This | # ]