-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathb2code-clean
executable file
·40 lines (36 loc) · 1.31 KB
/
b2code-clean
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
36
37
38
39
40
#!/bin/bash
# check for help option
if [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "-?" ]; then
echo
echo "Usage: `basename $0` [-f]"
echo
echo "This command deletes all built includes, object files, libraries, modules,"
echo "and executables of your current local release."
echo "The prompt for confirmation can be disabled with the -f option."
echo
exit 0
fi
# check whether a release is set up
if [ -z "${BELLE2_LOCAL_DIR}" ]; then
echo "Error: no local release is set up."
exit 1
fi
# ask for confirmation, unless -f option is given
if [ "$1" != "-f" ]; then
read -r -n 1 -p "Delete all built files at ${BELLE2_LOCAL_DIR}? [y/N] " DECISION
echo
if [ "${DECISION}" != "y" ]; then
exit 0
fi
fi
# delete the built local release files and directories
echo "Cleaning ${BELLE2_LOCAL_DIR:?}/include"
rm -rf "${BELLE2_LOCAL_DIR:?}/include"
echo "Cleaning ${BELLE2_LOCAL_DIR:?}/build/${BELLE2_SUBDIR}"
rm -rf "${BELLE2_LOCAL_DIR:?}/build/${BELLE2_SUBDIR?}"
echo "Cleaning ${BELLE2_LOCAL_DIR:?}/lib/${BELLE2_SUBDIR:?}"
rm -rf "${BELLE2_LOCAL_DIR:?}/lib/${BELLE2_SUBDIR:?}"
echo "Cleaning ${BELLE2_LOCAL_DIR:?}/bin/${BELLE2_SUBDIR:?}"
rm -rf "${BELLE2_LOCAL_DIR:?}/bin/${BELLE2_SUBDIR:?}"
echo "Cleaning ${BELLE2_LOCAL_DIR:?}/modules/${BELLE2_SUBDIR:?}"
rm -rf "${BELLE2_LOCAL_DIR:?}/modules/${BELLE2_SUBDIR:?}"