#!/bin/sh
# Restore system configuration stored in $FRIGO
# Pierre Jarillon - 2009 - License GPL 

FRIGO=/home/frigo
ETC=/etc
#ETC=/tmp/e-t-c  # used for tests

if [ -d $FRIGO/ssh ]
then 
	if [ ! -d $ETC/ssh/ ]; then urpmi openssh ; fi
#	if [ `rpm -qa "openssh" | wc -l` != "1" ];then urpmi openssh ; fi
	cp -p $FRIGO/ssh/* $ETC/ssh/ 
fi
cat $FRIGO/passwd >> $ETC/passwd
cat $FRIGO/group >> $ETC/group
cat $FRIGO/shadow >> $ETC/shadow
cat $FRIGO/hostname >> $ETC/sysconfig/network
cp $FRIGO/hosts $ETC/hosts
cp $FRIGO/faces/* /usr/share/faces/

echo ""
echo -n "Done. Remove $FRIGO ? [y/N]: "
read response
if [ -z $response ]; then
	   response=n
fi
echo ""
case $response in
   [OoYy]*) rm -rf $FRIGO
         echo "$FRIGO is erased "
         exit 0 ;;
	*)
          echo "$FRIGO is still available"
esac
