Last change
on this file since 429 was
429,
checked in by amain, 10 years ago
|
bitten: fix clean script keep-last feature to actually preserve the last build
|
-
Property svn:executable set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # |
---|
3 | # Copyright (C) 2012 Johan van Zoomeren <amain@debwrt.net> |
---|
4 | # |
---|
5 | # This program is free software: you can redistribute it and/or modify |
---|
6 | # it under the terms of the GNU General Public License as published by |
---|
7 | # the Free Software Foundation, either version 3 of the License, or |
---|
8 | # (at your option) any later version. |
---|
9 | # |
---|
10 | # This program is distributed in the hope that it will be useful, |
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | # GNU General Public License for more details. |
---|
14 | # |
---|
15 | # You should have received a copy of the GNU General Public License |
---|
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | |
---|
18 | if [ "${2}" == "" ] |
---|
19 | then |
---|
20 | cat <<EOF |
---|
21 | usage: $(basename $0) method architecture:system:profile |
---|
22 | |
---|
23 | method keep-last: keep last build in <build-dir> |
---|
24 | architecture mips, mipsel, ... |
---|
25 | system ar71xx, ... |
---|
26 | profile ubntrspro, .... |
---|
27 | |
---|
28 | example: |
---|
29 | |
---|
30 | clean.sh keep-last mips:ar71xx:ubntrspro |
---|
31 | |
---|
32 | EOF |
---|
33 | |
---|
34 | exit 1 |
---|
35 | fi |
---|
36 | |
---|
37 | |
---|
38 | method=${1} |
---|
39 | work=~/build/${2//:/\/} |
---|
40 | |
---|
41 | function keep-last() |
---|
42 | { |
---|
43 | echo "I: cleaning directory ${work}" |
---|
44 | |
---|
45 | find ${work} -maxdepth 1 -name "build_user*" \ |
---|
46 | | sort \ |
---|
47 | | head -n -2 \ |
---|
48 | | while read dir |
---|
49 | do |
---|
50 | echo -n " ${dir}..." |
---|
51 | sudo rm -rf ${dir} |
---|
52 | echo "done" |
---|
53 | done |
---|
54 | } |
---|
55 | |
---|
56 | ${method} |
---|
57 | |
---|
Note: See
TracBrowser
for help on using the repository browser.