| 1 | #########################################################################
 | 
|---|
| 2 | #
 | 
|---|
| 3 | # Subroutine for the 'clean' command
 | 
|---|
| 4 | #
 | 
|---|
| 5 | #########################################################################
 | 
|---|
| 6 | #
 | 
|---|
| 7 | # Copyright Rainer Wichmann (2005)
 | 
|---|
| 8 | #
 | 
|---|
| 9 | # License Information:
 | 
|---|
| 10 | # This program is free software; you can redistribute it and/or modify
 | 
|---|
| 11 | # it under the terms of the GNU General Public License as published by
 | 
|---|
| 12 | # the Free Software Foundation; either version 2 of the License, or
 | 
|---|
| 13 | # (at your option) any later version.
 | 
|---|
| 14 | #
 | 
|---|
| 15 | # This program is distributed in the hope that it will be useful,
 | 
|---|
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 18 | # GNU General Public License for more details.
 | 
|---|
| 19 | #
 | 
|---|
| 20 | # You should have received a copy of the GNU General Public License
 | 
|---|
| 21 | # along with this program; if not, write to the Free Software
 | 
|---|
| 22 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
| 23 | #
 | 
|---|
| 24 | 
 | 
|---|
| 25 | commandCLEAN() {
 | 
|---|
| 26 |     printINFO "About to run \"$action\""
 | 
|---|
| 27 | 
 | 
|---|
| 28 |     cd "${basedir}/source" || printFATAL "could not cd to ${basedir}/source"
 | 
|---|
| 29 | 
 | 
|---|
| 30 |     LIST=`ls samhain*.tar.gz 2>/dev/null`
 | 
|---|
| 31 |     if test x$? != x0
 | 
|---|
| 32 |     then
 | 
|---|
| 33 |         printINFO "No sources available."
 | 
|---|
| 34 |     fi
 | 
|---|
| 35 | 
 | 
|---|
| 36 |     for ff in $LIST
 | 
|---|
| 37 |     do
 | 
|---|
| 38 |         sh_version=`echo "$ff" | sed 's/.*samhain\-//g' | sed 's/\.tar\.gz//g'`
 | 
|---|
| 39 |         if test x"${sh_version}" = x
 | 
|---|
| 40 |         then
 | 
|---|
| 41 |             printFATAL "Cannot determine version for $ff"
 | 
|---|
| 42 |         fi
 | 
|---|
| 43 | 
 | 
|---|
| 44 |         if test "$ff" != "samhain-${sh_version}.tar.gz"
 | 
|---|
| 45 |         then
 | 
|---|
| 46 |             printFATAL "Version number not correctly extracted from $ff"
 | 
|---|
| 47 |         fi
 | 
|---|
| 48 | 
 | 
|---|
| 49 |         if test -f "samhain-${sh_version}.tar.gz.asc"
 | 
|---|
| 50 |         then
 | 
|---|
| 51 |             printINFO "REMOVE samhain-${sh_version}.tar.gz.asc"
 | 
|---|
| 52 |             if test x"$simulate" = x0
 | 
|---|
| 53 |             then
 | 
|---|
| 54 |                 rm -f "samhain-${sh_version}.tar.gz.asc"
 | 
|---|
| 55 |             else
 | 
|---|
| 56 |                 printINFO "rm -f samhain-${sh_version}.tar.gz.asc"
 | 
|---|
| 57 |             fi
 | 
|---|
| 58 |         fi
 | 
|---|
| 59 | 
 | 
|---|
| 60 |         if test -f "samhain-${sh_version}.tar.gz"
 | 
|---|
| 61 |         then
 | 
|---|
| 62 |             printINFO "REMOVE samhain-${sh_version}.tar.gz"
 | 
|---|
| 63 |             if test x"$simulate" = x0
 | 
|---|
| 64 |             then
 | 
|---|
| 65 |                 rm -f "samhain-${sh_version}.tar.gz"
 | 
|---|
| 66 |             else
 | 
|---|
| 67 |                 printINFO "rm -f samhain-${sh_version}.tar.gz"
 | 
|---|
| 68 |             fi
 | 
|---|
| 69 |         fi
 | 
|---|
| 70 |     done
 | 
|---|
| 71 |               
 | 
|---|
| 72 |     printLOG "Cleaned sources in ${basedir}/source/"
 | 
|---|
| 73 | 
 | 
|---|
| 74 |     dbSHOWPKG dontshow delete
 | 
|---|
| 75 |  
 | 
|---|
| 76 |     printLOG "Cleaned unused packages in ${basedir}/archpkg/"
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     return 0
 | 
|---|
| 79 | }
 | 
|---|