forked from lixmk/Wiegotcha
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlaststep.sh
executable file
·80 lines (77 loc) · 2.9 KB
/
laststep.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
#!/bin/bash
########################################################################
#
# Written by Mike Kelly
# twitter.com/lixmk
# git.io/lixmk
# exfil.co
# 2016
#
########################################################################
################### ###################
################### Wiegotcha Install Script Part2 ###################
################### ###################
########################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
########################################################################
#
#
echo -e "\e[0;31m#############################################################\e[0m"
echo -e "\e[0;31m#\e[0m \e[0;31m#\e[0m"
echo -e "\e[0;31m#\e[0m Finishing Wiegotcha Installation. \e[0;31m#\e[0m"
echo -e "\e[0;31m#\e[0m \e[0;31m#\e[0m"
echo -e "\e[0;31m#\e[0m Press ENTER to continue \e[0;31m#\e[0m"
echo -e "\e[0;31m#\e[0m \e[0;31m#\e[0m"
echo -e "\e[0;31m#############################################################\e[0m"
read -e NULL
echo "[*] Finishing installation."
#Checking if root. Will sudo
USER="$(whoami)"
if [ "$USER" != "root" ]
then
echo "[!] Not running as root."
echo -e "\e[0;31m[+] Switching to root. Enter root password.\e[0m"
sudo su -
else
echo "[*] cd'ing into /root/."
cd ~
fi
echo -n "[*] Configuring Hardware Clock..."
#Enabling i2c device
modprobe i2c-bcm2708
sleep 3
echo -n "."
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
sleep 3
echo -n "."
#Writing current time to hardware clock
hwclock -w
sleep 3
echo "."
#Replacing temp rc.local file
echo "[*] Replacing temporary rc.local."
cd Wiegotcha
cp ./confs/rc.local /etc/rc.local
cd ~/
rm ./laststep.sh
echo -e "\e[0;31m[+] Installation almost complete.\e[0m"
echo -e "\e[0;31m[+] One more reboot needed.\e[0m"
echo -e "\e[0;31m[+] After reboot, if your hwclock time (UTC) is incorrect, run /root/Wiegotcha/fixclock.sh\e[0m"
echo ""
echo -n -e "\e[0;31m[+]Press any key to reboot.\e[0m"
read -e NULL
reboot