diff --git a/generate-linear-patch-sequence.sh b/generate-linear-patch-sequence.sh new file mode 100755 index 0000000..5772ad0 --- /dev/null +++ b/generate-linear-patch-sequence.sh @@ -0,0 +1,17 @@ +#! /bin/sh -e + +releasesDir=test + +prev="" + +for i in $(cd "$releasesDir" && ls -d nixpkgs-*pre* | sort -n); do + if test -e "$releasesDir/$i/MANIFEST"; then + if test -n "$prev" -a ! -e "$releasesDir/$i/patches-created"; then + echo $prev "->" $i + date + time ./generate-patches.sh "$releasesDir/$prev" "$releasesDir/$i" + touch "$releasesDir/$i/patches-created" + fi + prev=$i + fi +done diff --git a/generate-patches.sh b/generate-patches.sh new file mode 100755 index 0000000..4161b98 --- /dev/null +++ b/generate-patches.sh @@ -0,0 +1,14 @@ +#! /bin/sh -e +src="$1" +dst="$2" + +if test ! -d "$src" -o ! -d "$dst"; then + echo "syntax: $0 source-dir dest-dir" + exit 1 +fi + +nix-generate-patches \ + /data/releases/nars \ + /data/releases/patches \ + http://nixos.org/releases/patches \ + "$src/MANIFEST" "$dst/MANIFEST" diff --git a/mirror-nixos-isos.sh b/mirror-nixos-isos.sh new file mode 100755 index 0000000..b81a22f --- /dev/null +++ b/mirror-nixos-isos.sh @@ -0,0 +1,57 @@ +#! /bin/sh -e + +# This script downloads the latest NixOS ISO images from the "tested" +# view in Hydra to $mirrorDir (http://nixos.org/releases/nixos). + +curl="curl --silent --show-error --fail" +wget="wget --no-verbose --content-disposition" + +mirrorDir=/data/releases/nixos + +url=$($curl --head http://hydra.nixos.org/view/nixos/tested/latest | sed 's/Location: \(.*\)\r/\1/; t; d') + +if [ -z "$url" ]; then exit 1; fi + +echo "View page is $url" + +release=$($curl $url | sed 's|

View.*(\(.*\).*|\1|; t; d') + +if [ -z "$release" ]; then echo "Failed to get release"; exit 1; fi + +echo "Release is $release" + +releaseDir=$mirrorDir/$release + +if [ -d $releaseDir ]; then + echo "Release already exists" +else + + tmpDir=$mirrorDir/.tmp-$release-$$ + mkdir -p $tmpDir + + $wget --directory=$tmpDir $url/tarball/download + $wget --directory=$tmpDir $url/iso_minimal-i686-linux/download + $wget --directory=$tmpDir $url/iso_minimal-x86_64-linux/download + $wget --directory=$tmpDir $url/iso_graphical-i686-linux/download + $wget --directory=$tmpDir $url/iso_graphical-x86_64-linux/download + + mv $tmpDir $releaseDir + +fi + +#ln -sfn $release $mirrorDir/latest + +# Generate a .htaccess with some symbolic redirects to the latest version. +htaccess=$mirrorDir/.htaccess + +echo "Redirect /releases/nixos/latest http://nixos.org/releases/nixos/$release" > $htaccess.tmp +fn=$(cd $releaseDir && echo nixos-minimal-*-i686-linux.iso) +echo "Redirect /releases/nixos/latest-iso-minimal-i686-linux http://nixos.org/releases/nixos/$release/$fn" >> $htaccess.tmp +fn=$(cd $releaseDir && echo nixos-minimal-*-x86_64-linux.iso) +echo "Redirect /releases/nixos/latest-iso-minimal-x86_64-linux http://nixos.org/releases/nixos/$release/$fn" >> $htaccess.tmp +fn=$(cd $releaseDir && echo nixos-graphical-*-i686-linux.iso) +echo "Redirect /releases/nixos/latest-iso-graphical-i686-linux http://nixos.org/releases/nixos/$release/$fn" >> $htaccess.tmp +fn=$(cd $releaseDir && echo nixos-graphical-*-x86_64-linux.iso) +echo "Redirect /releases/nixos/latest-iso-graphical-x86_64-linux http://nixos.org/releases/nixos/$release/$fn" >> $htaccess.tmp + +mv $htaccess.tmp $htaccess