aboutsummaryrefslogtreecommitdiff
path: root/lib/actions/clean.bash
blob: bb5d984c82895f231149c6e33c8c5e1c3d5ccc09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash

RSTAR_DEPS_BIN+=(
	find
	rm
)

action() {
	local OPTIND
	local clean_src

	while getopts ":s" opt
	do
		case "$opt" in
			s) clean_src=1 ;;
			*) emerg "Invalid option specified: $opt" ;;
		esac
	done

	shift $(( OPTIND - 1 ))

	find "$BASEDIR/bin" ! -name rstar -type f -exec rm -f {} +
	rm -fr -- "$BASEDIR/dist"
	rm -fr -- "$BASEDIR/include"
	rm -fr -- "$BASEDIR/lib/libmoar.so"
	rm -fr -- "$BASEDIR/share"

	# 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"
		rm -f -- "$BASEDIR/etc/epoch.txt"
	fi
}