mirror of
https://github.com/siderolabs/talos.git
synced 2025-12-10 03:51:14 +01:00
Re-design some methods, simplify flows and allow more simple interactions. Learn from mistakes and design better methods. Fixes #9471 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
21 lines
670 B
Go
21 lines
670 B
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package mount
|
|
|
|
import (
|
|
"github.com/freddierice/go-losetup/v2"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// Squashfs binds the squashfs to the loop device and returns the mountpoint for it to the specified target.
|
|
func Squashfs(target, squashfsFile string) (*Point, error) {
|
|
dev, err := losetup.Attach(squashfsFile, 0, true)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return NewPoint(dev.Path(), target, "squashfs", WithFlags(unix.MS_RDONLY|unix.MS_I_VERSION), WithShared()), nil
|
|
}
|