-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathclean.sh
executable file
·64 lines (53 loc) · 1.35 KB
/
clean.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
##################################
# System tools cleaner #
##################################
# -- Target architectures
ARCH=$1
TARGET_ARCHS="linux_x86_64 linux_i686 linux_armv7l linux_aarch64 windows_x86 windows_amd64 darwin darwin_arm64"
# -- Store current dir
WORK_DIR=$PWD
# -- Folder for building the source code
BUILDS_DIR=$WORK_DIR/_builds
# -- Folder for storing the generated packages
PACKAGES_DIR=$WORK_DIR/_packages
# -- Check ARCH
if [[ $# -gt 1 ]]; then
echo ""
echo "Error: too many arguments"
exit 1
fi
if [[ $# -lt 1 ]]; then
echo ""
echo "Usage: bash clean.sh TARGET"
echo ""
echo "Targets: $TARGET_ARCHS"
exit 1
fi
if [[ $ARCH =~ [[:space:]] || ! $TARGET_ARCHS =~ (^|[[:space:]])$ARCH([[:space:]]|$) ]]; then
echo ""
echo ">>> WRONG ARCHITECTURE \"$ARCH\""
exit 1
fi
echo ""
echo ">>> ARCHITECTURE \"$ARCH\""
printf "Are you sure? [y/N]:%s" "${NC} "
read -r RESP
case "$RESP" in
[yY][eE][sS]|[yY])
# -- Directory for compiling the tools
BUILD_DIR=$BUILDS_DIR/build_$ARCH
# -- Directory for installation the target files
PACKAGE_DIR=$PACKAGES_DIR/build_$ARCH
# -- Remove the package dir
rm -r -f "$PACKAGE_DIR"
# -- Remove the build dir
rm -r -f "$BUILD_DIR"
echo ""
echo ">> CLEAN"
;;
*)
echo ""
echo ">> ABORT"
;;
esac