2024-07-09 15:39:40 +09:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2024-09-13 11:49:10 +09:00
|
|
|
|
2024-09-17 13:48:42 +09:00
|
|
|
"git.ophivana.moe/cat/fortify/internal"
|
2024-07-09 15:39:40 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2024-09-09 21:19:12 +09:00
|
|
|
userName string
|
2024-09-22 00:29:36 +09:00
|
|
|
confPath string
|
2024-09-09 21:19:12 +09:00
|
|
|
|
|
|
|
dbusConfigSession string
|
|
|
|
dbusConfigSystem string
|
|
|
|
dbusVerbose bool
|
|
|
|
dbusID string
|
|
|
|
mpris bool
|
2024-09-08 02:24:01 +09:00
|
|
|
|
|
|
|
mustWayland bool
|
|
|
|
mustX bool
|
|
|
|
mustDBus bool
|
|
|
|
mustPulse bool
|
|
|
|
|
2024-09-04 01:20:12 +09:00
|
|
|
flagVerbose bool
|
2024-09-08 02:24:01 +09:00
|
|
|
printVersion bool
|
2024-09-22 00:29:36 +09:00
|
|
|
|
|
|
|
launchMethodText string
|
2024-07-09 15:39:40 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-09-09 03:16:54 +09:00
|
|
|
flag.StringVar(&userName, "u", "chronos", "Passwd name of user to run as")
|
2024-09-22 00:29:36 +09:00
|
|
|
flag.StringVar(&confPath, "c", "nil", "Path to full app configuration, or \"nil\" to configure from flags")
|
2024-09-09 21:19:12 +09:00
|
|
|
|
|
|
|
flag.StringVar(&dbusConfigSession, "dbus-config", "builtin", "Path to D-Bus proxy config file, or \"builtin\" for defaults")
|
|
|
|
flag.StringVar(&dbusConfigSystem, "dbus-system", "nil", "Path to system D-Bus proxy config file, or \"nil\" to disable")
|
|
|
|
flag.BoolVar(&dbusVerbose, "dbus-log", false, "Enable logging in the D-Bus proxy")
|
2024-09-09 03:16:54 +09:00
|
|
|
flag.StringVar(&dbusID, "dbus-id", "", "D-Bus ID of application, leave empty to disable own paths, has no effect if custom config is available")
|
|
|
|
flag.BoolVar(&mpris, "mpris", false, "Allow owning MPRIS D-Bus path, has no effect if custom config is available")
|
2024-09-08 02:24:01 +09:00
|
|
|
|
|
|
|
flag.BoolVar(&mustWayland, "wayland", false, "Share Wayland socket")
|
|
|
|
flag.BoolVar(&mustX, "X", false, "Share X11 socket and allow connection")
|
|
|
|
flag.BoolVar(&mustDBus, "dbus", false, "Proxy D-Bus connection")
|
|
|
|
flag.BoolVar(&mustPulse, "pulse", false, "Share PulseAudio socket and cookie")
|
|
|
|
|
2024-09-04 01:20:12 +09:00
|
|
|
flag.BoolVar(&flagVerbose, "v", false, "Verbose output")
|
2024-07-09 15:39:40 +09:00
|
|
|
flag.BoolVar(&printVersion, "V", false, "Print version")
|
|
|
|
}
|
2024-09-13 11:49:10 +09:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
methodHelpString := "Method of launching the child process, can be one of \"sudo\", \"bubblewrap\""
|
2024-09-17 13:48:42 +09:00
|
|
|
if internal.SdBootedV {
|
2024-09-13 11:49:10 +09:00
|
|
|
methodHelpString += ", \"systemd\""
|
|
|
|
}
|
|
|
|
|
2024-09-22 00:29:36 +09:00
|
|
|
flag.StringVar(&launchMethodText, "method", "sudo", methodHelpString)
|
2024-09-13 11:49:10 +09:00
|
|
|
}
|