Commit b1687a3d authored by mmoebius/ALUG's avatar mmoebius/ALUG

Script to create an offline APT repository

Put all your .deb - files in a directory "pool" , say /path/to/debarchive/pool
Run this on a shell:
$ cd /path/to/debarchive
$ bash mkdebarchive.sh

* disconnect Network
$ apt-get update
$ apt-get install <stuff>
* win, win and win again.

TODO: Order of APT source files. /etc/apt/sources.list seems to be prefered
      over any /etc/apt/sources.list.d/foo.list .
      Maybe workaround: clear /etc/apt/sources.list; move contents to
                        /etc/apt/sources.list.d/99original.list .
parent 14b5705b
#! /bin/bash
echo "mkdebarchive.sh (C) 2012 Mmoebius/ALUG License: GPLv3 GNU Public License"
echo "Prerequisite: Alle .deb-Packete liegen in ./pool/"
test -d ./pool | exit 2
echo
echo "Scanne nach Packages"
dpkg-scanpackages -a noarch pool > Packages.noarch
dpkg-scanpackages -a amd64 pool > Packages.amd64
dpkg-scanpackages -a i386 pool > Packages.i386
echo
echo "Erzeuge dist-Verzeichnisse"
mkdir -p dists/precise/lip/binary-amd64
mkdir -p dists/precise/lip/binary-i386
echo
echo "Erzeuge Packages.bz2"
cat Packages.noarch Packages.amd64 | bzip2 -c9 > dists/precise/lip/binary-amd64/Packages.bz2
cat Packages.noarch Packages.i386 | bzip2 -c9 > dists/precise/lip/binary-i386/Packages.bz2
echo
echo "Erzeuge './dists/precise/lip/binary-amd/Release'"
cat >dists/precise/lip/binary-amd64/Release <<EOF
Archive: precise
Version: 12.04
Component: main
Origin: Ubuntu
Label: Ubuntu
Architecture: amd64
EOF
echo
echo "Erzeuge './dists/precise/lip/binary-i386/Release'"
cat >dists/precise/lip/binary-i386/Release <<EOF
Archive: precise
Version: 12.04
Component: main
Origin: Ubuntu
Label: Ubuntu
Architecture: i386
EOF
echo
echo "Erzeuge './Release'"
cat >Release <<EOF
Origin: Ubuntu
Label: LIP Ubuntu Extra Packages
Suite: precise
Version: 12.04
Codename: precise
Date: Wed, 30 Sep 2012 01:49:23 UTC
Architectures: amd64 i386
Components: lip
Description: Ubuntu Precise 12.04
EOF
echo
echo "Erzeuge einen geeigneten Eintrag für APT in 'sources.list.d/01lip-stick-extra.list'"
echo "deb [ trusted=yes ] file:/${PWD#/} precise lip" > /etc/apt/sources.list.d/01lip-stick-extra.list
echo
echo "User: Bitte gleich 'apt-get update' starten. Das sollte das Repository einbinden"
echo "In diesem Verzeichnis liegen noch 3 Packages.* -Dateien. Die können gelöscht werden"
echo "Ende."
#end;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment