49473fc52e
list when booting from CD. Both are removed from the target in the InstallerFinishScript. This closes ticket #4342. * Make Installer start in safemode as well. * Are there any objections to always have the Installer link in the Deskbar? I see no real reason to leave it out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32686 a95241bf-73f2-0310-859d-f6bbb57e9c96
177 lines
3.6 KiB
Plaintext
177 lines
3.6 KiB
Plaintext
## The system's main boot script.
|
|
|
|
##
|
|
## Some functions used by the main script
|
|
##
|
|
|
|
# launch <executable path> [ <thread to wait for> [ <program args> ] ]
|
|
|
|
launch() {
|
|
toLaunch="$1"
|
|
shift
|
|
toWaitFor="$1"
|
|
shift
|
|
if [ -f "/boot/$toLaunch" ]
|
|
then
|
|
"/boot/$toLaunch" $* &
|
|
[ "$toWaitFor" != "" ] && waitfor "$toWaitFor"
|
|
return 1
|
|
else
|
|
echo There is no "$toLaunch"
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
# launchscript <script path>
|
|
|
|
launchscript() {
|
|
if [ -f "/boot/$1" ]
|
|
then
|
|
. "/boot/$1"
|
|
fi
|
|
}
|
|
|
|
# runprog <executable path>
|
|
|
|
runprog() {
|
|
if [ -f "/boot/$1" ]
|
|
then
|
|
"/boot/$1"
|
|
return 1
|
|
else
|
|
echo There is no "$1"
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
##
|
|
## Main script starts here
|
|
##
|
|
|
|
# Set up stdin/out/err to nirvana
|
|
|
|
exec </dev/null
|
|
exec >/dev/null 2>&1
|
|
|
|
# Standard locations of boot files
|
|
SCRIPTS=system/boot
|
|
SERVERS=system/servers
|
|
|
|
# clean the shared memory dir
|
|
shmDir=/boot/var/shared_memory
|
|
rm -rf $shmDir
|
|
mkdir -p $shmDir
|
|
chmod 777 $shmDir
|
|
|
|
# Set up the environment
|
|
|
|
export SAFEMODE=`/bin/safemode`
|
|
|
|
launchscript $SCRIPTS/SetupEnvironment
|
|
|
|
# If the boot volume is a CD we use another script
|
|
isReadOnly=`/bin/isvolume -readonly-partition /boot`
|
|
if [ "$isReadOnly" = "yes" ]; then
|
|
# block the CD tray (avoid accidental ejection)
|
|
# This option stays 'on' even if we continue booting to the desktop.
|
|
/bin/eject -b /boot
|
|
else
|
|
# Sets timezone etc.
|
|
runprog system/bin/clockconfig
|
|
fi
|
|
|
|
|
|
# Launch servers
|
|
|
|
# We must wait for the app_server and registrar to be ready
|
|
launch $SERVERS/registrar _roster_thread_ # launch registrar
|
|
|
|
launch $SERVERS/debug_server # launch debug_server
|
|
|
|
# Init Network
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/net_server # launch net_server
|
|
fi
|
|
|
|
launch $SERVERS/app_server picasso # launch app_server
|
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/syslog_daemon
|
|
waitfor _input_server_event_loop_ # wait for input devices
|
|
fi
|
|
|
|
# Now ask the user if he wants to run the Installer or continue to the Desktop.
|
|
if [ "$isReadOnly" = "yes" ]; then
|
|
# Create Installer links (using the write overlay)
|
|
ln -sf /boot/system/apps/Installer /boot/home/Desktop/Installer
|
|
ln -sf /boot/system/apps/Installer /boot/home/config/be/Applications/Installer
|
|
|
|
/bin/alert "Do you wish to run the Installer or continue booting to the Desktop?" "Installer" "Desktop"
|
|
if [ $? -eq 0 ]; then
|
|
launchscript $SCRIPTS/Bootscript.cd
|
|
exit 0 # and return
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ -e /etc/users ]; then
|
|
launch system/Login
|
|
# nothing more
|
|
else
|
|
cd /boot/home
|
|
launch system/Tracker
|
|
launch system/Deskbar
|
|
|
|
# install ProcessController in the deskbar
|
|
(sleep 7; /boot/system/apps/ProcessController -deskbar) &
|
|
fi
|
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/media_server
|
|
launch $SERVERS/midi_server
|
|
fi
|
|
|
|
# Launch Print Server
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/print_server
|
|
fi
|
|
|
|
# Launch Mail Daemon (if enabled on startup)
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/mail_daemon "" -E
|
|
fi
|
|
|
|
# Launch CDDB Daemon
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
launch $SERVERS/cddb_daemon ""
|
|
fi
|
|
|
|
# Check for daily saving time
|
|
launch system/bin/dstcheck
|
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
# Start user boot script
|
|
if [ -f $HOME/config/boot/UserBootscript ]; then
|
|
. $HOME/config/boot/UserBootscript
|
|
fi
|
|
fi
|
|
|
|
# Check for fresh install and run post install scripts.
|
|
postInstallDir=/boot/common/boot/post_install
|
|
freshInstallIndicator=/boot/common/settings/fresh_install
|
|
if [ -e $freshInstallIndicator ]; then
|
|
# wait a moment for things to calm down a bit
|
|
sleep 3
|
|
|
|
# execute scripts
|
|
for f in $postInstallDir/*.sh; do
|
|
if [ -f $f ]; then
|
|
echo "Running post install script $f ..." > /dev/dprintf
|
|
$f
|
|
fi
|
|
done
|
|
|
|
sync
|
|
rm $freshInstallIndicator
|
|
fi
|