diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-03-28 09:00:16 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-03-28 09:00:16 +0100 |
commit | 559711d4ce5af190d57ccfd67ce6d2e95fb545d4 (patch) | |
tree | 4c37d520ef3ebf8705ce21837782f015c94c5414 /lib/actions/clean.bash | |
parent | c9b07f443080ce5ed7db85f674bd70cf2a733475 (diff) |
Bring clean up to date with the rest of the repo
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 } |