1#!/bin/sh 2# 3# mkdeb: package the dist/install output of a Xen build in a .deb 4# 5# Takes 2 arguments, the path to the dist directory and the version 6 7set -e 8 9if test -z "$1" -o -z "$2" ; then 10 echo "usage: $0 path-to-XEN_ROOT xen-version" 11 exit 1 12fi 13 14cd $1 15version=$2 16 17# map the architecture, if necessary 18case "$XEN_TARGET_ARCH" in 19 x86_32|x86_32p) arch=i386 ;; 20 x86_64) arch=amd64 ;; 21 arm32) arch=armhf ;; 22 arm64) arch=$XEN_TARGET_ARCH;; 23 *) echo "Unknown XEN_TARGET_ARCH $XEN_TARGET_ARCH" >&2 24 exit 1 25 ;; 26esac 27 28# Prepare the directory to package 29cd dist 30rm -rf deb 31cp -a install deb 32 33# Debian doesn't use /usr/lib64 for 64-bit libraries 34if test -d deb/usr/lib64 ; then 35 cp -a deb/usr/lib64/* deb/usr/lib/ 36 rm -rf deb/usr/lib64 37fi 38 39# Fill in the debian boilerplate 40mkdir -p deb/DEBIAN 41cat >deb/DEBIAN/control <<EOF 42Package: xen-upstream 43Source: xen-upstream 44Version: $version 45Architecture: $arch 46Maintainer: Unmaintained snapshot 47Section: admin 48Priority: optional 49Installed-Size: $(du -ks deb | cut -f1) 50Description: Xen upstream testing build snapshot 51 Warning: This is a custom testing build of Xen; it is not an 52 officially supported Debian package. Please not distribute. 53 It is just the output of a xen "make dist" wrapped in a .deb 54 to make it easy to update and uninstall. 55EOF 56# Find all /etc files and add them to conffiles 57find deb/etc -type f -printf /etc/%P\\n >deb/DEBIAN/conffiles 58 59 60# Package it up 61chown -R root:root deb 62dpkg-deb --build -z0 deb xen-upstream-$version.deb 63 64# Tidy up after ourselves 65rm -rf deb 66