mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
61 lines
1.8 KiB
Bash
Executable file
61 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
echo "Raspberry Pi OS install start: $(date '+%Y-%m-%d %H:%M:%S')"
|
|
|
|
set -x
|
|
set -e
|
|
|
|
# Update if we haven't updated in the last day.
|
|
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -1)" ] && apt update
|
|
# Install dependencies.
|
|
apt-get install -y < /opt/wrolpi/pi-gen/stage2/04-wrolpi/01-packages
|
|
|
|
# App dependencies were installed.
|
|
node -v
|
|
npm -v
|
|
|
|
# Install serve, and archiving tools.
|
|
single-file --version || sudo npm i -g serve@12.0.1 single-file-cli@1.0.33 readability-extractor@0.0.6 carto@1.2.0
|
|
|
|
# Build React app in background job.
|
|
cd /opt/wrolpi/app || exit 5
|
|
npm install || npm install || npm install || npm install # try install multiple times :(
|
|
|
|
# Install python requirements in background job.
|
|
python3 -m venv /opt/wrolpi/venv
|
|
/opt/wrolpi/venv/bin/pip3 install -r /opt/wrolpi/requirements.txt
|
|
|
|
# Get map dependencies.
|
|
[ -d /opt/openstreetmap-carto ] && chown -R wrolpi:wrolpi /opt/openstreetmap-carto
|
|
git clone https://github.com/lrnselfreliance/openstreetmap-carto.git /opt/openstreetmap-carto || :
|
|
sudo -u _renderd /bin/bash -c '(cd /opt/openstreetmap-carto && git fetch && git checkout master && git reset --hard origin/master && git pull --ff)'
|
|
|
|
# Repair will install configs and restart services.
|
|
/opt/wrolpi/repair.sh
|
|
|
|
set +x
|
|
|
|
ip=$(hostname -i | cut -d' ' -f1)
|
|
if [[ $ip == *":"* ]]; then
|
|
# Don't suggest the ipv6 address.
|
|
ip=$(hostname -i | cut -d' ' -f2)
|
|
fi
|
|
|
|
echo "
|
|
|
|
WROLPi has successfully been installed!
|
|
|
|
Mount your external hard drive to /media/wrolpi if you have one. Change the
|
|
file permissions if necessary:
|
|
# sudo chown -R wrolpi:wrolpi /media/wrolpi
|
|
|
|
Start the WROLPi services using:
|
|
# sudo systemctl start wrolpi.target
|
|
|
|
then navigate to: http://${ip}
|
|
|
|
Or, join to the Wifi hotspot:
|
|
SSID: WROLPi
|
|
Password: wrolpi hotspot
|
|
|
|
When on the hotspot, WROLPi is accessible at http://192.168.0.1
|
|
"
|