Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapd: Add confinement warning #3211

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions packages/s/snapd/files/wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
ermo marked this conversation as resolved.
Show resolved Hide resolved
set -euo pipefail

YELLOW='\033[0;33m'
NC='\033[0m'
URL="https://help.getsol.us/docs/user/software/third-party/snap"
SNAP="/usr/lib64/snapd/snap"
CONFIG="/var/lib/snapd/solus"
CONFINEMENT="$("${SNAP}" debug confinement 2>/dev/null)"

if [[ -e "${CONFIG}" ]]
then
# shellcheck disable=SC1090
. "${CONFIG}"
fi

if [[ "$#" -ge 1 ]] && [[ "$1" == "hide-confinement-warning" ]]
then
echo "This will disable warnings when snap is running without strict confinement."
read -rp "Are you sure you want to do this [yN]? " choice
if [[ "${choice}" = "y" ]]
then
echo "DISABLE_CONFINEMENT_WARNING=y" >> "${CONFIG}"
echo "Confinement warnings disabled."
fi

exit 0
fi

if [[ "${CONFINEMENT}" != "strict" ]] && [[ "${DISABLE_CONFINEMENT_WARNING:-n}" != "y" ]]
then
if [[ -n "${BAMF_DESKTOP_FILE_HINT+x}" ]] && [[ -n "${GIO_LAUNCHED_DESKTOP_FILE+x}" ]]
then
notify-send \
--app-name Snap \
--urgency normal \
--icon dialog-warning \
"Snap has ${CONFINEMENT} confinement" \
"See ${URL} for details."
else
echo -e "${YELLOW}WARNING:${NC} snap is running with ${CONFINEMENT} confinement." \
"See ${URL} for details"
fi
fi

exec -a "$0" "${SNAP}" "$@"
5 changes: 3 additions & 2 deletions packages/s/snapd/package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name : snapd

Check notice on line 1 in packages/s/snapd/package.yml

View workflow job for this annotation

GitHub Actions / Checks

This package is included in the ISO. Consider validating the functionality in a newly built ISO.
version : 2.63
homepage : https://snapcraft.io/
release : 81
release : 82
source :
- https://github.com/snapcore/snapd/releases/download/2.63/snapd_2.63.vendor.tar.xz : 2f0083d2c4e087c29f48cd1abb8a92eb2e63cf04cd433256c86fac05d0b28cab
license : GPL-3.0-only
Expand Down Expand Up @@ -66,7 +66,8 @@

# Golang binaries
for snap_bin in ${bincommands[@]} ; do
install -m00755 bin/$snap_bin $installdir/usr/bin/.
install -m00755 $pkgfiles/wrapper.sh $installdir/usr/bin/$snap_bin
install -m00755 bin/$snap_bin $installdir/%libdir%/$package/.
done
for snap_lib in ${dcommands[@]} ; do
install -m00755 bin/$snap_lib $installdir/%libdir%/$package/.
Expand Down
13 changes: 7 additions & 6 deletions packages/s/snapd/pspec_x86_64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Name>snapd</Name>
<Homepage>https://snapcraft.io/</Homepage>
<Packager>
<Name>Zygmunt Krynicki</Name>
<Email>me@zygoon.pl</Email>
<Name>Silke Hofstra</Name>
<Email>silke@slxh.eu</Email>
</Packager>
<License>GPL-3.0-only</License>
<PartOf>desktop</PartOf>
Expand All @@ -31,6 +31,7 @@
<Path fileType="library">/usr/lib64/snapd/complete.sh</Path>
<Path fileType="library">/usr/lib64/snapd/etelpmoc.sh</Path>
<Path fileType="library">/usr/lib64/snapd/info</Path>
<Path fileType="library">/usr/lib64/snapd/snap</Path>
<Path fileType="library">/usr/lib64/snapd/snap-confine</Path>
<Path fileType="library">/usr/lib64/snapd/snap-device-helper</Path>
<Path fileType="library">/usr/lib64/snapd/snap-discard-ns</Path>
Expand Down Expand Up @@ -76,12 +77,12 @@
</Files>
</Package>
<History>
<Update release="81">
<Date>2024-05-27</Date>
<Update release="82">
<Date>2024-07-10</Date>
<Version>2.63</Version>
<Comment>Packaging update</Comment>
<Name>Zygmunt Krynicki</Name>
<Email>me@zygoon.pl</Email>
<Name>Silke Hofstra</Name>
<Email>silke@slxh.eu</Email>
</Update>
</History>
</PISI>