From de4fa2cc84fc819176ce3b3aa73a014436b1344d Mon Sep 17 00:00:00 2001 From: husarion Date: Thu, 29 Aug 2024 11:04:24 +0200 Subject: [PATCH] added hardware-observer to plugs for Raspberry Pi --- justfile | 24 +++++++++++++++++--- snap/snapcraft.yaml | 41 ++++++++++++++++++++++++++++++---- snapcraft_template.yaml.jinja2 | 4 +--- 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/justfile b/justfile index 45cb2e9..e09ef70 100644 --- a/justfile +++ b/justfile @@ -39,7 +39,7 @@ clean: export SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=1 snapcraft clean -iterate target="humble": +iterate target="jazzy": #!/bin/bash start_time=$(date +%s) @@ -83,7 +83,7 @@ iterate target="humble": swap-enable: #!/bin/bash - sudo fallocate -l 3G /swapfile + sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile @@ -114,4 +114,22 @@ publish: #!/bin/bash export SNAPCRAFT_STORE_CREDENTIALS=$(cat exported.txt) snapcraft login - snapcraft upload --release edge husarion-astra*.snap \ No newline at end of file + snapcraft upload --release edge husarion-depthai*.snap + +list-lxd-cache: + #!/bin/bash + sudo du -h --max-depth=1 /var/snap/lxd/common/lxd/storage-pools/default/containers/ | sort -h + +remove-lxd-cache: + #!/bin/bash + lxc project switch snapcraft + + for container in $(lxc list --format csv -c n); do + lxc delete $container --force + done + + echo "verify:" + sudo du -h --max-depth=1 /var/snap/lxd/common/lxd/storage-pools/default/containers/ + df -h + + lxc project switch default \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 310b8f8..e171832 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -51,12 +51,23 @@ slots: interface: shared-memory write: ['*'] # paths are relative to /dev/shm + c189-slot: + interface: custom-device + custom-device: c189 + files: + write: + - /run/udev/data/c189:* + plugs: shm-plug: interface: shared-memory shared-memory: shm-slot private: false + c189-plug: + interface: custom-device + custom-device: c189 + apps: daemon: @@ -71,8 +82,8 @@ apps: husarion-depthai: command: usr/bin/launcher.sh command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh] - plugs: [network, network-bind, shm-plug, raw-usb] - # plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support] + + plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support] # block-devices, slots: [shm-slot] extensions: [ros2-jazzy-ros-base] @@ -115,7 +126,7 @@ parts: version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')" [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable craftctl set version="$version" - craftctl set grade="$grade" + craftctl set grade="stable" @@ -149,4 +160,26 @@ parts: craftctl default cp $CRAFT_PART_BUILD/yq $CRAFT_PRIME/usr/bin/yq chmod +x $CRAFT_PRIME/usr/bin/yq - rm -rf $CRAFT_PRIME/local-ros \ No newline at end of file + rm -rf $CRAFT_PRIME/local-ros + + fix-execstack: + plugin: nil + after: + - husarion-depthai + - local-files + - husarion-snap-common + build-packages: + - execstack + override-prime: | + set -eu + craftctl default + + choosen_files=( + usr/lib/x86_64-linux-gnu/libamdhip64.so* + ) + + for f in "${choosen_files[@]}"; do + if [ -f "$f" ]; then + execstack -c "$f" + fi + done \ No newline at end of file diff --git a/snapcraft_template.yaml.jinja2 b/snapcraft_template.yaml.jinja2 index df27cc2..b20a95b 100644 --- a/snapcraft_template.yaml.jinja2 +++ b/snapcraft_template.yaml.jinja2 @@ -71,9 +71,7 @@ apps: husarion-depthai: command: usr/bin/launcher.sh command-chain: [usr/bin/check_daemon_running.sh, usr/bin/ros_setup.sh] - plugs: [network, network-bind, shm-plug, raw-usb] - # plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support] - # block-devices, + plugs: [network, network-bind, shm-plug, raw-usb, hardware-observe] slots: [shm-slot] extensions: [ros2-{{ ros_distro }}-ros-base]