#! /bin/sh # A script to restore the meta-data from the ZIP disk. This runs under # tomsrtbt only after partitions have been rebuilt, file systems made, # and mounted. It also assumes the ZIP disk has already been # mounted. Mounting the ZIP disk read only is probably a good idea. # Time-stamp: <2003-08-23 10:09:16 ccurley restore.metadata> # Copyright 2000 through the last date of modification Charles Curley. # 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 # You can also contact the Free Software Foundation at http://www.fsf.org/ # 2003 08 23: Oops: tar on tomsrtbt does not respect -p. Try setting # umask to 0000 instead. # 2003 02 13: Tar was not preserving permissions on restore. Fixed # that. # 2002 07 01: Went to bzip2 to compress the archives, for smaller # results. This is important in a 100MB ZIP disk. Also some general # code cleanup. # For more information contact the author, Charles Curley, at # http://www.charlescurley.com/. umask 0000 zip="/mnt"; # Where we mount the zip drive. target="/target"; # Where the hard drive to restore is mounted. ls -lt $zip # Warm fuzzies for the user. cd $target # Restore the archived metadata files. for archive in $( ls $zip/*.bz2 ); do echo $archive ls -al $archive bzip2 -dc $archive | tar -xf - done # Build the mount points for our second stage restoration and other # things. # If you boot via an initrd, make sure you build a directory here so # the kernel can mount the initrd at boot. for dir in mnt/zip mnt/cdrom mnt/floppy mnt/imports proc initrd; do mkdir -p $target/$dir done chmod a-w $target/proc # Restore /proc's read-only permissions # Restore the scripts we used to create the ZIP disk and the ones we will # use to restore it. These should be the latest & greatest in case we had # to do any editing during 1st stage restore. cp -p $zip/root.bin/* $target/root/bin # Now install the boot sector. chroot $target /sbin/lilo -C /etc/lilo.conf df -m