#!/bin/bash #Framework, welches ein komplettes Linux System aus den Sourcen erstellt #dieses Framework wird im CVS Repository #:pserver:cvs.tramp-bbs.de:/opt/cvs zur Verfügung gestellt # #Lage dieser Datei im Archiv: $Source$ # #(c) 2003 Harald Kueller, Germany #This program is free software; you can redistribute it and/or #modify ist 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. # #SysScan: #Scan ein mit Viitor Installiertes System, und versucht ein moeglichts #komplettes Backup der System Konfiguration zu erstellen, um so eine #identische neuinstallation anstossen zu koennen (was ein anderes Script erledigen wird) # #Aufruf: #SysScan -p # -o # #Letzte Änderung von: $Author$ #Datum der letzten Änderung: $Date$ #Version der Datei: $Revision$ # #$Log$ # #export DEBUG=echo source .function echo_help() { echo -e "$0\t-p " echo -e "\t\t-o " } while getopts :p:o: opt_char; do case $opt_char in p) ALLPACKAGES=$OPTARG if [ ! -f $ALLPACKAGES ]; then echo "$ALLPACKAGES does not exist" exit 10 fi ;; o) OUTDIR=$OPTARG if [ -f $OUTDIR ]; then echo "$OUTDIR is a file. Need a directory to store your configuration" exit 10 fi if [ -d $OUTDIR ]; then echo "$OUTDIR already exists, please remove first" exit 10 fi mkdir $OUTDIR ;; *) echo_help exit 10 ;; esac done if [ ! "${ALLPACKAGES}" ] || [ ! "${OUTDIR}" ]; then echo_help exit 10 fi echo -n "Generate directorys for System Konfiguration Files" if [ ! -d ${OUTDIR}/Disks ]; then mkdir ${OUTDIR}/Disks fi print_status success echo "Scanning installed packages - you will get a list of packages not known" ScanInstalledPackages ${ALLPACKAGES} ${OUTDIR}/${HOSTNAME}.cfg |tee ${OUTDIR}/${HOSTNAME}.missing echo -n "Storing Partition Tables" for i in `FindDiskDevices`; do sfdisk /dev/$i -d >${OUTDIR}/Disks/$i done print_status success echo "Starte Sicherung der package abhaengigen files" for i in FileLists/*; do source $i MODNAME=`basename $i` echo -n "Working on ${MODNAME}" for j in ${PKGFNAMES}; do CFGDIR=`dirname $j` FNAME=`basename $j` if [ -f /${CFGDIR}/${FNAME} ]; then echo -n " ${CFGDIR}/${FNAME}" if [ ! -d ${OUTDIR}/CFGS/${MODNAME}/${CFGDIR} ]; then $DEBUG mkdir -p ${OUTDIR}/CFGS/${MODNAME}/${CFGDIR} fi $DEBUG cp /${CFGDIR}/${FNAME} ${OUTDIR}/CFGS/${MODNAME}/${CFGDIR} fi done print_status success done for i in cfg_modules/*; do MODULENAME=`basename $i` if [ -d /var/install/$MODULENAME[^a-zA-Z]* ]; then echo -n "Starte sicherung der Konfigs fuer Package $MODULENAME" cfg_modules/$MODULENAME b ${OUTDIR} print_status success fi done