Added post-install script, and start UserBootscript again.

* This is the final missing piece of the former boot process.
* Removed the unused Bootscript, and Bootscript.cd files.
This commit is contained in:
Axel Dörfler 2015-07-17 22:15:38 +02:00
parent 58fd8acd78
commit 65ed8a5e87
6 changed files with 32 additions and 283 deletions

View File

@ -121,7 +121,7 @@ AddSymlinkToPackage bin : trash : untrash ;
AddSymlinkToPackage bin : less : more ;
# scripts and data files
local bootScripts = Bootscript Bootscript.cd SetupEnvironment
local bootScripts = PostInstallScript SetupEnvironment
InstallerInitScript InstallerFinishScript ;
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
AddFilesToPackage boot : $(bootScripts) ;

View File

@ -70,6 +70,11 @@ service x-vnd.Haiku-power_daemon {
legacy
}
job post-install {
launch /bin/sh /system/boot/PostInstallScript
if file_exists /boot/system/settings/fresh_install
}
target login {
job x-vnd.Haiku-autologin {
launch /system/bin/autologin

View File

@ -17,6 +17,10 @@ target desktop {
}
}
job user-bootscript {
launch /bin/sh /boot/home/config/settings/boot/UserBootscript
}
job create-installer-link {
# When run from a read-only medium a.k.a. live desktop
if {

View File

@ -1,212 +0,0 @@
## 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=/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
# Create /tmp dir, and make sure it's empty
TMPDIR=/boot/system/cache/tmp
if [ ! -d $TMPDIR ]; then
mkdir -f $TMPDIR
chmod a+rwx $TMPDIR
else
rm -rf $TMPDIR/*
fi
# Launch servers
# We must wait for the app_server and registrar to be ready
launch $SERVERS/registrar _roster_thread_ # launch registrar
# If app_server doesn't exist, just run consoled.
if [ ! -f "/boot/$SERVERS/app_server" ]; then
/bin/consoled
exit
fi
launch $SERVERS/debug_server # launch debug_server
launch $SERVERS/package_daemon
# 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.
localeSettings=/boot/home/config/settings/Locale\ settings
if [ "$isReadOnly" = "yes" -o ! -e "$localeSettings" ]; then
/bin/FirstBootPrompt
if [ $? -eq 0 ]; then
launchscript $SCRIPTS/Bootscript.cd
exit 0 # and return
elif [ "$isReadOnly" = "yes" ] ; then
# Create Installer link (using the write overlay)
ln -sf /boot/system/apps/Installer /boot/home/Desktop/Installer
fi
fi
if [ -e /etc/users ]; then
# TODO: system/Login needs to be fixed to launch the mount_server!
launch system/Login
# nothing more
else
cd /boot/home
launch $SERVERS/mount_server
waitfor -m application/x-vnd.Haiku-mount_server
# delay the boot script until all previous volumes have been mounted
hey -s mount_server DO InitialScan
launch system/Tracker
launch system/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
# Launch Notification Server
if [ "$SAFEMODE" != "yes" ]; then
launch $SERVERS/notification_server ""
fi
# Launch Power Daemon
if [ "$SAFEMODE" != "yes" ]; then
launch $SERVERS/power_daemon ""
fi
# Check for daylight saving time
launch system/bin/dstcheck
# Synchronize network time
launch system/preferences/Time "" --update
if [ "$SAFEMODE" != "yes" ]; then
# Start user boot script
if [ -f $HOME/config/settings/boot/UserBootscript ]; then
. $HOME/config/settings/boot/UserBootscript
fi
fi
# Check for fresh install and run post install scripts.
freshInstallIndicator=/boot/system/settings/fresh_install
postInstallDir=boot/post-install
if [ -e $freshInstallIndicator ]; then
# wait a moment for things to calm down a bit
sleep 3
# execute scripts
for f in /boot/system/$postInstallDir/*.sh
do
if [ -f $f ]; then
echo "Running post install script $f ..." > /dev/dprintf
$f
fi
done
sync
rm $freshInstallIndicator
fi

View File

@ -1,70 +0,0 @@
## The system's main CD boot script.
##
## Some functions used by the main script
##
# launch <executable path> [thread to wait for]
launch() {
if [ -f "/boot/$1" ]
then
"/boot/$1" &
[ "$2" != "" ] && waitfor "$2"
return 1
else
echo There is no "$1"
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
##
# Launch Installer
cd /boot/home
if [ -x /boot/system/apps/Installer ]; then
/boot/system/apps/Installer
else
/boot/system/apps/Terminal
fi
# sync disks
/bin/sync
# prepare for reboot
# (reboot quickly in 10 seconds)
# (we must start the shutdown process before /boot is ejected)
/bin/shutdown -r -q -d 10 &
# unblock the CD tray
/bin/eject -u /boot
# and open it before rebooting
/bin/eject /boot

View File

@ -0,0 +1,22 @@
#!/bin/sh
# Check for fresh install and run post install scripts.
freshInstallIndicator=/boot/system/settings/fresh_install
postInstallDir=boot/post-install
if [ -e $freshInstallIndicator ]; then
# wait a moment for things to calm down a bit
sleep 3
# execute scripts
for f in /boot/system/$postInstallDir/*.sh
do
if [ -f $f ]; then
echo "Running post install script $f ..." > /dev/dprintf
$f
fi
done
sync
rm $freshInstallIndicator
fi