-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
154 lines (125 loc) · 2.86 KB
/
setup.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
export LANG=""
cd ~/setup/
trap bashtrap INT
bashtrap()
{
exit 1
}
function runscript {
INTERFACE=`/sbin/ifconfig | grep ^eth | sed "s/ .*//" | head -n 1`
CUR_IFCONFIG=`/sbin/ifconfig $INTERFACE`
CURRENT_HOST=$(hostname)
CURRENT_IP=`echo $CUR_IFCONFIG | sed "s/.*inet addr:\([0-9\.]*\).*/\1/"`
host1=github.com
if [ "`ping -c 1 $host1`" ]; then
INTERNETUP="1"
else
INTERNETUP="0"
fi
clear
echo "Welcome to Impreshin"
echo "-----------------------------------------------"
echo "To access Impreshin open your web browser and go to:"
echo ""
echo " http://$CURRENT_HOST/"
echo " - or -"
echo " http://$CURRENT_IP/"
echo ""
if [ -d /media/data/wip ]; then
echo "WIP Branch"
echo " http://$CURRENT_HOST:81/ "
echo " (WARNING: this could be very unstable)"
echo ""
fi
echo "-----------------------------------------------"
echo "Setup $1"
echo ""
echo 'w) Wizard - This will erase everything to default settings'
echo '------------------------'
echo ' 1) Partitioning'
echo ' 2) Networking'
echo ' 3) Folders & Files'
echo ' 4) Impreshin Setup'
if [ "$INTERNETUP"="1" ]; then
echo ' 5) Update Impreshin'
fi
echo '------------------------'
echo 'u) Update System'
echo 'r) Reboot'
echo 's) Shut Down'
echo ''
echo 'e) Exit'
echo ""
read -e -p "Choose Option: " -i "" RUNIT
if [ -z "$RUNIT" ]; then
exit 0
fi
echo ""
SELECTED=""
case $RUNIT in
w)
SELECTED="1"
read -e -p "this will launch the first time wizard. Continue?: " -i "y" goon
if [ $goon = "y" ]; then
bash ./s_drive.sh "1"
else
runscript
fi
;;
1)
SELECTED="1"
bash ./s_drive.sh
;;
2)
SELECTED="1"
bash ./s_network.sh
;;
3)
SELECTED="1"
bash ./s_folder.sh
;;
4)
SELECTED="1"
bash ./s_database.sh
;;
5)
SELECTED="1"
bash ./s_update.sh
;;
r)
SELECTED="1"
sudo reboot
;;
s)
SELECTED="1"
sudo shutdown -h now
;;
e)
SELECTED="1"
echo "Exiting"
sleep 1
clear
exit 1
exit 0
exit
;;
u)
SELECTED="1"
clear
echo "Updating System"
echo "-----------------------------------------------"
echo ""
echo "this may take a while...."
sleep 1
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
runscript
;;
esac
if [ -z "$SELECTED" ]; then
runscript " - Sorry, $RUNIT is not a valid answer"
fi
}
runscript $1