1 | #########################################################################
|
---|
2 | #
|
---|
3 | # Subroutine for the 'clean' command
|
---|
4 | #
|
---|
5 | #########################################################################
|
---|
6 |
|
---|
7 | commandCLEAN() {
|
---|
8 | printINFO "About to run \"$action\""
|
---|
9 |
|
---|
10 | cd "${basedir}/source" || printFATAL "could not cd to ${basedir}/source"
|
---|
11 |
|
---|
12 | LIST=`ls samhain*.tar.gz 2>/dev/null`
|
---|
13 | if test x$? != x0
|
---|
14 | then
|
---|
15 | printINFO "No sources available."
|
---|
16 | fi
|
---|
17 |
|
---|
18 | for ff in $LIST
|
---|
19 | do
|
---|
20 | sh_version=`echo "$ff" | sed 's/.*samhain\-//g' | sed 's/\.tar\.gz//g'`
|
---|
21 | if test x"${sh_version}" = x
|
---|
22 | then
|
---|
23 | printFATAL "Cannot determine version for $ff"
|
---|
24 | fi
|
---|
25 |
|
---|
26 | if test "$ff" != "samhain-${sh_version}.tar.gz"
|
---|
27 | then
|
---|
28 | printFATAL "Version number not correctly extracted from $ff"
|
---|
29 | fi
|
---|
30 |
|
---|
31 | if test -f "samhain-${sh_version}.tar.gz.asc"
|
---|
32 | then
|
---|
33 | printINFO "REMOVE samhain-${sh_version}.tar.gz.asc"
|
---|
34 | if test x"$simulate" = x0
|
---|
35 | then
|
---|
36 | rm -f "samhain-${sh_version}.tar.gz.asc"
|
---|
37 | else
|
---|
38 | printINFO "rm -f samhain-${sh_version}.tar.gz.asc"
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 |
|
---|
42 | if test -f "samhain-${sh_version}.tar.gz"
|
---|
43 | then
|
---|
44 | printINFO "REMOVE samhain-${sh_version}.tar.gz"
|
---|
45 | if test x"$simulate" = x0
|
---|
46 | then
|
---|
47 | rm -f "samhain-${sh_version}.tar.gz"
|
---|
48 | else
|
---|
49 | printINFO "rm -f samhain-${sh_version}.tar.gz"
|
---|
50 | fi
|
---|
51 | fi
|
---|
52 | done
|
---|
53 |
|
---|
54 | printLOG "Cleaned sources in ${basedir}/source/"
|
---|
55 |
|
---|
56 | dbSHOWPKG dontshow delete
|
---|
57 |
|
---|
58 | printLOG "Cleaned unused packages in ${basedir}/archpkg/"
|
---|
59 |
|
---|
60 | return 0
|
---|
61 | }
|
---|