yast/yast-installation

View on GitHub
startup/YaST2.Second-Stage

Summary

Maintainability
Test Coverage
#!/bin/bash
#================
# FILE          : YaST2.Second-Stage
#----------------
# PROJECT       : YaST (Yet another Setup Tool v2)
# COPYRIGHT     : (c) 2004 SUSE Linux AG, Germany. All rights reserved
#               :
# AUTHORS       : Marcus Schaefer <ms@suse.de>
#               :
# BELONGS TO    : System installation and Administration
#               :
# DESCRIPTION   : This is the second stage YaST2 startup level after
#               : the first part of the installation has been finished.
#               : We will now prepare YaST2 for the so called continue
#               : mode
#               :
# STATUS        : $Id$
#----------------
#set -x

# when installing over serial console, something sents SIGHUP to 
# YaST2.Second-Stage which causes second stage of install to not
# be executed which in turn leads to broken autoyast installs
# (e.g. bnc#825728, bnc#823224). 
# Ignoring SIGHUP seems easiest workaround here
trap "" SIGHUP

#=============================================
# Functions...
#---------------------------------------------
function startYaST2 () {
    /usr/lib/YaST2/startup/YaST2.call installation continue
}

#=============================================
# 1) Source common script functions
#---------------------------------------------
. /usr/lib/YaST2/startup/common/functions.sh

#=============================================
# 1.0) Checking for text installation in
#      Multi-User mode
#---------------------------------------------
# If the system starts in multi-user mode plymouth
# will be quit while installation in order to ensure
# that installation will be finished on console 1 and the
# login prompt. So we have to ensure that the second
# stage of installation has to be run in ncurses mode.
# (bnc#903682,889757,897956)
if [ `systemctl get-default` = "multi-user.target" ];then
    if [ -f /etc/install.inf ];then
    sed -i 's/Textmode: 0/Textmode: 1/g' /etc/install.inf
    fi
fi

#=============================================
# 1.1) turn off splash screen, be verbose
#---------------------------------------------
disable_splash

#=============================================
# 1.2) import /etc/install.inf
#---------------------------------------------
import_install_inf

#=============================================
# 1.3) setup architecture variables
#---------------------------------------------
ARCH_ISERIES=0
ARCH_ZSERIES=0
if is_iseries ; then
    ARCH_ISERIES=1
fi
#...

#=============================================
# 1.4) prepare reset of manpages,info dirs,...
#---------------------------------------------
mkdir -p /var/adm/SuSEconfig
touch /var/adm/SuSEconfig/run-texhash
for i in \
    /usr/share/info/            \
    /usr/lib/info/              \
    /usr/local/info/            \
    /usr/local/lib/info/        \
    /usr/info                 \
    /usr/lib/xemacs/info/     \
    /var/adm/packages
do
    test -d $i && touch $i 2> /dev/null
done
for i in \
    /usr/share/info             \
    /usr/man /usr/share/man     \
    /usr/openwin/man            \
    /usr/lib/perl5/man          \
    /usr/lib/teTeX/man          \
    /usr/local/man
do
    if [ -d $i ] ; then
        find $i -follow -type d 2> /dev/null | xargs touch 2> /dev/null
    fi
done

#=============================================
# 1.5) start startup logging <y2start.log>
#---------------------------------------------
LOG_PREFIX="Stage [2]"
log "YaST2 startup level (2)..."
log "=========================="
log_export

#=============================================
# 1.6) call preSecondStage hook scripts...
#---------------------------------------------
callHooks preSecondStage

#=============================================
# 1.7) create stage list...
#---------------------------------------------
log "\tLevel 2 stages:"
createStageList "S" "/usr/lib/YaST2/startup/Second-Stage"
for i in ${STAGE_LIST[*]};do
    BS=`basename $i` && log "\t$BS"
done

#=============================================
# 1.8) start level scripts
#---------------------------------------------
callStages

#=============================================
# 1.9) call postSecondStage hook scripts...
#---------------------------------------------
callHooks postSecondStage

#=============================================
# Installation finished, yeah :-)
#---------------------------------------------
exit