#!/bin/ash

#  Setzt die in einem alten System gebundenen Benutzer -Konfigurationen Sprache, Tastatur-Sprache, Benutzer-Konto usw ein
#  Lesen der alten Konfiguration und ggf defaults in chkuserconf
#  Falls LANG0=0 , KBD0=0 sollen die im installierten SYS enthaltenen Werte unveraendert bleiben


read OLDSYS KBD KBD0 LANG LANG0 USER00 USER0 CHAP1 CHAP2 PAP1 PAP2 REST < userconf    # Falls in einem Unterprogramm
read UNW1 UNW2 NACH0 REST  < installinfo

echo " lilo, Text-Modus, KDE an Sprache " $LANG " , Tastatur-Sprache " $KBD "  anpassen: "
if test $LANG0 != - ; then  sed "s/nolapic /nolapic lang=$LANG /g" /nach/etc/lilo.conf > scr   ; cp -f scr /nach/etc/lilo.conf ; fi ;   
if test $KBD0 != - ; then sed "s/nolapic /nolapic keyb=$KBD /g" /nach/etc/lilo.conf > scr   ;  cp -f scr /nach/etc/lilo.conf ; fi ;   
cat /nach/etc/lilo.conf  ; chroot /nach   /sbin/lilo -v 3 -b $NACH0   

if test $LANG0 != - ; then 
grep "Language=" /nach/root/.kde/share/config/kdeglobals > scr ; read LANG01 REST < scr # ; LANG1=${LANG01#Language=}  
sed "s/$LANG01/$LANG0/g" /nach/root/.kde/share/config/kdeglobals > scr  
cp -f scr /nach/root/.kde/share/config/kdeglobals  
fi ;

if test $KBD0 != - ; then 
grep "LayoutList=" /nach/root/.kde/share/config/kxkbrc > scr ; read KBD01 REST < scr # ; KBD1=${KBD01#LayoutList=} 
sed "s/$KBD01/$KBD0/g" /nach/root/.kde/share/config/kxkbrc > scr  
cp -f scr /nach/root/.kde/share/config/kxkbrc  
echo -e "\nloadkeys " $KBD " ; LANG="$LANG "  " >> /nach/etc/rc.d/rc.local  
echo -e "\nloadkeys " $KBD " ; LANG="$LANG "  " >> /nach/etc/rc.d/rc.local.war   
fi ; 

if test $USER00 != - ; then 
echo " Benutzer " $USER00 " einrichten ..." 
#chroot /nach userconf --deluser $USER00   
chroot /nach userconf --adduser $USER00 users $USER00 /bin/bash    
fi ;

echo " Internet Name , Passwd uebernehmen "
echo $CHAP1 " * " $CHAP2 > /nach/etc/ppp/chap-secrets     
echo $PAP1 " * " $PAP2 > /nach/etc/ppp/pap-secrets    
 
exit 
