-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
60 lines (46 loc) · 1.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
#!/bin/bash
echo "Running automated raspi-config tasks"
# Via https://gist.github.com/damoclark/ab3d700aafa140efb97e510650d9b1be
# Execute the config options starting with 'do_' below
grep -E -v -e '^\s*#' -e '^\s*$' <<END | \
sed -e 's/$//' -e 's/^\s*/\/usr\/bin\/raspi-config nonint /' | bash -x -
#
# Drop this file in SD card root. After booting run: sudo /boot/setup.sh
# --- Begin raspi-config non-interactive config option specification ---
# Hardware Configuration
do_boot_wait 0 # Turn on waiting for network before booting
do_memory_split 1 # Set the GPU memory limit to 1MB
# System Configuration
do_configure_keyboard es
do_change_timezone Europe/Madrid
# do_change_locale LANG=es_ES.UTF-8
do_hostname ${host}
# Don't add any raspi-config configuration options after 'END' line below & don't remove 'END' line
END
############# CUSTOM COMMANDS ###########
# You may add your own custom GNU/Linux commands below this line
# These commands will execute as the root user
# Change locale. I was not able to change it via raspi-config
# sudo sed -i -e "/^[^#]/s/^/#/" -e "/en_US.UTF-8/s/^#//" /etc/locale.gen
# export LANGUAGE=en_US.UTF-8
# export LANG=en_US.UTF-8
# export LC_ALL=en_US.UTF-8
# locale-gen en_US.UTF-8
# sudo dpkg-reconfigure -f noninteractive locales
# Interactively set password for your login. Going through raspi-config w/do_change_pass is slower
sudo passwd pi
echo "Updating packages"
sudo apt-get update && sudo apt-get -y upgrade
echo "Set up a static IP Adress"
cat >> /etc/dhcpcd.conf << EOF
# Static IP address configuration
interface eth0
#IP address. First 24 bytes as subnet mask
static ip_address=10.128.0.244/24
#Router's IP address
static routers=10.128.0.1
static domain_name_servers= 1.1.1.1 8.8.8.8
EOF
echo "Restarting to apply changes. After run ssh pi@${host}.local"
# Reboot after all changes above complete
/sbin/shutdown -r now