wrapper

package
v0.0.0-...-1defb90 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package wrapper abstracts away OS-native operations like package installation and writing to file as root.

Index

Constants

View Source
const DefaultDirPerm = 0755

DefaultDirPerm is equivalent to -rwxr-xr-x

View Source
const DefaultFilePerm = 0644

DefaultFilePerm is equivalent to -rw-r--r--

View Source
const TmpDir = "/tmp/pompup"

⚠️ ⚠️ ⚠️ ⚠️ ⚠️ BE FUCKING CAREFUL WHEN CHANGING THIS IT IS USED WITH "rm -rf" IT MIGHT KDE6 THE SHIT OUT OF YOUR HOME DIR ⚠️ ⚠️ ⚠️ ⚠️ ⚠️

Variables

View Source
var (
	ErrStartupNotLinux      error = errors.New("platform is not Linux")
	ErrStartupRunningAsRoot error = errors.New("program running as root")
	ErrStartupNoPacman      error = errors.New("pacman is not installed")
	ErrStartupNoSudo        error = errors.New("sudo is not installed")
)

Startup error

Functions

func AddGroup

func AddGroup(group string)

AddGroup adds the user to group if the user is not part of the group already.

func BashRun

func BashRun(command string) error

BashRun runs a command as if it was typed out in a bash shell. This allows the usage of piping among other stuff.

func Dconf

func Dconf(data string) error

Dconf loads dconf configuration from string

func Flatpak

func Flatpak(appID string) error

Flatpak installs flatpak packages.

func FlatpakOnce

func FlatpakOnce(packageName string)

FlatpakOnce acts like Flatpak but skips when the package is installed already.

func GetHomeDir

func GetHomeDir() string

func GetUserName

func GetUserName() string

func InHome

func InHome(path string) string

func IsArchPkgInstalled

func IsArchPkgInstalled(packageName string) bool

IsArchPkgInstalled checks if an arch package has been installed already.

func IsBinInstalled

func IsBinInstalled(command string) bool

IsBinInstalled checks if a file can be found in PATH.

func IsFileUpdated

func IsFileUpdated(filePath string, s string) bool

IsFileUpdated checks if file's content is already s.

func IsFlatpakInstalled

func IsFlatpakInstalled(packageName string) bool

IsFlatpakInstalled checks if an flatpak package has been installed already.

func IsLinux

func IsLinux() bool

IsLinux checks if the program is running on a Linux-based Operating System.

func IsRoot

func IsRoot() bool

IsRoot checks if the program is running with root permission.

func Pacman

func Pacman(packageName string) error

Pacman installs Arch Linux packages using pacman. It can not install packages from the AUR.

func PacmanOnce

func PacmanOnce(packageName string)

PacmanOnce acts like Pacman but skips when the package is installed already.

func Paru

func Paru(packageName string) error

Paru installs Arch Linux packages using paru. It can also install packages from the AUR.

func ParuOnce

func ParuOnce(packageName string)

ParuOnce acts like Paru but skips when the package is installed already.

func PathExists

func PathExists(path string) bool

PathExists checks whether the given path exists or not

func ReadFile

func ReadFile(filePath string) (content string, fileExists bool)

func Run

func Run(name string, arg ...string) error

func StartupCheck

func StartupCheck() error

StartupCheck checks whether there are any irrecoverable issues in the system that prevents the program to begin installing.

func SudoWriteFile

func SudoWriteFile(path string, data string)

SudoWriteFile writes data to path where file is owned by root. It can safely perform multiple operations on the same path.

func SystemctlEnable

func SystemctlEnable(service string)

func TryDconf

func TryDconf(data string)

TryDconf tries to load dconf configuration from string then terminates program if it fails.

func WriteFile

func WriteFile(filePath string, data []byte)

WriteFile writes data to path. It can safely perform multiple operations on the same path.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL