File gstreamer-0_10-plugins-ugly-patch-source.sh of Package gstreamer-0_10-plugins-ugly
#!/bin/bash
REMOVE_DIRS=( asfdemux iec958 mpegaudioparse mpegstream )
set -o errexit
CMDNAME=${0##*/}
SOURCEDIR=${0%$CMDNAME}
BASENAME=${1%.tar.xz}
trap "rm -rf \"$BASENAME-patched.tar\" \"$BASENAME-patched.tar.xz\"" ERR
for (( N=0 ; N<${#REMOVE_DIRS[@]} ; N++ )) ; do
REMOVE_DIRS[N]="$BASENAME/gst/${REMOVE_DIRS[N]}"
done
cd "$SOURCEDIR" >/dev/null
if ! test -f "$BASENAME.tar.xz" ; then
exit 0
fi
if test -f "$BASENAME-patched.tar.xz" ; then
if test "$BASENAME.tar.xz" -ot "$BASENAME-patched.tar.xz" ; then
if test $CMDNAME -ot "$BASENAME-patched.tar.xz" ; then
exit 0
fi
fi
fi
cp -a "$BASENAME.tar.xz" "$BASENAME-patched.tar.xz"
xz --decompress "$BASENAME-patched.tar.xz"
tar --delete -f "$BASENAME-patched.tar" "${REMOVE_DIRS[@]}"
xz "$BASENAME-patched.tar"