-
Notifications
You must be signed in to change notification settings - Fork 1
/
help-meeeeee.sh
165 lines (155 loc) · 4.2 KB
/
help-meeeeee.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
154
155
156
157
158
159
160
161
162
163
164
165
#!/bin/bash
# -----------------------------------------------
# Version: 0.0.6
# Discord: Mr. Dubz#1337
# GitHub: TheDublord
# https://github.com/TheDublord/Pi-Tools
# -----------------------------------------------
DELAY=2 # Delay in seconds
locip=$(ip route | grep default | awk '{print $7}')
pubip=$(curl -s ifconfig.me)
statrouts=$(ip route | grep default | awk '{print $3}')
while true; do
clear
cat << _EOF_
Please Select:
1. Create SSH File
2. Connect to WiFi
3. Display IP(s)
4. Change Display Mode (fixes "Cannot currently show the dekstop" in vnc as well)
5. What Pi do I have?
6. Set Static IP
8. Mouse trailing behind where it should be / Laggy mouse.
0. Quit
WARNING: PLEASE ONLY USE EACH OF THESE OPTIONS ONCE, MULTIPLE USES WILL CAUSE DUPLICATE OPTIONS WHICH CAN RESULT IN IT NOT WORKING!
_EOF_
read -p "Enter selection [0-7] > "
if [[ $REPLY =~ ^[0-7]$ ]]; then
case $REPLY in
1)
sudo touch /boot/ssh
echo "SSH File Created!"
echo "Use $locip to connect!"
sleep 7
continue
;;
2)
if [[ -f /boot/wpa_supplicant.conf ]]
then
echo "This file exists! Please delete the existing file with: sudo rm -rf /boot/wpa_supplicant.conf"
else
sudo touch /boot/wpa_supplicant.conf && echo "Created wpa_supplicant.conf file!"
sleep 1
echo -n "Name of your WiFi Network?"
read user
echo -n "Whats your password? (Dont trust me? https://www.raspberrypi.org/documentation/configuration/wireless/headless.md And figure it out yourself!)"
read passwd
echo -n "What is your country code? (Ex: If you live in the US, US is the country code. fr=france, de=germany, gb=Great Britain, se=sweden) - "
read whereulive
sudo tee -a /boot/wpa_supplicant.conf > /dev/null <<EOT
ctrl_interface=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=$whereulive
network={
scan_ssid=1
ssid="$user"
psk="$passwd"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
EOT
echo "File made, please reboot for changes to take affect!"
fi
sleep 10
continue
;;
3)
echo "IPs :"
echo
echo "Public IP = $pubip"
echo "Local IP = $locip"
sleep $DELAY
continue
;;
4)
echo -n "What display mode would you like to set? Refer to https://www.raspberrypi.org/documentation/configuration/config-txt/video.md for the mode you want - "
read mode
sudo tee -a config.txt > /dev/null <<EOT
hdmi_mode=$mode
hdmi_force_hotplug=1
EOT
continue
;;
5)
cat /proc/device-tree/model
sleep 7
continue
;;
6)
echo -n "Select Interface (eth/wifi)"
read interface
if [ "$interface" = eth ] ;then
sudo tee -a /etc/dhcpcd > /dev/null <<EOT
interface eth0
EOT
else
sudo tee -a /etc/dhcpcd > /dev/null <<EOT
interface wlan0
EOT
fi
sudo tee -a /etc/dhcpcd > /dev/null <<EOT
static_routers=$statrouts
static domain_name_servers=1.1.1.1
EOT
continue
;;
7)
sudo rfkill unblock all
sudo tee -a /etc/network/interfaces > /dev/null <<EOT
auto lo
iface lo inet loopback
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
EOT
continue
;;
8)
sudo tee -a /boot/cmdline.txt > /dev/null <<EOT
usbhid.mousepoll=8
EOT
continue
;;
9)
echo -n "What Pi do you have? (0/3b/3b+/4/400):"
read piver
if [ "$piver" = 0 ] ;then
sudo sed -i 's/#arm_freq={100,900}/arm_freq=1000/g' /boot/config.txt
elif [ "$piver" = 3b ] ;then
sudo sed -i 's/arm_freq={100,900}/arm_freq=1200/g' /boot/config.txt
elif [ "$piver" = 3b+ ] ;then
sudo sed -i 's/arm_freq={100,900}/arm_freq=1400/g' /boot/config.txt
elif [ "$piver" = 4 ] ;then
sudo sed -i 's/arm_freq={100,900}/arm_freq=1500/g' /boot/config.txt
elif [ "$piver" = 400 ] ;then
sudo sed -i 's/arm_freq={100,900}/arm_freq=1800/g' /boot/config.txt
else
echo -n "$piver doesnt exist breh -- You livin in the future?"
fi
continue
;;
0)
break
;;
esac
else
echo "Invalid entry."
sleep $DELAY
fi
done
echo "Program terminated."
sleep 1.5
clear