home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- #
-
- # *** NOTE ***
- #
- # linuxrc now takes care of integrating the instsys. No need to fiddle with
- # symlinks and such here.
- #
- # linuxrc-based tools are in /lbin.
- #
- # linuxrc passes the root directory of the freshly mounted instsys in
- # the environment variable INSTSYS.
- #
-
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin:/lbin
-
- # tmpfs has mode 1777, sshd doesnt like that
- chmod 755 /
-
- # see bug 46535
- [ -e /proc/sys/vm/local-oom-kill ] && echo 1 > /proc/sys/vm/local-oom-kill
-
- if [ -f /.timestamp ] ; then
- read build_time < /.timestamp
- now_time=`TZ= LANG= LC_ALL= date +%Y%m%d`
- if [ "$now_time" -lt "$build_time" ] ; then
- echo
- echo "your system time is not correct:"
- TZ= date
- echo "setting system time to:"
- TZ= LANG= LC_ALL= date ${build_time#????*}1234${build_time%*????}.56
- echo
- /sbin/hwclock --systohc -u &
- sleep 3
- fi
- fi
-
- if [ -d /dev/pts ] ; then
- grep -q devpts /proc/mounts || mount -t devpts devpts /dev/pts
- fi
-
- # no old hotplug stuff
- echo > /proc/sys/kernel/hotplug
-
- # FIXME fix udev to not delete valid device nodes
- # /proc/self/fd/N will fail
- exec < /dev/console > /dev/console 2>&1 3>&1
-
- yast="$1"
- shift
- echo $yast > /tmp/linuxrc_installer_name
- export YAST2_SSH=false
- unset SSH_FAILED
- stty sane
-
- if [ -s /etc/install.inf ]; then
- # # fix fonts for japanese
- # lang=`awk '{ if(/^Locale:/) print $2 }' /etc/install.inf`
- # if [ "$lang" = ja_JP ]; then
- # rm -f /usr/X11R6/lib/X11/fonts/truetype/FZSongTi.ttf
- # rm -f /usr/X11R6/lib/X11/fonts/truetype/gulim.ttf
- # fi
- if [ "$(hostname)" = "(none)" ] ; then
- # hostname and domainname may come from cmdline
- if test -z "$hostname" ; then
- hostname=$(awk ' /^Hostname:/ { print $2 }' < /etc/install.inf)
- fi
- if test -z "$hostname" ; then
- hostname=$(awk ' /^IP:/ { print $2 }' < /etc/install.inf)
- fi
- if test -z "$hostname" ; then
- hostname=linux
- fi
-
- if test -z "$domain" ; then
- domain=$(awk ' /^Domain:/ { print $2 }' < /etc/install.inf)
- fi
- if test -z "$domain" ; then
- domain=local
- fi
- hostname $hostname
- domainname $domain
- fi
- #
- else
- # hostname may come from cmdline
- if test -z "$hostname" ; then
- hostname=`hostname`
- fi
- fi
- #
- # a few files should be restored when installation has completed if we
- # return to linuxrc.
- FILES_TO_RESTORE="/etc/ld.so.cache"
- for file in $FILES_TO_RESTORE ; do
- test -e $file && mv $file $file.initrd
- done
- #
-
- ldconfig
-
- # start dbus & hal
- if [ -x /usr/bin/dbus-daemon -a -x /usr/sbin/hald ] ; then
- rm -f /var/run/dbus/pid /var/run/hal/haldaemon.pid
- echo -n "starting hald..."
- if /usr/bin/dbus-daemon --system && /usr/sbin/hald ; then
- echo " ok"
- else
- echo " failed"
- fi
- fi
-
- # driver update: rebuild yast update tree
- [ -L /y2update ] && rm -f /y2update
- [ -d /update/y2update ] && mv /update/y2update /update/y2update.bak
- for i in /update/[0-9]*/y2update ; do
- [ -d "$i" ] && cp -a "$i" /update
- done
- if [ -d /update/y2update ] ; then
- rm -rf /update/y2update.bak
- else
- [ -d /update/y2update.bak ] && mv /update/y2update.bak /update/y2update
- fi
-
- # driver update: add files to inst-sys
- for i in /update/[0-9]*/inst-sys ; do
- [ -d "$i" ] && adddir "$i" /
- done
-
- # driver update: run update.pre scripts
- for i in /update/[0-9]*/install/update.pre ; do
- [ -x "$i" ] && "$i"
- done
-
- # unpack license files for yast
- if [ -f /license.zip ] ; then
- mkdir -p /var/lib/YaST2/license
- ( [ -d /var/lib/YaST2/license ] && cd /var/lib/YaST2/license && unzip -qqo /license.zip )
- fi
-
- # start syslog
- if [ -x /sbin/syslogd ] ; then
- checkproc /sbin/syslogd || {
- echo -n "starting syslogd (logging to /dev/tty4)..."
- sh -c '/sbin/syslogd >&1' 2>/dev/null
- echo " ok"
- }
- fi
-
- # start klog
- if [ -x /sbin/klogd ] ; then
- checkproc /sbin/klogd || {
- echo -n "starting klogd..."
- if /sbin/klogd -c 1 ; then
- echo " ok"
- else
- echo " failed"
- fi
- }
- fi
-
- # Update module config.
- #
- # Note: modules are all from initrd, but new ones might have come in via
- # driver updates.
- #
- depmod -a 2>/dev/null
-
- test -x /etc/init.d/ia32el && /etc/init.d/ia32el start
-
- # boot with usessh=1 or use linuxrc to enable ssh
- # vnc=1 will override the install mode
- if grep -q "^UseSSH:.*1" /etc/install.inf ; then
- test -x /sbin/inst_setup_ssh && . /sbin/inst_setup_ssh
- fi
-
- # for yast debugging.
- if grep -iwq y2debug < /proc/cmdline ; then
- export Y2DEBUG=1
- export Y2MAXLOGSIZE=50000
- export Y2MAXLOGNUM=5
- test -d $INSTSYS/root/.yast2 && cp -a $INSTSYS/root/.yast2 /root
- fi
-
- export XCURSOR_THEME=crystalwhite
- export YAST2_STORAGE_NO_EVMS=10.2
- grep -qwi give_me_evms_access /proc/cmdline && unset YAST2_STORAGE_NO_EVMS
-
- grep -qwi start_shell /proc/cmdline && START_SHELL=1
- grep -qi "^StartShell:.*1" /etc/install.inf && START_SHELL=1
- # leave a core file if yast crashes
- ulimit -c unlimited
-
- # start shell, useful on iSeries or via serial console
- function start_shell() {
- echo
- echo "ATTENTION: Starting shell... (use 'exit' to proceed)"
- bash --init-file /root/.bash_login
- }
- [ "$START_SHELL" ] && start_shell
-
- # anounce VNC via slpd
- if grep -qi "^VNC:.*1" /etc/install.inf ; then
- echo starting slpd to announce VNC...
- test -x /usr/sbin/slpd && /usr/sbin/slpd ; ec=$?
- if test "$ec" = "0" ; then
- (
- sleep 3
- /usr/bin/slptool register "service:YaST.installation.suse:vnc://${hostname}:5901"
- ) &> /tmp/slptool_register.txt &
- else
- echo "slpd returned with exit code $ec, VNC will not be announced"
- fi
- # vnc=1 usessh=1 should start sshd, but the result is a vnc installation
- YAST2_SSH=false
- fi
-
- ec=
- if [ "$YAST2_SSH" = "true" ] ; then
- cat <<EOF
-
- *** login using 'ssh -X root@${hostname}' ***
- *** run '$yast' to start the installation ***
-
- EOF
- while true ; do
- #echo -n .
- sleep 3
- # this file is created from YaST2.firstboot after installation
- test ! -f /tmp/YaST2_ssh_installation_finished && continue
- # you can touch this file to keep the ssh shell
- # useful for debugging the installer
- test -f /tmp/YaST2_keep_sshd_running && continue
- break
- done
-
- ec=$(cat /tmp/YaST2_ssh_installation_finished)
- rm -f /tmp/YaST2_ssh_installation_finished
- elif [ "$yast" = yast ] ; then
- # now, run yast
- echo "starting yast..."
- /sbin/yast "$@" ; ec=$?
- elif [ "$yast" ] ; then
- # now, run yast
- echo "starting $yast..."
- "$yast" "$@" ; ec=$?
- fi
-
- # start shell, useful on iSeries or via serial console
- [ "$START_SHELL" ] && start_shell
-
- # stop various daemons
- killall hald >/dev/null 2>&1
- killall dbus-daemon >/dev/null 2>&1
- killall slpd >/dev/null 2>&1
- killall Xvnc >/dev/null 2>&1
- killall sshd >/dev/null 2>&1
-
- umount devpts 2>/dev/null
-
- for file in $FILES_TO_RESTORE ; do
- test -e $file.initrd && mv $file.initrd $file
- done
-
- rm -f /etc/modules.conf
-
- # clean up after yast
- sed -n '1{h;n};x;H;${x;p}' /proc/mounts | awk '{ if($2 ~ /^\/var/) system("umount " $2) }'
-
- exit $ec
-
-