Skip to content

Instantly share code, notes, and snippets.

@SignpostMarv
Created September 10, 2012 12:15
Show Gist options
  • Save SignpostMarv/3690604 to your computer and use it in GitHub Desktop.
Save SignpostMarv/3690604 to your computer and use it in GitHub Desktop.
Shell script for packaging up OpenSim builds (run from bin directory)
GITNAME="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')"
DIRNAME="${1-../..}/${GITNAME}"
TIMESTAMP="$(date +%Y-%m-%d_%H-%M-%S)"
FILENAME="opensim (${GITNAME}) ${TIMESTAMP}"
if [ -f ../../7za.exe ];
then
echo "Using 7-zip"
../../7za.exe a "../../${FILENAME}.tar" ./*
../../7za.exe a -tgzip "../../${FILENAME}.tgz" "../../${FILENAME}.tar" -mx=9 -mfb=258 -mpass=15
rm "../../${FILENAME}.tar"
else
echo "using tar"
tar --exclude=".*" -pvczf "../../${FILENAME}.tgz" * 1> /dev/null
fi;
mkdir -p "${DIRNAME}"
mv "../../${FILENAME}.tgz" "${DIRNAME}/${FILENAME}.tgz"
echo "${DIRNAME}/${FILENAME}.tgz"
@SignpostMarv
Copy link
Author

Modified it further so I don't have to manually move the archive to the branch-specific archive directory.

@SignpostMarv
Copy link
Author

Corrected the path to clean up the tar.

@SignpostMarv
Copy link
Author

Tweaked the dirname variable so the trailing slash does not need to be specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment