Browse Source

Remove systemd hack & improve permissions handling

cryobry 5 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'
         cat <<-'EOF'
 USAGE
 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...]]
                     [--silent] [--debug] [COMMANDS [ARGS...]]
 
 
 COMMANDS
 COMMANDS
@@ -86,11 +86,6 @@ OPTIONS
         This will form the base of the container name and should be unique to each project
         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
         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
     --array, -a ARRAY
         Read arguments from an existing or new ARRAY (bash >= 4.3)
         Read arguments from an existing or new ARRAY (bash >= 4.3)
         This is useful to reduce parsing errors and recommended for build-wrapper plugins
         This is useful to reduce parsing errors and recommended for build-wrapper plugins
@@ -117,7 +112,7 @@ EOF
         unset _array
         unset _array
 
 
         # Parse input and set switches using getopt
         # 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"
             eval set -- "$_input"
             while true; do
             while true; do
                 case "$1" in
                 case "$1" in
@@ -149,9 +144,6 @@ EOF
                     --mkexec|-x)
                     --mkexec|-x)
                         _mkexec="true"
                         _mkexec="true"
                         ;;
                         ;;
-                    --systemd|-s)
-                        _systemd="true"
-                        ;;
                     --silent)
                     --silent)
                         _silent="true"
                         _silent="true"
                         ;;
                         ;;
@@ -201,10 +193,10 @@ EOF
         declare -ga _pre_options_array
         declare -ga _pre_options_array
         _pre_options_array+=("-it")
         _pre_options_array+=("-it")
         #[[ "$_mode" == "ephemeral" ]] && _pre_options_array+=("--rm")
         #[[ "$_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+=("-w" "${_workdir}")
+        _pre_options_array+=("--userns=keep-id") # Fix user permission problems by default
         [[ -n $_maskdir ]] && _pre_options_array+=("-v" "${_maskdir}")
         [[ -n $_maskdir ]] && _pre_options_array+=("-v" "${_maskdir}")
-        [[ -n $_systemd ]] && _pre_options_array+=("--systemd=always")
         [[ -n $_debug ]] && echo "_pre_options_array:" "${_pre_options_array[@]}"
         [[ -n $_debug ]] && echo "_pre_options_array:" "${_pre_options_array[@]}"
 
 
     }
     }