-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·79 lines (66 loc) · 1.56 KB
/
configure.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
BACKUP_RANDOM=backup-$RANDOM
USER_CUSTOM_SH=${HOME}/.custom.sh
USER_CUSTOM_SH_BACKUP=${USER_CUSTOM_SH}.$BACKUP_RANDOM
USER_BASHRC=${HOME}/.bashrc
USER_BASHRC_BACKUP=${USER_BASHRC}.$BACKUP_RANDOM
R_MAKEVARS=$HOME/.R/Makevars
echo "Backing up $USER_BASHRC to $USER_BASHRC_BACKUP"
cp $USER_BASHRC $USER_BASHRC_BACKUP
if [[ -f $USER_CUSTOM_SH ]]; then
echo "Backing up $USER_CUSTOM_SH to $USER_CUSTOM_SH_BACKUP"
cp $USER_CUSTOM_SH $USER_CUSTOM_SH_BACKUP
fi
echo
while true; do
read -p "Replace $USER_CUSTOM_SH (Y/n): " YN
YN=${YN:-Y}
case $YN in
[Yy]*)
[[ -f $USER_CUSTOM_SH ]] && rm $USER_CUSTOM_SH
break
;;
[Nn]*)
break
;;
*) echo "Please answer y or n" ;;
esac
done
while true; do
read -p "Reset $USER_BASHRC (Y/n): " YN
YN=${YN:-Y}
case $YN in
[Yy]*)
cp /uufs/chpc.utah.edu/sys/modulefiles/templates/bashrc $USER_BASHRC
break
;;
[Nn]*)
break
;;
*) echo "Please answer y or n" ;;
esac
done
while true; do
read -p "Reset $R_MAKEVARS (Y/n): " YN
YN=${YN:-Y}
case $YN in
[Yy]*)
[[ -f $R_MAKEVARS ]] && rm $R_MAKEVARS
break
;;
[Nn]*)
break
;;
*) echo "Please answer y or n" ;;
esac
done
source $(dirname $BASH_SOURCE)/scripts/config.sh
echo "
# Source lin-group environment configuration
if [ -f "$CONFIG_FILENAME" ]; then
source $CONFIG_FILENAME
fi
" >>$USER_CUSTOM_SH
echo
echo "Configuration complete! Log out and back in for changes to take effect."