Browse Source

Remove systemd hack & improve permissions handling

cryobry 4 years ago
parent
commit
3e07284a4e
1 changed files with 4 additions and 12 deletions
  1. 4 12
      plugins/podmanRun/podmanRunEasy

+ 4 - 12
plugins/podmanRun/podmanRunEasy

@@ -51,7 +51,7 @@ podmanRunEasy () {
 
         cat <<-'EOF'
 USAGE
-    podman-run-easy [-m _mode] [-w PATH] [-d PATH] [-i _image] [--systemd] [--mkexec] [--help]
+    podmanRunEasy [-m _mode] [-w PATH] [-d PATH] [-i _image] [--userfix] [--mkexec] [--help]
                     [--silent] [--debug] [COMMANDS [ARGS...]]
 
 COMMANDS
@@ -86,11 +86,6 @@ OPTIONS
         This will form the base of the container name and should be unique to each project
         Default: Container name will be set based on a concatenation of the image and commands
 
-    --systemd
-        Force container to init with systemd (--systemd=always)
-        Default: --systemd=true (systemd will only start if CMD is systemd, /usr/sbin/init or
-        /sbin/init)
-
     --array, -a ARRAY
         Read arguments from an existing or new ARRAY (bash >= 4.3)
         This is useful to reduce parsing errors and recommended for build-wrapper plugins
@@ -117,7 +112,7 @@ EOF
         unset _array
 
         # Parse input and set switches using getopt
-        if _input=$(getopt -o +m:w:d:i:a:n:xsh -l mode:,workdir:,maskdir:,image:,array:,name:,mkexec,systemd,silent,debug,help -- "$@"); then
+        if _input=$(getopt -o +m:w:d:i:a:n:xh -l mode:,workdir:,maskdir:,image:,array:,name:,mkexec,silent,debug,help -- "$@"); then
             eval set -- "$_input"
             while true; do
                 case "$1" in
@@ -149,9 +144,6 @@ EOF
                     --mkexec|-x)
                         _mkexec="true"
                         ;;
-                    --systemd|-s)
-                        _systemd="true"
-                        ;;
                     --silent)
                         _silent="true"
                         ;;
@@ -201,10 +193,10 @@ EOF
         declare -ga _pre_options_array
         _pre_options_array+=("-it")
         #[[ "$_mode" == "ephemeral" ]] && _pre_options_array+=("--rm")
-        _pre_options_array+=("-v" "${_workdir}:${_workdir}")
+        _pre_options_array+=("-v" "${_workdir}:${_workdir}:Z")
         _pre_options_array+=("-w" "${_workdir}")
+        _pre_options_array+=("--userns=keep-id") # Fix user permission problems by default
         [[ -n $_maskdir ]] && _pre_options_array+=("-v" "${_maskdir}")
-        [[ -n $_systemd ]] && _pre_options_array+=("--systemd=always")
         [[ -n $_debug ]] && echo "_pre_options_array:" "${_pre_options_array[@]}"
 
     }