pmbootstrap chroot --xauth: new option (MR 1944)
Make it easy to start any X11 application from the native chroot.
This commit is contained in:
parent
2dd707a7ea
commit
6d013b4472
|
@ -117,20 +117,31 @@ def chroot(args):
|
||||||
not suffix.startswith("buildroot_")):
|
not suffix.startswith("buildroot_")):
|
||||||
raise RuntimeError("--user is only supported for native or"
|
raise RuntimeError("--user is only supported for native or"
|
||||||
" buildroot_* chroots.")
|
" buildroot_* chroots.")
|
||||||
|
if args.xauth and suffix != "native":
|
||||||
|
raise RuntimeError("--xauth is only supported for native chroot.")
|
||||||
|
|
||||||
# apk: check minimum version, install packages
|
# apk: check minimum version, install packages
|
||||||
pmb.chroot.apk.check_min_version(args, suffix)
|
pmb.chroot.apk.check_min_version(args, suffix)
|
||||||
if args.add:
|
if args.add:
|
||||||
pmb.chroot.apk.install(args, args.add.split(","), suffix)
|
pmb.chroot.apk.install(args, args.add.split(","), suffix)
|
||||||
|
|
||||||
|
# Xauthority
|
||||||
|
env = {}
|
||||||
|
if args.xauth:
|
||||||
|
pmb.chroot.other.copy_xauthority(args)
|
||||||
|
env["DISPLAY"] = os.environ.get("DISPLAY")
|
||||||
|
env["XAUTHORITY"] = "/home/pmos/.Xauthority"
|
||||||
|
|
||||||
# Run the command as user/root
|
# Run the command as user/root
|
||||||
if args.user:
|
if args.user:
|
||||||
logging.info("(" + suffix + ") % su pmos -c '" +
|
logging.info("(" + suffix + ") % su pmos -c '" +
|
||||||
" ".join(args.command) + "'")
|
" ".join(args.command) + "'")
|
||||||
pmb.chroot.user(args, args.command, suffix, output=args.output)
|
pmb.chroot.user(args, args.command, suffix, output=args.output,
|
||||||
|
env=env)
|
||||||
else:
|
else:
|
||||||
logging.info("(" + suffix + ") % " + " ".join(args.command))
|
logging.info("(" + suffix + ") % " + " ".join(args.command))
|
||||||
pmb.chroot.root(args, args.command, suffix, output=args.output)
|
pmb.chroot.root(args, args.command, suffix, output=args.output,
|
||||||
|
env=env)
|
||||||
|
|
||||||
|
|
||||||
def config(args):
|
def config(args):
|
||||||
|
|
|
@ -493,6 +493,10 @@ def arguments():
|
||||||
default="tui")
|
default="tui")
|
||||||
chroot.add_argument("command", default=["sh", "-i"], help="command"
|
chroot.add_argument("command", default=["sh", "-i"], help="command"
|
||||||
" to execute inside the chroot. default: sh", nargs='*')
|
" to execute inside the chroot. default: sh", nargs='*')
|
||||||
|
chroot.add_argument("-x", "--xauth", action="store_true",
|
||||||
|
help="Copy .Xauthority and set environment variables,"
|
||||||
|
" so X11 applications can be started (native"
|
||||||
|
" chroot only)")
|
||||||
for action in [build_init, chroot]:
|
for action in [build_init, chroot]:
|
||||||
suffix = action.add_mutually_exclusive_group()
|
suffix = action.add_mutually_exclusive_group()
|
||||||
if action == chroot:
|
if action == chroot:
|
||||||
|
|
Loading…
Reference in New Issue