#!/bin/bash set -exu if [[ ! -d ~/www/static/six9.net/software/q-tools/ ]]; then echo go to server exit 1 fi mkdir -p ~/tmp/q-tools-release-$$ cd ~/tmp/q-tools-release-$$ git clone ssh://git@git.six9.net:8222/moonq/q-tools.git cd q-tools rm -rf .git release.sh seconds=$(( 10#$( date +%H )*3600 + 10#$( date +%M )*60 + 10#$( date +%S ) )) version="$( date +%Y%m%d ).$seconds" echo $version > .version find . \( -type f -or -type l \) -printf "%P\n" | grep -v \.git > current-files.txt echo .version >> current-files.txt git log --pretty=format: --name-status | awk '{ print $2 }' | grep -v ^$ | sort -u > git-files.txt sort current-files.txt git-files.txt | uniq -c | sed 's/^[[:space:]]*//g' | grep ^1 | awk '{ print $2 }' > .removed_files.txt rm -f current-files.txt git-files.txt tar \ -czf ~/www/static/six9.net/software/q-tools/q-tools.$version.tar.gz \ --owner=0 --group=0 \ . ln -sfT q-tools.$version.tar.gz ~/www/static/six9.net/software/q-tools/current.tar.gz echo $version > ~/www/static/six9.net/software/q-tools/current.txt cd ~/www/static/six9.net/software/q-tools/ rm -r ~/tmp/q-tools-release-$$ SimpleWebPage