|
@@ -273,10 +273,18 @@ init() {
|
|
|
|
|
|
# CLI subcommand: "check"
|
|
|
cmd_entrypoint_check() {
|
|
|
+ init
|
|
|
# requirements are already checked in init()
|
|
|
INFO "Requirements are satisfied"
|
|
|
}
|
|
|
|
|
|
+# CLI subcommand: "nsenter"
|
|
|
+cmd_entrypoint_nsenter() {
|
|
|
+ # No need to call init()
|
|
|
+ pid=$(cat "$XDG_RUNTIME_DIR/dockerd-rootless/child_pid")
|
|
|
+ exec nsenter --no-fork --wd="$(pwd)" --preserve-credentials -m -n -U -t "$pid" -- "$@"
|
|
|
+}
|
|
|
+
|
|
|
show_systemd_error() {
|
|
|
n="20"
|
|
|
ERROR "Failed to start ${SYSTEMD_UNIT}. Run \`journalctl -n ${n} --no-pager --user --unit ${SYSTEMD_UNIT}\` to show the error log."
|
|
@@ -383,6 +391,7 @@ cli_ctx_rm() {
|
|
|
|
|
|
# CLI subcommand: "install"
|
|
|
cmd_entrypoint_install() {
|
|
|
+ init
|
|
|
# requirements are already checked in init()
|
|
|
if [ -z "$SYSTEMD" ]; then
|
|
|
install_nonsystemd
|
|
@@ -416,6 +425,7 @@ cmd_entrypoint_install() {
|
|
|
|
|
|
# CLI subcommand: "uninstall"
|
|
|
cmd_entrypoint_uninstall() {
|
|
|
+ init
|
|
|
# requirements are already checked in init()
|
|
|
if [ -z "$SYSTEMD" ]; then
|
|
|
INFO "systemd not detected, ${DOCKERD_ROOTLESS_SH} needs to be stopped manually:"
|
|
@@ -461,6 +471,7 @@ usage() {
|
|
|
echo
|
|
|
echo "Commands:"
|
|
|
echo " check Check prerequisites"
|
|
|
+ echo " nsenter Enter into RootlessKit namespaces (mostly for debugging)"
|
|
|
echo " install Install systemd unit (if systemd is available) and show how to manage the service"
|
|
|
echo " uninstall Uninstall systemd unit"
|
|
|
}
|
|
@@ -508,5 +519,4 @@ if ! command -v "cmd_entrypoint_${command}" > /dev/null 2>&1; then
|
|
|
fi
|
|
|
|
|
|
# main
|
|
|
-init
|
|
|
-"cmd_entrypoint_${command}"
|
|
|
+"cmd_entrypoint_${command}" "$@"
|