Skip to content

Commit d36199e

Browse files
committed
Adding default modules and cleanup scripts for image building.
1 parent 12ab919 commit d36199e

File tree

9 files changed

+130
-7
lines changed

9 files changed

+130
-7
lines changed

installer/stock_raspbian/scripts/00_latest_updates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
13
echo "### Fetch all the latest Pi updates."
24
apt-get -y update
35
apt-get -y dist-upgrade

installer/stock_raspbian/scripts/01_headless_basics.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12

23
echo "### Add ssh to start up."
34
insserv ssh
@@ -32,6 +33,7 @@ cp -v ../../../raspbian-addons/etc/network/interfaces* /etc/network/
3233
cp -v ../../../raspbian-addons/etc/default/* /etc/default/
3334
cp -v ../../../raspbian-addons/etc/dhcp/dhcpd.conf /etc/dhcp/
3435
cp -v ../../../raspbian-addons/etc/modprobe.d/* /etc/modprobe.d/
36+
cp -v ../../../raspbian-addons/etc/modules /etc/modules
3537

3638
cp -v ../../../raspbian-addons/etc/wpa_supplicant/wpa_supplicant* /etc/wpa_supplicant/
3739
chown -v root:wpaconfig /etc/wpa_supplicant/wpa_supplicant*

installer/stock_raspbian/scripts/02_coder_dependencies.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12

23
echo "### Add coder user to [spi, gpio, audio] groups (device access that coder needs)."
34
adduser coder spi
@@ -11,8 +12,9 @@ cp -v ../../../raspbian-addons/etc/redis/redis.conf /etc/redis/redis.conf
1112
echo ""
1213

1314
echo "### Install nodejs and npm."
14-
#These are really old...
15-
#apt-get -y install nodejs npm
15+
# The node packages are really old...
16+
# Ideally, we'd do: apt-get -y install nodejs npm
17+
# For now, we'll install manually from nodejs.org to /opt/node/
1618
mkdir tmp
1719
wget http://nodejs.org/dist/v0.10.8/node-v0.10.8-linux-arm-pi.tar.gz -P tmp/
1820
tar -zxv -C tmp/ -f tmp/node-v0.10.8-linux-arm-pi.tar.gz
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
4+
echo "Removing any generated SSL keys and certs."
5+
rm /etc/ssh/ssh_host_dsa_key
6+
rm /etc/ssh/ssh_host_dsa_key.pub
7+
rm /etc/ssh/ssh_host_rsa_key
8+
rm /etc/ssh/ssh_host_rsa_key.pub
9+
rm /home/coder/coder-dist/coder-base/certs/server.*
10+
echo ""
11+
12+
echo "Resetting Coder http configuration defaults."
13+
cp /home/coder/coder-dist/coder-base/config.js.default /home/coder/coder-dist/coder-base/config.js
14+
cp /home/coder/coder-dist/coder-base/device.json.reset /home/coder/coder-dist/coder-base/device.json
15+
rm -rf /home/coder/coder-dist/coder-base/tmp/*
16+
echo ""
17+
18+
echo "Clearing out user history files."
19+
rm /root/.bash_history
20+
rm /root/.viminfo
21+
rm /home/pi/.bash_history
22+
rm /home/pi/.viminfo
23+
rm /home/coder/.bash_history
24+
rm /home/coder/.viminfo
25+
rm /home/coder/.gitconfig
26+
echo ""
27+
28+
echo "Resetting hostname and hosts files in /boot/coder_settings."
29+
touch /boot/coder_settings/reset.txt
30+
cp ../../../raspbian-addons/boot/coder_settings/hosts.txt /boot/coder_settings/hosts.txt
31+
cp ../../../raspbian-addons/boot/coder_settings/hostname.txt /boot/coder_settings/hostname.txt
32+
echo ""
33+
34+
echo "Resetting wifi and network defaults."
35+
cp ../../../raspbian-addons/etc/network/interfaces /etc/network/interfaces
36+
cp ../../../raspbian-addons/etc/network/interfaces.reset /etc/network/interfaces.reset
37+
chown root:root /etc/network/interfaces
38+
chown root:root /etc/network/interfaces.reset
39+
chmod 664 /etc/network/interfaces
40+
chmod 664 /etc/network/interfaces.reset
41+
cp ../../../raspbian-addons/etc/wpa_supplicant/wpa_supplicant.conf.reset /etc/wpa_supplicant/wpa_supplicant.conf
42+
chown root:wpaconfig /etc/wpa_supplicant/wpa_supplicant.conf
43+
chmod 660 /etc/wpa_supplicant/wpa_supplicant.conf
44+
echo ""
45+
46+
echo "Clearing system log files."
47+
rm /var/log/messages
48+
rm /var/log/syslog
49+
rm /var/log/wtmp
50+
touch /var/log/wtmp
51+
chmod 644 /var/log/wtmp
52+
rm /var/log/dmesg*
53+
rm /var/log/debug
54+
touch /var/log/debug
55+
rm /var/log/btmp
56+
touch /var/log/btmp
57+
chmod 644 /var/log/btmp
58+
rm /var/log/auth.log
59+
touch /var/log/auth.log
60+
chown root:adm /var/log/auth.log
61+
chmod 640 /var/log/auth.log
62+
touch /var/log/user.log
63+
chown root:adm /var/log/user.log
64+
chmod 640 /var/log/user.log
65+
echo ""
66+
67+
# Reset pi password to raspberry
68+
echo "Choose the default pi passwd (normally this should be raspberry)"
69+
passwd pi
70+
71+
echo ""
72+
echo "Done!"
73+
echo ""
74+
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
#!/bin/bash
12

2-
# set up coder account
3+
echo "### Setting up the coder account."
34
adduser --system --group coder
5+
echo ""
46

57

6-
# fetch the latest coder tree
8+
echo "### Downloading the Coder git repo to /home/coder/coder-dist."
79
su -s/bin/bash coder <<'EOF'
810
cd /home/coder
911
git clone https://github.com/googlecreativelab/coder.git coder-dist
1012
EOF
13+
echo ""
1114

1215

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
#!/bin/bash
2+
13
# Allows the coder user to run a limited number of scripts as the root user.
24
# This is used for changing the pi password and wireless settings, and for
35
# rebooting the device from the Coder UI.
46

7+
echo "### Granting sudo access to coder for scripts in /home/coder/coder-dist/coder-base/sudo_scripts/"
58
bash -c "echo 'coder ALL= NOPASSWD: /home/coder/coder-dist/coder-base/sudo_scripts/*' >>/etc/sudoers"
9+
echo "### A line has been added to /etc/sudoers:"
10+
echo "coder ALL= NOPASSWD: /home/coder/coder-dist/coder-base/sudo_scripts/*"
11+
echo ""

installer/stock_raspbian/scripts/install_all_coder.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
bash ./00_latest_updates.sh
2-
bash ./01_headless_basics.sh
3-
bash ./02_coder_dependencies.sh
1+
#!/bin/bash
42

3+
cat <<EOF
4+
==================================================================
5+
Beginning Coder installation.
6+
7+
This will update your Raspberry Pi, install all the required
8+
packages for Coder, and configure your Pi to be configured
9+
via a web browser, without the use of a monitor.
10+
11+
EOF
12+
13+
14+
./00_latest_updates.sh
15+
./01_headless_basics.sh
16+
./02_coder_dependencies.sh
517

618
cat <<EOF
719
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# blacklist spi and i2c by default (many users don't need them)
2+
3+
#blacklist spi-bcm2708
4+
#blacklist i2c-bcm2708

raspbian-addons/etc/modules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# /etc/modules: kernel modules to load at boot time.
2+
#
3+
# This file contains the names of kernel modules that should be loaded
4+
# at boot time, one per line. Lines beginning with "#" are ignored.
5+
# Parameters can be specified after the module name.
6+
7+
# Sound
8+
snd-bcm2835
9+
10+
# SPI
11+
spi-bcm2708
12+
spi-dev
13+
14+
# I2C
15+
i2c-bcm2708
16+
i2c-dev
17+
18+

0 commit comments

Comments
 (0)