-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4136 from zyga/fix/font-sharing
cmd/snap-update-ns: fix mount rules for font sharing
- Loading branch information
Showing
8 changed files
with
100 additions
and
14 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
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
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,5 @@ | ||
#!/bin/sh | ||
|
||
for dir in "$@"; do | ||
ls $dir | ||
done |
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,5 @@ | ||
#!/bin/sh | ||
|
||
for file in "$@"; do | ||
cat $file | ||
done |
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,12 @@ | ||
name: test-snapd-desktop | ||
version: 1.0 | ||
summary: Basic desktop interface test snap | ||
description: A basic snap to access dektop interface | ||
|
||
apps: | ||
check-files: | ||
command: bin/check-files | ||
plugs: [desktop] | ||
check-dirs: | ||
command: bin/check-dirs | ||
plugs: [desktop] |
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,61 @@ | ||
summary: Ensure that the desktop interface works. | ||
|
||
details: | | ||
The desktop interface allows to access the different resources. | ||
The test-snapd-desktop snap checks files and dirs are accessible through the | ||
desktop interface. | ||
systems: [-ubuntu-core-*] | ||
|
||
prepare: | | ||
echo "Given the desktop snap is installed" | ||
snap try $TESTSLIB/snaps/test-snapd-desktop | ||
execute: | | ||
CONNECTED_PATTERN=":desktop +test-snapd-desktop" | ||
DISCONNECTED_PATTERN="\- +test-snapd-desktop:desktop" | ||
dirs="/var/cache/fontconfig /usr/share/icons /usr/share/pixmaps" | ||
files="/etc/xdg/user-dirs.conf /etc/xdg/user-dirs.defaults" | ||
echo "The plug is connected by default" | ||
snap interfaces | MATCH "$CONNECTED_PATTERN" | ||
echo "Then the snap is able to desktop files and directories" | ||
test-snapd-desktop.check-files $files | ||
test-snapd-desktop.check-dirs $dirs | ||
echo "The mount namespace contains shared font directories" | ||
for d in /usr/share/fonts /usr/local/share/fonts /var/cache/fontconfig; do | ||
if [ -d "$d" ]; then | ||
cat /run/snapd/ns/snap.test-snapd-desktop.fstab | MATCH "$d" | ||
test-snapd-desktop.check-dirs "$d" | ||
fi | ||
done | ||
if [ "$(snap debug confinement)" = partial ] ; then | ||
exit 0 | ||
fi | ||
echo "When the plug is disconnected" | ||
snap disconnect test-snapd-desktop:desktop | ||
snap interfaces | MATCH "$DISCONNECTED_PATTERN" | ||
echo "Then the snap is not able to access the desktop files" | ||
for file in $files; do | ||
if test-snapd-desktop.check-files $file 2>${PWD}/call.error; then | ||
echo "Expected permission error calling desktop with disconnected plug" | ||
exit 1 | ||
fi | ||
MATCH "Permission denied" < call.error | ||
done | ||
echo "Then the snap is not able to access the desktop dirs" | ||
for dir in $dirs; do | ||
if test-snapd-desktop.check-dirs $dir 2>${PWD}/call.error; then | ||
echo "Expected permission error calling desktop with disconnected plug" | ||
exit 1 | ||
fi | ||
MATCH "Permission denied" < call.error | ||
done |