Rev 7 | Blame | Last modification | View Log | Download | RSS feed
#!/bin/bash################################################################## Restore the system to a usable and bootable installation## Urs Beyerle, PSI################################################################# source livecd.conf. livecd.conf###############################################################function usage() {## Usage# ----------------------------------------------------------cat <<EOFOptions:-h: print this screen-psi: customize for PSI Live CDEOF}################################################################## read options from command-linePSI=""while [ $# -gt 0 ]; docase "$1" in-h)usage; exit;;-psi)PSI=true; shift; continue;;*)usage; exit;;esacdone################################################################## check if I run inside my directoryif [ ! -x $( basename $0 ) ]; thenecho "Please run $( basename $0 ) within its directory"exit 1fiLIVECD_DIR=$( pwd )### restore /etc/rc.d/rc.sysinitcp /etc/rc.d/rc.sysinit.ori /etc/rc.d/rc.sysinit### enable ssh againchkconfig sshd on 2>/dev/null### create link to liblinuxlivemkdir -p /livecd/liverm -f /livecd/live/liblinuxliveln -s $LIVECD_DIR/linux-live.sl4/initrd/liblinuxlive /livecd/live/liblinuxlive### restore /etc/resolv.confmv -f /etc/resolv.conf.ori /etc/resolv.conf### move /etc/yum.repos.d, it will interfere with our yum.conf.psiif [ -d /etc/yum.repos.d ]; thenrm -rf /etc/yum.repos.d.orimv -f /etc/yum.repos.d /etc/yum.repos.d.orifi### restore folders from /miniif [ -f /mini/usr/share/info/bash.info.gz ]; then./mini-livecd.sh -restorefi### restore cronjobsmv /etc/cron_backup/sysstat /etc/cron.d/ 2>/dev/nullmv /etc/cron_backup/00-makewhatis.cron.weekly /etc/cron.weekly/00-makewhatis.cron 2>/dev/nullmv /etc/cron_backup/* /etc/cron.daily/### special file for PSIif [ $PSI ]; thenecho "root" > /etc/security/usersfi### set root password againpasswd