From cb420441c778c1a8b3b26836d8c14ac178fac1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Berke=C5=A1?= Date: Tue, 28 Oct 2025 13:08:33 +0100 Subject: [PATCH 1/5] Fix typo in robopipehostname service --- data/robopipehostname.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/robopipehostname.service b/data/robopipehostname.service index 436f107..50ca1b6 100644 --- a/data/robopipehostname.service +++ b/data/robopipehostname.service @@ -1,5 +1,5 @@ [Unit] -description=Set robopipe controller hostname +Description=Set robopipe controller hostname After=network.target [Service] From 8a4865eb510c3f6c9a86fb31a91cd13f2f666e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Berke=C5=A1?= Date: Tue, 28 Oct 2025 13:08:57 +0100 Subject: [PATCH 2/5] Add DHCP server --- data/dhcpd.conf | 8 ++++++++ data/enable-robopipe-dhcp.sh | 17 +++++++++++++++++ data/isc-dhcp-server | 1 + data/robopipeapi.service | 4 ++-- data/robopipedhcp.service | 15 +++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 data/dhcpd.conf create mode 100755 data/enable-robopipe-dhcp.sh create mode 100644 data/isc-dhcp-server create mode 100644 data/robopipedhcp.service diff --git a/data/dhcpd.conf b/data/dhcpd.conf new file mode 100644 index 0000000..856d58f --- /dev/null +++ b/data/dhcpd.conf @@ -0,0 +1,8 @@ +default-lease-time 600; +max-lease-time 7200; +authoritative; +subnet 169.254.0.0 netmask 255.255.0.0 { + range 169.254.1.100 169.254.1.200; + option routers 169.254.1.1; + option domain-name-servers 8.8.8.8, 8.8.4.4; +} diff --git a/data/enable-robopipe-dhcp.sh b/data/enable-robopipe-dhcp.sh new file mode 100755 index 0000000..d9e3224 --- /dev/null +++ b/data/enable-robopipe-dhcp.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +IFACE="eth0" +LEASEFILE="/run/dhcp-test-$IFACE.leases" +PIDFILE="/run/dhcp-test-$IFACE.pid" + +OUTPUT=$(timeout 5 dhclient -1 -v -sf /bin/true -pf "$PIDFILE" -lf "$LEASEFILE" "$IFACE" 2>&1) + +if [ $? -eq 0 ]; then + echo "DHCP is available" + systemctl stop isc-dhcp-server +else + echo "DHCP is not available" + systemctl start isc-dhcp-server +fi + +echo "$OUTPUT" diff --git a/data/isc-dhcp-server b/data/isc-dhcp-server new file mode 100644 index 0000000..48fdbd1 --- /dev/null +++ b/data/isc-dhcp-server @@ -0,0 +1 @@ +INTERFACESv4="eth0" \ No newline at end of file diff --git a/data/robopipeapi.service b/data/robopipeapi.service index de03d52..301799c 100644 --- a/data/robopipeapi.service +++ b/data/robopipeapi.service @@ -1,7 +1,7 @@ [Unit] Description=Start Robopipe API -After=robopipehostname.service -Requires=robopipehostname.service +After=robopipedhcp.service +Requires=robopipedhcp.service [Service] ExecStart=/bin/sh -c 'HOSTNAME=$(hostname) robopipe-api' diff --git a/data/robopipedhcp.service b/data/robopipedhcp.service new file mode 100644 index 0000000..4207f97 --- /dev/null +++ b/data/robopipedhcp.service @@ -0,0 +1,15 @@ +[Unit] +Description=Enable DHCP server on robopipe controller if no DHCP server is present +After=robopipehostname.service +Wants=network-pre.target + +[Service] +Type=oneshot +ExecStart=/opt/robopipe/tools/enable-robopipe-dhcp.sh +ExecStartPre=/bin/sh -c 'sleep 2' +RemainAfterExit=true +User=root +Group=root + +[Install] +WantedBy=multi-user.target From aeb9641ffaaa686bd33a3f72db6809137a56e7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Berke=C5=A1?= Date: Tue, 28 Oct 2025 13:09:17 +0100 Subject: [PATCH 3/5] Bump base os verions and add DHCP --- build-os.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build-os.sh b/build-os.sh index dd87300..29b13ff 100755 --- a/build-os.sh +++ b/build-os.sh @@ -10,7 +10,7 @@ prepare-base-os() { cp "${DATA_PATH}/base-os.zip" "base-os.zip" else echo "Downloading Base OS" - wget -nv --header="User-Agent: Mozilla/5.0" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20240917.1.zip -O base-os.zip + wget -nv --header="User-Agent: Mozilla/5.0" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20250617.0.zip -O base-os.zip fi unzip base-os.zip -d base-os && rm base-os.zip @@ -61,7 +61,7 @@ configure_os() { mkdir -p /opt/robopipe/tools mkdir -p /etc/robopipe - apt update && apt install -y pipx git nginx owserver avahi-utils + apt update && apt install -y pipx git nginx owserver avahi-utils isc-dhcp-client isc-dhcp-server apt install -y --no-install-recommends evok-unipi-data # User configuration @@ -77,6 +77,14 @@ configure_os() { cp /mnt/set-robopipe-hostname.sh /opt/robopipe/tools/ systemctl enable robopipehostname + DHCP service + cp /mnt/isc-dhcp-server /etc/default/ + cp /mnt/dhcpd.conf /etc/dhcp/ + cp /mnt/robopipedhcp.service /etc/systemd/system/ + cp /mnt/enable-robopipe-dhcp.sh /opt/robopipe/tools/ + systemctl disable isc-dhcp-server + systemctl enable robopipedhcp + # Pipx configuration pipx ensurepath pipx install pipx From 894b21cf86a3a743751b7da56e18c11bad5ccdaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Berke=C5=A1?= Date: Thu, 19 Mar 2026 11:21:37 +0100 Subject: [PATCH 4/5] Add local option for download robopipe api --- build-os.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build-os.sh b/build-os.sh index 29b13ff..7bd263f 100755 --- a/build-os.sh +++ b/build-os.sh @@ -10,7 +10,7 @@ prepare-base-os() { cp "${DATA_PATH}/base-os.zip" "base-os.zip" else echo "Downloading Base OS" - wget -nv --header="User-Agent: Mozilla/5.0" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20250617.0.zip -O base-os.zip + wget -nv --header="User-Agent: Mozilla/5.0" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20251103.1.zip -O base-os.zip fi unzip base-os.zip -d base-os && rm base-os.zip @@ -26,11 +26,18 @@ prepare-base-os() { } prepare-packages() { + export ROBOPIPE_API="robopipe-api.tar.gz" + + if [ -f "${DATA_PATH}/${ROBOPIPE_API}" ]; + then + echo "Robopipe API package present" + return + fi + ROBOPIPE_API_REPO="Robopipe/API" ROBOPIPE_API_RES=$(wget -qO- "https://api.github.com/repos/${ROBOPIPE_API_REPO}/releases/latest") ROBOPIPE_API_RELEASE=$(echo "${ROBOPIPE_API_RES}" | jq -r '.assets[] | select(.name | endswith("tar.gz")) | .browser_download_url') - export ROBOPIPE_API="robopipe-api.tar.gz" wget -nv "${ROBOPIPE_API_RELEASE}" -O "${DATA_PATH}/${ROBOPIPE_API}" } From 3b1623d7a5f7817082f025c6517166574241d47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Berke=C5=A1?= Date: Thu, 19 Mar 2026 11:47:36 +0100 Subject: [PATCH 5/5] Update user agent when downloading base os --- build-os.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-os.sh b/build-os.sh index 7bd263f..c7b5967 100755 --- a/build-os.sh +++ b/build-os.sh @@ -10,7 +10,7 @@ prepare-base-os() { cp "${DATA_PATH}/base-os.zip" "base-os.zip" else echo "Downloading Base OS" - wget -nv --header="User-Agent: Mozilla/5.0" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20251103.1.zip -O base-os.zip + wget -nv --header="User-Agent: RobopipeOSBuilder/0.1" https://kb.unipi.technology/_media/files:software:os-images:patron-base-os_12.20251103.1.zip -O base-os.zip fi unzip base-os.zip -d base-os && rm base-os.zip