create_offlinerepo.sh 863 Bytes
Newer Older
1 2 3 4 5 6 7
#!/bin/bash

set -e
set -x

iso_file="ubuntu-18.04.1-desktop-amd64.iso"
workspace="/workspace"
8
dest="archive"
9 10 11 12 13 14 15
packages="vim htop"

rm -rf "$workspace"/offlinerepo
mkdir -p "$workspace"/offlinerepo

7z e -so "$iso_file" casper/filesystem.squashfs > "$workspace"/offlinerepo/filesystem.squashfs
unsquashfs -no-xattrs -d "$workspace"/offlinerepo/squashfs-root "$workspace"/offlinerepo/filesystem.squashfs 
16

17 18
apt-get -o Dir="$workspace"/offlinerepo/squashfs-root update

19 20 21 22 23 24 25 26 27 28
{
	apt-get -o Dir="$workspace"/offlinerepo/squashfs-root upgrade --print-uris -qq
	apt-get -o Dir="$workspace"/offlinerepo/squashfs-root install --reinstall --print-uris -qq $packages
} | cut -d"'" -f2 | while read url; do wget -nc -P "$dest" "$url"; done

{
	cd "$dest"
	dpkg-scanpackages . | gzip > Packages.gz
}

29
# Maybe sort files into the usual directory structure ("pool/main/g/glib2.0...")