{"body":"#!/bin/sh\nif [ \"$(id -u)\" -ne 0 ]; then\n    echo \"session-tool needs to be invoked as root\" >&2\n    exit 1\nfi\nif [ -z \"$(command -v busctl)\" ]; then\n    echo \"session-tool requires busctl\" >&2\n    exit 1\nfi\nif [ $# -eq 0 ]; then\n\techo \"usag: session-tool [-u user] [--] <CMD>\"\n\texit 1\nfi\npid=$PPID\nuser=root\nwhile [ $# -gt 0 ]; do\n\tcase \"$1\" in\n\t\t--)\n\t\t\tshift\n\t\t\tbreak\n\t\t\t;;\n\t\t-u)\n\t\t\tuser=\"$2\"\n\t\t\tshift 2\n\t\t\t;;\n\t\t-*)\n\t\t\techo \"session-tool: unsupported argument $1\" >&2\n\t\t\texit 1\n\t\t\t;;\n\t\t*)\n\t\t\tbreak\n\t\t\t;;\n\tesac\ndone\nunit_name=\"service-tool-$(cat /proc/sys/kernel/random/uuid).service\"\nexec busctl \\\n\t--allow-interactive-authorization=no \\\n\t--quiet \\\n\t--system \\\n\t-- \\\n\tcall \\\n\t org.freedesktop.systemd1 \\\n\t/org/freedesktop/systemd1 \\\n\t org.freedesktop.systemd1.Manager \\\n\tStartTransientUnit \"ssa(sv)a(sa(sv))\" \\\n\t\"$unit_name\" fail 3 \\\n\t\tDescription s \"service-tool running $* as $user\" \\\n\t\tType s oneshot \\\n\t\tExecStart \"a(sasb)\" 1 \\\n\t\t\t/bin/sh 3 /bin/sh -c \"exec runuser -l - $user -c \\\"$*\\\" </dev/null >/proc/$pid/fd/1 2>/proc/$pid/fd/2\" false \\\n\t0\n","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/N9YISpKV","modified":1582814876,"id":"N9YISpKV","size":1050,"lines":51,"own_paste":false,"theme":"","date":1582814876}