forked from canonical/lxd-pkg-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
snapcraft: provide qemu-external plug connect/disconnect hooks
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> (cherry picked from commit b4db1b5)
- Loading branch information
1 parent
c60e08c
commit f3c55f4
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
# Re-exec outside of apparmor confinement | ||
if [ -d /sys/kernel/security/apparmor ]; then | ||
label="$(cat /proc/self/attr/current 2>/dev/null)" | ||
if [ "$label" != "unconfined" ] && [ -n "${label##*(unconfined)}" ]; then | ||
exec aa-exec -p unconfined -- "$0" "$@" | ||
fi | ||
fi | ||
|
||
echo 1 > "${SNAP_COMMON}/use-qemu-external-snap" | ||
|
||
echo reload > "${SNAP_COMMON}/state" | ||
read -r PID < "${SNAP_COMMON}/lxd.pid" | ||
kill "$PID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
# Re-exec outside of apparmor confinement | ||
if [ -d /sys/kernel/security/apparmor ]; then | ||
label="$(cat /proc/self/attr/current 2>/dev/null)" | ||
if [ "$label" != "unconfined" ] && [ -n "${label##*(unconfined)}" ]; then | ||
exec aa-exec -p unconfined -- "$0" "$@" | ||
fi | ||
fi | ||
|
||
rm -f "${SNAP_COMMON}/use-qemu-external-snap" | ||
|
||
echo reload > "${SNAP_COMMON}/state" | ||
read -r PID < "${SNAP_COMMON}/lxd.pid" | ||
kill "$PID" |