Skip to content

Commit

Permalink
add restart app
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed Sep 16, 2024
1 parent b27f82d commit 9be31c3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
14 changes: 14 additions & 0 deletions snap/local/post_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi

sudo snap connect rosbot-xl:raw-usb
sudo snap connect rosbot-xl:hardware-observe
sudo snap connect rosbot-xl:joystick
sudo snap connect rosbot-xl:shm-plug rosbot-xl:shm-slot
sudo snap connect rosbot-xl:shutdown

sudo rosbot-xl.restart
9 changes: 9 additions & 0 deletions snap/local/restart_launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -e

source $SNAP/usr/bin/utils.sh

log "Restart ${SNAP_NAME}.daemon service"
snapctl restart --enable ${SNAP_NAME}.daemon 2>&1 || true

log "Restart ${SNAP_NAME}.joy service"
snapctl restart --enable ${SNAP_NAME}.joy 2>&1 || true
6 changes: 4 additions & 2 deletions snapcraft_template.yaml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ apps:
stop:
command: usr/bin/stop_launcher.sh

restart:
command: usr/bin/restart_launcher.sh

reset-stm32:
command: usr/bin/reset_stm32_launcher.sh
plugs: [raw-usb, network-bind]
Expand Down Expand Up @@ -326,6 +329,7 @@ parts:
stage:
- "-usr/bin/start_launcher.sh"
- "-usr/bin/stop_launcher.sh"
- "-usr/bin/restart_launcher.sh"

local-files:
plugin: dump
Expand All @@ -335,5 +339,3 @@ parts:
'*.py': usr/bin/
'*.yaml': usr/share/rosbot-xl/config/
'*.xml': usr/share/rosbot-xl/config/
'*.json': usr/share/rosbot-xl/config/
'Caddyfile': usr/share/rosbot-xl/config/

0 comments on commit 9be31c3

Please sign in to comment.