mirror of
				https://github.com/containers/podman.git
				synced 2025-11-04 17:07:20 +08:00 
			
		
		
		
	Moving from Go module v4 to v5 prepares us for public releases. Move done using gomove [1] as with the v3 and v4 moves. [1] https://github.com/KSubedi/gomove Signed-off-by: Matt Heon <mheon@redhat.com>
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
//go:build !windows
 | 
						|
 | 
						|
package util
 | 
						|
 | 
						|
// TODO once rootless function is consolidated under libpod, we
 | 
						|
//  should work to take darwin from this
 | 
						|
 | 
						|
import (
 | 
						|
	"path/filepath"
 | 
						|
 | 
						|
	"github.com/containers/podman/v5/pkg/rootless"
 | 
						|
	"github.com/containers/storage/pkg/homedir"
 | 
						|
)
 | 
						|
 | 
						|
// GetRootlessRuntimeDir returns the runtime directory when running as non root
 | 
						|
func GetRootlessRuntimeDir() (string, error) {
 | 
						|
	if !rootless.IsRootless() {
 | 
						|
		return "", nil
 | 
						|
	}
 | 
						|
	return homedir.GetRuntimeDir()
 | 
						|
}
 | 
						|
 | 
						|
// GetRootlessConfigHomeDir returns the config home directory when running as non root
 | 
						|
func GetRootlessConfigHomeDir() (string, error) {
 | 
						|
	return homedir.GetConfigHome()
 | 
						|
}
 | 
						|
 | 
						|
// GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for
 | 
						|
// the pause process.
 | 
						|
func GetRootlessPauseProcessPidPath() (string, error) {
 | 
						|
	runtimeDir, err := GetRootlessRuntimeDir()
 | 
						|
	if err != nil {
 | 
						|
		return "", err
 | 
						|
	}
 | 
						|
	// Note this path must be kept in sync with pkg/rootless/rootless_linux.go
 | 
						|
	// We only want a single pause process per user, so we do not want to use
 | 
						|
	// the tmpdir which can be changed via --tmpdir.
 | 
						|
	return filepath.Join(runtimeDir, "libpod", "tmp", "pause.pid"), nil
 | 
						|
}
 |