use a script to generate stackbrew versions
diff --git a/Dockerfile b/Dockerfile.template
similarity index 97%
rename from Dockerfile
rename to Dockerfile.template
index 2330f73..9d6766b 100644
--- a/Dockerfile
+++ b/Dockerfile.template
@@ -21,7 +21,7 @@
 
 COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-angent-port.groovy
 
-ENV JENKINS_VERSION 1.565.3
+ENV JENKINS_VERSION %%JENKINS_VERSION%%
 
 # could use ADD but this one does not check Last-Modified header 
 # see https://github.com/docker/docker/issues/8331
diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh
new file mode 100755
index 0000000..01aa5d5
--- /dev/null
+++ b/generate-stackbrew-library.sh
@@ -0,0 +1,24 @@
+#!/usr/local/Cellar/bash/4.3.30/bin/bash
+set -e
+
+declare -A aliases
+aliases=(
+	[1.592]='weekly'
+	[1.580.1]='latest'
+)
+
+versions=( */ )
+versions=( "${versions[@]%/}" )
+url='git://github.com/cloudbees/jenkins-ci.org-docker'
+
+echo '# maintainer: Nicolas De Loof <nicolas.deloof@gmail.com> (@ndeloo)'
+
+for version in "${versions[@]}"; do
+	commit="$(git log -1 --format='format:%H' -- "$version")"
+	versionAliases=( $version ${aliases[$version]} )
+	
+	echo
+	for va in "${versionAliases[@]}"; do
+		echo "$va: ${url}@${commit} $version"
+	done
+done
diff --git a/update.sh b/update.sh
new file mode 100755
index 0000000..a0d7f15
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e
+
+versions=( "$@" )
+if [ ${#versions[@]} -eq 0 ]; then
+	versions=( */ )
+fi
+versions=( "${versions[@]%/}" )
+
+for version in "${versions[@]}"; do
+	rm -rf "$version"/*
+	cp Dockerfile.template jenkins.sh plugins.sh init.groovy "$version/"
+	mv "$version/Dockerfile.template" "$version/Dockerfile"
+	sed -i "" 's/%%JENKINS_VERSION%%/'$version'/g; s/%%JENKINS_VERSION%%/'$version'/g' "$version/Dockerfile"
+done
+