-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·102 lines (83 loc) · 2.2 KB
/
install
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash
set -e
[ ! -e install-functions.sh ] && echo -e "\e[31mThe installer must be started from bash-completer directory.\e[0m" && exit 1
source 'install-functions.sh'
args=$(getopt -s bash -o 'h' -l 'help,notes' -- "$@")
if [ $? -ne 0 ]
then
echo -e "\e[31mInvalid arguments\e[0m"
usage
exit 1
fi
eval set -- "$args"
while true
do
option=$1
shift 1
case "$option" in
-h|--help) usage ; exit 0 ;;
--notes) echoNotes ; exit 0 ;;
--) break ;;
esac
done
## Installer for the bash-completer system.
cat <<MSG
Welcome in the installer of bash-completer.
There is few steps in this installer:
* checking of the dependencies
* configuration of the computer
* and it's done
So, let's go.
-------------
MSG
# Checking the dependencies
installationList=$(checkDependencies)
if [ -n "$installationList" ]
then
echoPackageList "\e[33mbash-completer requires the following packages to work:" "\e[0m\nTo resume installation, go to ~/.bash-completer and execute ./install" $installationList
else
echo -e "\e[32mAll dependencies are present\e[0m"
fi
## Checking for optionnal packages
optionalList=$(checkOptionals)
if [ -n "$optionalList" ]
then
echoPackageList "The following packages and programs may be installed to take benefit of all features of bash-completer" "" $optionalList
fi
if [ -n "$installationList" ]
then
cat <<MSG
This will exit to let you install the missing packages.
Restart the installer to resume where it left.
MSG
exit 0
fi
cat <<MSG
------------------------------
Installation of bash-completer
> Installing the completion program
This step requires root privileges. It will
* install the completion commands in /etc/bash_completion.d
* install the completer binary in /usr/bin
MSG
while true
do
echo -n "Continue the installation [Y/n] "
read continueInstallation
if [ "$continueInstallation" == "n" ] || [ "$continueInstallation" == "N" ]
then
echo "Thanks for your participation. Retry when you want."
exit 0
elif [ -z "$continueInstallation" ] || [ "$continueInstallation" == "y" ] || [ "$continueInstallation" == "Y" ]
then
break
else
echo -e "\e[31mInvalid choice\e[0m"
## loop again
fi
done
echo ""
install
echo ""
echoNotes
exit 0