2004-11-03 19:36:40 +03:00
|
|
|
## The system's main boot script.
|
|
|
|
|
|
|
|
##
|
|
|
|
## Some functions used by the main script
|
|
|
|
##
|
|
|
|
|
2008-04-26 00:52:33 +04:00
|
|
|
# launch <executable path> [ <thread to wait for> [ <program args> ] ]
|
2004-11-03 19:36:40 +03:00
|
|
|
|
2005-01-19 05:46:12 +03:00
|
|
|
launch() {
|
2008-04-26 00:52:33 +04:00
|
|
|
toLaunch="$1"
|
|
|
|
shift
|
|
|
|
toWaitFor="$1"
|
|
|
|
shift
|
|
|
|
if [ -f "/boot/$toLaunch" ]
|
2004-11-03 19:36:40 +03:00
|
|
|
then
|
2008-04-26 00:52:33 +04:00
|
|
|
"/boot/$toLaunch" $* &
|
|
|
|
[ "$toWaitFor" != "" ] && waitfor "$toWaitFor"
|
2004-11-03 19:36:40 +03:00
|
|
|
return 1
|
|
|
|
else
|
2008-04-26 00:52:33 +04:00
|
|
|
echo There is no "$toLaunch"
|
2008-04-25 20:35:35 +04:00
|
|
|
fi
|
|
|
|
return 0
|
2009-04-03 13:02:44 +04:00
|
|
|
}
|
2004-11-03 19:36:40 +03:00
|
|
|
|
|
|
|
# launchscript <script path>
|
|
|
|
|
|
|
|
launchscript() {
|
|
|
|
if [ -f "/boot/$1" ]
|
|
|
|
then
|
|
|
|
. "/boot/$1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-11-23 02:33:02 +03:00
|
|
|
# runprog <executable path>
|
|
|
|
|
|
|
|
runprog() {
|
|
|
|
if [ -f "/boot/$1" ]
|
|
|
|
then
|
|
|
|
"/boot/$1"
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
echo There is no "$1"
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2004-11-03 19:36:40 +03:00
|
|
|
##
|
|
|
|
## Main script starts here
|
|
|
|
##
|
|
|
|
|
|
|
|
# Set up stdin/out/err to nirvana
|
|
|
|
|
|
|
|
exec </dev/null
|
2006-05-16 18:50:46 +04:00
|
|
|
exec >/dev/null 2>&1
|
2004-11-03 19:36:40 +03:00
|
|
|
|
2005-01-19 05:46:12 +03:00
|
|
|
# Standard locations of boot files
|
2009-04-03 13:02:44 +04:00
|
|
|
SCRIPTS=system/boot
|
|
|
|
SERVERS=system/servers
|
2005-01-19 05:46:12 +03:00
|
|
|
|
2008-05-08 17:42:33 +04:00
|
|
|
# clean the shared memory dir
|
|
|
|
shmDir=/boot/var/shared_memory
|
|
|
|
rm -rf $shmDir
|
2009-04-03 13:02:44 +04:00
|
|
|
mkdir -p $shmDir
|
2008-05-08 17:42:33 +04:00
|
|
|
chmod 777 $shmDir
|
|
|
|
|
2004-11-03 19:36:40 +03:00
|
|
|
# Set up the environment
|
|
|
|
|
2004-11-25 21:39:09 +03:00
|
|
|
export SAFEMODE=`/bin/safemode`
|
|
|
|
|
2004-11-03 19:36:40 +03:00
|
|
|
launchscript $SCRIPTS/SetupEnvironment
|
|
|
|
|
2008-03-06 04:20:09 +03:00
|
|
|
# If the boot volume is a CD we use another script
|
|
|
|
iw=`/bin/isvolume -readonly /boot`
|
|
|
|
if [ "$iw" = "yes" ]; then
|
|
|
|
launchscript $SCRIPTS/Bootscript.cd
|
|
|
|
exit 0 # and return
|
|
|
|
fi
|
|
|
|
|
2004-11-25 21:39:09 +03:00
|
|
|
# Sets timezone etc.
|
2009-04-03 13:02:44 +04:00
|
|
|
runprog system/bin/clockconfig
|
2004-11-23 02:33:02 +03:00
|
|
|
|
2005-01-16 00:34:20 +03:00
|
|
|
# Launch servers
|
|
|
|
|
2005-01-19 05:46:12 +03:00
|
|
|
# We must wait for the app_server and registrar to be ready
|
2005-07-15 16:31:59 +04:00
|
|
|
launch $SERVERS/registrar _roster_thread_ # launch registrar
|
|
|
|
|
|
|
|
launch $SERVERS/debug_server # launch debug_server
|
|
|
|
|
2007-01-15 19:16:10 +03:00
|
|
|
# Init Network
|
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
2008-04-25 20:35:35 +04:00
|
|
|
launch $SERVERS/net_server # launch net_server
|
2007-01-15 19:16:10 +03:00
|
|
|
fi
|
|
|
|
|
2005-06-07 04:54:23 +04:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
|
|
launch $SERVERS/app_server picasso # launch app_server
|
|
|
|
else
|
|
|
|
launch $SERVERS/fake_app_server picasso
|
|
|
|
fi
|
|
|
|
|
2005-01-19 05:46:12 +03:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
|
|
launch $SERVERS/syslog_daemon
|
2006-12-24 02:00:37 +03:00
|
|
|
waitfor _input_server_event_loop_ # wait for input devices
|
2005-01-19 05:46:12 +03:00
|
|
|
fi
|
|
|
|
|
2006-03-02 11:29:18 +03:00
|
|
|
# Launch Terminal or consoled depending on $SAFEMODE
|
2005-06-07 04:54:23 +04:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
2008-01-12 04:36:28 +03:00
|
|
|
if [ -e /etc/users ]; then
|
2009-04-03 13:02:44 +04:00
|
|
|
launch system/Login
|
2008-01-12 04:36:28 +03:00
|
|
|
# nothing more
|
|
|
|
else
|
2009-04-03 13:02:44 +04:00
|
|
|
launch system/Tracker
|
|
|
|
launch system/Deskbar
|
2008-01-14 00:15:38 +03:00
|
|
|
|
|
|
|
# install ProcessController in the deskbar
|
2009-04-03 13:02:44 +04:00
|
|
|
(sleep 7; /boot/system/apps/ProcessController -deskbar) &
|
2008-01-12 04:36:28 +03:00
|
|
|
fi
|
2009-04-03 13:02:44 +04:00
|
|
|
launch system/apps/Terminal
|
2005-06-07 04:54:23 +04:00
|
|
|
else
|
2009-04-03 13:02:44 +04:00
|
|
|
launch system/bin/consoled
|
2005-06-07 04:54:23 +04:00
|
|
|
fi
|
2005-01-16 00:34:20 +03:00
|
|
|
|
2006-03-12 17:21:39 +03:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
|
|
launch $SERVERS/media_server
|
2006-06-30 01:57:15 +04:00
|
|
|
launch $SERVERS/midi_server
|
2006-03-12 17:21:39 +03:00
|
|
|
fi
|
|
|
|
|
2009-04-03 13:02:44 +04:00
|
|
|
# Launch Print Server
|
2007-05-20 23:04:58 +04:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
|
|
launch $SERVERS/print_server
|
|
|
|
fi
|
|
|
|
|
2008-04-25 20:35:35 +04:00
|
|
|
# Launch Mail Daemon (if enabled on startup)
|
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
2008-04-26 00:52:33 +04:00
|
|
|
launch $SERVERS/mail_daemon "" -E
|
2008-04-25 20:35:35 +04:00
|
|
|
fi
|
|
|
|
|
2004-12-14 19:38:47 +03:00
|
|
|
# Check for daily saving time
|
2009-04-03 13:02:44 +04:00
|
|
|
launch system/bin/dstcheck
|
2004-12-14 19:38:47 +03:00
|
|
|
|
2006-03-02 11:29:18 +03:00
|
|
|
if [ "$SAFEMODE" != "yes" ]; then
|
|
|
|
# Start user boot script
|
|
|
|
if [ -f $HOME/config/boot/UserBootscript ]; then
|
|
|
|
. $HOME/config/boot/UserBootscript
|
|
|
|
fi
|
|
|
|
fi
|
2008-03-06 01:25:33 +03:00
|
|
|
|
2008-05-04 17:10:42 +04:00
|
|
|
# Check for fresh install and run post install scripts.
|
2008-05-07 02:47:38 +04:00
|
|
|
postInstallDir=/boot/common/boot/post_install
|
|
|
|
freshInstallIndicator=/boot/common/settings/fresh_install
|
2008-05-04 17:10:42 +04:00
|
|
|
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
|
2008-03-06 01:25:33 +03:00
|
|
|
fi
|