Blame SOURCES/sudo.sh

f3a180
#! /bin/bash
f3a180
f3a180
# Emulate /usr/bin/sudo, so that SCL environment variables
f3a180
# are passed through via an /bin/env wrapper.
f3a180
# Includes work by Andy Fong <boringuy@gmail.com>
f3a180
f3a180
cmd_started=false
f3a180
is_option_param_next=false
f3a180
for arg in "$@"
f3a180
do
f3a180
   case "$arg" in
f3a180
    *\'*)
f3a180
      arg= ;;
f3a180
   esac
f3a180
   if [ "$cmd_started" = true ]; then
f3a180
       cmd_options="$cmd_options '$arg'"
f3a180
   elif [ "$is_option_param_next" = true ]; then
f3a180
       sudo_options="$sudo_options $arg"
f3a180
       is_option_param_next=false
f3a180
   elif [[ $arg == -* ]]; then
f3a180
       sudo_options="$sudo_options $arg"
f3a180
       case "$arg" in
f3a180
        # all the options that take a parameter
f3a180
        "-g" | "-h" | "-p" | "-u" | "-U" | "-C" | "-s" | "-r" | "-t" | "-T")
f3a180
            is_option_param_next=true
f3a180
        ;;
f3a180
        "--")
f3a180
          cmd_started=true
f3a180
        ;;
f3a180
       esac
f3a180
   elif [[ $arg == *=* ]]; then
f3a180
       sudo_options="$sudo_options $arg"
f3a180
   else
f3a180
       cmd_options="$cmd_options '$arg'"
f3a180
       cmd_started=true
f3a180
   fi
f3a180
done
f3a180
if [ "$sudo_options" == "" ]; then
f3a180
    sudo_options="-E"
f3a180
fi
f3a180
exec /usr/bin/sudo $sudo_options env LD_LIBRARY_PATH=$LD_LIBRARY_PATH PATH=$PATH scl enable %{scl} "$cmd_options"