| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
version="$1"; shift |
| 6 |
flavour="$1"; shift |
| 7 |
t=debian/tmp |
| 8 |
|
| 9 |
hv="xen-hypervisor-$version-$flavour" |
| 10 |
dest="debian/$hv/boot" |
| 11 |
mkdir -p "$dest" |
| 12 |
|
| 13 |
# The upstream build system puts a pile of needless symlinks in /boot, |
| 14 |
# like 'xen-4.14.gz', 'xen-4.gz' and 'xen.gz' or even just 'xen'. |
| 15 |
# |
| 16 |
# Conversely it gives the actual hypervisor binary an |
| 17 |
# unhelpfully-varying name, like 'xen-4.14.1-pre.gz'. The symlinks to |
| 18 |
# this binary have more stable names, which we can use to our advantage. |
| 19 |
# |
| 20 |
# First of all, we figure out the version string that is used in the |
| 21 |
# upstream build result. So, for xen-4.14.1-pre.gz that would be |
| 22 |
# 4.14.1-pre |
| 23 |
verstring="$(readlink debian/tmp/boot/xen.gz || |
| 24 |
readlink debian/tmp/boot/xen)" |
| 25 |
verstring="${verstring##*xen-}" |
| 26 |
verstring="${verstring%.gz}" |
| 27 |
|
| 28 |
# Next we substitute this upstream version string with our own format. |
| 29 |
# For our part, we have been in the habit of putting the flavour in the |
| 30 |
# name and want to continue to do so for continuity. (This was more |
| 31 |
# useful when the -i386 flavour existed and was coinstallable with the |
| 32 |
# -amd64 flavour.) |
| 33 |
# |
| 34 |
# So, e.g. debian/tmp/boot/xen-4.14.1-pre.gz will end up in our package |
| 35 |
# as debian/xen-hypervisor-4.14-amd64/boot/xen-4.14-amd64.gz |
| 36 |
# |
| 37 |
# Finally, note that we're not just renaming the files here, we are |
| 38 |
# actually manually doing part of the install process here. Afterwards, |
| 39 |
# we can ignore the content of debian/tmp/boot/. See the d/not-installed |
| 40 |
# file for this. The boot/ location is mentioned in there. |
| 41 |
find "$t/boot" -type f -print | while read f; do |
| 42 |
basename="${f#$t/boot/}" |
| 43 |
head="${basename%$verstring*}" |
| 44 |
tail="${basename#*$verstring}" |
| 45 |
cp -v "$f" "${dest}/${head}${version}-${flavour}${tail}" |
| 46 |
done |
| 47 |
|
| 48 |
# For /usr/lib/debug, we make similar changes to the file names, before we |
| 49 |
# actually install them into the locations for our binary packages. |
| 50 |
# |
| 51 |
# After executing the upstream build process, we at first end up a situation |
| 52 |
# that looks like the following (small part from 'tree' output): |
| 53 |
# |
| 54 |
# [...] |
| 55 |
# ├── usr |
| 56 |
# │ ├── lib |
| 57 |
# │ │ ├── debug |
| 58 |
# │ │ │ ├── usr |
| 59 |
# │ │ │ │ └── lib |
| 60 |
# │ │ │ │ └── xen-4.17 |
| 61 |
# │ │ │ │ └── boot |
| 62 |
# │ │ │ │ └── xen-shim-syms |
| 63 |
# │ │ │ ├── xen-4.17.0.efi.map |
| 64 |
# │ │ │ ├── xen-syms-4.17.0 |
| 65 |
# │ │ │ └── xen-syms-4.17.0.map |
| 66 |
# [...] |
| 67 |
# |
| 68 |
# In this case we also want to strip off the .0 (or e.g. .3-pre) so that |
| 69 |
# the file names do not change when we do a package update with new |
| 70 |
# upstream stable branch line code. We especially do want this to |
| 71 |
# prevent filenames from changing during a stable security update. |
| 72 |
# |
| 73 |
# For consistency with the file names in boot/, we also add the flavour |
| 74 |
# name here. So, for example xen-4.17.0.efi.map is renamed to |
| 75 |
# xen-4.17-amd64.efi.map |
| 76 |
find "$t/usr/lib/debug" -maxdepth 1 -name 'xen*' -type f -print | while read f; do |
| 77 |
head="${f%$verstring*}" |
| 78 |
tail="${f#*$verstring}" |
| 79 |
mv -v "$f" "${head}${version}-${flavour}${tail}" |
| 80 |
done |