Changeset 460


Ignore:
Timestamp:
Oct 24, 2012, 12:41:16 AM (10 years ago)
Author:
amain
Message:

bitten: update clean script to use new directory schema

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/contrib/bitten/scripts/clean.sh

    r458 r460  
    1919then
    2020cat <<EOF
    21 usage: $(basename $0) method architecture:system:profile
     21usage: $(basename $0) <method> <architecture/system/profile>
    2222
    23    method       keep-last: keep last build in <build-dir>
     23Cleans builds in ${work:-<buildir>}.
     24
     25   method       keep-last: keep last build
     26                keep-none: clean all builds
    2427   architecture mips, mipsel, ...
    2528   system       ar71xx, ...
     
    2831example:
    2932
    30   clean.sh keep-last mips:ar71xx:ubntrspro
     33  clean.sh keep-last mips/ar71xx/ubntrspro
    3134
    3235EOF
     
    3740
    3841method=${1}
    39 work=~/build/${2//:/\/}
     42work=~/build/${2}
    4043
    41 function keep-last()
     44function keep()
    4245{
    43    echo "I: cleaning builds in ${work} using method 'keep-last'"
     46   local method=${1:-keep-last}
     47   local keep_last=${2:-2}
     48
     49   echo "I: cleaning builds in ${work} using method '${method}'"
    4450
    4551   find ${work} -maxdepth 1 -name "build_user*"  \
    4652     | sort -V \
    47      | head -n -2 \
     53     | head -n -${keep_last} \
    4854     | while read dir
    4955       do
     
    5460}
    5561
    56 ${method}
     62case ${method} in
     63   keep-none) keep ${method} 1;;
     64   keep-last) keep ${method} 2;;
     65   *) echo "E: method '${method} not found";;
     66esac
    5767
Note: See TracChangeset for help on using the changeset viewer.