github.com/kubiko/snapd@v0.0.0-20201013125620-d4f3094d9ddf/snapdtool/tool_other.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  // +build !linux
     3  
     4  /*
     5   * Copyright (C) 2018 Canonical Ltd
     6   *
     7   * This program is free software: you can redistribute it and/or modify
     8   * it under the terms of the GNU General Public License version 3 as
     9   * published by the Free Software Foundation.
    10   *
    11   * This program is distributed in the hope that it will be useful,
    12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14   * GNU General Public License for more details.
    15   *
    16   * You should have received a copy of the GNU General Public License
    17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18   *
    19   */
    20  
    21  package snapdtool
    22  
    23  import (
    24  	"errors"
    25  )
    26  
    27  var errUnsupported = errors.New("unsupported on non-Linux systems")
    28  
    29  // ExecInSnapdOrCoreSnap makes sure you're executing the binary that ships in
    30  // the snapd/core snap.
    31  // On this OS this is a stub.
    32  func ExecInSnapdOrCoreSnap() {
    33  	return
    34  }
    35  
    36  // InternalToolPath returns the path of an internal snapd tool. The tool
    37  // *must* be located inside the same tree as the current binary.
    38  //
    39  // On this OS this is a stub and always returns an error.
    40  func InternalToolPath(tool string) (string, error) {
    41  	return "", errUnsupported
    42  }
    43  
    44  // IsReexecd returns true when the current process binary is running from a snap.
    45  //
    46  // On this OS this is a stub and always returns an error.
    47  func IsReexecd() (bool, error) {
    48  	return false, errUnsupported
    49  }