diff options
Diffstat (limited to 'lib/actions/clean.bash')
-rw-r--r-- | lib/actions/clean.bash | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lib/actions/clean.bash b/lib/actions/clean.bash index c00e85d..0ed521d 100644 --- a/lib/actions/clean.bash +++ b/lib/actions/clean.bash @@ -1,11 +1,31 @@ #!/usr/bin/env bash action() { - remove "$BASEDIR/tmp" - remove "$BASEDIR/install" -} + local OPTIND + local clean_source + + while getopts ":s" opt + do + case "$opt" in + s) clean_src=1 ;; + *) emerg "Invalid option specified: $opt" ;; + esac + done + + shift $(( OPTIND - 1 )) + + shopt -s extglob + + rm -fr -- "!($BASEDIR/bin/rstar)" + rm -fr -- "$BASEDIR/dist" + rm -fr -- "$BASEDIR/include" + rm -fr -- "$BASEDIR/lib/libmoar.so" + rm -fr -- "$BASEDIR/share" -remove() { - info "Removing $1" - rm -fr -- "$1" + # Cleaning the sources is not desired for end-users, but convenient for + # maintainers. As such, this one is put behind an opt. + if [[ $clean_src ]] + then + rm -fr -- "$BASEDIR/src" + fi } |