diff --git a/create_offlinerepo.sh b/create_offlinerepo.sh index 248e15bdb9149af8c81469e23a3020f09ee06a13..a89c11e61fe45eb2b145444e38794b358eda9cbb 100755 --- a/create_offlinerepo.sh +++ b/create_offlinerepo.sh @@ -1,12 +1,22 @@ #!/bin/bash set -e -set -x -iso_file="ubuntu-18.04.1-desktop-amd64.iso" +usage () { + echo "usage: create_offlinerepo.sh repodir isofile [list of packages]" >&2 + echo >&2 + echo "Downloads all packages required to fully update the system in 'isofile' and" >&2 + echo "to install the listed packages and adds them to the package archive in 'repodir'." >&2 + exit 1 +} + +dest="$1" +shift || usage +iso_file="$1" +shift || usage +packages="$@" + workspace="/workspace" -dest="archive" -packages="vim htop" rm -rf "$workspace"/offlinerepo mkdir -p "$workspace"/offlinerepo @@ -23,6 +33,7 @@ apt-get -o Dir="$workspace"/offlinerepo/squashfs-root update { cd "$dest" + rm -rf "$dest"/Packages.* dpkg-scanpackages . | gzip > Packages.gz }