Skip to content

Instantly share code, notes, and snippets.

@kpiwko
Created May 7, 2015 06:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kpiwko/d7e8d6e4fbab12a7a8b6 to your computer and use it in GitHub Desktop.
Save kpiwko/d7e8d6e4fbab12a7a8b6 to your computer and use it in GitHub Desktop.
Red Hat SCL Sudo wrapper
#! /bin/sh
# TODO: parse & pass-through sudo options from $@
sudo_options="-E"
scls=$X_SCLS
#available_scls="`scl --list | tr '\n' ' ' | sed 's/ $//'`"
for arg in "$@"
do
case "$arg" in
*\'*)
arg= ;;
esac
cmd_options="$cmd_options '$arg'"
done
if [ "x$scls" = "x" ]; then
echo "Unable to identify activated SCL collection(s). Please activate them in shell profile via"
echo 'source /opt/rh/$collection_name/enable'
echo 'export X_SCLS="`scl enable $collection_name '"'"'echo \$X_SCLS'"'"'`"'
exit 1
fi
exec /usr/bin/sudo $sudo_options LD_LIBRARY_PATH=$LD_LIBRARY_PATH PATH=$PATH scl enable $scls "$cmd_options"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment