-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset
executable file
·77 lines (69 loc) · 1.5 KB
/
set
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
#!/bin/bash
# Author: steve.jeong
# e-mail: how2soft@gmail.com
# start: 2022.10.24
# last-modified: 2022.11.10
set -e
# directories
TOP_DIR="$(cd $(dirname $0); pwd -P )"
usage() {
echo "Usage: $(basename $0) [--help] [--target=<env>]"
echo " [--version=<target version>]"
echo " [--name=<name>]"
echo ""
echo ""
echo " ===== options ====="
echo " --help: print usage"
echo " --target=<env>: select setting env"
echo " --version=<target version>: target's version"
echo " e.g. python\"3.6\""
echo " --name=<name>: output name"
echo " ==================="
echo ""
echo " e.g. setting \"vi\" env"
echo ""
echo " $ cd workspace"
echo " $ ./set --target=vi"
exit 0
}
# option parsing
for opt in $@; do
case ${opt} in
--help)
usage
;;
--flavour=*)
FLAVOUR=${opt#*=}
;;
--name=*)
NAME=${opt#*=}
;;
--speed=*)
SPEED=${opt#*=}
;;
--target=*)
TARGET=${opt#*=}
;;
--version=*)
VERSION=${opt#*=}
;;
*)
echo "Invalid option"
;;
esac
done
. ${TOP_DIR}/time
. ${TOP_DIR}/prefix
. ${TOP_DIR}/functions
print_env
do_preinstall
if [ -d ${BACKUP_DIR} ]; then
echo "===== WARNING! There are backup files already. ====="
confirm "Do you still want to proceed with the backup? (Y/n)?" \
&& do_backup
else
do_backup
fi
echo "[INFO] complete backup before setting workspace."
do_install
# vim: set ft=sh ts=4 sw=2 sts=2 et