mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
Context On Sept 21st, Microsoft anounced systemd support for WSL 2 ([see anouncement](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/)), and Ubuntu-Preview already ships with systemd enabled by default. Changes Snap now works on WSL 2. Hence some of the current system checks in snapd have to be updated in response. Bugfixes This PR fixes: - [#1991823](https://bugs.launchpad.net/snapd/+bug/1991823) WSL detection is now incorrect / inappropriate - [#1991826](https://bugs.launchpad.net/snapd/+bug/1991826) snapd is intentionally broken under WSL and shouldn't be * release: Implemented WLS 1/2 distinction * syscheck: enabled snapd on WSL 2 * snapd-apparmor: Applied distiction, split tests * Made WSL1 check more robust * release: Removed redundant isWSL * snapd-apparmor: WSL2 has internal policy * release: Strenghtened detection of WSL1 vs. WSL2 * cmd/snap: Allowed snap on WSL2 * release: getting filesystem type with syscal * release: added unit test for filesystemRootType * release: use Assert to check errors as we usually do Co-authored-by: Samuele Pedroni <pedronis@lucediurna.net>
39 lines
930 B
Go
39 lines
930 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 syscheck
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/snapcore/snapd/release"
|
|
)
|
|
|
|
func init() {
|
|
checks = append(checks, checkWSL)
|
|
}
|
|
|
|
func checkWSL() error {
|
|
if release.WSLVersion == 1 {
|
|
return errors.New("snapd does not work inside WSL1")
|
|
}
|
|
|
|
return nil
|
|
}
|