mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
This patch fixes the algorithm that dertermines the mount point for snaps. The old code used to work because it was looking at /etc/os-release and looking for specific ID or ID_LIKE values. With the introduction of base snaps that can have arbitrary os-release files we cannot rely on this information alone. When a process is inside a snap mount namespace that has a base snap mounted as the root filesystem then the os-release level information is not useful and must not be used anymore. Inside that environment the snaps are always mounted at /snap. On the outside of a mount namespace the current algorithm is correct, it will identify the distribution and apply any differences mandated by the distribution policy. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
33 lines
872 B
Go
33 lines
872 B
Go
// -*- Mode: Go; indent-tabs-mode: t -*-
|
|
|
|
/*
|
|
* Copyright (C) 2018 Canonical Ltd
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 3 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
package dirs
|
|
|
|
var (
|
|
IsInsideBaseSnap = isInsideBaseSnap
|
|
)
|
|
|
|
func MockMetaSnapPath(path string) (restore func()) {
|
|
old := metaSnapPath
|
|
metaSnapPath = path
|
|
return func() {
|
|
metaSnapPath = old
|
|
}
|
|
}
|