-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·59 lines (48 loc) · 1.31 KB
/
install.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
#!/usr/bin/env bash
# This script "installs" the yuse wrapper package on your system.
areYouSure() {
clear
userprompt=""
printf "Do you want to install the yuse package wrapper on your system? [y/n]\nIt will be installed in /opt/yuse-crosspkg\n> "
read userprompt
installOpt() {
echo "Installing..."
copyFiles
setExectobin
checkInstalation
}
noOpt() {
echo "You choose not to install, the script will be closed."
}
case $userprompt in
"y" | "yes" | "yep")
installOpt
;;
"n" | "no" | "nop")
noOpt
;;
*)
echo "I didn't understand your answer, so I'll take it as no."
;;
esac
}
copyFiles() {
if [[ -d /opt/yuse-crosspkg ]]; then
sudo rm -r /opt/yuse-crosspkg
fi
sudo cp -r $(pwd) /opt/yuse-crosspkg
}
setExectobin() {
if [[ -e /usr/bin/yuse ]]; then
sudo rm /usr/bin/yuse
fi
sudo ln -s /opt/yuse-crosspkg/yuse.sh /usr/bin
sudo mv /usr/bin/yuse.sh /usr/bin/yuse
}
checkInstalation() {
# TODO: Put some conditions here to check if there are all the necessary files.
# fake, don't trust me
echo "Nice, it's been installed successfully, trust me."
printf "use: \"yuse help\" for more information\n"
}
areYouSure