Blame SOURCES/scl-service

7686b4
#!/bin/bash
7686b4
7686b4
# This is a wrapper for 'scl enable' call, that accepts arguments given by
7686b4
# systemd service file, which doesn't allow to use arguments as we need.
7686b4
# It simply gets the first argument as a list of collection names (separated
7686b4
# by whitespace character) and will pass the rest of arguments to scl call
7686b4
# as the command.
7686b4
7686b4
if [ $# -lt 3 ] ; then
7686b4
        echo "Usage: `basename $0` collection_list command [ arg1 arg2 ... argN ]"
7686b4
        exit 1
7686b4
fi
7686b4
7686b4
# Store collections list
7686b4
COLLECTIONS=$1
7686b4
shift
7686b4
7686b4
# Store unquoted first argument
7686b4
ARGS="$1"
7686b4
shift
7686b4
7686b4
# Add other arguments with quotes
7686b4
while [ $# -ge 1 ] ; do
7686b4
    ARGS="$ARGS '$1'"
7686b4
    shift
7686b4
done
7686b4
7686b4
exec /usr/bin/scl enable $COLLECTIONS "$ARGS"
7686b4
7686b4
# Normally exec doesn't return
7686b4
echo "Exec returned, i.e. command failed: /usr/bin/scl enable $COLLECTIONS \"$ARGS\"" >&2
7686b4
exit 1