Subversion Repositories ipe_artfile_utils

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

#!/bin/bash

# Get the directory of this script (also works with symlinks)
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
        DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
        SOURCE="$(readlink "$SOURCE")"
        [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

cd "$DIR"
dirname=$( basename "$( pwd )" )
tmpfile=$( mktemp )

FILENAME="stable.tar.gz"

cd ..
tar cvfz "$tmpfile" --exclude="$dirname"/"$FILENAME" --exclude ".svn" -- "$dirname"

# otherwise: "the file has changed while reading"
mv "$tmpfile" "$dirname"/"$FILENAME"

chmod 644 "$dirname"/"$FILENAME"