mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 10:51:36 -04:00
Importing maps as wrolpi user, then changing ownership to _renderd. Changing ownership of /opt/wrolpi as well. Creating pgpass for wrolpi user in debian 11. Install specific version of serve. Not echoing the echo. Updating cache directory in create_db.sh. Use python binary to run db upgrade. Install renderd.conf to /etc on RPi OS. Fetching DC map from wrolpi.org to avoid broken daily PBFs. Only get latest dc map if it doesn't exist. carto switched again?? Changing mod_tile directory to /var/cache/renderd/tiles for RPi OS. Copying renderd configs for RPi OS. Installing postgres 13 for RPi OS map. Changing title of feature matrix. Moving download link up in readme. Changing mod_tile to _renderd. Using unix socket rather than host connection. Getting openstreetmap-carto as _renderd user. Assigning ownership of gis db to _renderd in reset_map.sh. Creating _renderd db user. Using _renderd to run renderd on debian 11. Installing python modules that map requires globally. Upgrading db using venv. Installing nodejs which installs npm. Install npm/node after other dependencies. Updating apt so nodejs can be installed. Upgrading PyYAML in new venv. Installing pip via apt. Including bash binary for portability. Moving images link out of list. Moving download up on Readme. Removing map installation from readme. Installing specific version of carto. Creating venv for wrolpi project. Using venv to install requirements and run wrolpi's main.py. Logging upgrade script. Including upgrade script in Upgrade readme. Moving upgrade logic into separate script. This is necessary so and repo update will take immediate effect on the upgrade. Modifying and unifying Debian installation with RPi OS installation.
72 lines
2 KiB
Bash
Executable file
72 lines
2 KiB
Bash
Executable file
#! /usr/bin/env bash
|
|
# This script will install WROLPi to `/opt/wrolpi` on a fresh/empty machine. It is expected to be run once to
|
|
# install, and any subsequent runs will update WROLPi. This script assumes it will be run as the `root` user.
|
|
|
|
Help() {
|
|
# Display Help
|
|
echo "Install WROLPi onto this machine."
|
|
echo
|
|
echo "Syntax: install.sh [-h] [-b BRANCH]"
|
|
echo "options:"
|
|
echo "h Print this help."
|
|
echo "b Install from this git BRANCH."
|
|
echo
|
|
}
|
|
|
|
BRANCH="release"
|
|
while getopts ":hb:" option; do
|
|
case $option in
|
|
h) # display Help
|
|
Help
|
|
exit
|
|
;;
|
|
b)
|
|
BRANCH="${OPTARG}"
|
|
;;
|
|
*) # invalid argument(s)
|
|
echo "Error: Invalid option"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
rpi=false
|
|
debian11=false
|
|
if (grep 'Raspberry Pi' /proc/cpuinfo >/dev/null); then
|
|
rpi=true
|
|
fi
|
|
if (grep 'PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"' /etc/os-release >/dev/null); then
|
|
debian11=true
|
|
fi
|
|
|
|
if [[ ${rpi} == false && ${debian11} == false ]]; then
|
|
echo 'This script can only be run on a Raspberry Pi or Debian 11!' && exit 2
|
|
fi
|
|
|
|
set -x
|
|
set -e
|
|
|
|
# Check that WROLPi directory exists, and contains wrolpi.
|
|
[ -d /opt/wrolpi ] && [ ! -d /opt/wrolpi/wrolpi ] && echo "/opt/wrolpi exists but does not contain wrolpi!" && exit 3
|
|
|
|
# Add the WROLPi directory as a global safe directory so root can fetch.
|
|
[ -d /opt/wrolpi ] && git config --global --add safe.directory /opt/wrolpi
|
|
|
|
# Get the latest WROLPi code. Use the branch requested.
|
|
apt install -y git
|
|
git --version
|
|
git clone https://github.com/lrnselfreliance/wrolpi.git /opt/wrolpi || :
|
|
(cd /opt/wrolpi && git fetch && git checkout "${BRANCH}" && git reset --hard origin/"${BRANCH}") || exit 4
|
|
|
|
if [ ${rpi} == true ]; then
|
|
/opt/wrolpi/scripts/install_raspberrypios.sh 2>&1 | tee /opt/wrolpi/install.log
|
|
install_code=${PIPESTATUS[0]}
|
|
elif [ ${debian11} == true ]; then
|
|
/opt/wrolpi/scripts/install_debian_11.sh 2>&1 | tee /opt/wrolpi/install.log
|
|
install_code=${PIPESTATUS[0]}
|
|
fi
|
|
|
|
set +x
|
|
|
|
echo "Install end $(date '+%Y-%m-%d %H:%M:%S')" >>/opt/wrolpi/install.log
|
|
exit "${install_code}"
|