summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-06 13:44:40 +0000
committerrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-06 13:44:40 +0000
commit2ed61cfb3ad3d404b9a44bbb3f4c8083b469ae22 (patch)
tree9939c67d95720a330bd7b884363d801cc7d5811d /scripts
Move everything into trunk.
Also add branches and tags directories. git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@348 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_keys.rb13
-rwxr-xr-xscripts/prepare_release.sh40
-rwxr-xr-xscripts/sign_update.rb7
3 files changed, 60 insertions, 0 deletions
diff --git a/scripts/generate_keys.rb b/scripts/generate_keys.rb
new file mode 100755
index 0000000..b22439c
--- /dev/null
+++ b/scripts/generate_keys.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/ruby
+["dsaparam.pem", "dsa_priv.pem", "dsa_pub.pem"].each do |file|
+ if File.exist? file
+ puts "There's already a #{file} here! Move it aside or be more careful!"
+ end
+end
+`openssl dsaparam 2048 < /dev/urandom > dsaparam.pem`
+`openssl gendsa dsaparam.pem -out dsa_priv.pem`
+`openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem`
+`rm dsaparam.pem`
+puts "\nGenerated private and public keys: dsa_priv.pem and dsa_pub.pem.\n
+BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!\n
+If you lose it, your users will be unable to upgrade!\n" \ No newline at end of file
diff --git a/scripts/prepare_release.sh b/scripts/prepare_release.sh
new file mode 100755
index 0000000..dfed6ee
--- /dev/null
+++ b/scripts/prepare_release.sh
@@ -0,0 +1,40 @@
+set -o errexit
+
+PROJECT_NAME=TikZiT
+APP_BUNDLE=xbuild/Release/$PROJECT_NAME.app
+
+VERSION=$(defaults read "$(pwd)/$APP_BUNDLE/Contents/Info" CFBundleVersion)
+DOWNLOAD_BASE_URL="http://tikzit.sourceforge.net/appcast"
+RELEASENOTES_URL="$DOWNLOAD_BASE_URL/rnotes.html"
+
+ARCHIVE_FILENAME="$PROJECT_NAME $VERSION.tar.bz2"
+ARCHIVE_PATH="docs/web/appcast/files/$ARCHIVE_FILENAME"
+DOWNLOAD_URL="$DOWNLOAD_BASE_URL/files/$ARCHIVE_FILENAME"
+
+if [ -e "$ARCHIVE_PATH" ]; then
+ echo 'Archive already exists. Either remove this archive or increment version.'
+ exit 1
+fi
+
+tar cjf "$ARCHIVE_PATH" "$APP_BUNDLE"
+
+SIZE=$(stat -f %z "$ARCHIVE_PATH")
+PUBDATE=$(LC_TIME=en_US date +"%a, %d %b %G %T %z")
+SIGNATURE=$(scripts/sign_update.rb "$ARCHIVE_PATH" tikzit_dsa_priv.pem)
+
+cat <<EOF
+ <item>
+ <title>Version $VERSION</title>
+ <sparkle:releaseNotesLink>
+ $RELEASENOTES_URL
+ </sparkle:releaseNotesLink>
+ <pubDate>$PUBDATE</pubDate>
+ <enclosure
+ url="$DOWNLOAD_URL"
+ sparkle:version="$VERSION"
+ type="application/octet-stream"
+ length="$SIZE"
+ sparkle:dsaSignature="$SIGNATURE"
+ />
+ </item>
+EOF
diff --git a/scripts/sign_update.rb b/scripts/sign_update.rb
new file mode 100755
index 0000000..6d03e2e
--- /dev/null
+++ b/scripts/sign_update.rb
@@ -0,0 +1,7 @@
+#!/usr/bin/ruby
+if ARGV.length < 2
+ puts "Usage: ruby sign_update.rb update_archive private_key"
+ exit
+end
+
+puts `openssl dgst -sha1 -binary < "#{ARGV[0]}" | openssl dgst -dss1 -sign "#{ARGV[1]}" | openssl enc -base64` \ No newline at end of file