~bkerensa/ubuntu-release-upgrader/fix-for-1068874

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# Include the latest base-installer version into the DistUpgrader/
# directory (this is used for the kernel selection)
#

set -e

DIST="$(lsb_release -c -s)"
BASEDIR=./apt

APT_OPTS="\
   -o Dir::State=./apt                \
   -o Dir::Cache=./apt                \
   -o Dir::Etc=./apt                  \
   -o Dir::State::Status=./apt/status \
"

# cleanup base-installer first
rm -rf base-installer*

# create dirs
if [ ! -d $BASEDIR/archives/partial ]; then
    mkdir -p $BASEDIR/archives/partial
fi
if [ ! -d $BASEDIR/preferences.d ]; then
    mkdir -p $BASEDIR/preferences.d
fi

cp /usr/share/keyrings/ubuntu-archive-keyring.gpg $BASEDIR/trusted.gpg

# create status file
touch $BASEDIR/status

# put right sources.list in
echo "deb-src http://archive.ubuntu.com/ubuntu $DIST main" > $BASEDIR/sources.list

# run apt-get update
apt-get $APT_OPTS update 

# get the latest base-installer
apt-get $APT_OPTS source base-installer

# move kernel/ lib into place
mkdir -p ../DistUpgrade/base-installer
mv base-installer-*/kernel ../DistUpgrade/base-installer/
# get changelog subset
head -n 500 base-installer-*/debian/changelog > ../DistUpgrade/base-installer/VERSION

# cleanup
rm -rf base-installer-* base-installer_*