Idea ID: 2874598

gw server install script should have an command line option to update installed programs unattended

Status : New Idea

my suggestion is, that if you lunch gw18.4.1-141232-66_full_linux_multi/install.sh with a command line option, it will update all the installed gw programs of this package without querying for further input.

this would simplify the update process for environments with many gw servers

it would also allow for easy unattended update of gw servers using something like ZCM

if updating all installed products takes too much change, then implementing options to do the selections via command line instead of menu would also fit the purpose. For example:

gw18.4.1-141232-66_full_linux_multi/install.sh -i -p server

gw18.4.1-141232-66_full_linux_multi/install.sh -i -p ma

-i for installation

-p server for selecting Groupwise Server

-p ma for selecting Groupwise Monitor Agent

Labels:

Administration
  • thanks Mike,

    for me it works mostly, but I see that grpwise-ma is not restarted without any changes. no problems about the gui however

  • No it won't work.
    Use a text editor (notepad++) to compare both files and you'll see the differences.
    Some if-statements have changed and the check which detects graphical mode.
    Even if we're not running the graphical mode and starting the install in a remote shell the install is not starting because of that check.

  • thanks Mike,

    did not know about this option. would ./install_server.sh -q not work just as well? could not see any changes you made that would prevent that from working

  • We do this with a slightly modified install_server.sh (install_server_silent.sh).
    ./install_server_silent.sh -q

    #!/bin/sh
    #  Author: PAH
    # Company: Novell Inc. 
    # Purpose: To install Novell GroupWise Server on Linux
    #
    # Code Standard: Ensure that functions follow the following standard:
    #
    #                # Comment describing what the function does
    #        FunctionName()
    #        {
    #           DoActionsInsideFunction
    #        }
    . ../install.conf
    . ../launcher/en-us.msg
    . ../launcher/install_functions.sh
    . ./install_server.conf
    
    if [ -z $FILE_LICENSE]
    then
        FILE_LICENSE=../license/licenseen.txt
    fi
    
    if [ ! -z $FILE_LANG_CONF ] 
    then
        . $FILE_LANG_CONF
    fi
    
    if [ -z $DIALOGRC_CONF_LANG ] 
    then
        DIALOGRC_CONF_LANG=en
    fi
    
    SetVars_General()
    {
        # Supported Operating Systems for this script
        SUPPORTED_OS="Linux"
    
        # Get the SLES version (hack)
        if [[ `grep "Server 11" /etc/issue` ]]; then
            SLES_VERSION="11"
        elif [[ `grep "Server 12" /etc/issue` ]]; then
            SLES_VERSION="12"
        else
            SLES_VERSION="unknown"
        fi
    
        # Null Device
        NULLDEV=/dev/null
    
        CMD_HOSTOS="uname -s"
    
        # Initialize the values for "YES", "NO", "INVALID", "TRUE", "FALSE" "ENABLED" and "DISABLED"
        TRUE=1; FALSE=0; YES=$TRUE; NO=$FALSE; INVALID=999; ENABLED=1; DISABLED=2
    
        INPUT="/tmp/`basename $0`.$$"
    
        # Return codes from dialog
        INPUT_OK=0
        INPUT_CANCEL=1
        INPUT_ESC=255
        INPUT_HELP=2
    
        # Default menu width & height
        MENU_WIDTH=45
        MENU_HEIGHT=7
        
        # Default infobox width & height
        INFOBOX_WIDTH=76
        INFOBOX_HEIGHT=19
        
        # Default msgbox width & height
        MSGBOX_WIDTH=110
        MSGBOX_HEIGHT=14
        
        # Enable lang chars to be displayed (need to be in UTF-8 within putty)
        TERM=linux     
    
        RPM_GWMON_INSTALLED=$FALSE
    }
    
    GetHostOS()
    {
        OS="`$CMD_HOSTOS`"
    }
    
    VerifySupportedOS()
    {
        for CHECKOS in $SUPPORTED_OS
        do
            if [ "$OS" = "$CHECKOS" ]
            then
                return 1
            fi
        done
        printf "$MSG_OS_NOT_SUPPORTED" $OS
        exit 1
    }
    
    CheckCommandline()
    {
        while [ "$#" -gt "0" ]
        do
            case $1 in
                "-h" | "--help")        DisplayCommandlineHelp ;;
                "-q" | "--quick")       QUICK_INSTALL=$TRUE ;
                			    LICENSE_AGREED=$TRUE ;;
                *)                      DisplayCommandlineHelp ;;
            esac
            shift
        done     
    }
    
    DisplayCommandlineHelp()
    {
        printf "Syntax: $0 [options]\n"
        printf "Where [options] is one of the following switches:\n"
        printf "  -h   --help\n"
        printf "       Displays this command line help.\n"
        printf "\n"
        exit 2
    }
    
    DisplayLicense()
    {
        if [ "$LICENSE_AGREED" != "$TRUE" ]
        then
            DIALOGRC=../launcher/dialog_license_${DIALOGRC_CONF_LANG}.conf dialog  --colors --backtitle "\Z7$PRODUCT_TITLE" --title "\Z0$MSG_LICENSE_AGREE" \
    		--ok-label "$MSG_DISAGREE" --no-cancel \
                    --extra-button --extra-label "$MSG_AGREE" \
                    --textbox $FILE_LICENSE $INFOBOX_HEIGHT \
                    $INFOBOX_WIDTH
            rc=$?
    
            case $rc in
                    3)      LICENSE_AGREED=$TRUE;;
                    *)      LICENSE_AGREED=$FALSE;;
            esac
            export LICENSE_AGREED
        fi
    }
    
    MenuMain()
    {
       local menuExit=$FALSE
       local menuDefault=1
       local menuItems=2
       local menuItemsHeight=`expr $MENU_HEIGHT + $menuItems`
       local _dialogrc=../launcher/dialog_menu_okexit_${DIALOGRC_CONF_LANG}.conf
       
       if [ "$MSG_EXIT" == "$MSG_BACK" ]
       then
    	_dialogrc=../launcher/dialog_menu_okback_${DIALOGRC_CONF_LANG}.conf
       fi
    
       while [ $menuExit == $FALSE ]
       do
    	DIALOGRC=${_dialogrc} dialog  --colors --backtitle "\Z7$PRODUCT_TITLE" --item-help --default-item "$menuDefault" --ok-label "$MSG_OK" --exit-label "$MSG_EXIT" --cancel-label "$MSG_EXIT" --menu "$MSG_SELECT_OPT" $menuItemsHeight $MENU_WIDTH $menuItems \
            	"1" "$MSG_MENU_OPT_INSTALL"     ""      \
                    "2" "$MSG_MENU_OPT_CONFIGURE"    ""      \
                     2>"${INPUT}"
           rc=$?
    
    	if [ $rc == $INPUT_CANCEL ]
    	then
    	    menuExit=$TRUE
    	    return;
    	else
    	   input=$(<"${INPUT}")
       	   menuDefault=$input
    	   case $input in
    	       1)	Install;
    	       		Pause;;
    	       2)	Configure;;
    	   esac
    	fi
           menuExit=$FALSE
       done
    }
    
    Configure()
    {
        local _gwadmininfo=/opt/novell/groupwise/admin/gwadmin.info
        local _gwadmin_port=
        local _gwadmin_addr=
        local _netstat=netstat
        
        if ! [ -x "$(command -v netstat)" ]; then
            _netstat=ss
        fi
        DisplayMsg "$MSG_WAIT_FOR_GWADMIN_SERVICE"
        
        which rcgrpwise 1>$NULLDEV 2>$NULLDEV
        rc=$?
        if [ $rc = 0 ]
        then
    	rcgrpwise start 1>$NULLDEV 2>$NULLDEV
        fi
        
        while [ ! -e $_gwadmininfo ]
        do
            sleep 1
        done
        
        while read line;
        do
        	local _key=`echo $line | cut -d = -f 1`
     	local _value=`echo $line | cut -d = -f 2`
     	
     	if [[ "$_key" == *.port* ]]
     	then
     	    _gwadmin_port=$_value
     	fi
     	
     	if [[ "$_key" == *.addr* ]]
     	then
     	    _gwadmin_addr=$_value
     	fi
     	
     	if [ "$_gwadmin_port" != "" -a "$_gwadmin_addr" != "" ]
     	then
     	    break
     	fi
        done < $_gwadmininfo
        
        if [ "$_gwadmin_port" == "" ]
        then
            _gwadmin_port=9710
        fi
        
        if [ "$_gwadmin_addr" == "" -o "$_gwadmin_addr" == "0.0.0.0" ]
        then
            _gwadmin_addr=`hostname | cut -d . -f 1; domainname | cut -d . -f 2-9999 | grep -v none`
        fi
    
        rc=1    
        while [ "$rc" != "0" ]
        do
        	_tmp=`$_netstat -nap|grep LIST|grep $_gwadmin_port`
        	rc=$?
        done
        
        _gwadmin_token="`/opt/novell/groupwise/admin/gwadmin-ipc authorize`"
        
        if [ "$_gwadmin_token" == "" ]
        then
        	_gwadmin_token="Error: No token was generated via gwadmin-ipc"
    	local _msg="`printf "$MSG_CONFIGURE_SERVER" "$_gwadmin_addr" "$_gwadmin_port" "" "$_gwadmin_addr" "$_gwadmin_port"`"    	
        else
    	local _msg="`printf "$MSG_CONFIGURE_SERVER" "$_gwadmin_addr" "$_gwadmin_port" "$_gwadmin_token" "$_gwadmin_addr" "$_gwadmin_port"`"
        fi
    
        dialog  --colors --backtitle "\Z7$PRODUCT_TITLE" --ok-label "$MSG_BACK" --msgbox "$_msg" $MSGBOX_HEIGHT $MSGBOX_WIDTH
    }
    
    Install()
    {
        ImportRpmKey ../launcher
        IsPlat64
        rc=$?
        
        if [ "$rc" == "$FALSE" ]
        then
    	return    
        fi
    
        if [ "$QUICK_INSTALL" != "$TRUE" ]
        then
            clear
        fi
        printf "$MSG_INSTALLING\n" "$PRODUCT_NAME"
        
        which rcgrpwise 1>$NULLDEV 2>$NULLDEV
        rc=$?
        if [ $rc = 0 ]
        then
            rcgrpwise stop    
        fi
    
        rpm --quiet -q groupwise-gwmon
        rc=$?
        if [ $rc == 0 ]
        then
            RPM_GWMON_INSTALLED=$TRUE
        else
            rpm --quiet -q novell-groupwise-gwmon
            rc=$?
            if [ $rc == 0 ]
            then
                RPM_GWMON_INSTALLED=$TRUE
            fi
        fi
        ###if [ "$RPM_GWMON_INSTALLED" = "$TRUE" -a "$QUICK_INSTALL" != "$TRUE" ]
    	if [ "$RPM_GWMON_INSTALLED" = "$TRUE" ]
        then
    	rcgrpwise-ma stop
        fi
    
        killall -9 packagekitd 1>$NULLDEV 2>$NULLDEV
        
    	 rpm --quiet -q novell-groupwise-gwmon > /dev/null
    	 rc=$?
    	 if [ $rc == 0 ]
    	 then
    		rpm -e --nodeps novell-groupwise-gwmon > /dev/null
    	 fi
        
    	 rpm --quiet -q novell-groupwise-gwha > /dev/null
    	 rc=$?
    	 if [ $rc == 0 ]
    	 then
    		rpm -e --nodeps novell-groupwise-gwha > /dev/null
    	 fi
        
    	 rpm --quiet -q novell-groupwise-server > /dev/null
    	 rc=$?
    	 if [ $rc == 0 ]
    	 then
    		rpm -e --nodeps novell-groupwise-server > /dev/null
    	 fi
    
    	 rpm --quiet -q gw-oracle-outside-in > /dev/null
    	 rc=$?
    	 if [ $rc == 0 ]
    	 then
    		rpm -e --nodeps gw-oracle-outside-in
    	 fi
    
    	# Check for old (conflicting) version of openmotif
    	rpm -q openmotif22-libs > /dev/null
    	rc=$?
    	if [[ $rc == 0 ]]; then
    		echo "openmotif22-libs is currently installed, which conflicts with the newer openmotif packages being installed."
    		echo "openmotif22-libs will be uninstalled and replaced with a newer version of openmotif."
    		rpm -e --nodeps openmotif22-libs
    	fi
    
        if [[ ${SLES_VERSION} == "11" ]]; then
            # Fix the package list for SLES 11 installations
            PRODUCT_RPMS="${PRODUCT_RPMS} ${PRODUCT_RPMS_SLES11}"
        fi
        if [ "$RPM_GWMON_INSTALLED" = "$TRUE" ]
        then
    	PRODUCT_RPMS="${PRODUCT_RPMS} ../admin/monitor/linux/groupwise-gwmon.64bit.rpm"
        fi
    
        zypper --non-interactive in --force --force-resolution $PRODUCT_RPMS
        rc=$?
        if [ $rc = 4 ]
        then
            rpm -Uv --force $PRODUCT_RPMS
        fi
    
    #    if [ "$RPM_GWMON_INSTALLED" = "$TRUE" -a "$QUICK_INSTALL" != "$TRUE" ]
    #    then
    #        pushd ../admin/monitor &>$NULLDEV
    #        ./install_monitoragent.sh --quick
    #        popd &>$NULLDEV
    #    fi
    
        if [[ ${SLES_VERSION} == "11" ]]; then
    	 	rm /opt/novell/groupwise/agents/lib/libssl.so.0.9.8  1>$NULLDEV 2>$NULLDEV
    	 	rm /opt/novell/groupwise/agents/lib/libcrypto.so.0.9.8  1>$NULLDEV 2>$NULLDEV
        fi
        
        which rcgrpwise 1>$NULLDEV 2>$NULLDEV
        rc=$?
        if [ $rc = 0 ]
        then
    		 ###if [ "$RPM_GWMON_INSTALLED" = "$TRUE" -a "$QUICK_INSTALL" == "$TRUE" ]
    		 if [ "$RPM_GWMON_INSTALLED" = "$TRUE" ]
    		 then
           	rcgrpwise start
    		 else
           	rcgrpwise restart
    		fi
    	###if [ "$RPM_GWMON_INSTALLED" = "$TRUE" -a "$QUICK_INSTALL" != "$TRUE" ]
    	if [ "$RPM_GWMON_INSTALLED" = "$TRUE" ]
    	then
    	  rcgrpwise-ma start
    	fi
        fi
    
    }
    
    # Main function
    main()
    {
        SetVars_General
        GetHostOS
        VerifySupportedOS
        SetVars_Product
        #ExitIfGUI
        CheckCommandline $*
        EnsureDialogExists
        rc=$?
    
        if [ $rc == 1 ]
        then
            exit
        fi
    
        UserIsNotRoot
        rc=$?
        
        if [ "$rc" = "$TRUE" ]
        then
        	clear
    	return
        fi
    
        # If the license has already been agreed to, then assume that we have been called from the launcher
        if [ "$LICENSE_AGREED" = "$TRUE" ]
        then
    	MSG_EXIT="$MSG_BACK"    
        fi
    
        DisplayLicense
                                                                    
        if [ "$LICENSE_AGREED" = "$TRUE" ]
        then
            if [ "$QUICK_INSTALL" != "$TRUE" ]
            then
                MenuMain
            else
                Install
            fi
        fi
        return
    }
    
    main $*