From f4f7d18fa0e43230612467341f54614b93ce765a Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 9 Apr 2006 18:07:03 +0000 Subject: [PATCH] filelist clean-up. --- extras/filelist | 175 ++++++++++-------------------------------------- 1 file changed, 36 insertions(+), 139 deletions(-) diff --git a/extras/filelist b/extras/filelist index 77d58ab..249169b 100755 --- a/extras/filelist +++ b/extras/filelist @@ -1,161 +1,58 @@ -#!/bin/bash -# -# filelist - prepare a list of the files in a built system. -# This is for use in comparing two builds, to answer the -# question "can it build itself" ? Obviously, it can also be -# used to compare two partial builds to see what changed. -# -# Call this script with the path to the root of the system. -# If you are running the new system, the path is probably '/'. -# Alternatively, the system might be mounted at /mnt/lfs, or -# it might have been copied to ~/build1 or wherever. -# -# The output is a single file, filelist-CCYYMMDDhhmm -# e.g. filelist-200510052108 -# which contains a list of the files to compare. -# It excludes certain files which are not of interest (/tools, -# /cross-tools, /home) together with any mounted filesystems. -# -# you should run this as a regular user - this will cause files -# in e.g. /root to be ignored. -# -# I like to build a graphical desktop before using a new system -# to see if it can build itself. Filelist supports this by allowing -# you to list the files at any time. My normal process is: -# -# 1. Build an LFS system as normal. -# 2. Build some extras before booting (nfs client, ntp, openssh, -# lynx, dhcp client, etc). -# 3. Boot the new (first) system, set up users, run filelist. -# 4. Build X and whatever else I want to use. -# 5. Build the second system. -# 6. Build the same extras for the second system. -# 7. Boot the second system, to prove it works. -# 8. Reboot to the first system, mount the second system at /mnt/lfs, -# then run filelist on /mnt/lfs and run the comparison. -# -# Copyright (C) 2005, 2006 Ken Moffat -# -# All rights reserved. -# -# 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, GOOD TITLE or -# NON INFRINGEMENT. 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., 675 Mass Ave, Cambridge, MA 02139, USA. +#!/bin/bash# +#$Id$ + +# Acknowledgment: +# The following code is a modified version of an original work written by +# Ken Moffat for the "DIY Linux" project and is included here with his +# permission. # -VERSION="002" +set -e -function error() { - echo "usage:" - echo " `basename $0` [--whole-build] path name for output file]" - echo " e.g. '/' or '/mnt/lfs' or 'build1'" - echo " use --whole-build to compare files from /tools or /cross-tools" - echo - echo "Error: $1" - exit 1 -} +: <$OUTFILE if [ $? -ne 0 ]; then - echo "error, cannot write to $OUTFILE" - exit 1 + echo "error, cannot write to $OUTFILE" + exit 1 fi -# Explanation of the find command: we exclude any filesystems mounted below -# this path (typically, you are looking at '/' so this excludes /proc /sys -# /dev). We only care about files, not directories. -# Exclusions - insert whatever we were given at the start of the pathes to -# exclude - this might mean we have '//' in them, but that shouldn't matter. -# /tools* /tools and also e.g. /tools.old if you rename an old version -# /cross-tools* similar, for cross-lfs -# /home/* - in case /home is not a separate filesystem -# /sources/* - where the book thinks you should keep sources -# /tmp/* - we really don't care about any junk left in here -# /misc/* - where I keep buildscripts and stamps -# we then sed it so that / or /mnt/lfs/ or whatever are all converted to '/'. - -# At one time, EXCLUDE contained the ! -path strings for cross-tools and tools -# but htat didn't work, so now it is just a marker to control this logic. -if [ -z "$EXCLUDE" ]; then - find $LOC -xdev -xtype f \ - ! -path "${LOC}home/*" \ - ! -path "${LOC}sources/*" ! -path "${LOC}tmp/*" \ - ! -path "${LOC}misc/*" | sed "s%^${LOC}%/%" | sort >$OUTFILE -else - find $LOC -xdev -xtype f \ - ! -path "${LOC}cross-tools*/*" ! -path "${LOC}tools/*" \ - ! -path "${LOC}home/*" \ - ! -path "${LOC}sources/*" ! -path "${LOC}tmp/*" \ - ! -path "${LOC}misc/*" | sed "s%^${LOC}%/%" | sort >$OUTFILE -fi +find $LOC -xdev -xtype f | sed "s%^${LOC}%/%" | sort >$OUTFILE exit - - -