Author: rpmcruz
Date: Fri Jan 18 12:57:12 2008
New Revision: 43730
URL: http://svn.opensuse.org/viewcvs/yast?rev=43730&view=rev
Log:
10.3 fixes.
Added:
trunk/gtk/10_3/integrate/YaST2.call
trunk/gtk/10_3/integrate/yast2
trunk/gtk/10_3/integrate/yast2-funcs
Added: trunk/gtk/10_3/integrate/YaST2.call
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/integrate/YaST2.call?rev=43730&view=auto
==============================================================================
--- trunk/gtk/10_3/integrate/YaST2.call (added)
+++ trunk/gtk/10_3/integrate/YaST2.call Fri Jan 18 12:57:12 2008
@@ -0,0 +1,779 @@
+#!/bin/sh
+#================
+# FILE : YaST2.call
+#----------------
+# PROJECT : YaST (Yet another Setup Tool v2)
+# COPYRIGHT : (c) 2004 SUSE Linux AG, Germany. All rights reserved
+# :
+# AUTHORS : Steffen Winterfeldt
+# . Arvin Schnell
+# : Marcus Schaefer
+# :
+# BELONGS TO : System installation and Administration
+# :
+# DESCRIPTION : This is the main script to start the YaST2 installer
+# : according to the possible installation environments
+# : These are:
+# : ---
+# : - Standard Installation Qt/X11 or text based
+# : - Via serial line ttyS0/115200 baud, 8N1, RTS/CTS
+# : which is the same as the NCURSES mode
+# : - VNC Installation via browser
+# :
+# :
+# STATUS : $Id: YaST2.call 32688 2006-09-04 14:05:17Z locilka $
+#----------------
+#
+#set -x
+
+. /etc/YaST2/XVersion
+
+#=============================================
+# Functions...
+#---------------------------------------------
+#----[ wait_for_x11 ]----#
+function wait_for_x11() {
+#------------------------------------------------------
+# after a X-Server has been started you can wait until
+# the server is ready for requests using this function
+# ---
+ server_running=0
+ TESTX=/usr/sbin/testX
+ while kill -0 $xserver_pid 2>/dev/null ; do
+ sleep 1
+ if test -e /tmp/.X11-unix/X0 && test -x $TESTX ; then
+ $TESTX "$YaST2color" 2>/dev/null
+ err=$?
+ # exit code 1 -> XOpenDisplay failed...
+ if test $err = 1;then
+ log "\tTestX: XOpenDisplay failed"
+ server_running=0
+ continue
+ fi
+ # exit code 2 -> color or dimensions doesn't fit...
+ if test $err = 2;then
+ log "\tTestX: color or dimensions doesn't fit"
+ kill $xserver_pid
+ server_running=0
+ break;
+ fi
+ server_running=1
+ break
+ fi
+ done
+}
+
+#----[ get_bus_id ]----#
+function get_bus_id () {
+#------------------------------------------------------
+# ask the PCi bus for the location of the first
+# graphics card.
+# ---
+ for line in $(/sbin/lspci -n | grep "Class 0300" | cut -f 1 -d " ");do
+ echo $line |\
+ grep -q -E "^[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]"
+ if [ $? = 0 ];then
+ PCIBus=$(echo $line | cut -f1 -d:);
+ PCISlot=$(echo $line | cut -f2 -d: | cut -f 1 -d.);
+ PCIFunc=$(echo $line | cut -f2 -d.);
+ log "\tFound standard BusID: $PCIBus:$PCISlot:$PCIFunc"
+ printf "PCI:%d@0:%d:%d" \
+ 0x$PCIBus 0x$PCISlot 0x$PCIFunc
+ break
+ else
+ echo $line |\
+ grep -q -E "^[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]"
+ if [ $? = 0 ];then
+ PCIDomain=$(echo $line | cut -f1 -d:);
+ PCIBus=$(echo $line | cut -f2 -d:);
+ PCISlot=$(echo $line | cut -f3 -d: | cut -f 1 -d.);
+ PCIFunc=$(echo $line | cut -f2 -d.);
+ log "\tFound domain BusID: $PCIBus@$PCIDomain:$PCISlot $PCIFunc"
+ printf "PCI:%d@%d:%d:%d" \
+ 0x$PCIBus 0x$PCIDomain 0x$PCISlot 0x$PCIFunc
+ break
+ fi
+ fi
+ done
+}
+
+#----[ count_qt_geometry ]----#
+function count_qt_geometry () {
+ # current X-resolution, display 0
+ XRES=$(/usr/sbin/xquery -d :0 -r)
+
+ log "\t===Qt Geometry==="
+ log "\tResolution: ${XRES}"
+
+ # current X and Y resolution
+ XRES_X=$(echo $XRES | sed 's|[0123456789]\+ \([0123456789]\+\)x[0123456789]\+|\1|') #'
+ XRES_Y=$(echo $XRES | sed 's|[0123456789]\+ [0123456789]\+x\([0123456789]\+\)|\1|') #'
+
+ log "\tX: ${XRES_X}"
+ log "\tY: ${XRES_Y}"
+
+ # default values, minimal window 640x480
+ WINDOW_SIZE_X=640
+ WINDOW_SIZE_Y=480
+ OFFSET_X=0
+ OFFSET_Y=0
+ BACKGROUND_IMAGE=""
+
+ # cannot get any X-resolution
+ if [ "${XRES}" == "" ]; then
+ # cannot find out X resolution
+ WINDOW_SIZE_X=800
+ WINDOW_SIZE_Y=600
+ # reasonable
+ else
+ # FIXME: recount background image
+ BACKGROUND_IMAGE="/usr/lib/YaST2/startup/bkg.png"
+
+ # must be bigger or equal to 1400x1050
+ if [ "$(expr $XRES_X \>= 1400)" == "1" ] && [ "$(expr $XRES_Y \>= 1050)" == "1" ]; then
+ WINDOW_SIZE_X=1024
+ WINDOW_SIZE_Y=786
+ # must be bigger or equal to 800x600
+ elif [ "$(expr $XRES_X \>= 800)" == "1" ] && [ "$(expr $XRES_Y \>= 600)" == "1" ]; then
+ WINDOW_SIZE_X=800
+ WINDOW_SIZE_Y=600
+ fi
+
+ # X and Y offsets
+ OFFSET_X=$(expr ${XRES_X} - ${WINDOW_SIZE_X})
+ OFFSET_X=$(expr ${OFFSET_X} / 2)
+ OFFSET_Y=$(expr ${XRES_Y} - ${WINDOW_SIZE_Y})
+ OFFSET_Y=$(expr ${OFFSET_Y} / 2)
+ fi
+
+ log "\tWindow size X: ${WINDOW_SIZE_X}"
+ log "\tWindow size X: ${WINDOW_SIZE_Y}"
+ log "\tOffset X: ${OFFSET_X}"
+ log "\tOffset X: ${OFFSET_Y}"
+
+ # final window geometry, 'Window_XxWindow_Y+Offset_X+Offset_Y'
+ X_GEOMETRY="${WINDOW_SIZE_X}x${WINDOW_SIZE_Y}+${OFFSET_X}+${OFFSET_Y}"
+
+ log "\tUsed geometry: ${X_GEOMETRY}"
+}
+
+#----[ prepare_for_qt ]----#
+function prepare_for_qt () {
+#------------------------------------------------------
+# prepare Qt installation
+# ---
+ export LD_LIBRARY_PATH="/opt/gnome/lib:$LD_LIBRARY_PATH"
+
+ #=============================================
+ # Setup Qt environment
+ #---------------------------------------------
+ set_inst_qt_env
+ set_splash 100
+
+ #=============================================
+ # patch X11 conf. if not update/continue mode
+ #---------------------------------------------
+ if [ ! -f /var/lib/YaST2/runme_at_boot ];then
+ if [ ! -f /etc/X11/xorg.conf.instorig ];then
+ # create backup copy...
+ cp /etc/X11/xorg.conf /etc/X11/xorg.conf.instorig
+
+ # Activate correct device/screen section...
+ sed -e "s#Screen.*Screen\[.*\]#Screen "\""Screen[$X11_CONFIG_ID]#" \
+ /etc/X11/xorg.conf >/etc/X11/xorg.conf.new
+ mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
+
+ # update core pointer input device section...
+ if [ -f "/usr/sbin/xupdate" ];then
+ cat /etc/X11/xorg.conf | \
+ /usr/sbin/xupdate > /etc/X11/xorg.conf.new
+ mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
+ fi
+
+ # update driver and busID if accelerated driver should be used...
+ if [ "$X11_CONFIG_ID" = 0 ];then
+ # replace BusID placeholder with real busID
+ XBusID=$(get_bus_id)
+ if [ ! -z "$XBusID" ];then
+ sed -e 's/#BusID/BusID/' \
+ -e "s#1:0:0#$XBusID#" /etc/X11/xorg.conf \
+ > /etc/X11/xorg.conf.new
+ mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
+ fi
+
+ # replace driver placeholder with real name
+ sed -e "s#ChangeMe#$XServer#" /etc/X11/xorg.conf \
+ > /etc/X11/xorg.conf.new
+ mv /etc/X11/xorg.conf.new /etc/X11/xorg.conf
+ fi
+ fi
+ fi
+ #=============================================
+ # start X-Server and wait until ready
+ #---------------------------------------------
+ if [ ! -z "$NEED_XSERVER" ];then
+ export DISPLAY=:0
+ [ -z $Xstartpath ] || ln -snf $Xbindir/XFree86 /var/X11R6/bin/X
+ $Xexecutable -deferglyphs 16 2>/dev/tty8 1>&2 vt07 &
+ xserver_pid=$!
+ wait_for_x11
+ if [ "$server_running" = 1 ];then
+ log "\tX-Server is ready: $xserver_pid"
+ fi
+ fi
+ #=============================================
+ # set YaST2 Qt options for local displays
+ #---------------------------------------------
+ if [ ! -z "$NEED_XSERVER" ];then
+ Y2_UI_ARGS="--noborder --auto-fonts"
+ count_qt_geometry
+ if [ "${X_GEOMETRY}" != "" ]; then
+ Y2_UI_ARGS="${Y2_UI_ARGS} -geometry ${X_GEOMETRY}"
+ fi
+ fi
+}
+
+#----[ prepare_for_ncurses ]----#
+function prepare_for_ncurses () {
+#------------------------------------------------------
+# prepare NCURSES installation
+# ---
+ #=============================================
+ # Create Braille config if not update mode
+ #---------------------------------------------
+ if [ $INST_MODE = "normal" ];then
+ if [ ! -z "$Braille" ];then
+ log "Braille config needed, setting up braille display"
+ sed -e "s#brlname=.*#brlname=$Braille#" \
+ -e "s#brlport=.*#brlport=$Brailledevice#" /etc/suse-blinux.conf \
+ >/tmp/suse-blinux.conf
+ mv -f /tmp/suse-blinux.conf /etc
+ /etc/init.d/suse-blinux start
+ fi
+ fi
+ #=============================================
+ # Check for FbIterm
+ #---------------------------------------------
+ check_run_fbiterm
+ log "\tCheck for FB-I-terminal: RUN_FBITERM = $RUN_FBITERM"
+}
+
+#----[ prepare_for_ssh ]----#
+function prepare_for_ssh () {
+#------------------------------------------------------
+# prepare SSH installation
+# ---
+#
+ :
+}
+
+#----[ prepare_for_vnc ]----#
+function prepare_for_vnc () {
+#------------------------------------------------------
+# prepare VNC installation
+# ---
+#
+ #=============================================
+ # Setup splash screen
+ #---------------------------------------------
+ set_splash 100
+
+ #=============================================
+ # Setup y2base options
+ #---------------------------------------------
+ # xxx
+ #Y2_UI_ARGS="--fullscreen --noborder --auto-fonts"
+ Y2_UI_ARGS="--noborder --auto-fonts"
+
+ #=============================================
+ # Setup VNC server and start it
+ #---------------------------------------------
+ setupVNCAuthentication
+ if [ $VNCPASS_EXCEPTION = 0 ];then
+ disable_splash
+ startVNCServer
+ wait_for_x11
+ if [ "$server_running" = 1 ];then
+ log "\tXvnc-Server is ready: $xserver_pid"
+ fi
+ fi
+}
+
+function check_gtk()
+{
+ echo "silly stub check_gtk"
+ return 0
+}
+
+#----[ check_Qt ]----#
+function check_Qt () {
+#------------------------------------------------------
+# check if the prepared medium Qt is valid
+# ---
+ if [ ! -z "$NEED_XSERVER" ];then
+ if [ "$server_running" = 0 ];then
+ # /.../
+ # X-Server couldn't be started, selecting
+ # NCURSES mode as fallback ?
+ # ---
+ log "\tX-Server couldn't be started, falling back to ncurses"
+ Y2_MODE_FLAGS='("text_fallback")'
+ SELECTED_MEDIUM="NCURSES"
+ prepare_for_ncurses
+ Y2_MODE=ncurses
+ fi
+ else
+ /usr/sbin/testX --fast 2>/dev/null
+ if test $? = 1;then
+ log "\tCannot access Display: $DISPLAY, falling back to ncurses"
+ SELECTED_MEDIUM="NCURSES"
+ prepare_for_ncurses
+ Y2_MODE=ncurses
+ fi
+ fi
+}
+
+#----[ check_network ]----#
+function check_network () {
+#------------------------------------------------------
+# check if the prepared medium SSH is valid. It is valid
+# if there is a network interface accessable and we are
+# able to use ncurses or X11
+# ---
+ if ! found_iface ; then
+ # /.../
+ # No network interface found for SSH or VNC installation
+ # this is a fatal error here
+ # ---
+ log "\tNo network interface found, fatal error"
+ fatalError
+ fi
+ if [ ! -z "$DISPLAY" ];then
+ log "\tDisplay: $DISPLAY found for network install"
+ Y2_MODE=gtk
+ fi
+ if ! check_gtk ; then
+ log "\tQt plugin check failed falling back to ncurses"
+ Y2_MODE=ncurses
+ fi
+}
+
+#----[ check_vnc ]----#
+function check_vnc () {
+#------------------------------------------------------
+# check if the prepared medium VNC is valid
+# ---
+ check_network
+ if [ $VNCPASS_EXCEPTION = 1 ];then
+ log "\tVNC access has been disabled due to a password exception"
+ log "\tPlease make sure the password is at least 8 characters long"
+ fatalError
+ fi
+ if [ "$server_running" = 0 ];then
+ # /.../
+ # XVnc server couldn't be started, what to do now, I think
+ # this is a fatal error here
+ # ---
+ log "\tXVnc server couldn't be started, fatal error"
+ fatalError
+ fi
+}
+
+#----[ start_yast ]----#
+function start_yast () {
+#------------------------------------------------------
+# Start YaST2 refering to the contents of the Y2_*
+# startup variables
+# ---
+ local overcommit
+ read overcommit < /proc/sys/vm/overcommit_memory
+ echo "*** Starting YaST2 ***"
+ log "\tAllow big memory allocation: overcommit_memory=1"
+ echo 1 > /proc/sys/vm/overcommit_memory
+ if [ "$SPLASH" = yes -a -x /sbin/splash -a -n "$SPLASHCFG" ];then
+ /sbin/splash -t "YaST running"
+ fi
+ export QT_IM_MODULE=xim
+
+ if [ "$RUN_FBITERM" = "1" ]; then
+ OPT_FBITERM=/usr/bin/fbiterm
+ else
+ OPT_FBITERM=
+ fi
+
+ # set up a background if any needed
+ if [ "${BACKGROUND_IMAGE}" != "" ]; then
+ log "\tUsing background: ${BACKGROUND_IMAGE}"
+ fvwm-root --dither ${BACKGROUND_IMAGE}
+ fi
+
+ log "\tStarting YaST2:"
+ log "\tMODULE_NAME: $Y2_MODULE_NAME"
+ log "\tMODE_FLAGS: $Y2_MODE_FLAGS"
+ log "\tMODULE_ARGS: $Y2_MODULE_ARGS"
+ log "\tMODE: $Y2_MODE"
+ log "\tUI_ARGS: $Y2_UI_ARGS"
+ log "\tQT_IM_MODULE:$QT_IM_MODULE"
+ $OPT_FBITERM y2base \
+ "$Y2_MODULE_NAME" \
+ $Y2_MODE_FLAGS \
+ $Y2_MODULE_ARGS \
+ $Y2_MODE \
+ $Y2_UI_ARGS
+ Y2_EXIT_CODE=$?
+ Y2_ABORT_MESSAGE="YaST seems to be aborted abnormally !"
+ Y2_OK_MESSAGE="YaST procedure ended successfully"
+ if [ -s /etc/yast.inf ];then
+ #=============================================
+ # check yast.inf contents
+ #---------------------------------------------
+ cat /etc/yast.inf | grep -q -i "Aborted: 1"
+ if [ $? = 0 ];then
+ log "\t$Y2_ABORT_MESSAGE"
+ fi
+ else
+ #=============================================
+ # YaST ended successfully
+ #---------------------------------------------
+ log "\t$Y2_OK_MESSAGE"
+ fi
+ if [ $SELECTED_MEDIUM = "SSH" ] && [ ! "$VNC" = 1 ];then
+ echo "*** Preparing SSH installation for reboot ***"
+ echo "*** NOTE: after reboot, you have to reconnect and call ***"
+ echo "*** /usr/lib/YaST2/startup/YaST2.ssh ***"
+ log "\tPreparing SSH installation for reboot"
+ echo $Y2_EXIT_CODE > /tmp/YaST2_ssh_installation_finished
+ fi
+ if [ $Y2_EXIT_CODE -eq 0 ];then
+ start_yast_and_reboot
+ start_yast_again
+ fi
+ log "\tReset memory allocation: overcommit_memory=$overcommit"
+ echo $overcommit > /proc/sys/vm/overcommit_memory
+}
+
+#----[ start_yast_and_reboot ]----#
+function start_yast_and_reboot () {
+#------------------------------------------------------
+# This function will reboot the system and start yast
+# again by touching the file /var/lib/YaST2/runme_at_boot.
+# The function is triggered by the file /var/lib/YaST2/reboot
+# ---
+ if [ -f /var/lib/YaST2/reboot ];then
+ rm -f /var/lib/YaST2/reboot
+ touch /var/lib/YaST2/runme_at_boot
+ /sbin/shutdown -r now
+ fi
+}
+
+#----[ start_yast_again ]----#
+function start_yast_again () {
+#------------------------------------------------------
+# This function will restart yast again with the same
+# options as used before. The function is triggered by
+# the file /var/lib/YaST2/restart_yast
+# ---
+ if [ -f /var/lib/YaST2/restart_yast ];then
+ rm -f /var/lib/YaST2/restart_yast
+ start_yast
+ fi
+}
+
+#=============================================
+# Start the Magic :-)
+#=============================================
+# 1) Source common script functions
+#---------------------------------------------
+. /usr/lib/YaST2/startup/common/functions.sh
+. /usr/lib/YaST2/startup/requires
+. /usr/lib/YaST2/startup/arch/ia64/x11.sh
+
+#=============================================
+# 1.1) set splash progress bar to 90%
+#---------------------------------------------
+set_splash 90
+#=============================================
+# 1.2) set root HOME directory
+#---------------------------------------------
+export HOME=/root
+#=============================================
+# 1.3) set HTTP/FTP proxy and configure syslog
+#---------------------------------------------
+set_syslog ; set_proxy
+
+#=============================================
+# 2) Initialize...
+#---------------------------------------------
+# 2.1) setup PATH
+PATH=$ybindir:$PATH
+[ -z Xstartpath ] || PATH=/var/X11R6/bin:$PATH
+#=============================================
+# 2.2) get X11 driver directory
+#---------------------------------------------
+X11_DRIVER_DIR=$Xdriverpath
+if [ -d $Xdriver64path ];then
+ X11_DRIVER_DIR=$Xdriver64path
+fi
+#=============================================
+# 2.3) obtain RAM size in Kb
+#---------------------------------------------
+MEM_TOTAL=`awk '/^MemTotal:/{ print $2 }' /proc/meminfo`
+if [ ${#MEM_TOTAL} -gt 9 ];then
+ MEM_TOTAL=1000000000
+fi
+#=============================================
+# 2.4) check for valid framebuffer
+#---------------------------------------------
+FBDEV_OK=0
+if (: < /dev/fb0) 2>/dev/null ; then
+ FBDEV_OK=1
+fi
+#=============================================
+# 2.5) setup installation mode (update y/n)
+#---------------------------------------------
+INST_MODE="normal"
+if [ -f /var/lib/YaST2/update_mode ];then
+ INST_MODE="update"
+fi
+#=============================================
+# 2.6) import install.inf
+#---------------------------------------------
+import_install_inf
+
+#=============================================
+# 2.7) set LOG prefix
+#---------------------------------------------
+LOG_PREFIX="Stage [call]"
+
+#=============================================
+# 3) Medium prequalification
+#---------------------------------------------
+# Check which installation mediums can be used. There are
+# four mediums available: Qt(0) SSH(1), VNC(2) and NCURSES(3).
+# The following checks will create an array which contains
+# the possible mediums. An index of 1 indicates "can be used"
+# an index of 0 indicated "cannot be used"
+# ---
+MEDIUM=(1 1 1 1)
+
+#=============================================
+# 3.1) prequalification checks for Qt
+#---------------------------------------------
+log "Starting prequalification checks..."
+log "==================================="
+# 3.1.1) Qt plugin check...
+if ! check_gtk ; then
+ log "\tQt plugin check failed -> Medium Qt disabled"
+ MEDIUM[0]=0
+fi
+# 3.1.2) X-Server module check...
+# BEG IA64: use accelerated X11 driver
+ia64_check_x11
+# END IA64:
+XServerAccel=$XServer
+if [ "$XServer" = "vmware" ];then
+ if [ ! -f "$X11_DRIVER_DIR/${XServer}_drv.so" ];then
+ log "\t$XServer driver not installed -> Medium Qt disabled"
+ MEDIUM[0]=0
+ fi
+ X11_CONFIG_ID=vmware
+else
+ XServer=fbdev
+ if [ $FBDEV_OK -eq 0 ];then
+ log "\tNo Framebuffer available: Using vesa driver"
+ XServer=vesa
+ fi
+ if [ ! -f "$X11_DRIVER_DIR/${XServer}_drv.so" ];then
+ log "\t$XServer driver not installed -> Medium Qt disabled"
+ MEDIUM[0]=0
+ fi
+ X11_CONFIG_ID=$XServer
+fi
+if [ "$acceleratedx" = "1" ];then
+ if [ ! -f "$X11_DRIVER_DIR/${XServerAccel}_drv.so" ];then
+ log "\t$XServerAccel driver not installed -> X11 acceleration disabled"
+ else
+ log "\tUsing accelerated driver -> $XServerAccel"
+ MEDIUM[0]=1
+ XServer=$XServerAccel
+ X11_CONFIG_ID=0
+ fi
+fi
+# 3.1.3) Memory check >= 90MB for Qt/X11...
+if [ $MEM_TOTAL -lt "$MEM_NEEDED" ];then
+ log "\tMemory requirement > 90MB not fulfilled -> Medium Qt disabled"
+ MEDIUM[0]=0
+fi
+# 3.1.4) Check if we need to start our own X11 server...
+if [ -z "$DISPLAY" ];then
+ NEED_XSERVER=1
+fi
+# 3.1.5) Check for xorg.conf...
+if [ ! -f /etc/X11/xorg.conf ];then
+if [ ! -f $Xorgconftempl ];then
+ log "\tNo X11 configuration template found -> Medium Qt disabled"
+ MEDIUM[0]=0
+else
+ cp $Xorgconftempl /etc/X11/xorg.conf
+fi
+fi
+# 3.1.6) Check for WindowManager configuration
+if [ ! -f $Xsharedir/fvwm/fvwmrc.yast2 ];then
+ log "\tNo Windowmanager configuration found -> Medium Qt disabled"
+ MEDIUM[0]=0
+fi
+# 3.1.7) Check for remote display usage
+if [ ! -z $Display_IP ];then
+ log "\tRemote Display usage -> Medium Qt enabled"
+ log "\tExporting DISPLAY to host: $Display_IP:0.0"
+ export DISPLAY="$Display_IP:0.0"
+ NEED_XSERVER=""
+ MEDIUM[0]=1
+fi
+
+#=============================================
+# 3.2) prequalification checks for SSH
+#---------------------------------------------
+# 3.2.1) Check for SSH daemon
+if [ -f /var/run/sshd.*pid ];then
+ ps `cat /var/run/sshd.*pid` >/dev/null || MEDIUM[2]=0
+else
+ log "\tNo SSH daemon running -> Medium SSH disabled"
+ MEDIUM[1]=0
+fi
+
+#=============================================
+# 3.3) prequalification checks for VNC
+#---------------------------------------------
+# 3.3.1) Check for WindowManager configuration
+if [ ! -f $Xsharedir/fvwm/fvwmrc.yast2 ];then
+ log "\tNo Windowmanager configuration found -> Medium VNC disabled"
+ MEDIUM[2]=0
+fi
+# 3.3.2) Check for VNC X-Server binary
+if [ ! -x $Xbindir/Xvnc ] ; then
+ log "\tNo Xvnc server installed -> Medium VNC disabled"
+ MEDIUM[2]=0
+fi
+# 3.3.3) Check for testX binary
+if [ ! -x /usr/sbin/testX ] ; then
+ log "\tNo testX binary installed -> Medium VNC disabled"
+ MEDIUM[2]=0
+fi
+
+#=============================================
+# 4) Evaluate medium selection
+#---------------------------------------------
+# At this point we are evaluating the variables which have
+# been imported from the install.inf file into the current
+# environment. The standard method of installing the system
+# should be Qt based. Refering to the variables Textmode,
+# Braille, UseSSH and VNC another medium could be selected
+# VNC overrides UseSSH
+# ---
+log "Evaluate medium selection..."
+log "============================"
+SELECTED_MEDIUM="QT"
+if [ "$Textmode" = 1 ];then
+ log "\tMedium Textmode (ncurses) has been selected"
+ SELECTED_MEDIUM="NCURSES"
+fi
+if [ ! -z "$Braille" ];then
+ log "\tMedium Braille (ncurses) has been selected"
+ SELECTED_MEDIUM="NCURSES"
+fi
+if [ "$UseSSH" = 1 ];then
+ log "\tMedium SSH has been selected"
+ SELECTED_MEDIUM="SSH"
+fi
+if [ "$VNC" = 1 ];then
+ log "\tMedium VNC has been selected"
+ SELECTED_MEDIUM="VNC"
+fi
+
+#=============================================
+# 5) Check selected medium
+#---------------------------------------------
+# Refering to the prequalification check results we need to
+# check if the selected medium is valid according to the
+# MEDIUM flag entry. If the medium is not valid we will
+# fallback to NCURSES mode
+# ---
+log "Check selected medium..."
+log "========================"
+log "\tWished medium is: $SELECTED_MEDIUM"
+case $SELECTED_MEDIUM in
+ QT) {
+ if [ ${MEDIUM[0]} -eq 0 ];then
+ log "\tMedium Qt not available, falling back to ncurses"
+ SELECTED_MEDIUM="NCURSES"
+ fi
+ } ;;
+ SSH) {
+ if [ ${MEDIUM[1]} -eq 0 ];then
+ log "\tMedium SSH not available, falling back to ncurses"
+ SELECTED_MEDIUM="NCURSES"
+ fi
+ } ;;
+ VNC) {
+ if [ ${MEDIUM[2]} -eq 0 ];then
+ log "\tMedium VNC not available, falling back to ncurses"
+ SELECTED_MEDIUM="NCURSES"
+ fi
+ } ;;
+esac
+log "\tSelected medium is: $SELECTED_MEDIUM"
+
+#=============================================
+# 6) Prepare selected medium
+#---------------------------------------------
+case $SELECTED_MEDIUM in
+ QT) prepare_for_qt ; Y2_MODE=gtk ;;
+ SSH) prepare_for_ssh ; Y2_MODE=ncurses ;;
+ VNC) prepare_for_vnc ; Y2_MODE=gtk ;;
+ NCURSES) prepare_for_ncurses ; Y2_MODE=ncurses ;;
+esac
+
+#=============================================
+# 7) Check prepared medium
+#---------------------------------------------
+case $SELECTED_MEDIUM in
+ QT) check_Qt ;;
+ SSH) check_network ;;
+ VNC) check_vnc ;;
+esac
+
+# The prepare_for_ncurses in step 6 is kinda useless if step 7 can
+# change Y2MODE to ncurses in several ways
+# Anyway, #150799
+if [ "$Y2_MODE" = "ncurses" ]; then
+ Y2_UI_ARGS=--nothreads
+fi
+
+#=============================================
+# 8) Call YaST2
+#---------------------------------------------
+Y2_MODULE_NAME=${1:-installation}; shift
+Y2_MODULE_ARGS=\(\"$*\"\)
+start_yast
+
+#=============================================
+# 9) Clean sweep
+#---------------------------------------------
+# 9.1) clear Qt environment...
+clr_inst_qt_env
+
+# 9.2) kill X-Server...
+if [ "$server_running" = 1 ];then
+ sleep 1 && kill $xserver_pid
+ while kill -0 $xserver_pid 2>/dev/null ; do
+ sleep 1
+ done
+fi
+
+#=============================================
+# 10) exit with YaST2 exit code
+#---------------------------------------------
+exit $Y2_EXIT_CODE
+
+
Added: trunk/gtk/10_3/integrate/yast2
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/integrate/yast2?rev=43730&view=auto
==============================================================================
--- trunk/gtk/10_3/integrate/yast2 (added)
+++ trunk/gtk/10_3/integrate/yast2 Fri Jan 18 12:57:12 2008
@@ -0,0 +1,280 @@
+#!/bin/bash
+
+# File: /sbin/yast2
+# Module: yast2
+# Summary: YaST2 launch script
+#
+# This script is responsable to start the YaST setup tools. If no arguments
+# are given, a control center should be launched that will call this same script
+# with the wanted setup tool as an argument. In which case, we shall detect the
+# best YaST frontend to provide (eg. gtk for gnome, qt for kde, ncurses for console).
+#
+
+export PATH=/sbin:/usr/sbin:$PATH
+
+# load common script functions
+# (like the detection of frontend plugins)
+. /usr/lib/YaST2/bin/yast2-funcs
+
+# allow user to over-rule the default frontend via a global file
+FRONTEND="auto"
+if test -f /etc/sysconfig/yast2; then
+ . /etc/sysconfig/yast2
+fi
+
+# Arguments to be passed for frontend and the control center (like the --fullscreen)
+YAST_ARGS=""
+
+printhelp()
+{
+ echo "Usage: $0 [OPTIONS] [MODULE] [module specific parameters]"
+ echo
+ echo "OPTIONS:"
+ echo " -l, --list list all available modules"
+ echo " -g, --geometry default window size (graphical frontend only)"
+ echo " --noborder no window manager border for main window (graphical frontend only)"
+ echo " --fullscreen use full screen (graphical frontend only)"
+ echo " -s, --style widget style (qt only)"
+ echo " -h, --help this message"
+ echo
+ echo "exceptional case for installing packages:"
+ echo "$0 OPTION <package> [<package> [...]]"
+ echo
+ echo "OPTION:"
+ echo " -i, --install install rpm package"
+ echo
+ echo "<package> can be a single short package name (e.g. gvim)"
+ echo "which will be installed with dependency checking, or the full"
+ echo "path to an rpm package (e.g /tmp/gvim.rpm) which will be"
+ echo "installed without dependency checking"
+ echo
+}
+
+listmodules()
+{
+ list=`/bin/ls -1 /usr/share/applications/YaST2/*.desktop 2>/dev/null`
+
+ if [ -z "$list" ] ; then
+ echo "No modules installed"
+ else
+ echo "Available modules:"
+ echo
+ grep -h "Exec=/sbin/yast2 " $list | \
+ sed 's|Exec=/sbin/yast2 \([^ ]\+\)\( .*\)\?|\1|' | \
+ sort -u
+ fi
+}
+
+YCP_MENU="$ybindir/y2base menu"
+QT_MENU="$ybindir/y2controlcenter"
+GTK_MENU="/opt/gnome/bin/control-center"
+run_yast_menu()
+{
+ if [ $FRONTEND == "ncurses" ]; then
+ while true ; do
+ $YCP_MENU ncurses $YAST_ARGS
+ if [ ! -e "/var/lib/YaST2/restart_menu" ] ; then
+ break
+ fi
+ done
+ else # gtk or qt
+ if echo $WINDOWMANAGER | grep -qi "gnome" &&
+ [ -e $GTK_MENU ]; then
+ $GTK_MENU $YAST_ARGS
+ elif [ -e $QT_CONTROL_CENTER ]; then
+ $QT_MENU $YAST_ARGS
+ else
+ # run the same YCP menu of ncurses
+ $YCP_MENU $FRONTEND $YAST_ARGS
+ fi
+ fi
+}
+
+## PARSE arguments
+TEMP=`/usr/bin/getopt -o hlg:s:Si --long help,list,kcontrol,geometry:,style:,strings,install,fullscreen,noborder \
+ -n 'yast2' -- "$@"`
+
+if [ $? != 0 ] ; then
+ echo "Exit." >&2
+ exit 1
+fi
+
+# Note the quotes around `$TEMP': they are essential!
+eval set -- "$TEMP"
+
+while true ; do
+ case "$1" in
+ -h|--help) printhelp; exit 0 ;;
+ -l|--list) listmodules; exit 0 ;;
+ -g|--geometry) YAST_ARGS="$YAST_ARGS -geometry $2"; shift 2; ;;
+ -i|--install) Y2_INSTALL_PACKAGES=true; shift ;;
+ --fullscreen) YAST_ARGS="$YAST_ARGS --fullscreen"; shift ;;
+ --noborder) YAST_ARGS="$YAST_ARGS --noborder" ; shift ;;
+ --kcontrol) YAST_ARGS="$YAST_ARGS --kcontrol_id YaST" ; shift ;;
+ --) shift ; break ;;
+ *) echo "Unrecognized option $1" ; exit 1 ;;
+
+ # IMPORTANT: Remember to change that "getopt" call above, too
+ # if you change anything here!
+ esac
+done
+
+if [ "$Y2_INSTALL_PACKAGES" = "true" ]; then
+ export module=sw_single
+else
+ # allow module as argument, defaults to "menu"
+ export module="${1-menu}"
+ shift
+fi
+
+case "`/usr/bin/basename $0`" in
+ YaST|yast|yast1|zast)
+ unset DISPLAY
+ ;;
+esac
+
+if [ "$UID" = 0 ]; then
+ echo $$ > /var/run/yast.pid
+fi
+set_lang_from_sysconfig
+
+## CHECK what frontend we should use
+if [ $FRONTEND != "ncurses" ] && [ $FRONTEND != "qt" ] && [ $FRONTEND != "gtk" ] && \
+ [ $FRONTEND != "auto" ]; then
+ echo "Warning: specified frontend $FRONTEND is unknown."
+ FRONTEND="auto"
+fi
+
+if [ $FRONTEND == "auto" ]; then
+ if [ -z "$DISPLAY" ]; then
+ # using the terminal
+ FRONTEND="ncurses"
+ else
+ # running on X11
+ # TODO: maybe GTK could be the default one? ;-)
+ if echo $WINDOWMANAGER | grep -qi "gnome" || \
+ echo $WINDOWMANAGER | grep -qi "xfce" ; then
+ FRONTEND="gtk"
+ else
+ FRONTEND="qt"
+ fi
+ fi
+fi
+
+# fallbacks should go here so that an user preferred frontend also fallback
+if [ $FRONTEND == "gtk" ] && ! check_gtk && check_qt ; then
+ FRONTEND="qt"
+fi
+if [ $FRONTEND == "qt" ] && ! check_qt && check_gtk ; then
+ FRONTEND="gtk"
+fi
+if [ $FRONTEND != "ncurses" ] && ! check_qt && ! check_gtk ; then
+ FRONTEND="ncurses"
+fi
+if [ $FRONTEND == "ncurses" ] && ! check_ncurses; then
+ echo "Error: please install yast2-ncurses to use the YaST2 text mode interface"
+ exit 1
+fi
+
+## SET frontend specific environment settings and whatever they need
+if [ $FRONTEND == "ncurses" ]; then
+ TTY=`/usr/bin/tty`
+ # on console, start yast in UTF-8 locale (only on a 'local' console)
+ if [ "$TERM" = "linux" -a \( "$TTY" = /dev/console -o "$TTY" != "${TTY#/dev/tty[0-9]}" \) ] ; then
+ case "$LANG" in
+ # if it is known that a language doesn't yet work well with ncurses
+ # on console use English instead:
+ ja*|ko*|zh*)
+ export LANG=en_US.UTF-8
+ export LC_CTYPE=en_US.UTF-8
+ ;;
+ *)
+ # get rid of encoding and/or modifier
+ export LANG=${LANG%%[.@]*}.UTF-8
+ export LC_CTYPE=${LANG%%[.@]*}.UTF-8
+ ;;
+ esac
+ if /bin/testutf8 ; [ $? -ne 2 ] ; then
+ /usr/bin/test -x /bin/unicode_start && /bin/unicode_start
+ uc_started=1
+ fi
+ else
+ case "$TERM" in
+ vt*|xterm*|linux|screen*)
+ # probe terminal and fix lang settings
+ UTF8TESTED=0
+ # binary /bin/testutf8 is missing at least on s390x, #158001
+ /usr/bin/test -x /bin/testutf8 && UTF8TESTED=1 && /bin/testutf8
+ # return code of the /bin/testutf8
+ # 0=utf-unknown, 1=utf-ok, 2=utf-err
+ UTF8STATUS=$?
+
+ # not tested or not working UTF-8 support
+ if [ "$UTF8TESTED" == "1" ] && [ $UTF8STATUS -ne 2 ] ; then
+ /usr/bin/test -n "$LANG" && LANG=${LANG%.UTF-8}
+ /usr/bin/test -n "$LC_CTYPE" && LC_CTYPE=${LC_CTYPE%.UTF-8}
+ else
+ /usr/bin/test -n "$LANG" && LANG=${LANG%%[.@]*}.UTF-8
+ /usr/bin/test -n "$LC_CTYPE" && LC_CTYPE=${LC_CTYPE%%[.@]*}.UTF-8
+ fi
+ ;;
+ esac
+ fi
+
+ # this fixes launching of interactive subprocesses, #150799
+ YAST_ARGS="$YAST_ARGS --nothreads"
+fi
+
+if [ $FRONTEND == "qt" ]; then
+ set_qt_home_dir
+
+ # FIXME: why the hack was this done? full screening something that
+ # takes so much time to load is just annoying!
+ if echo $WINDOWMANAGER | grep -qi "kde" ; then
+ if [ $module == "sw_single" ] ; then
+ case "$YAST_ARGS" in
+ *fullscreen*) ;;
+ *) YAST_ARGS="$YAST_ARGS --fullscreen" ;;
+ esac
+ fi
+ fi
+fi
+
+## RUN the requested module
+if [ $module == "menu" ]; then
+ run_yast_menu
+else
+ # we do a cycle because we want to keep the online_update module alive as long
+ # as there are pending patches
+ while true ; do
+ # Transform every argument into a ycp string, that is surround all
+ # args by ("..."). args may contain spaces.
+ a=("$@")
+ b=("${a[@]/#/(\"}")
+ c=("${b[@]/%/\")}")
+ set -- "${c[@]}"
+
+ $ybindir/y2base $module "$@" $FRONTEND "$YAST_ARGS"
+
+ if [ ! $module == "online_update" ] || [ ! -e "/var/lib/YaST2/selected_patches.ycp" ] ; then
+ break
+ fi
+ done
+fi
+
+## LAST frontend specific changes
+if [ $FRONTEND == "ncurses" ]; then
+ if [ "$uc_started" ] ; then
+ /usr/bin/test -x /bin/unicode_stop && /bin/unicode_stop
+ fi
+fi
+
+## EXIT
+exit_code=$?
+
+if [ "$UID" = 0 ]; then
+ rm -f /var/run/yast.pid
+fi
+
+exit $exit_code
+
Added: trunk/gtk/10_3/integrate/yast2-funcs
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/integrate/yast2-funcs?rev=43730&view=auto
==============================================================================
--- trunk/gtk/10_3/integrate/yast2-funcs (added)
+++ trunk/gtk/10_3/integrate/yast2-funcs Fri Jan 18 12:57:12 2008
@@ -0,0 +1,141 @@
+# File: /usr/share/YaST2/bin/yast2-funcs
+# Module: yast2
+# Summary: Common functions for YaST2 start scripts
+# Authors: Arvin Schnell
+#
+# $Id: yast2-funcs 24861 2005-08-12 11:10:25Z locilka $
+
+# some path definitions
+ybindir=/usr/lib/YaST2/bin
+logdir=/var/log/YaST2
+
+
+# font for qt
+# obsolete, we should not need it anymore, adrian
+# Y2_XFONT="-gnu-unifont-medium-r-normal--16-160-75-75-p-80-iso10646-1"
+
+
+#
+# check if plugins are in lib or lib64 subdir and sets the variable
+# plugindir accordingly
+#
+function get_plugindir()
+{
+ plugindir=/usr/lib/YaST2/plugin
+ if `ldd $ybindir/y2base | egrep --quiet "/lib64/(.*/)?libc.so"` ; then
+ plugindir=/usr/lib64/YaST2/plugin
+ fi
+}
+
+#
+# check if the gtk plugin and all necessary libaries are present
+#
+function check_gtk()
+{
+ get_plugindir
+ Y2_GTK=$plugindir/libpy2gtk.so.2
+
+ if [ -e "$Y2_GTK" ] ; then
+ if ! `/usr/bin/ldd "$Y2_GTK" | grep --quiet "=> not found"` ; then
+ return 0 # success
+ fi
+ echo "warning: the gtk frontend is installed but does not work"
+ sleep 1
+ fi
+
+ return 1 # failure
+}
+
+#
+# check if the qt plugin and all necessary libaries are present
+#
+function check_qt()
+{
+ get_plugindir
+ Y2_QT=$plugindir/libpy2qt.so.2
+
+ if [ -e "$Y2_QT" ] ; then
+ if ! `/usr/bin/ldd "$Y2_QT" | grep --quiet "=> not found"` ; then
+ return 0 # success
+ fi
+ echo "warning: the qt frontend is installed but does not work"
+ sleep 1
+ fi
+
+ return 1 # failure
+}
+
+
+#
+# check if the ncurses plugin and all necessary libaries are present
+#
+function check_ncurses()
+{
+ get_plugindir
+ Y2_NCURSES=$plugindir/libpy2ncurses.so.2
+
+ if [ -e "$Y2_NCURSES" ] ; then
+ if ! `/usr/bin/ldd "$Y2_NCURSES" | grep --quiet "=> not found"` ; then
+ return 0 # success
+ fi
+ echo "warning: the ncurses frontend is installed but does not work"
+ sleep 1
+ fi
+
+ return 1 # failure
+}
+
+
+#
+# if LANG is empty set LANG to RC_LANG in /etc/sysconfig/language
+#
+function set_lang_from_sysconfig()
+{
+ # if LANG is "POSIX", unset LANG
+ # SL 9.3 had default LANG set to ""
+ # SL 10.0 has default LANG set to "POSIX"
+ if [ "$LANG" == "POSIX" ] ; then
+ LANG=""
+ fi
+
+ # if LANG is not empty and /etc/sysconfig/language exists
+ if [ -z "$LANG" -a -r /etc/sysconfig/language ] ; then
+ . /etc/sysconfig/language
+ if [ -n "$RC_LANG" ] ; then
+ export LANG=$RC_LANG
+ fi
+ fi
+}
+
+
+function set_qt_home_dir()
+{
+ local user="$USER"
+ if [ "$KDESU_USER" ]; then
+ user="$KDESU_USER"
+ fi
+ temp_QT_HOME_DIR="`eval echo ~$user/.qt/`"
+ if test -r "$temp_QT_HOME_DIR/qtrc"; then
+ export QT_HOME_DIR="$temp_QT_HOME_DIR"
+ fi
+}
+
+
+function set_inst_qt_env()
+{
+ export XCURSOR_THEME="crystalwhite"
+ export QT_HOME_DIR="`eval echo /tmp/.qt/`"
+ mkdir -p /tmp/.qt
+ [ -e /usr/share/desktop-data/qtrc ] && cp /usr/share/desktop-data/qtrc /tmp/.qt/
+}
+
+
+function clr_inst_qt_env()
+{
+ rm -rf /tmp/.qt/
+}
+
+
+### Local Variables: ***
+### mode: shell-script ***
+### End: ***
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org