summaryrefslogtreecommitdiff
path: root/recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch')
-rw-r--r--recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch b/recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch
new file mode 100644
index 0000000..b78eec0
--- /dev/null
+++ b/recipes-support/snapd/files/0002-cmd-snap-do-not-allow-classic-snaps-on-other-distrib.patch
@@ -0,0 +1,47 @@
+From 24616e1c2b8ade1700ee77dc9549ae839addebf6 Mon Sep 17 00:00:00 2001
+From: Simon Fels <simon.fels@canonical.com>
+Date: Mon, 27 Mar 2017 10:17:03 +0200
+Subject: [PATCH 2/4] cmd/snap: do not allow classic snaps on other
+ distributions
+
+As of right now classic snaps are not supported on other distributions
+than Ubuntu or Debian. This is because of those not allowing us to have
+a global /snap directory, so its moved into /var/lib/snapd/snap instead.
+
+The changed /snap directory breaks classic snaps as those have static
+paths hardcoded to binaries/libraries in /snap for the sake of the
+linker to work.
+---
+ cmd/snap/cmd_snap_op.go | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/cmd/snap/cmd_snap_op.go b/cmd/snap/cmd_snap_op.go
+index 50095f4..fb86b41 100644
+--- a/cmd/snap/cmd_snap_op.go
++++ b/cmd/snap/cmd_snap_op.go
+@@ -36,6 +36,7 @@ import (
+ "github.com/snapcore/snapd/i18n"
+ "github.com/snapcore/snapd/osutil"
+ "github.com/snapcore/snapd/progress"
++ "github.com/snapcore/snapd/release"
+ )
+
+ func lastLogStr(logs []string) string {
+@@ -438,6 +439,14 @@ func (x *cmdInstall) installOne(name string, opts *client.SnapOptions) error {
+ var installFromFile bool
+ var changeID string
+
++ switch release.ReleaseInfo.ID {
++ case "fedora", "centos", "rhel", "opensuse", "suse":
++ if opts.Classic {
++ fmt.Fprintf(Stderr, i18n.G("snap %q can not be installed as classic snaps are not supported on your distribution\n"), name)
++ return nil
++ }
++ }
++
+ cli := Client()
+ if strings.Contains(name, "/") || strings.HasSuffix(name, ".snap") || strings.Contains(name, ".snap.") {
+ installFromFile = true
+--
+2.7.4
+