diff --git a/.github/workflows/build-os.yml b/.github/workflows/build-os.yml index 3ffaa6a1c..32bb3678a 100644 --- a/.github/workflows/build-os.yml +++ b/.github/workflows/build-os.yml @@ -200,7 +200,7 @@ jobs: user: pi run: | export DEBIAN_FRONTEND=noninteractive - cd /home/pi/PlanktoScope + cd /opt/PlanktoScope just ci # UPLOAD OS IMAGE diff --git a/backend/planktoscope-org.backend.service b/backend/planktoscope-org.backend.service index 448bf1af3..eac9cac08 100644 --- a/backend/planktoscope-org.backend.service +++ b/backend/planktoscope-org.backend.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple -ExecStart=/home/pi/PlanktoScope/backend/src/service.js +ExecStart=/opt/PlanktoScope/backend/src/service.js Restart=on-failure User=pi diff --git a/controller/bubbler/planktoscope-org.controller.bubbler.service b/controller/bubbler/planktoscope-org.controller.bubbler.service index 5976a09a0..0ee3655d8 100644 --- a/controller/bubbler/planktoscope-org.controller.bubbler.service +++ b/controller/bubbler/planktoscope-org.controller.bubbler.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run python -m bubbler.main User=pi Group=pi diff --git a/controller/display/planktoscope-org.controller.display.service b/controller/display/planktoscope-org.controller.display.service index ec33a6af4..2dbc52e8b 100644 --- a/controller/display/planktoscope-org.controller.display.service +++ b/controller/display/planktoscope-org.controller.display.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run python -m display.main User=pi Group=pi diff --git a/controller/focus/main.py b/controller/focus/main.py index 30a50f7e0..104f8acf3 100644 --- a/controller/focus/main.py +++ b/controller/focus/main.py @@ -34,7 +34,7 @@ async def start() -> None: hardware_config = None try: - async with aiofiles.open("/home/pi/PlanktoScope/hardware.json", mode="r") as file: + async with aiofiles.open("/opt/PlanktoScope/hardware.json", mode="r") as file: hardware_config = json.loads(await file.read()) except FileNotFoundError: return None diff --git a/controller/focus/planktoscope-org.controller.focus.service b/controller/focus/planktoscope-org.controller.focus.service index 9ed72f79b..c0b589579 100644 --- a/controller/focus/planktoscope-org.controller.focus.service +++ b/controller/focus/planktoscope-org.controller.focus.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run python -m focus.main User=pi Group=pi diff --git a/controller/helpers.py b/controller/helpers.py index d4b8bf50a..a1618b85d 100644 --- a/controller/helpers.py +++ b/controller/helpers.py @@ -7,7 +7,7 @@ import aiomqtt import paho -HARDWARE_CONFIG_PATH = "/home/pi/PlanktoScope/hardware.json" +HARDWARE_CONFIG_PATH = "/opt/PlanktoScope/hardware.json" hardwre_config_lock = asyncio.Lock() diff --git a/controller/imager/main.py b/controller/imager/main.py index 163c714bf..b7da6e504 100644 --- a/controller/imager/main.py +++ b/controller/imager/main.py @@ -529,7 +529,7 @@ def close(self) -> None: def read_config() -> typing.Any: config = {} try: - with open("/home/pi/PlanktoScope/hardware.json", "r") as file: + with open("/opt/PlanktoScope/hardware.json", "r") as file: try: config = json.load(file) except Exception: diff --git a/controller/imager/planktoscope-org.controller.imager.service b/controller/imager/planktoscope-org.controller.imager.service index b7a109d36..3a2448d5c 100644 --- a/controller/imager/planktoscope-org.controller.imager.service +++ b/controller/imager/planktoscope-org.controller.imager.service @@ -7,7 +7,7 @@ After=mediamtx.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller # FIXME: https://github.com/fairscope/PlanktoScope/issues/842 ExecStartPre=/bin/sleep 5 ExecStart=/usr/local/bin/uv run python -m imager.main diff --git a/controller/light/LM36011.py b/controller/light/LM36011.py index 3216e0eba..1eb1d6214 100644 --- a/controller/light/LM36011.py +++ b/controller/light/LM36011.py @@ -24,7 +24,7 @@ class Register(enum.IntEnum): DEFAULT_CURRENT = 10 def __init__(self): - with open("/home/pi/PlanktoScope/hardware.json", "r") as file: + with open("/opt/PlanktoScope/hardware.json", "r") as file: config = json.load(file) hat_version = float(config.get("hat_version") or 0) # The led is controlled by LM36011 diff --git a/controller/light/planktoscope-org.controller.light.service b/controller/light/planktoscope-org.controller.light.service index 3279f00f4..1ff79794b 100644 --- a/controller/light/planktoscope-org.controller.light.service +++ b/controller/light/planktoscope-org.controller.light.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run python -m light.main User=pi Group=pi diff --git a/controller/planktoscope-org.controller.service b/controller/planktoscope-org.controller.service index 91ea393b2..a53c5aa78 100644 --- a/controller/planktoscope-org.controller.service +++ b/controller/planktoscope-org.controller.service @@ -8,7 +8,7 @@ After=mediamtx.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run main.py User=pi Group=pi diff --git a/controller/pump/planktoscope-org.controller.pump.service b/controller/pump/planktoscope-org.controller.pump.service index 794dea573..69d02f5bb 100644 --- a/controller/pump/planktoscope-org.controller.pump.service +++ b/controller/pump/planktoscope-org.controller.pump.service @@ -5,7 +5,7 @@ After=mosquitto.service [Service] Type=simple Environment=HOME=/home/pi -WorkingDirectory=/home/pi/PlanktoScope/controller +WorkingDirectory=/opt/PlanktoScope/controller ExecStart=/usr/local/bin/uv run python -m pump.main User=pi Group=pi diff --git a/documentation/docs/community/contribute/tips-and-tricks.md b/documentation/docs/community/contribute/tips-and-tricks.md index 50e7f66f3..3ac5ebb42 100644 --- a/documentation/docs/community/contribute/tips-and-tricks.md +++ b/documentation/docs/community/contribute/tips-and-tricks.md @@ -39,7 +39,7 @@ PlanktoScope OS is ready. Type the following commands ```sh -cd /home/pi/PlanktoScope +cd /opt/PlanktoScope just update # don't forget to copy default configs if needed/wanted # cp default-configs/v3.0.hardware.json hardware.json @@ -99,7 +99,7 @@ You can now SSH into your PlanktoScope without username / password (using `ssh $ On the PlanktoScope ```sh -cd ~/PlanktoScope +cd /opt/PlanktoScope just developer-mode git checkout main git status @@ -107,7 +107,7 @@ git status -We recommend developping directly from the PlanktoScope using [Visual Studio Code and the Remote - SSH extension](https://code.visualstudio.com/docs/remote/ssh) or [Zed - Remote Development](https://zed.dev/docs/remote-development). Use `$planktoscope` as the host to connect to and open the `/home/pi/PlanktoScope` directory. +We recommend developping directly from the PlanktoScope using [Visual Studio Code and the Remote - SSH extension](https://code.visualstudio.com/docs/remote/ssh) or [Zed - Remote Development](https://zed.dev/docs/remote-development). Use `$planktoscope` as the host to connect to and open the `/opt/PlanktoScope` directory. ## Connect to router diff --git a/documentation/docs/operation/software-upgrades.md b/documentation/docs/operation/software-upgrades.md index 60fb12d9f..9abe5cd87 100644 --- a/documentation/docs/operation/software-upgrades.md +++ b/documentation/docs/operation/software-upgrades.md @@ -16,7 +16,7 @@ Before you reset/upgrade/downgrade the software installed on your PlanktoScope, Advanced users may also want to take the following actions, depending on what changes they have made: -- If you don't want to write down your white balance gains and hardware settings/calibrations, you can instead back up your PlanktoScope's hardware settings file, which is saved at `/home/pi/PlanktoScope/hardware.json`, for example in the file browser at . This file includes some hidden settings not exposed in the PlanktoScope's Node-RED dashboard - so if you have changed any such settings by editing this file, then you may want to back up this file. +- If you don't want to write down your white balance gains and hardware settings/calibrations, you can instead back up your PlanktoScope's hardware settings file, which is saved at `/opt/PlanktoScope/hardware.json`, for example in the file browser at . This file includes some hidden settings not exposed in the PlanktoScope's Node-RED dashboard - so if you have changed any such settings by editing this file, then you may want to back up this file. ## Reset the PlanktoScope OS diff --git a/justfile b/justfile index 899a25ce3..0200a7f40 100644 --- a/justfile +++ b/justfile @@ -75,6 +75,7 @@ developer-mode: setup-dev reset: base setup rm /home/pi/PlanktoScope/config.json rm /home/pi/PlanktoScope/hardware.json + rm /home/pi/PlanktoScope/calibration.json sudo reboot install-uv: diff --git a/lib/cockpit.js b/lib/cockpit.js index 32dff399b..2ee4e4bac 100644 --- a/lib/cockpit.js +++ b/lib/cockpit.js @@ -6,7 +6,7 @@ import { Systemctl } from "systemctl.js" import { randomUUID } from "node:crypto" import { queue } from "./helpers.js" -const config_template_path = "/home/pi/PlanktoScope/os/cockpit/cockpit.ini" +const config_template_path = "/opt/PlanktoScope/os/cockpit/cockpit.ini" const config_path = "/etc/cockpit/cockpit.conf" async function configureCockpit({ hostname, address } = {}) { diff --git a/lib/file-config.js b/lib/file-config.js index a62c10f28..57d2abd67 100644 --- a/lib/file-config.js +++ b/lib/file-config.js @@ -1,10 +1,11 @@ -import { rm, writeFile } from "fs/promises" +import { rm, writeFile, mkdir } from "fs/promises" import { readFile, access, constants, copyFile } from "fs/promises" const HARDWARE_PATH = "/home/pi/PlanktoScope/hardware.json" const SOFTWARE_PATH = "/home/pi/PlanktoScope/config.json" const CALIBRATION_PATH = "/home/pi/PlanktoScope/calibration.json" -const CALIBRATION_DEFAULTS_PATH = "/home/pi/PlanktoScope/default-configs/calibration.json" +const CALIBRATION_DEFAULTS_PATH = + "/opt/PlanktoScope/default-configs/calibration.json" async function hasConfig(path) { try { @@ -16,14 +17,16 @@ async function hasConfig(path) { } export async function initConfigFiles(hardware_version) { + await mkdir("/home/pi/PlanktoScope") + await Promise.all([ copyFile( - `/home/pi/PlanktoScope/default-configs/${hardware_version}.config.json`, - "/home/pi/PlanktoScope/config.json", + `/opt/PlanktoScope/default-configs/${hardware_version}.config.json`, + SOFTWARE_PATH, ), copyFile( - `/home/pi/PlanktoScope/default-configs/${hardware_version}.hardware.json`, - "/home/pi/PlanktoScope/hardware.json", + `/opt/PlanktoScope/default-configs/${hardware_version}.hardware.json`, + HARDWARE_PATH, ), // Create calibration.json from defaults if it doesn't exist yet. // Unlike config/hardware, this never overwrites — preserving user calibrations. @@ -62,6 +65,7 @@ export async function removeConfig() { await Promise.all([ rm(HARDWARE_PATH, { force: true }), rm(SOFTWARE_PATH, { force: true }), + rm(CALIBRATION_PATH, { forrce: true }), ]) } @@ -100,4 +104,3 @@ export async function updateCalibrationConfig(...args) { export async function hasCalibrationConfig() { return hasConfig(CALIBRATION_PATH) } - diff --git a/lib/mediamtx.js b/lib/mediamtx.js index b6d8a1370..e05155b11 100644 --- a/lib/mediamtx.js +++ b/lib/mediamtx.js @@ -3,8 +3,8 @@ import os from "os" import { queue } from "./helpers.js" const config_template_path = - "/home/pi/PlanktoScope/os/mediamtx/mediamtx.template.yml" -const config_path = "/home/pi/PlanktoScope/os/mediamtx/mediamtx.yml" + "/opt/PlanktoScope/os/mediamtx/mediamtx.template.yml" +const config_path = "/opt/PlanktoScope/os/mediamtx/mediamtx.yml" async function configureMediaMTX({ hostname, address } = {}) { let content = await readFile(config_template_path, "utf8") diff --git a/lib/nodered.js b/lib/nodered.js index 8f0bb156c..854a6bc3c 100644 --- a/lib/nodered.js +++ b/lib/nodered.js @@ -3,7 +3,7 @@ import { createRequire } from "node:module" const require = createRequire(import.meta.url) -const node_red_settings_path = "/home/pi/PlanktoScope/node-red/settings.cjs" +const node_red_settings_path = "/opt/PlanktoScope/node-red/settings.cjs" export async function promiseDashboardOnline() { const { uiPort: port } = require(node_red_settings_path) diff --git a/node-red/30-override.conf b/node-red/30-override.conf index 3c0ac6765..25cb6dc2e 100644 --- a/node-red/30-override.conf +++ b/node-red/30-override.conf @@ -8,4 +8,4 @@ Before=mosquitto.service [Service] ExecStart= -ExecStart=/home/pi/.local/bin/node-red-pi $NODE_OPTIONS --settings /home/pi/PlanktoScope/node-red/settings.cjs $NODE_RED_OPTIONS +ExecStart=/home/pi/.local/bin/node-red-pi $NODE_OPTIONS --settings /opt/PlanktoScope/node-red/settings.cjs $NODE_RED_OPTIONS diff --git a/node-red/justfile b/node-red/justfile index aa547c05d..59334c64d 100644 --- a/node-red/justfile +++ b/node-red/justfile @@ -16,7 +16,7 @@ setup-dev: dev: -sudo systemctl stop nodered - node --watch-path ~/PlanktoScope/node-red/nodes/ ~/.local/bin/node-red --settings ~/PlanktoScope/node-red/settings.cjs + node --watch-path /opt/PlanktoScope/node-red/nodes/ ~/.local/bin/node-red --settings /opt/PlanktoScope/node-red/settings.cjs test: validator projects/dashboard/flows.json diff --git a/node-red/projects/dashboard b/node-red/projects/dashboard index 41122091e..539a102f1 160000 --- a/node-red/projects/dashboard +++ b/node-red/projects/dashboard @@ -1 +1 @@ -Subproject commit 41122091e7fcd49f75773e711a5b8998e6d49792 +Subproject commit 539a102f133da23d61aac34bf8e248721bd9cc3d diff --git a/os/caddy/Caddyfile b/os/caddy/Caddyfile index e7f07d416..6d8f16fa7 100644 --- a/os/caddy/Caddyfile +++ b/os/caddy/Caddyfile @@ -42,7 +42,7 @@ # We want everyrthing else /* to frontend handle /* { - root * /home/pi/PlanktoScope/frontend/dist + root * /opt/PlanktoScope/frontend/dist try_files {path} /index.html file_server } diff --git a/os/image/README.md b/os/image/README.md index c815bdc50..8af3c7182 100644 --- a/os/image/README.md +++ b/os/image/README.md @@ -4,9 +4,6 @@ This folder contains scripts and documentation to build the PlanktoScope OS imag The scripts should work on standard Linux installations, in case of doubt use Raspberry Pi OS. - - - ## How to use ### Bootstrap Raspberry Pi OS diff --git a/os/image/mount-firmware.service b/os/image/mount-firmware.service index a5b5a2e2c..c673661b6 100644 --- a/os/image/mount-firmware.service +++ b/os/image/mount-firmware.service @@ -3,7 +3,7 @@ Description=Mount firmware partition [Service] Type=oneshot -ExecStart=/home/pi/PlanktoScope/os/image/mount-firmware.js +ExecStart=/opt/PlanktoScope/os/image/mount-firmware.js RemainAfterExit=yes [Install] diff --git a/os/machine-name/generate-hostname.service b/os/machine-name/generate-hostname.service index d5670c001..c0a3a889f 100644 --- a/os/machine-name/generate-hostname.service +++ b/os/machine-name/generate-hostname.service @@ -10,7 +10,7 @@ Before=sysinit.target [Service] Type=oneshot -ExecStart=/home/pi/PlanktoScope/os/machine-name/generate-hostname.sh +ExecStart=/opt/PlanktoScope/os/machine-name/generate-hostname.sh [Install] WantedBy=sysinit.target diff --git a/os/machine-name/generate-machine-name.service b/os/machine-name/generate-machine-name.service index ff953862c..3a08b99dc 100644 --- a/os/machine-name/generate-machine-name.service +++ b/os/machine-name/generate-machine-name.service @@ -9,7 +9,7 @@ Before=systemd-hostnamed.service [Service] Type=oneshot ExecStartPre=sh -c "echo 'unknown' >/run/machine-name" -ExecStart=/home/pi/PlanktoScope/os/machine-name/generate-machine-name.sh +ExecStart=/opt/PlanktoScope/os/machine-name/generate-machine-name.sh [Install] WantedBy=sysinit.target diff --git a/os/mediamtx/justfile b/os/mediamtx/justfile index 27a4279db..0a4a27961 100644 --- a/os/mediamtx/justfile +++ b/os/mediamtx/justfile @@ -1,7 +1,7 @@ setup: sudo ./setup_h264_sysctl.sh wget https://github.com/bluenviron/mediamtx/releases/download/v1.16.2/mediamtx_v1.16.2_linux_arm64.tar.gz -P /tmp - wget https://raw.githubusercontent.com/bluenviron/mediamtx/refs/tags/v1.16.2/internal/servers/webrtc/reader.js -O /home/pi/PlanktoScope/frontend/src/pages/preview/reader.js + wget https://raw.githubusercontent.com/bluenviron/mediamtx/refs/tags/v1.16.2/internal/servers/webrtc/reader.js -O /opt/PlanktoScope/frontend/src/pages/preview/reader.js cd /tmp && tar -xf /tmp/mediamtx_v1.16.2_linux_arm64.tar.gz -sudo systemctl stop mediamtx sudo cp /tmp/mediamtx /usr/local/bin/mediamtx diff --git a/os/mediamtx/mediamtx.service b/os/mediamtx/mediamtx.service index a8d9d55cd..4314089ce 100644 --- a/os/mediamtx/mediamtx.service +++ b/os/mediamtx/mediamtx.service @@ -5,7 +5,7 @@ After=network.target Wants=network.target [Service] -ExecStart=/usr/local/bin/mediamtx /home/pi/PlanktoScope/os/mediamtx/mediamtx.yml +ExecStart=/usr/local/bin/mediamtx /opt/PlanktoScope/os/mediamtx/mediamtx.yml [Install] WantedBy=multi-user.target diff --git a/os/preimage.sh b/os/preimage.sh index 9ec913c28..8901ba4a4 100755 --- a/os/preimage.sh +++ b/os/preimage.sh @@ -18,8 +18,9 @@ rm -f "$HOME"/.gitconfig rm -rf "$HOME"/.ssh rm -rf "$HOME"/data rm -f "$HOME"/filebrowser.db -rm -f "$HOME"/planktoScope/hardware.json +rm -f "$HOME"/PlanktoScope/hardware.json rm -f "$HOME"/PlanktoScope/config.json +rm -f "$HOME"/PlanktoScope/calibartion.json # Clear machine-id so that it will be regenerated on the next boot # This is also the condition for ConditionFirstBoot=yes diff --git a/os/raspberry/bootloader.sh b/os/raspberry/bootloader.sh index 925f17323..8bafbd9fc 100755 --- a/os/raspberry/bootloader.sh +++ b/os/raspberry/bootloader.sh @@ -12,7 +12,9 @@ cp /usr/lib/firmware/raspberrypi/bootloader-2712/latest/recovery.bin /tmp rpi-eeprom-config /tmp/pieeprom-2025-11-05.bin --config boot.ini --out /tmp/pieeprom.upd rpi-eeprom-digest -i /tmp/pieeprom.upd -o /tmp/pieeprom.sig +sudo mount -o remount,rw /boot/firmware sudo cp /tmp/pieeprom.upd /tmp/pieeprom.sig /tmp/recovery.bin /boot/firmware/ +sudo mount -o remount,ro /boot/firmware # The bootloader will be installed on first boot and the files removed # see https://github.com/fairscope/PlanktoScope/pull/589 diff --git a/os/raspberry/firmware.sh b/os/raspberry/firmware.sh index ad1299706..3b2009bc5 100755 --- a/os/raspberry/firmware.sh +++ b/os/raspberry/firmware.sh @@ -1,5 +1,7 @@ #!/bin/bash -eux +sudo mount -o remount,rw /boot/firmware + # Configure firmware # https://www.raspberrypi.com/documentation/computers/config_txt.html sudo bash -c "cat \"config.ini\" >> \"/boot/firmware/config.txt\"" @@ -17,3 +19,5 @@ sudo bash -c "cat \"config.ini\" >> \"/boot/firmware/config.txt\"" [ ! -f /boot/firmware/cmdline.txt ] || \ grep -qw logo.nologo /boot/firmware/cmdline.txt || \ sudo sed -i 's/$/ logo.nologo/' /boot/firmware/cmdline.txt + +sudo mount -o remount,ro /boot/firmware diff --git a/os/raspberry/planktoscope-org.firstboot.service b/os/raspberry/planktoscope-org.firstboot.service index ec9dd5d33..787d55450 100644 --- a/os/raspberry/planktoscope-org.firstboot.service +++ b/os/raspberry/planktoscope-org.firstboot.service @@ -4,7 +4,7 @@ ConditionFirstBoot=yes [Service] Type=oneshot -ExecStart=/home/pi/PlanktoScope/os/raspberry/firstboot.sh +ExecStart=/opt/PlanktoScope/os/raspberry/firstboot.sh [Install] WantedBy=sysinit.target diff --git a/os/rauc/rauc.ini b/os/rauc/rauc.ini index 46f8c7fd0..8d770aa6f 100644 --- a/os/rauc/rauc.ini +++ b/os/rauc/rauc.ini @@ -9,14 +9,14 @@ data-directory=/data/rauc # https://rauc.readthedocs.io/en/latest/using.html#system-based-customization-handlers [handlers] # https://rauc.readthedocs.io/en/latest/integration.html#custom -bootloader-custom-backend=/home/pi/PlanktoScope/os/rauc/custom-bootloader-script +bootloader-custom-backend=/opt/PlanktoScope/os/rauc/custom-bootloader-script # https://rauc.readthedocs.io/en/latest/reference.html#handlers-section # TODO # system-info=/usr/lib/raspberrypi-firmware-rauc-bootloader-backend/system-info # https://rauc.readthedocs.io/en/latest/reference.html#keyring-section [keyring] -path=/home/pi/PlanktoScope/os/rauc/demo.cert.pem +path=/opt/PlanktoScope/os/rauc/demo.cert.pem # https://rauc.readthedocs.io/en/latest/reference.html#slot-slot-class-idx-sections # Generated by rauc.js diff --git a/os/setup-ci.sh b/os/setup-ci.sh index f0ee2cc7b..8556fe0b4 100755 --- a/os/setup-ci.sh +++ b/os/setup-ci.sh @@ -7,10 +7,10 @@ export LANG="en_US.UTF-8" # The PlanktoScope monorepo is used for running and iterating on software components # https://github.com/fairscope/planktoscope -sudo cp -r "$build_scripts_root"/.. "$HOME/PlanktoScope" -sudo chown -R "$USER:$USER" "$HOME/PlanktoScope" +sudo cp -r "$build_scripts_root"/.. "/opt/PlanktoScope" +sudo chown -R "$USER:$USER" "/opt/PlanktoScope" sudo apt install -y just -just --justfile "$HOME"/PlanktoScope/justfile +just --justfile /opt/PlanktoScope/justfile ./postinstall.sh ./preimage.sh diff --git a/os/setup.sh b/os/setup.sh index 48dbe8d45..b455bcfa7 100755 --- a/os/setup.sh +++ b/os/setup.sh @@ -12,11 +12,13 @@ if [ "$line" != "$expected" ]; then exit 1 fi -cd /home/pi sudo apt install -y git just +cd /opt if cd PlanktoScope; then git pull else + sudo mkdir PlanktoScope + sudo chown pi:pi PlanktoScope git clone https://github.com/fairscope/PlanktoScope.git cd PlanktoScope fi diff --git a/segmenter/planktoscope-org.segmenter.service b/segmenter/planktoscope-org.segmenter.service index 177370ddc..ea851b554 100644 --- a/segmenter/planktoscope-org.segmenter.service +++ b/segmenter/planktoscope-org.segmenter.service @@ -8,7 +8,7 @@ After=nodered.service Type=simple Environment=HOME=/home/pi Environment=PLANKTOSCOPE_DATA_PATH=/home/pi/data -WorkingDirectory=/home/pi/PlanktoScope/segmenter +WorkingDirectory=/opt/PlanktoScope/segmenter ExecStart=/usr/local/bin/uv run main.py User=pi Group=pi