#!/bin/bash # # sbuml--prepare-snapshots-for-posting - create .sbuml files and # file-listing.txt files that sbuml needs to find and download # snapshots using web pages links. # Copyright (C) 2003 Richard Potter # This wrapper script is part of the Scrapbook for User-Mode-Linux (SBUML), # which is a Computation Scrapbook for saving, organizing, and restoring # multiple copies of the active computation state of User-Mode-Linux, # a virtual version of Linux. More information about UML can be found # at http://user-mode-linux.sourceforge.net/. More about SBUML can be # found at http://sbuml.sourceforge.net/. # 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 # ----------------- ## first parameter $1 is the URL path up to the current directory ## if the second parameter is -r, then all directories are recursively ## processed. If not, only the current directory is processed. rm link*.sbuml -f rm file-list.txt -f ls >file-list.txt shopt -s nullglob for snapshot in * do if [ -f $snapshot/status ] || [ -a $snapshot/status.delta ] then echo Processing snapshot $snapshot pushd $snapshot >/dev/null rm file-list.txt -f ls >file-list.txt if head check.after | grep '(not set)' >/dev/null then vncparam="" else vncparam="-v 22" fi popd >/dev/null echo $snapshot -c $vncparam -sd $1 >link-${snapshot:0:$[ ${#snapshot} - 17 ] }.sbuml elif [ -d $snapshot ] then if [ "-r" == "$2" ] then echo Processing directory $(pwd)/$snapshot pushd $snapshot >/dev/null echo about to do: $0 "$1"$snapshot/ $2 $0 "$1"$snapshot/ $2 popd >/dev/null echo Finished processing directory $(pwd)/$snapshot echo else echo Ignoring directory $snapshot fi else echo Ignoring $snapshot fi done