-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremovesdk.sh
executable file
·59 lines (46 loc) · 1.07 KB
/
removesdk.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
#! /bin/env bash
if [ ! -f $PWD/config ];then
echo "Configuration file absent, aborting installation!"
exit 1
fi
source $PWD/config
if [[ "$EUID" != 0 ]]
then
echo "${MAGENTA}Please run the script with administrator privileges!${NORMAL}"
echo "Try sudo $0"
exit
fi
if [ -d "$HEADER_PATH" ];then
rm -rf $HEADER_PATH
fi
if [ -d "$SDK_PATH" ];then
rm -rf $SDK_PATH
fi
printf "${YELLOW}Remove the RISC-V Toolchain (Y/n):${NORMAL} "
read -r input
if [ -z "$input" ] || [ "${input^^}" = "Y" ]; then
if [ -d "$RISCV_TOOLCHAIN_PATH" ];then
rm -rf $RISCV_TOOLCHAIN_PATH
fi
fi
if [ -f "$MINIRC" ];then
rm $MINIRC
fi
if [ -f "$UDEV_CONFIG" ];then
rm $UDEV_CONFIG
fi
case "$DEFAULT_SHELL" in
"bash")
RC_FILE=/home/$SUDO_USER/.bashrc
;;
"zsh")
RC_FILE=/home/$SUDO_USER/.zshrc
;;
*)
printf "Unsupported shell: %s
Manually delete the environment variable VEGA_SDK_PATH from your shell profile",$DEFAULT_SHELL
;;
esac
# Remove the environment variable from rc file
sed -i '/VEGA_SDK_PATH/d' "$RC_FILE"
#EOF