本文整理汇总了Golang中github.com/snapcore/snapd/snap.PlaceInfo类的典型用法代码示例。如果您正苦于以下问题:Golang PlaceInfo类的具体用法?Golang PlaceInfo怎么用?Golang PlaceInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlaceInfo类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RemoveSnapFiles
// RemoveSnapFiles removes the snap files from the disk after unmounting the snap.
func (b Backend) RemoveSnapFiles(s snap.PlaceInfo, typ snap.Type, meter progress.Meter) error {
mountDir := s.MountDir()
// this also ensures that the mount unit stops
if err := removeMountUnit(mountDir, meter); err != nil {
return err
}
if err := os.RemoveAll(mountDir); err != nil {
return err
}
// try to remove parent dir, failure is ok, means some other
// revisions are still in there
os.Remove(filepath.Dir(mountDir))
// snapPath may either be a file or a (broken) symlink to a dir
snapPath := s.MountFile()
if _, err := os.Lstat(snapPath); err == nil {
// remove the kernel assets (if any)
if typ == snap.TypeKernel {
if err := boot.RemoveKernelAssets(s); err != nil {
return err
}
}
// remove the snap
if err := os.RemoveAll(snapPath); err != nil {
return err
}
}
return nil
}
开发者ID:niemeyer,项目名称:snapd,代码行数:35,代码来源:setup.go
示例2: removeCurrentSymlinks
func removeCurrentSymlinks(info snap.PlaceInfo) error {
var err1, err2 error
// the snap "current" symlink
currentActiveSymlink := filepath.Join(info.MountDir(), "..", "current")
err1 = os.Remove(currentActiveSymlink)
if err1 != nil && !os.IsNotExist(err1) {
logger.Noticef("Cannot remove %q: %v", currentActiveSymlink, err1)
} else {
err1 = nil
}
// the data "current" symlink
currentDataSymlink := filepath.Join(info.DataDir(), "..", "current")
err2 = os.Remove(currentDataSymlink)
if err2 != nil && !os.IsNotExist(err2) {
logger.Noticef("Cannot remove %q: %v", currentDataSymlink, err2)
} else {
err2 = nil
}
if err1 != nil && err2 != nil {
return fmt.Errorf("cannot remove snap current symlink: %v and %v", err1, err2)
} else if err1 != nil {
return fmt.Errorf("cannot remove snap current symlink: %v", err1)
} else if err2 != nil {
return fmt.Errorf("cannot remove snap current symlink: %v", err2)
}
return nil
}
开发者ID:niemeyer,项目名称:snapd,代码行数:31,代码来源:link.go
示例3: RemoveSnapFiles
func (f *fakeSnappyBackend) RemoveSnapFiles(s snap.PlaceInfo, typ snap.Type, meter progress.Meter) error {
meter.Notify("remove-snap-files")
f.ops = append(f.ops, fakeOp{
op: "remove-snap-files",
name: s.MountDir(),
stype: typ,
})
return nil
}
开发者ID:niemeyer,项目名称:snapd,代码行数:9,代码来源:backend_test.go
示例4: UndoSetupSnap
func (f *fakeSnappyBackend) UndoSetupSnap(s snap.PlaceInfo, typ snap.Type, p progress.Meter) error {
p.Notify("setup-snap")
f.ops = append(f.ops, fakeOp{
op: "undo-setup-snap",
name: s.MountDir(),
stype: typ,
})
return nil
}
开发者ID:niemeyer,项目名称:snapd,代码行数:9,代码来源:backend_test.go
示例5: RemoveKernelAssets
// RemoveKernelAssets removes the unpacked kernel/initrd for the given
// kernel snap.
func RemoveKernelAssets(s snap.PlaceInfo) error {
bootloader, err := partition.FindBootloader()
if err != nil {
return fmt.Errorf("no not remove kernel assets: %s", err)
}
// remove the kernel blob
blobName := filepath.Base(s.MountFile())
dstDir := filepath.Join(bootloader.Dir(), blobName)
if err := os.RemoveAll(dstDir); err != nil {
return err
}
return nil
}
开发者ID:pedronis,项目名称:snappy,代码行数:17,代码来源:kernel_os.go
注:本文中的github.com/snapcore/snapd/snap.PlaceInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论