-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto-install.sh
executable file
·126 lines (108 loc) · 2.49 KB
/
auto-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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
#
# https://github.com/WestleyK/drive-mounting-script
# Created by: Westley K
# Date: Jul 4, 2018
# version-1.2-auto
# Designed and tested on raspberry pi
#
# this install script must be runed as root or sudo
# sudo ./install.sh
# check if your root
if [[ "$EUID" -ne 0 ]]; then
echo "Please run as root!"
echo "$ sudo ./auto-install.sh"
exit
fi
option=$1
if [[ -n $option ]]; then
case $option in
-h | -help)
echo "usage ./install [option]
-h | -help (display help menu)
-c (check if on latest version) (comming soon)
-u (un-install command)"
exit
;;
-c)
echo "comming soon!"
exit
;;
-u)
un_install=$"true"
;;
*)
echo "option not found :o try: ./install -help"
;;
esac
fi
echo "drive-mounter installer"
echo "https://github.com/WestleyK/drive-mounting-script"
echo "./install -help (for help)"
echo
# check if we need to un-install
if [[ $un_install == "true" ]]; then
check_script=$( ls /usr/bin | grep drive-mounter )
if [[ -z $check_script ]]; then
echo "nothing to un-install"
exit
fi
echo "are you sure you want to un-install drive-mounter"
echo -n "[Y,n]"
read input
echo
if [[ $input == "y" || $input == "Y" ]]; then
echo "un-installing..."
sudo rm /usr/bin/drive-mounter
echo "un-installed"
exit
fi
fi
# check if its installed aready
check_script=$( ls /usr/bin | grep drive-mounter )
if [[ -n $check_script ]]; then
echo "It seems like its already installed"
echo "For uninstall, try:"
echo "$ sudo ./auto-install -u"
exit
fi
# is this raspberry pi?
os_check=$( uname -a | grep 'raspberrypi' )
if [[ -n $os_check ]]; then
# check if the script is still here
check_script=$( ls raspberry-pi | grep drive-mounter )
if [[ -z $check_script ]]; then
echo "No script to install."
exit
fi
echo "Installing for raspberry pi..."
# the install part
sudo chmod 777 raspberry-pi/drive-mounter
sudo cp raspberry-pi/drive-mounter /usr/bin
echo "Installed!"
echo
echo "(drive-mounter) is installed!"
echo "Try:"
echo "$ drive-mounter -help (for help)"
exit
else
# check if the script is still here
check_script=$( ls linux-ubuntu | grep drive-mounter )
if [[ -z $check_script ]]; then
echo "No script to install."
exit
fi
echo "Installing for linux/ubuntu..."
# the install part
chmod 777 linux-ubuntu/drive-mounter-root
cp linux-ubuntu/drive-mounter /usr/bin
echo "Installed!"
echo
echo "(drive-mounter) is installed!"
echo "Try:"
echo "$ drive-mounter -help (for help)"
exit
fi
#
# End install script
#