-cp $d.tar.bz2 $HOME/work/web/disorder
-cp .src/CHANGES $HOME/work/web/disorder/CHANGES.txt
-cp .src/README $HOME/work/web/disorder/README.txt
-cp .src/ChangeLog.d/*--* $HOME/work/web/disorder/ChangeLog.d
+src=$d.tar.bz2
+
+# Report and execute a command remotely
+remote() {
+ local h=$1
+ shift
+ echo "$h:" "$@"
+ ssh $h "$@"
+}
+
+# Build .debs and copy to the right place
+build() {
+ local h=$1 # build host
+ local f=$2
+ local vs=$3
+ local dist=$4
+
+ remote $h "mkdir -p _builds"
+ remote $h "rm -rf _builds/*.deb _builds/$d"
+ scp $src $h:_builds
+ remote $h "cd _builds && tar xfj $src"
+ if [ "$vs" != "" ]; then
+ remote $h "cd _builds/$d && scripts/setversion $v~$vs 'Backport to $vs' $dist"
+ fi
+ remote $h "cd _builds/$d && fakeroot debian/rules binary"
+ mkdir -p $web/$f
+ scp $h:_builds/*.deb $web/$f/.
+}
+
+# Build various debs
+
+# Ubuntu dapper; binaries suit Debian etch too
+build dekabrach etch etch oldstable
+
+# Debian lenny (32-bit)
+build leucomorph lenny "" stable
+
+# Debian lenny (64-bit)
+build araminta lenny "" stable
+
+# Update the web
+cp $src $web