summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-11-20 15:01:22 +0100
committerYorhel <git@yorhel.nl>2016-11-20 15:01:22 +0100
commit46a6e2ff7c2afa73bcaf0fd01f79bf2b8ad928ca (patch)
tree9e791979ed5c0220b7be0deda918cb68a9d1e20f /util
parent2ee2f7495bda08ea23fb4d4515579e9e25a5e72c (diff)
Use Rust indexer for Ubuntu + script cleanup
Diffstat (limited to 'util')
-rwxr-xr-xutil/arch.sh14
-rw-r--r--util/common.sh60
-rwxr-xr-xutil/cron.sh10
-rwxr-xr-xutil/debian.sh2
-rwxr-xr-xutil/freebsd.sh44
-rwxr-xr-xutil/ubuntu.sh473
6 files changed, 193 insertions, 410 deletions
diff --git a/util/arch.sh b/util/arch.sh
index 7a54a1d..fee502d 100755
--- a/util/arch.sh
+++ b/util/arch.sh
@@ -2,12 +2,12 @@
. ./common.sh
+MIRROR=http://ftp.nluug.nl/pub/os/Linux/distr/archlinux
+
case "$1" in
- active)
- MIRROR=http://ftp.nluug.nl/pub/os/Linux/distr/archlinux
- REPOS="core extra community"
- for REPO in $REPOS; do
- index arch --sys arch --mirror $MIRROR --repo $REPO
- done
- ;;
+ current)
+ index arch --sys arch --mirror $MIRROR --repo core
+ index arch --sys arch --mirror $MIRROR --repo extra
+ index arch --sys arch --mirror $MIRROR --repo community
+ ;;
esac
diff --git a/util/common.sh b/util/common.sh
index 430f1d3..85e9cad 100644
--- a/util/common.sh
+++ b/util/common.sh
@@ -1,13 +1,9 @@
-#!/bin/bash
-
-if test -f .config; then
- source .config
-fi
+test -f .config && source .config
index() {
echo "====> indexer -vv $@"
- ./indexer -vv --dryrun $@ 2>&1
+ ./indexer -vv $@ 2>&1
echo
}
@@ -33,55 +29,3 @@ index_deb() {
index deb --sys "$SYS" --mirror "$MIRROR" --contents "$MIRROR$CONT" --packages "${MIRROR}dists/$DISTRO/$CMP/binary-i386/Packages.gz"
done
}
-
-
-PSQL="psql -U manned -Awtq"
-
-
-
-
-## THE STUFF BELOW IS OLD
-# To be replaced with calls to index()
-
-CURL="curl -fSs -A manual-page-crawler,info@manned.org --limit-rate 500k"
-
-TMP=`mktemp -d manned.XXXXXX`
-
-# bash-ism, remove the working directory when we're done.
-trap "rm -rf $TMP" EXIT
-
-
-# Usage: add_pkginfo sysid category name version date
-# Returns 0 if the package is already in the database or if an error occured.
-# Otherwise adds the package, sets PKGID to the new package_versions.id, and returns 1.
-PKGID=
-add_pkginfo() {
- RES=`echo "SELECT pv.id FROM packages p JOIN package_versions pv ON pv.package = p.id
- WHERE p.system = :'sysid' AND p.category = :'cat' AND p.name = :'name' AND pv.version = :'ver'"\
- | $PSQL -v "sysid=$1" -v "cat=$2" -v "name=$3" -v "ver=$4"`
- [ "$?" -ne 0 -o -n "$RES" ] && return 0
- RES=`echo "
- INSERT INTO packages (system, category, name) VALUES(:'sysid', :'cat', :'name') ON CONFLICT DO NOTHING;
- INSERT INTO package_versions (version, released, package) VALUES(:'ver', :'rel',
- (SELECT packages.id FROM packages WHERE system = :'sysid' AND category = :'cat' AND name = :'name'))
- RETURNING id"\
- | $PSQL -v "sysid=$1" -v "cat=$2" -v "name=$3" -v "ver=$4" -v "rel=$5"`
- [ "$?" -ne 0 ] && return 0
- PKGID=$RES
- return 1
-}
-
-
-# Usage: add_tar <file> <pkgid> <flags>
-# Requires a recent GNU tar for compression autodetect and xz support.
-# TODO: tar throws an error if there are no man pages, but this isn't really an
-# error.
-add_tar() {
- DIR=`mktemp -d "$TMP/tar.XXXXXXX"`
- tar --warning=no-unknown-keyword --warning=no-alone-zero-block -C "$DIR" $3 -xf "$1" --wildcards '*man/*'\
- && ./add_dir.pl "$DIR" "$2"
- RET=$?
- rm -rf "$DIR"
- return $RET
-}
-
diff --git a/util/cron.sh b/util/cron.sh
index 5678314..c73de32 100755
--- a/util/cron.sh
+++ b/util/cron.sh
@@ -1,9 +1,11 @@
-#!/bin/bash
+#!/bin/sh
-. ./common.sh
+PSQL="psql -U manned -Awtq"
-./arch.sh active
-./debian.sh active
+
+./arch.sh current
+./debian.sh current
+./ubuntu.sh current
echo "============ Updating SQL indices"
$PSQL -f update_indices.sql
diff --git a/util/debian.sh b/util/debian.sh
index 1262282..4768557 100755
--- a/util/debian.sh
+++ b/util/debian.sh
@@ -68,7 +68,7 @@ case "$1" in
$0 lenny
$0 squeeze
;;
- active)
+ current)
$0 wheezy
$0 jessie
;;
diff --git a/util/freebsd.sh b/util/freebsd.sh
index 8e03722..8a900fd 100755
--- a/util/freebsd.sh
+++ b/util/freebsd.sh
@@ -3,6 +3,50 @@
. ./common.sh
+CURL="curl -fSs -A manual-page-crawler,info@manned.org --limit-rate 500k"
+
+TMP=`mktemp -d manned.XXXXXX`
+
+# bash-ism, remove the working directory when we're done.
+trap "rm -rf $TMP" EXIT
+
+
+# Usage: add_pkginfo sysid category name version date
+# Returns 0 if the package is already in the database or if an error occured.
+# Otherwise adds the package, sets PKGID to the new package_versions.id, and returns 1.
+PKGID=
+add_pkginfo() {
+ RES=`echo "SELECT pv.id FROM packages p JOIN package_versions pv ON pv.package = p.id
+ WHERE p.system = :'sysid' AND p.category = :'cat' AND p.name = :'name' AND pv.version = :'ver'"\
+ | $PSQL -v "sysid=$1" -v "cat=$2" -v "name=$3" -v "ver=$4"`
+ [ "$?" -ne 0 -o -n "$RES" ] && return 0
+ RES=`echo "
+ INSERT INTO packages (system, category, name) VALUES(:'sysid', :'cat', :'name') ON CONFLICT DO NOTHING;
+ INSERT INTO package_versions (version, released, package) VALUES(:'ver', :'rel',
+ (SELECT packages.id FROM packages WHERE system = :'sysid' AND category = :'cat' AND name = :'name'))
+ RETURNING id"\
+ | $PSQL -v "sysid=$1" -v "cat=$2" -v "name=$3" -v "ver=$4" -v "rel=$5"`
+ [ "$?" -ne 0 ] && return 0
+ PKGID=$RES
+ return 1
+}
+
+
+# Usage: add_tar <file> <pkgid> <flags>
+# Requires a recent GNU tar for compression autodetect and xz support.
+# TODO: tar throws an error if there are no man pages, but this isn't really an
+# error.
+add_tar() {
+ DIR=`mktemp -d "$TMP/tar.XXXXXXX"`
+ tar --warning=no-unknown-keyword --warning=no-alone-zero-block -C "$DIR" $3 -xf "$1" --wildcards '*man/*'\
+ && ./add_dir.pl "$DIR" "$2"
+ RET=$?
+ rm -rf "$DIR"
+ return $RET
+}
+
+
+
add_splittar() { # <url-prefix> <last-sequence> <pkgid> <flags>
$CURL "$1{"`perl -le "print join ',', 'aa'..'$2'"`'}' | add_tar - $3 $4
}
diff --git a/util/ubuntu.sh b/util/ubuntu.sh
index 0b4b8b1..97be7e2 100755
--- a/util/ubuntu.sh
+++ b/util/ubuntu.sh
@@ -1,343 +1,136 @@
-#!/bin/bash
-
-# A fetcher for debian-style repositories.
+#!/bin/sh
. ./common.sh
-checkpkg() {
- SYSID=$1
- REPO=$2
- NAME=$3
- VERSION=$4
- SECTION=$5
- FILE=$6
- echo "===> $NAME-$VERSION"
- FN="$TMP/$NAME-$VERSION.deb"
- $CURL "$REPO$FILE" -o "$FN" || return 1
-
- # For 0.939000 formats:
- # control.tar.gz = tail -n+3 $FILE | head -c"`head -n2 $FILE | tail -n1`"
- # data.tar.gz = tail -n+3 $FILE | tail -c+"`head -n2 $FILE | tail -n1`" | tail -c+2
-
- # Get the date from the last modification time of the debian-binary file
- # inside the .deb. Preferably, the date we store in the database indicates
- # when the *source* package has been uploaded, but this will work fine as
- # an approximation, I guess.
- if [ "`head -c8 \"$FN\"`" = "0.939000" ]; then
- DATE=`tail -n+3 "$FN" | head -c"\`head -n2 \"$FN\" | tail -n1\`" | tar -tvzf - | grep control | perl -lne 's/.+ ([^ ]+ [^ ]+) [^ ]*control$/print $1/e'`
- else
- DATE=`ar tv "$FN" debian-binary | perl -lne 's/^[^ ]+ [^ ]+ +\d+ (.+) debian-binary$/print $1/e'`
- fi
- DATE=`date -d "$DATE" +%F`
-
- # Insert package in the database
- add_pkginfo $SYSID $SECTION $NAME $VERSION $DATE
-
- # Extract and handle the man pages
- if [ "$?" -eq 1 -a -n "$PKGID" ]; then
- # Old format
- if [ "`head -c8 \"$FN\"`" = "0.939000" ]; then
- tail -n+3 "$FN" | tail -c+"`head -n2 \"$FN\" | tail -n1`" | tail -c+2 | add_tar - $PKGID -z
-
- # New format
- else
- DATAFN=`ar t $FN | grep -F data.tar`
- case "$DATAFN" in
- "data.tar.gz") DATAZ="-z" ;;
- "data.tar.bz2") DATAZ="-j" ;;
- "data.tar.lzma") DATAZ="--lzma" ;;
- "data.tar.xz") DATAZ="-J" ;;
- *) echo "No data.tar found, or unknown compression format."; DATAZ="ERR" ;;
- esac
-
- [ "$DATAZ" != "ERR" ] && ar p "$FN" "$DATAFN" | add_tar - $PKGID $DATAZ
- fi
- fi
-
- rm "$FN"
-}
-
-
-syncrepo() {
- SYSID=$1
- REPO=$2
- DISTRO=$3
- COMPONENTS=$4
- CONTENTSURL=${5:-"dists/$DISTRO/Contents-i386.gz"}
- echo "============ $REPO $DISTRO ($COMPONENTS)"
-
- # Get Contents.gz and Packages
- CFN="$TMP/Contents"
- PFN="$TMP/Packages"
- printf "" >"$PFN"
- if [ "$CONTENTSURL" != "-" ]; then
- $CURL "$REPO$CONTENTSURL" -o "$CFN.gz" || return 1
- gunzip -f "$CFN.gz"
- fi
-
- for CMP in $COMPONENTS; do
- echo "MANDIFF-COMPONENT: $CMP" >>"$PFN"
- TFN="$TMP/Packages-$CMP.bz2"
- $CURL "${REPO}dists/$DISTRO/$CMP/binary-i386/Packages.bz2" -o "$TFN" 2>/dev/null
- if [ -s "$TFM" ]; then
- bzcat "$TFN" >>"$PFN"
- else
- $CURL "${REPO}dists/$DISTRO/$CMP/binary-i386/Packages.gz" -o "$TFN" || return 1
- zcat "$TFN" >>"$PFN"
- fi
- rm "$TFN"
- done
-
- # Parse the Contents and Packages files and check with the database to figure
- # out which packages we need to download.
- mkfifo "$TMP/fifo"
- perl -l - $CFN $PFN $SYSID <<'EOP' >"$TMP/fifo" &
- ($cfn, $pfn, $sysid) = @ARGV;
-
- use DBI;
- $db = DBI->connect('dbi:Pg:dbname=manned', 'manned', '', {RaiseError => 1});
-
- open F, '<', $cfn or die $!;
- while(<F>) {
- chomp; @l=split/ +/;
- grep{ s{^.+/([^/]+)$}{$1}; $_ ne"-" and ($pkg{$_}=1) } split/,/, $l[1] if $l[0]=~/\/man\//
- }
- close F;
-
- open F, '<', $pfn or die $!;
- while(<F>) {
- chomp;
- $p = $1 if /^Package: (.+)/;
- $v = $1 if /^[Vv]ersion: (.+)/;
- $s = $1 if /^[Ss]ection: (.+)/;
- $f = $1 if /^[Ff]ilename: (.+)/;
- if(!$_) {
- if($p && $v && $s && $f) {
- $f =~ s{^(Debian-1.[12])/}{dists/$1/main/};
- print "$p $v $s $f" if $pkg{$p} && $pkg{$p} == 1
- && !$db->selectrow_arrayref(q{
- SELECT 1 FROM packages p JOIN package_versions pv ON pv.package = p.id
- WHERE p.system = ? AND p.category = ? AND p.name = ? AND pv.version = ?}, {}, $sysid, $s, $p, $v);
- #warn "Duplicate package? $p\n" if $pkg{$p} && $pkg{$p} == 2;
- $pkg{$p} = 2;
- }
- $p=$v=$f=$s=undef
- }
- }
- close F;
-EOP
-
- while read l; do
- checkpkg $SYSID $REPO $l
- done <"$TMP/fifo"
-
- rm -f "$TMP/fifo" "$CFN" "$PFN"
-}
-
-
-
-
-# TODO: backports?
-# TODO: Debian testing?
-
-ubuntu_warty() {
- syncrepo 2 "http://old-releases.ubuntu.com/ubuntu/" "warty" "main multiverse restricted universe"
- syncrepo 2 "http://old-releases.ubuntu.com/ubuntu/" "warty-updates" "main multiverse restricted universe" "dists/warty/Contents-i386.gz"
- syncrepo 2 "http://old-releases.ubuntu.com/ubuntu/" "warty-security" "main multiverse restricted universe" "dists/warty/Contents-i386.gz"
-}
-
-ubuntu_hoary() {
- syncrepo 3 "http://old-releases.ubuntu.com/ubuntu/" "hoary" "main multiverse restricted universe"
- syncrepo 3 "http://old-releases.ubuntu.com/ubuntu/" "hoary-updates" "main multiverse restricted universe" "dists/hoary/Contents-i386.gz"
- syncrepo 3 "http://old-releases.ubuntu.com/ubuntu/" "hoary-security" "main multiverse restricted universe" "dists/hoary/Contents-i386.gz"
-}
-
-ubuntu_breezy() {
- syncrepo 4 "http://old-releases.ubuntu.com/ubuntu/" "breezy" "main multiverse restricted universe"
- syncrepo 4 "http://old-releases.ubuntu.com/ubuntu/" "breezy-updates" "main multiverse restricted universe" "dists/breezy/Contents-i386.gz"
- syncrepo 4 "http://old-releases.ubuntu.com/ubuntu/" "breezy-security" "main multiverse restricted universe" "dists/breezy/Contents-i386.gz"
-}
-
-ubuntu_dapper() {
- # Contents-i386.gz in dists/dapper/ is broken, so try to combine the files from breezy, edgy and Contents-hppa.gz.
- $CURL "http://old-releases.ubuntu.com/ubuntu/dists/dapper/Contents-hppa.gz" -o "$TMP/Contents-TMP.gz" || return
- zcat "$TMP/Contents-TMP.gz" > "$TMP/Contents"
- rm "$TMP/Contents-TMP.gz"
- $CURL "http://old-releases.ubuntu.com/ubuntu/dists/breezy/Contents-i386.gz" -o "$TMP/Contents-TMP.gz" || return
- zcat "$TMP/Contents-TMP.gz" >> "$TMP/Contents"
- rm "$TMP/Contents-TMP.gz"
- $CURL "http://old-releases.ubuntu.com/ubuntu/dists/edgy/Contents-i386.gz" -o "$TMP/Contents-TMP.gz" || return
- zcat "$TMP/Contents-TMP.gz" >> "$TMP/Contents"
- rm "$TMP/Contents-TMP.gz"
- syncrepo 5 "http://old-releases.ubuntu.com/ubuntu/" "dapper" "main multiverse restricted universe" -
-
- # -updates and -security do have a functional Contents-i386.gz
- syncrepo 5 "http://old-releases.ubuntu.com/ubuntu/" "dapper-updates" "main multiverse restricted universe"
- syncrepo 5 "http://old-releases.ubuntu.com/ubuntu/" "dapper-security" "main multiverse restricted universe"
-}
-
-ubuntu_edgy() {
- syncrepo 6 "http://old-releases.ubuntu.com/ubuntu/" "edgy" "main multiverse restricted universe"
- syncrepo 6 "http://old-releases.ubuntu.com/ubuntu/" "edgy-updates" "main multiverse restricted universe" "dists/edgy/Contents-i386.gz"
- syncrepo 6 "http://old-releases.ubuntu.com/ubuntu/" "edgy-security" "main multiverse restricted universe" "dists/edgy/Contents-i386.gz"
-}
-
-ubuntu_feisty() {
- syncrepo 7 "http://old-releases.ubuntu.com/ubuntu/" "feisty" "main multiverse restricted universe"
- syncrepo 7 "http://old-releases.ubuntu.com/ubuntu/" "feisty-updates" "main multiverse restricted universe"
- syncrepo 7 "http://old-releases.ubuntu.com/ubuntu/" "feisty-security" "main multiverse restricted universe"
-}
-
-ubuntu_gutsy() {
- syncrepo 8 "http://old-releases.ubuntu.com/ubuntu/" "gutsy" "main multiverse restricted universe"
- syncrepo 8 "http://old-releases.ubuntu.com/ubuntu/" "gutsy-updates" "main multiverse restricted universe"
- syncrepo 8 "http://old-releases.ubuntu.com/ubuntu/" "gutsy-security" "main multiverse restricted universe"
-}
-
-ubuntu_hardy() {
- syncrepo 9 "http://nl.archive.ubuntu.com/ubuntu/" "hardy" "main multiverse restricted universe"
- syncrepo 9 "http://nl.archive.ubuntu.com/ubuntu/" "hardy-updates" "main multiverse restricted universe"
- syncrepo 9 "http://nl.archive.ubuntu.com/ubuntu/" "hardy-security" "main multiverse restricted universe"
-}
-
-ubuntu_intrepid() {
- syncrepo 10 "http://old-releases.ubuntu.com/ubuntu/" "intrepid" "main multiverse restricted universe"
- syncrepo 10 "http://old-releases.ubuntu.com/ubuntu/" "intrepid-updates" "main multiverse restricted universe"
- syncrepo 10 "http://old-releases.ubuntu.com/ubuntu/" "intrepid-security" "main multiverse restricted universe"
-}
-
-ubuntu_jaunty() {
- syncrepo 11 "http://old-releases.ubuntu.com/ubuntu/" "jaunty" "main multiverse restricted universe"
- syncrepo 11 "http://old-releases.ubuntu.com/ubuntu/" "jaunty-updates" "main multiverse restricted universe"
- syncrepo 11 "http://old-releases.ubuntu.com/ubuntu/" "jaunty-security" "main multiverse restricted universe"
-}
-
-ubuntu_karmic() {
- syncrepo 12 "http://old-releases.ubuntu.com/ubuntu/" "karmic" "main multiverse restricted universe"
- syncrepo 12 "http://old-releases.ubuntu.com/ubuntu/" "karmic-updates" "main multiverse restricted universe"
- syncrepo 12 "http://old-releases.ubuntu.com/ubuntu/" "karmic-security" "main multiverse restricted universe"
-}
-
-ubuntu_lucid() {
- syncrepo 13 "http://nl.archive.ubuntu.com/ubuntu/" "lucid" "main multiverse restricted universe"
- syncrepo 13 "http://nl.archive.ubuntu.com/ubuntu/" "lucid-updates" "main multiverse restricted universe"
- syncrepo 13 "http://nl.archive.ubuntu.com/ubuntu/" "lucid-security" "main multiverse restricted universe"
-}
-
-ubuntu_maverick() {
- syncrepo 14 "http://nl.archive.ubuntu.com/ubuntu/" "maverick" "main multiverse restricted universe"
- syncrepo 14 "http://nl.archive.ubuntu.com/ubuntu/" "maverick-updates" "main multiverse restricted universe"
- syncrepo 14 "http://nl.archive.ubuntu.com/ubuntu/" "maverick-security" "main multiverse restricted universe"
-}
-
-ubuntu_natty() {
- syncrepo 15 "http://nl.archive.ubuntu.com/ubuntu/" "natty" "main multiverse restricted universe"
- syncrepo 15 "http://nl.archive.ubuntu.com/ubuntu/" "natty-updates" "main multiverse restricted universe"
- syncrepo 15 "http://nl.archive.ubuntu.com/ubuntu/" "natty-security" "main multiverse restricted universe"
-}
-
-ubuntu_oneiric() {
- syncrepo 16 "http://nl.archive.ubuntu.com/ubuntu/" "oneiric" "main multiverse restricted universe"
- syncrepo 16 "http://nl.archive.ubuntu.com/ubuntu/" "oneiric-updates" "main multiverse restricted universe"
- syncrepo 16 "http://nl.archive.ubuntu.com/ubuntu/" "oneiric-security" "main multiverse restricted universe"
-}
-
-ubuntu_precise() {
- syncrepo 17 "http://nl.archive.ubuntu.com/ubuntu/" "precise" "main multiverse restricted universe"
- syncrepo 17 "http://nl.archive.ubuntu.com/ubuntu/" "precise-updates" "main multiverse restricted universe"
- syncrepo 17 "http://nl.archive.ubuntu.com/ubuntu/" "precise-security" "main multiverse restricted universe"
-}
-
-ubuntu_quantal() {
- syncrepo 81 "http://nl.archive.ubuntu.com/ubuntu/" "quantal" "main multiverse restricted universe"
- syncrepo 81 "http://nl.archive.ubuntu.com/ubuntu/" "quantal-updates" "main multiverse restricted universe"
- syncrepo 81 "http://nl.archive.ubuntu.com/ubuntu/" "quantal-security" "main multiverse restricted universe"
-}
-
-ubuntu_raring() {
- syncrepo 82 "http://nl.archive.ubuntu.com/ubuntu/" "raring" "main multiverse restricted universe"
- syncrepo 82 "http://nl.archive.ubuntu.com/ubuntu/" "raring-updates" "main multiverse restricted universe"
- syncrepo 82 "http://nl.archive.ubuntu.com/ubuntu/" "raring-security" "main multiverse restricted universe"
-}
-
-ubuntu_saucy() {
- syncrepo 87 "http://nl.archive.ubuntu.com/ubuntu/" "saucy" "main multiverse restricted universe"
- syncrepo 87 "http://nl.archive.ubuntu.com/ubuntu/" "saucy-updates" "main multiverse restricted universe"
- syncrepo 87 "http://nl.archive.ubuntu.com/ubuntu/" "saucy-security" "main multiverse restricted universe"
-}
-
-ubuntu_trusty() {
- syncrepo 88 "http://nl.archive.ubuntu.com/ubuntu/" "trusty" "main multiverse restricted universe"
- syncrepo 88 "http://nl.archive.ubuntu.com/ubuntu/" "trusty-updates" "main multiverse restricted universe"
- syncrepo 88 "http://nl.archive.ubuntu.com/ubuntu/" "trusty-security" "main multiverse restricted universe"
-}
-
-ubuntu_utopic() {
- syncrepo 89 "http://nl.archive.ubuntu.com/ubuntu/" "utopic" "main multiverse restricted universe"
- syncrepo 89 "http://nl.archive.ubuntu.com/ubuntu/" "utopic-updates" "main multiverse restricted universe"
- syncrepo 89 "http://nl.archive.ubuntu.com/ubuntu/" "utopic-security" "main multiverse restricted universe"
-}
-
-ubuntu_vivid() {
- syncrepo 90 "http://nl.archive.ubuntu.com/ubuntu/" "vivid" "main multiverse restricted universe"
- syncrepo 90 "http://nl.archive.ubuntu.com/ubuntu/" "vivid-updates" "main multiverse restricted universe"
- syncrepo 90 "http://nl.archive.ubuntu.com/ubuntu/" "vivid-security" "main multiverse restricted universe"
-}
-
-ubuntu_wily() {
- syncrepo 92 "http://nl.archive.ubuntu.com/ubuntu/" "wily" "main multiverse restricted universe"
- syncrepo 92 "http://nl.archive.ubuntu.com/ubuntu/" "wily-updates" "main multiverse restricted universe"
- syncrepo 92 "http://nl.archive.ubuntu.com/ubuntu/" "wily-security" "main multiverse restricted universe"
-}
-
-ubuntu_xenial() {
- syncrepo 93 "http://nl.archive.ubuntu.com/ubuntu/" "xenial" "main multiverse restricted universe"
- syncrepo 93 "http://nl.archive.ubuntu.com/ubuntu/" "xenial-updates" "main multiverse restricted universe"
- syncrepo 93 "http://nl.archive.ubuntu.com/ubuntu/" "xenial-security" "main multiverse restricted universe"
-}
-
-ubuntu_yakkety() {
- syncrepo 100 "http://nl.archive.ubuntu.com/ubuntu/" "yakkety" "main multiverse restricted universe"
- syncrepo 100 "http://nl.archive.ubuntu.com/ubuntu/" "yakkety-updates" "main multiverse restricted universe"
- syncrepo 100 "http://nl.archive.ubuntu.com/ubuntu/" "yakkety-security" "main multiverse restricted universe"
-}
-
-ubuntu_old() {
- ubuntu_warty
- ubuntu_hoary
- ubuntu_breezy
- ubuntu_dapper
- ubuntu_edgy
- ubuntu_feisty
- ubuntu_gutsy
- ubuntu_intrepid
- ubuntu_jaunty
- ubuntu_karmic
- ubuntu_lucid
- ubuntu_maverick
- ubuntu_natty
- ubuntu_hardy
- ubuntu_oneiric
- ubuntu_raring
- ubuntu_quantal
- ubuntu_saucy
- ubuntu_utopic
- ubuntu_vivid
-}
-
-ubuntu_active() {
- ubuntu_precise # until 2017-04
- ubuntu_trusty # until 2019-04
- ubuntu_wily # until 2016-07
- ubuntu_xenial # until 2021-04
- ubuntu_yakkety # until 2017-07
-}
-
-ubuntu() {
- ubuntu_old
- ubuntu_active
-}
-
-
-"$@"
-
+AMIRROR=http://old-releases.ubuntu.com/ubuntu/
+CMIRROR=http://nl.archive.ubuntu.com/ubuntu/
+
+
+# Shortcut for a standard Ubuntu repo, usage:
+# stdrepo name mirror
+stdrepo() {
+ index_deb ubuntu-$1 $2 $1 "main multiverse restricted universe"
+ index_deb ubuntu-$1 $2 $1-updates "main multiverse restricted universe"
+ index_deb ubuntu-$1 $2 $1-security "main multiverse restricted universe"
+}
+
+
+case $1 in
+ warty)
+ index_deb ubuntu-warty $AMIRROR warty "main multiverse restricted universe"
+ index_deb ubuntu-warty $AMIRROR warty-updates "main multiverse restricted universe" "dists/warty/Contents-i386.gz"
+ index_deb ubuntu-warty $AMIRROR warty-security "main multiverse restricted universe" "dists/warty/Contents-i386.gz"
+ ;;
+ hoary)
+ index_deb ubuntu-hoary $AMIRROR hoary "main multiverse restricted universe"
+ index_deb ubuntu-hoary $AMIRROR hoary-updates "main multiverse restricted universe" "dists/hoary/Contents-i386.gz"
+ index_deb ubuntu-hoary $AMIRROR hoary-security "main multiverse restricted universe" "dists/hoary/Contents-i386.gz"
+ ;;
+ breezy)
+ index_deb ubuntu-breezy $AMIRROR breezy "main multiverse restricted universe"
+ index_deb ubuntu-breezy $AMIRROR breezy-updates "main multiverse restricted universe" "dists/breezy/Contents-i386.gz"
+ index_deb ubuntu-breezy $AMIRROR breezy-security "main multiverse restricted universe" "dists/breezy/Contents-i386.gz"
+ ;;
+ dapper)
+ # dists/dapper/ has an empty Contents-i386.gz; but that's handled properly (by downloading every package -.-).
+ stdrepo dapper $AMIRROR
+ ;;
+ edgy)
+ index_deb ubuntu-edgy $AMIRROR edgy "main multiverse restricted universe"
+ index_deb ubuntu-edgy $AMIRROR edgy-updates "main multiverse restricted universe" "dists/edgy/Contents-i386.gz"
+ index_deb ubuntu-edgy $AMIRROR edgy-security "main multiverse restricted universe" "dists/edgy/Contents-i386.gz"
+ ;;
+ feisty)
+ stdrepo feisty $AMIRROR
+ ;;
+ gutsy)
+ stdrepo gutsy $AMIRROR
+ ;;
+ hardy)
+ stdrepo hardy $AMIRROR
+ ;;
+ intrepid)
+ stdrepo intrepid $AMIRROR
+ ;;
+ jaunty)
+ stdrepo jaunty $AMIRROR
+ ;;
+ karmic)
+ stdrepo karmic $AMIRROR
+ ;;
+ lucid)
+ stdrepo lucid $AMIRROR
+ ;;
+ maverick)
+ stdrepo maverick $AMIRROR
+ ;;
+ natty)
+ stdrepo natty $AMIRROR
+ ;;
+ oneiric)
+ stdrepo oneiric $AMIRROR
+ ;;
+ precise)
+ stdrepo precise $CMIRROR
+ ;;
+ quantal)
+ stdrepo quantal $AMIRROR
+ ;;
+ raring)
+ stdrepo raring $AMIRROR
+ ;;
+ saucy)
+ stdrepo saucy $AMIRROR
+ ;;
+ trusty)
+ stdrepo trusty $CMIRROR
+ ;;
+ utopic)
+ stdrepo utopic $AMIRROR
+ ;;
+ vivid)
+ stdrepo vivid $CMIRROR
+ ;;
+ wily)
+ stdrepo wily $CMIRROR
+ ;;
+ xenial)
+ stdrepo xenial $CMIRROR
+ ;;
+ yakkety)
+ stdrepo yakkety $CMIRROR
+ ;;
+ old)
+ $0 warty
+ $0 hoary
+ $0 breezy
+ $0 dapper
+ $0 edgy
+ $0 feisty
+ $0 gutsy
+ $0 intrepid
+ $0 jaunty
+ $0 karmic
+ $0 lucid
+ $0 maverick
+ $0 natty
+ $0 hardy
+ $0 oneiric
+ $0 raring
+ $0 quantal
+ $0 saucy
+ $0 utopic
+ $0 vivid
+ $0 wily
+ ;;
+ current)
+ $0 precise # until 2017-04
+ $0 trusty # until 2019-04
+ $0 xenial # until 2021-04
+ $0 yakkety # until 2017-07
+ ;;
+ all)
+ $0 old
+ $0 current
+ ;;
+esac