Blame SOURCES/sudo.sh

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