Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Work on rpi64 setup

Christian Bauer4cf40bd6695c
diff --git a/platform/rpi3/pi64/openremote-setup.sh b/platform/rpi3/pi64/openremote-setup.sh
new file mode 100755
index 000000000..338e9dac9
--- /dev/null
+++ b/platform/rpi3/pi64/openremote-setup.sh
@@ -0,0 +1,29 @@
+#!/bin/bash -e
+
+# Prepares setup for Pi64 OS
+
+: ${SSH_PUBKEY:?"Please set the path to your SSH public key"}
+: ${WIFI_SSID:?"Please set the Wifi network SSID"}
+: ${WIFI_PASSWORD:?"Please set the Wifi password"}
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# Clean build directory
+BUILD_DIR=$DIR/build
+if [[ -d $BUILD_DIR ]]; then
+ rm -r $BUILD_DIR
+fi
+BOOT_BUILD_DIR=$BUILD_DIR/boot
+mkdir -p $BOOT_BUILD_DIR
+
+# Prepare the files for the boot SD card partition
+mkdir -p $BOOT_BUILD_DIR/openremote
+cp $SSH_PUBKEY $BOOT_BUILD_DIR/openremote-ssh.pub
+cp $DIR/src/* $BOOT_BUILD_DIR
+sed -i '' "s/MY_SSID/$WIFI_SSID/g" $BOOT_BUILD_DIR/setup
+sed -i '' "s/MY_PASSWORD/$WIFI_PASSWORD/g" $BOOT_BUILD_DIR/setup
+
+echo "Setup files generated, next steps:"
+echo "1. Download Pi64 SD image and write it to an SD card (e.g. using Etcher): https://github.com/bamarni/pi64/releases"
+echo "2. Mount the SD card and copy files to boot partition: $BOOT_BUILD_DIR"
+echo "3. Boot your Raspberry Pi3 with the SDCARD and connect: ssh pi@<IP of your device>"
diff --git a/platform/rpi3/pi64/src/config.txt b/platform/rpi3/pi64/src/config.txt
new file mode 100644
index 000000000..f0ce74b96
--- /dev/null
+++ b/platform/rpi3/pi64/src/config.txt
@@ -0,0 +1,14 @@
+# Enable serial port
+enable_uart=1
+
+# Disable camera
+start_x=0
+
+# Use minimum of GPU memory
+gpu_mem=16
+
+# Use HDMI mode even if no HDMI monitor is detected
+hdmi_force_hotplug=1
+
+# Enable audio
+dtparam=audio=on
diff --git a/platform/rpi3/pi64/src/setup b/platform/rpi3/pi64/src/setup
new file mode 100755
index 000000000..2e0c5e7d6
--- /dev/null
+++ b/platform/rpi3/pi64/src/setup
@@ -0,0 +1,39 @@
+#!/bin/bash -e
+{
+
+# Comment out this line if you do not use Wifi
+/usr/bin/wpa_passphrase 'MY_SSID' 'MY_PASSWORD' >> /etc/wpa/wpa_supplicant.conf
+
+# TODO Test this
+#if [ -f /boot/openremote-ssh.pub ]; then
+# mkdir -p /home/pi/.ssh/
+# mv /boot/openremote-ssh.pub /home/pi/.ssh/authorized_keys
+# chown -R pi:pi /home/pi/.ssh
+#fi
+#
+#export PG_VERSION=9.6 \
+# PG_VERSION_INSTALL=9.6* \
+# POSTGIS_VERSION=2.3 \
+# GOSU_VERSION=1.10
+#
+#apt-get update \
+# && apt-get install -y --no-install-recommends curl vim postgresql-common \
+# && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
+# && apt-get install -y --no-install-recommends \
+# postgresql=$PG_VERSION_INSTALL \
+# postgresql-contrib=$PG_VERSION_INSTALL \
+# postgresql-$PG_VERSION-postgis-$POSTGIS_VERSION \
+# postgresql-$PG_VERSION-postgis-$POSTGIS_VERSION-scripts \
+# && rm -rf /var/lib/apt/lists/*
+#
+#curl -L -o /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-arm64 \
+# && chmod +x /usr/local/bin/gosu \
+# && gosu nobody true
+#
+#export PGDATA=/var/lib/postgresql/data/
+#RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA"
+#
+#export PG_BIN=/usr/lib/postgresql/${PG_VERSION}/bin
+#export PATH=$PATH:$PG_BIN
+
+} > /var/log/setup.log 2>&1