Skip to content

Commit

Permalink
Working boot
Browse files Browse the repository at this point in the history
  • Loading branch information
chiefwigms committed Jun 25, 2020
1 parent 0a426b9 commit cc9b643
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions scripts/pi/_readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Creating a custom image:
Download lastest Lite image from https://www.raspberrypi.org/downloads/raspberry-pi-os/
Download firstboot.service from https://github.com/nmcclain/raspberian-firstboot
(Remove ExecStartPost from firstboot.service - script will rename itself)
Extract img from zip

mkdir mnt boot
Expand Down
28 changes: 17 additions & 11 deletions scripts/pi/firstboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ apt -y update
apt -y --autoremove purge ifupdown dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog avahi-daemon
apt-mark hold ifupdown dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog raspberrypi-net-mods openresolv avahi-daemon libnss-mdns
apt -y install libnss-resolve hostapd dnsmasq samba git python3 python3-pip

# Install Picobrew server
cd /
git clone https://github.com/chiefwigms/picobrew_pico.git
cd /picobrew_pico
git update-index --assume-unchanged config.yaml
pip3 install -r requirements.txt
cd /

# Setup Hostapd
rm -rf /etc/network /etc/dhcp
systemctl enable systemd-networkd.service systemd-resolved.service
systemctl unmask hostapd.service
Expand Down Expand Up @@ -223,22 +233,15 @@ service smbd restart
# Startup Script
sed -i 's/exit 0//g' /etc/rc.local
cat >> /etc/rc.local <<EOF
if [ ! -d "/picobrew_pico" ]
if [ -d "/picobrew_pico" ]
then
echo 'Installing Picobrew Server...'
cd /
git clone https://github.com/chiefwigms/picobrew_pico.git
cd /picobrew_pico
git update-index --assume-unchanged config.yaml
pip3 install -r requirements.txt
else
echo 'Updating Picobrew Server...'
cd /picobrew_pico
git pull
pip3 install -r requirements.txt
echo 'Starting Picobrew Server...'
python3 server.py &
fi
echo 'Starting Picobrew Server...'
python3 server.py &
exit 0
EOF
Expand All @@ -247,5 +250,8 @@ EOF
#systemctl enable apt-daily.timer
#systemctl enable apt-daily-upgrade.timer

(echo "Finished setup - Rebooting system in 10 seconds!"; sleep 10; reboot) &
# Rename script
mv /boot/firstboot.sh /boot/firstboot.done

echo "Finished setup - rebooting now!"
reboot

0 comments on commit cc9b643

Please sign in to comment.