Improve make-archive.sh

This commit is contained in:
Frédéric Guillot
2014-12-05 20:55:08 -05:00
parent 1a75d1118f
commit 2c6d810411

View File

@@ -1,30 +1,61 @@
#!/bin/sh #!/bin/sh
VERSION=$1 if [ "$#" -lt 1 ]
APP="kanboard" then
echo "Usage: $0 <version> [destination]"
exit 1
fi
cd /tmp APP="kanboard"
VERSION=$1
DESTINATION=$2
if [ -z "$2" ]
then
DESTINATION=~/Devel/websites/$APP
fi
echo "Build package for version $VERSION => $DESTINATION"
# Cleanup
rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null
git clone --depth 1 https://github.com/fguillot/$APP.git # Download source code
cd /tmp
git clone --depth 1 -q https://github.com/fguillot/$APP.git >/dev/null
rm -rf $APP/data/*.sqlite \ # Install vendors
$APP/.git $APP/.gitignore \ cd /tmp/$APP
$APP/scripts \ composer --prefer-dist --no-dev --optimize-autoloader --quiet install
$APP/tests \
$APP/Vagrantfile \
$APP/.*.yml \
$APP/README.markdown \
$APP/docs \
$APP/Dockerfile
sed -i.bak s/master/$VERSION/g $APP/app/constants.php && rm -f $APP/app/*.bak # Remove useless files
zip -r $APP-$VERSION.zip $APP rm -rf data/*.sqlite \
.git \
.gitignore \
scripts \
tests \
Vagrantfile \
.*.yml \
README.markdown \
docs \
Dockerfile \
composer.*
mv $APP-$VERSION.zip ~/Devel/websites/$APP # Set the version number
sed -i.bak s/master/$VERSION/g app/constants.php && rm -f app/*.bak
cd ~/Devel/websites/$APP/ # Make the archive
unlink $APP-latest.zip cd /tmp
ln -s $APP-$VERSION.zip $APP-latest.zip zip -r $APP-$VERSION.zip $APP > /dev/null
mv $APP-$VERSION.zip $DESTINATION
cd $DESTINATION
# Make symlink for generic archive
if [ -L $APP-latest.zip ]
then
unlink $APP-latest.zip
ln -s $APP-$VERSION.zip $APP-latest.zip
fi
rm -rf /tmp/$APP 2>/dev/null rm -rf /tmp/$APP 2>/dev/null