#!/bin/sh
# vim:set sw=4 ts=4:
#
# $Id: make_rc_config,v 1.4 2005/04/11 14:14:39 fabian Exp $
#
#############################################################################
#
# ALICE
# Automatic Linux Installation and Configuration Environment
#
# Copyright (c) 2000 SuSE Linux Solutions AG, Eschborn, Germany
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#############################################################################
#
# Author: Jrgen Henge-Ernst
# 
##############################################################################
#
# make_rc_config
# set variables in rc.config
#
# Sections: sys
# Tags:     SYS_RC_CONFIG_VARS
#
# ONLY NEEDED FOR SLES7 systems
#
##############################################################################
#

usage()
{
   echo "$_self -h | --help | -?"
   echo "$_self -fqhn"
}

test -n "$alice_dir" || alice_dir="/usr/lib/alice2/"
export alice_dir


while [ $# -gt 0 ]
do
   case $1 in
       -h | --help | -? ) usage
                          exit 1
                          ;;
       -fqhn | --fqhn ) export fqhn=$2; shift
            ;;

   esac
   shift
done

. $alice_dir/lib/alicerc
WELCOME

#
############################################################################
#
# And now we begin - get the configuration
#
GET_CONFIGURATION sys $CFG_DEBUG

BACKUP /etc/rc.config

#
# Make sure we run as "root", otherwise we cant change the rccondif-settings
#
if [ "$(whoami)" != "root" ]
then
    FATAL ROOTONLY
fi

if [ -n "${SYS_RC_CONFIG_VARS}" ]
then
	echo "${SYS_RC_CONFIG_VARS}" | 
	while read line ; do
		var=${line%%=*}
		value=${line#*=}
		if [ -n "${var}" ]
		then
			RC_CONFIG_SET "${var}" "${value}"
		fi
	done
fi


#
# now call SuSEconfig to create/update the corrosponding config-files
/sbin/SuSEconfig

#
############################################################################
# Thats all
GOOD_BYE
