Skip to content

Commit a3a3c0a

Browse files
authored
os: Move /home/pi/PlanktoScope to /opt (#950)
Follow up: * #919 * #935 for #923 `/home/pi` is on a partition "DATA" that is shared between ROOT A and ROOT B `PlanktoScope` is part of the OS so it should be on the ROOT partitions and not shared `hardware.json`, `config.json` and `calibraton.json` did not change path for now as we need to figure out the upgrade story # Migrate ```sh cd /home/pi/PlanktoScope git checkout main git pull sudo mv /home/pi/PlanktoScope /opt sudo chown -R pi:pi /opt/PlanktoScope mkdir /home/pi/PlanktoScope mv /opt/PlanktoScope/config.json /home/PlanktoScope mv /opt/PlanktoScope/hardware.json /home/PlanktoScope mv /opt/PlanktoScope/calibration.json /home/PlanktoScope cd /opt/PlanktoScope just ```
1 parent 89da7d7 commit a3a3c0a

38 files changed

Lines changed: 59 additions & 49 deletions

.github/workflows/build-os.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
user: pi
201201
run: |
202202
export DEBIAN_FRONTEND=noninteractive
203-
cd /home/pi/PlanktoScope
203+
cd /opt/PlanktoScope
204204
just ci
205205
206206
# UPLOAD OS IMAGE

backend/planktoscope-org.backend.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=mosquitto.service
55

66
[Service]
77
Type=simple
8-
ExecStart=/home/pi/PlanktoScope/backend/src/service.js
8+
ExecStart=/opt/PlanktoScope/backend/src/service.js
99
Restart=on-failure
1010

1111
User=pi

controller/bubbler/planktoscope-org.controller.bubbler.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=mosquitto.service
55
[Service]
66
Type=simple
77
Environment=HOME=/home/pi
8-
WorkingDirectory=/home/pi/PlanktoScope/controller
8+
WorkingDirectory=/opt/PlanktoScope/controller
99
ExecStart=/usr/local/bin/uv run python -m bubbler.main
1010
User=pi
1111
Group=pi

controller/display/planktoscope-org.controller.display.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=mosquitto.service
55
[Service]
66
Type=simple
77
Environment=HOME=/home/pi
8-
WorkingDirectory=/home/pi/PlanktoScope/controller
8+
WorkingDirectory=/opt/PlanktoScope/controller
99
ExecStart=/usr/local/bin/uv run python -m display.main
1010
User=pi
1111
Group=pi

controller/focus/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def start() -> None:
3434

3535
hardware_config = None
3636
try:
37-
async with aiofiles.open("/home/pi/PlanktoScope/hardware.json", mode="r") as file:
37+
async with aiofiles.open("/opt/PlanktoScope/hardware.json", mode="r") as file:
3838
hardware_config = json.loads(await file.read())
3939
except FileNotFoundError:
4040
return None

controller/focus/planktoscope-org.controller.focus.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ After=mosquitto.service
55
[Service]
66
Type=simple
77
Environment=HOME=/home/pi
8-
WorkingDirectory=/home/pi/PlanktoScope/controller
8+
WorkingDirectory=/opt/PlanktoScope/controller
99
ExecStart=/usr/local/bin/uv run python -m focus.main
1010
User=pi
1111
Group=pi

controller/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import aiomqtt
88
import paho
99

10-
HARDWARE_CONFIG_PATH = "/home/pi/PlanktoScope/hardware.json"
10+
HARDWARE_CONFIG_PATH = "/opt/PlanktoScope/hardware.json"
1111
hardwre_config_lock = asyncio.Lock()
1212

1313

controller/imager/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def close(self) -> None:
529529
def read_config() -> typing.Any:
530530
config = {}
531531
try:
532-
with open("/home/pi/PlanktoScope/hardware.json", "r") as file:
532+
with open("/opt/PlanktoScope/hardware.json", "r") as file:
533533
try:
534534
config = json.load(file)
535535
except Exception:

controller/imager/planktoscope-org.controller.imager.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ After=mediamtx.service
77
[Service]
88
Type=simple
99
Environment=HOME=/home/pi
10-
WorkingDirectory=/home/pi/PlanktoScope/controller
10+
WorkingDirectory=/opt/PlanktoScope/controller
1111
# FIXME: https://github.com/fairscope/PlanktoScope/issues/842
1212
ExecStartPre=/bin/sleep 5
1313
ExecStart=/usr/local/bin/uv run python -m imager.main

controller/light/LM36011.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Register(enum.IntEnum):
2424
DEFAULT_CURRENT = 10
2525

2626
def __init__(self):
27-
with open("/home/pi/PlanktoScope/hardware.json", "r") as file:
27+
with open("/opt/PlanktoScope/hardware.json", "r") as file:
2828
config = json.load(file)
2929
hat_version = float(config.get("hat_version") or 0)
3030
# The led is controlled by LM36011

0 commit comments

Comments
 (0)