81d4d49234
* fixup! snap: Support official config paths via *-files confinement interfaces (#197) * FIXME no longer applied * Obsoleted HOME environment variable assignment Signed-off-by: 林博仁(Buo-ren Lin) <Buo.Ren.Lin@gmail.com> * snap: Migrate to selective-checkout The selective-pull stage snap is superseded by selective-checkout, prefer the new one. Refer-to: Selective-checkout: Check out the tagged release revision if it isn't promoted to the stable channel <https://forum.snapcraft.io/t/the-selective-pull-scriptlet-stage-snap-workaround/10389> Signed-off-by: 林博仁(Buo-ren Lin) <Buo.Ren.Lin@gmail.com> * snap: Support bash completion Refer-to: Scriptlets <https://docs.snapcraft.io/scriptlets/4892> Refer-to: Tab completion for snaps <https://docs.snapcraft.io/tab-completion-for-snaps/2261> Signed-off-by: 林博仁(Buo-ren Lin) <Buo.Ren.Lin@gmail.com> * snap: Implement interface connection warning in the launcher This patch ensures that the user will be acknowledge the missing connection to the `removable-media` interface. Signed-off-by: 林博仁(Buo-ren Lin) <Buo.Ren.Lin@gmail.com>
33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# This is the maintainence launcher for the snap, make necessary runtime environment changes to make the snap work here. You may also insert security confinement/deprecation/obsoletion notice of the snap here.
|
|
|
|
set \
|
|
-o errexit \
|
|
-o errtrace \
|
|
-o nounset \
|
|
-o pipefail
|
|
|
|
# Use user's real home directory for canonical configuration path access
|
|
declare REALHOME="$(
|
|
getent passwd "${USER}" \
|
|
| cut --delimiter=: --fields=6
|
|
)"
|
|
HOME="${REALHOME}"
|
|
|
|
if ! test -f "${SNAP_USER_COMMON}"/marker_disable_interface_warning; then
|
|
# Warn if the `removable-media` interface isn't connected
|
|
if ! ls /media &>/dev/null; then
|
|
printf -- \
|
|
"It seems that this snap isn't connected to the \`removable-media\` security confinement interface. If you want to save the files under \`/media\`, \`/run/media\`, or \`/mnt\` directories you need to connect this snap to the \`removable-media\` interface by running the following command in a terminal:\\n\\n sudo snap connect %s:removable-media\\n\\n" \
|
|
"${SNAP_NAME}" \
|
|
>&2
|
|
printf -- \
|
|
"To disable this warning create an empty file at the following path:\\n\\n %s/marker_disable_interface_warning\\n\\n" \
|
|
"${SNAP_USER_COMMON}" \
|
|
>&2
|
|
fi
|
|
fi
|
|
|
|
# Finally run the next part of the command chain
|
|
exec "${@}"
|