File blender-patch-source of Package blender
#!/bin/bash
REMOVE_DIRS=( extern/ffmpeg extern/xvidcore extern/libmp3lame/ extern/x264)
set -o errexit
CMDNAME=${0##*/}
SOURCEDIR=${0%$CMDNAME}
BASENAME=${1%.tar.bz2}
echo "removing $REMOVE_DIRS , base name is $BASENAME"
trap "rm -rf \"$BASENAME-patched.tar\" \"$BASENAME-patched.tar.bz2\"" ERR
for (( N=0 ; N<${#REMOVE_DIRS[@]} ; N++ )) ; do
REMOVE_DIRS[N]="$BASENAME/${REMOVE_DIRS[N]}"
done
cd "$SOURCEDIR" >/dev/null
if ! test -f "$BASENAME.tar.bz2" ; then
exit 0
fi
if test -f "$BASENAME-patched.tar.bz2" ; then
if test "$BASENAME.tar.bz2" -ot "$BASENAME-patched.tar.bz2" ; then
if test $CMDNAME -ot "$BASENAME-patched.tar.bz2" ; then
exit 0
fi
fi
fi
cp -a "$BASENAME.tar.bz2" "$BASENAME-patched.tar.bz2"
bunzip2 "$BASENAME-patched.tar.bz2"
tar --delete -f "$BASENAME-patched.tar" "${REMOVE_DIRS[@]}"
bzip2 "$BASENAME-patched.tar"