-----Original Message-----
From: Bruce Dubbs <bruce.du...@gmail.com>
To: LFS Support List <lfs-support@lists.linuxfromscratch.org>
Sent: Tue, 27 Oct 2015 22:27
Subject: Re: [lfs-support] section 5.5

Michael Havens wrote:
>
>     If possible, it'd be better to make a difference between the source
>     files (configure, *.c, etc) and the source packages (usually
>     compressed tar archives). You have to remove all the source files
>     (including the directory where they reside), and also anything in
>     the /mnt/lfs tree, except the /tools and /sources directories, and
>     the source packages (and patches).
>     Something like (as user lfs):
>     -----
>     rm -rf $LFS/tools/*
>     find $LFS/sources -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
>     -----
>     should be enough.

I use scripts for lfs:

$ cat clean-mnt-lfs.sh
#!/bin/bash

function rmrf
{
    if test -d $LFS/$1 ; then
      $SUDO rm -rf $LFS/$1
    fi
}

if [ $EUID -ne 0 ]; then
   SUDO=sudo
else
   SUDO=""
fi

if [ x$LFS == x ]; then
   echo "LFS not set"
   exit 1
fi

sh umount-virt.sh

rmrf bin
rmrf dev
rmrf home
rmrf lib
rmrf mnt
rmrf proc
rmrf run
rmrf sys
rmrf tools
rmrf var
rmrf boot
rmrf etc
rmrf jhalfs
$SUDO rm -f $LFS/lib64
rmrf media
rmrf opt
rmrf root
rmrf sbin
rmrf srv
rmrf tmp
rmrf usr

=========

$ cat umount-virt.sh
#!/bin/bash

function unmount
{
    if mountpoint $LFS/$1 >/dev/null; then
      $SUDO umount $LFS/$1
      echo $LFS/$1 unmounted
    else
      echo $LFS/$1 was not mounted
    fi
}

if [ $EUID -ne 0 ]; then
   SUDO=sudo
else
   SUDO=""
fi

if [ x$LFS == x ]; then
   echo "LFS not set"
   exit 1
fi

unmount run
unmount sys
unmount proc
unmount dev/pts
unmount dev
unmount usr/src
unmount boot

=========

   -- Bruce

[Nifty scripts and except for sh umount-virt.sh and the mountpoint command I 
even understand what they do and how they do it. Wow. Thanks Bruce. -- jl]

-- 
Jim
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to