diff --git a/pi-gen/build.sh b/pi-gen/build.sh index ebd5a627..3f00e3cd 100755 --- a/pi-gen/build.sh +++ b/pi-gen/build.sh @@ -12,6 +12,34 @@ if [ $EUID != 0 ]; then exit $? fi +Help() { + # Display Help + echo "Build WROLPi Raspberry Pi images" + echo + echo "Syntax: upgrade.sh [-h] [-b BRANCH]" + echo "options:" + echo "h Print this help." + echo "b Build from this git BRANCH." + echo +} + +BRANCH="master" +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 + if [ ! -f "${SCRIPT_DIR}/stage2/04-wrolpi/files/gis-map.dump.gz" ]; then echo "stage2/04-wrolpi/files/gis-map.dump.gz does not exist!" exit 1 @@ -29,6 +57,7 @@ git clone --branch arm64 https://github.com/RPI-Distro/pi-gen.git "${BUILD_DIR}" # Copy the configuration and build files into the pi-gen directory. cp "${SCRIPT_DIR}/config.txt" "${BUILD_DIR}/config.txt" +echo "WROLPI_BRANCH=${BRANCH}" >> "${BUILD_DIR}/config.txt" rsync -a "${SCRIPT_DIR}"/stage2/* "${BUILD_DIR}/stage2/" # We only need to build the Lite and Desktop images. diff --git a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh index 3f11d01a..736853ac 100755 --- a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh @@ -21,7 +21,8 @@ sed -i 's/port = 5433/port = 5432/' /etc/postgresql/15/main/postgresql.conf npm i -g serve@12.0.1 single-file-cli@1.1.54 readability-extractor@0.0.6 carto@1.2.0 # Put the latest WROLPi master in /opt/wrolpi. -git clone -b master https://github.com/lrnselfreliance/wrolpi.git /opt/wrolpi +export WROLPI_BRANCH=${WROLPI_BRANCH:master} +git clone -b ${WROLPI_BRANCH} https://github.com/lrnselfreliance/wrolpi.git /opt/wrolpi git config --global --add safe.directory /opt/wrolpi # Install Python requirements.