Commit abbb6db5 authored by Tim Gardner's avatar Tim Gardner

UBUNTU: [Debian] Cloud tools

Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent e61e0cd7
#!/bin/bash
# This example script retrieves the DHCP state of a given interface.
# In the interest of keeping the KVP daemon code free of distro specific
# information; the kvp daemon code invokes this external script to gather
# DHCP setting for the specific interface.
#
# Input: Name of the interface
#
# Output: The script prints the string "Enabled" to stdout to indicate
# that DHCP is enabled on the interface. If DHCP is not enabled,
# the script prints the string "Disabled" to stdout.
#
# Each Distro is expected to implement this script in a distro specific
# fashion.
#set -x
IF_FILE="/etc/network/interfaces"
NMCMD="nmcli"
function checknetworkmanager {
#Assumes if $NMCMD exists, inteface exists and interface is not
# in $IF_FILE then dhcp is being used by NM
if hash $NMCMD >/dev/null 2>&1 ; then
if $NMCMD dev status |grep -q $1 ; then
echo "Enabled"
else
echo "Disabled"
fi
else
#Give up
echo "Disabled"
fi
}
if [ -z $1 ] ; then echo "Disabled"; exit; fi
if [ -e $IF_FILE ]; then
if grep -v -e "^#" $IF_FILE|grep -q $1 ; then
#interface exists so
if grep -q -e $1\.\*dhcp $IF_FILE; then
echo "Enabled"; exit;
else
echo "Disabled"; exit;
fi
else
checknetworkmanager $1
exit
fi
else
checknetworkmanager $1
exit
fi
#!/bin/bash
# This example script parses /etc/resolv.conf to retrive DNS information.
# In the interest of keeping the KVP daemon code free of distro specific
# information; the kvp daemon code invokes this external script to gather
# DNS information.
# This script is expected to print the nameserver values to stdout.
# Each Distro is expected to implement this script in a distro specific
# fashion. For instance on Distros that ship with Network Manager enabled,
# this script can be based on the Network Manager APIs for retrieving DNS
# entries.
cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'
#! /usr/bin/env python
# set interfaces in hv_kvp_daemon style
import fileinput
import sys
import errno
import os
import shutil
import tempfile
import subprocess
if_filename="/etc/network/interfaces"
'''Get quiet'''
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
try:
if_file=open(if_filename,"r+")
except IOError as e:
exit(e.errno)
else:
if_file.close()
def kvp_dict(file):
return dict(line.strip().split("=") for line in file)
#setting the hwaddress to something azure is not expecting is fatal networking
if len(sys.argv) != 2 :
exit(errno.EINVAL)
kvp=dict(line.strip().split("=") for line in fileinput.input())
if not "HWADDR" in kvp :
exit(errno.EPROTO)
if not "DEVICE" in kvp :
exit(1)
output=[]
basename=kvp["DEVICE"]
if "DHCP" in kvp and kvp["DHCP"]=="yes" :
output += ["auto " + basename]
output += ["iface " + basename + " inet dhcp"]
output += [""]
else:
''' Matchup the interface specific lines '''
'''DNS entries will go with the first interface
and there can be a max of three'''
autolist=[]
dns=[]
if "DNS1" in kvp :
dns+=[kvp["DNS1"]]
if "DNS2" in kvp :
dns+=[kvp["DNS2"]]
if "DNS3" in kvp :
dns+=[kvp["DNS3"]]
'''
No real max for the number of interface + aliases ...
only required is the address (but mate everything up that comes in. '''
'''ipv4 first'''
v4names=[name for name in kvp.keys() if name.startswith("IPADDR")]
v4names.sort()
v6names=[name for name in kvp.keys() if name.startswith("IPV6ADDR")]
v6names.sort()
'''IPV6 requires a netmask'''
'''If an ipv6 exists, you'll want to turn off /proc/sys/net/ipv6/conf/all/autoconf with
up echo 0 > /proc/sys/net/ipv6/conf/all/autoconf'''
'''Counter needs to increment as soon as any interface is set.'''
if_count=0
for v4 in v4names:
ifname=basename
suffix=""
if if_count :
ifname+=":" + str(if_count)
suffix="_"+str(if_count)
if not ifname in autolist:
autolist += [ifname]
output += [ "iface " + ifname + " inet static"]
output += [ "\t" + "address " + kvp[v4]]
if "NETMASK"+suffix in kvp.keys():
output += ["\tnetmask " + kvp["NETMASK"+suffix]]
if "GATEWAY"+suffix in kvp.keys():
output += ["\tgateway " + kvp["GATEWAY"+suffix]]
if not if_count :
output += ["\tdns-nameservers " + ' '.join(dns)]
output += [""]
if_count+=1
if6_count=0
if6_used=0
for v6 in v6names:
ifname=basename
suffix=""
if if6_used :
ifname+=":" + str(if6_used)
if if6_count :
suffix="_" + str(if6_count)
if not ifname in autolist:
autolist += [ifname]
if "IPV6NETMASK"+suffix in kvp.keys():
output += [ "iface " + ifname + " inet6 static"]
output += [ "\taddress " + kvp[v6]]
output += [ "\tnetmask " + kvp["IPV6NETMASK"+suffix]]
if "IPV6_DEFAULTGW"+suffix in kvp.keys():
output += [ "\tgateway " + kvp["IPV6_DEFAULTGW"+suffix] ]
if not if_count :
output += ["\tdns-nameservers " + ' '.join(dns)]
output += [""]
if_count += 1
if6_used += 1
if6_count += 1
output = ["auto "+" ".join(autolist)] + output
output=["# The following stanza(s) added by hv_set_ifconfig"] + output
output+=["#End of hv_set_ifconfig stanzas"]
print "==================================="
print output
print "==================================="
''' Time to clean out the existing interface file'''
f=open(if_filename,"r")
flines=f.readlines()
f.close()
newfile=[]
pitchstanza=0
inastanza=0
stanza=[]
for line in flines:
if line.startswith("auto"):
if inastanza:
if not pitchstanza:
newfile.extend(stanza)
stanza=[]
inastanza=0
newline=""
autoline=line.strip().split(" ")
for word in autoline:
if (not word == basename) and (not word.startswith(basename+":")):
newline+=word + " "
newline = newline.strip()
if not newline == "auto":
newfile += [newline.strip()]
elif line.startswith(("iface","mapping","source")):
'''Read a stanza'''
'''A Stanza can also start with allow- ie allow-hotplug'''
if inastanza:
if not pitchstanza:
newfile.extend(stanza)
stanza=[]
inastanza=1
pitchstanza=0
autoline=line.strip().split(" ")
for word in autoline:
if (word == basename) or (word.startswith(basename+":")):
pitchstanza=1
if not pitchstanza:
stanza+=[line.strip()]
else:
if inastanza:
if not pitchstanza:
stanza+=[line.strip()]
else:
if not pitchstanza:
newfile += [line.strip()]
for line in newfile:
print line
for line in output:
print line
fd, path = tempfile.mkstemp()
for line in newfile:
os.write(fd,line)
os.write(fd,"\n")
for line in output:
os.write(fd,line)
os.write(fd,"\n")
os.close(fd)
shutil.copy(path,if_filename)
os.chmod(if_filename,0644)
#print "TMPFILE is at: " + path
#print "Copied file is at: " + if_filename
try:
retcode = subprocess.call("ifdown "+basename , shell=True)
if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -retcode
else:
print >>sys.stderr, "Child returned", retcode
except OSError as e:
print >>sys.stderr, "Execution failed:", e
try:
retcode = subprocess.call("ifup "+basename , shell=True)
if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -retcode
else:
print >>sys.stderr, "Child returned", retcode
except OSError as e:
print >>sys.stderr, "Execution failed:", e
# On Azure/Hyper-V systems start the hv_fcopy_daemon
#
# author "Andy Whitcroft <apw@canonical.com>"
[Unit]
Description=Hyper-V File Copy Protocol Daemon
ConditionVirtualization=microsoft
[Service]
Type=forking
ExecStart=/usr/sbin/hv_fcopy_daemon
[Install]
WantedBy=multi-user.target
# On Azure/Hyper-V systems start the hv_fcopy_daemon
#
description "Hyper-V File Copy Protocol Daemon"
author "Andy Whitcroft <apw@canonical.com>"
start on runlevel [2345]
stop on runlevel [!2345]
console log
pre-start script
if [ -e "/etc/default/hv-kvp-daemon-init" ]; then
. /etc/default/hv-kvp-daemon-init
fi
[ "$RUN_FCOPY_DAEMON" -eq 0 ] && { stop; exit 0; }
if [ -d /sys/class/dmi/id/. ]; then
read company </sys/class/dmi/id/sys_vendor
read product </sys/class/dmi/id/product_name
[ "$company:$product" = 'Microsoft Corporation:Virtual Machine' ] || { stop; exit 0; }
fi
end script
exec /usr/sbin/hv_fcopy_daemon
# On Azure/Hyper-V systems start the hv_kvp_daemon
#
# author "Andy Whitcroft <apw@canonical.com>"
[Unit]
Description=Hyper-V KVP Protocol Daemon
ConditionVirtualization=microsoft
[Service]
Type=forking
ExecStart=/usr/sbin/hv_kvp_daemon
[Install]
WantedBy=multi-user.target
# On Azure/Hyper-V systems start the hv_kvp_daemon
#
description "Hyper-V KVP Protocol Daemon"
author "Adam Conrad <adconrad@canonical.com>"
start on runlevel [2345]
stop on runlevel [!2345]
console log
pre-start script
if [ -e "/etc/default/hv-kvp-daemon-init" ]; then
. /etc/default/hv-kvp-daemon-init
fi
[ "$RUN_KVP_DAEMON" = 0 ] && { stop; exit 0; }
if [ -d /sys/class/dmi/id/. ]; then
read company </sys/class/dmi/id/sys_vendor
read product </sys/class/dmi/id/product_name
[ "$company:$product" = 'Microsoft Corporation:Virtual Machine' ] || { stop; exit 0; }
fi
end script
exec /usr/sbin/hv_kvp_daemon
# On Azure/Hyper-V systems start the hv_vss_daemon
#
# author "Andy Whitcroft <apw@canonical.com>"
[Unit]
Description=Hyper-V VSS Protocol Daemon
ConditionVirtualization=microsoft
[Service]
Type=forking
ExecStart=/usr/sbin/hv_vss_daemon
[Install]
WantedBy=multi-user.target
# On Azure/Hyper-V systems start the hv_vss_daemon
#
description "Hyper-V VSS Protocol Daemon"
author "Ben Howard <ben.howard@canonical.com>"
start on runlevel [2345]
stop on runlevel [!2345]
console log
pre-start script
if [ -e "/etc/default/hv-kvp-daemon-init" ]; then
. /etc/default/hv-kvp-daemon-init
fi
[ "$RUN_VSS_DAEMON" -eq 0 ] && { stop; exit 0; }
if [ -d /sys/class/dmi/id/. ]; then
read company </sys/class/dmi/id/sys_vendor
read product </sys/class/dmi/id/product_name
[ "$company:$product" = 'Microsoft Corporation:Virtual Machine' ] || { stop; exit 0; }
fi
end script
exec /usr/sbin/hv_vss_daemon
......@@ -29,11 +29,23 @@ include $(DROOT)/rules.d/0-common-vars.mk
# Maintainer targets
include $(DROOT)/rules.d/1-maintainer.mk
do_linux_tools=$(sort $(filter-out false,$(do_tools_cpupower) $(do_tools_perf) $(do_tools_x86)))
do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
# Don't build tools in a cross compile environment.
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
do_tools = false
do_tools=false
endif
# Backwards compatiblility, do_tools=false|0 should disable all tools.
ifneq ($(do_tools),true)
do_linux_tools=
do_cloud_tools=
endif
# Either tools package needs the common source preparation
do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
ifeq ($(DEB_STAGE),stage1)
DEB_BUILD_PROFILE=bootstrap
......
......@@ -171,6 +171,9 @@ endif
tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
tools_common_pkg_name=$(src_pkg_name)-tools-common
tools_flavour_pkg_name=linux-tools-$(abi_release)
cloud_pkg_name=$(src_pkg_name)-cloud-tools-$(abi_release)
cloud_common_pkg_name=$(src_pkg_name)-cloud-tools-common
cloud_flavour_pkg_name=linux-cloud-tools-$(abi_release)
# The general flavour specific image package.
do_flavour_image_package=true
......
......@@ -79,8 +79,15 @@ printenv:
@echo "do_common_headers_indep = $(do_common_headers_indep)"
@echo "do_full_source = $(do_full_source)"
@echo "do_tools = $(do_tools)"
@echo "do_any_tools = $(do_any_tools)"
@echo "do_linux_tools = $(do_linux_tools)"
@echo " do_tools_cpupower = $(do_tools_cpupower)"
@echo " do_tools_perf = $(do_tools_perf)"
@echo " do_tools_x86 = $(do_tools_x86)"
@echo "do_cloud_tools = $(do_cloud_tools)"
@echo " do_tools_hyperv = $(do_tools_hyperv)"
@echo "full_build = $(full_build)"
@echo "libc_dev_version = $(libc_dev_version)"
@echo "libc_dev_version = $(libc_dev_version)"
@echo "DEB_HOST_GNU_TYPE = $(DEB_HOST_GNU_TYPE)"
@echo "DEB_BUILD_GNU_TYPE = $(DEB_BUILD_GNU_TYPE)"
@echo "DEB_HOST_ARCH = $(DEB_HOST_ARCH)"
......@@ -103,9 +110,10 @@ diffupstream:
startnewrelease:
dh_testdir
@nextminor=$(shell expr `echo $(revision) | gawk -F. '{print $$2}'` + 1); \
nextmajor=$(shell expr `echo $(revision) | awk -F. '{print $$1}'` + 1); \
now="$(shell date -R)"; \
echo "Creating new changelog set for $(abi_release).$$nextminor..."; \
echo -e "$(src_pkg_name) ($(abi_release).$$nextminor) UNRELEASED; urgency=low\n" > $(DEBIAN)/changelog.new; \
echo "Creating new changelog set for $(release)-$$nextmajor.$$nextminor..."; \
echo -e "$(src_pkg_name) ($(release)-$$nextmajor.$$nextminor) UNRELEASED; urgency=low\n" > $(DEBIAN)/changelog.new; \
echo " CHANGELOG: Do not edit directly. Autogenerated at release." >> \
$(DEBIAN)/changelog.new; \
echo " CHANGELOG: Use the printchanges target to see the curent changes." \
......
......@@ -53,6 +53,7 @@ install-%: bindoc = $(pkgdir)/usr/share/doc/$(bin_pkg_name)-$*
install-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
install-%: signed = $(CURDIR)/debian/$(bin_pkg_name)-signed
install-%: toolspkgdir = $(CURDIR)/debian/$(tools_flavour_pkg_name)-$*
install-%: cloudpkgdir = $(CURDIR)/debian/$(cloud_flavour_pkg_name)-$*
install-%: basepkg = $(hdrs_pkg_name)
install-%: indeppkg = $(indep_hdrs_pkg_name)
install-%: kernfile = $(call custom_override,kernel_file,$*)
......@@ -86,7 +87,6 @@ else
chmod 600 $(pkgdir)/boot/$(instfile)-$(abi_release)-$*
endif
ifeq ($(arch),amd64)
ifeq ($(uefi_signed),true)
install -d $(signed)/$(release)-$(revision)
# Check to see if this supports handoff, if not do not sign it.
......@@ -96,7 +96,6 @@ ifeq ($(uefi_signed),true)
cp -p $(pkgdir)/boot/$(instfile)-$(abi_release)-$* \
$(signed)/$(release)-$(revision)/$(instfile)-$(abi_release)-$*.efi; \
fi
endif
endif
install -m644 $(builddir)/build-$*/.config \
......@@ -119,7 +118,7 @@ ifeq ($(no_dumpfile),)
chmod 0600 $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$*
endif
$(build_cd) $(kmake) $(build_O) $(conc_level) modules_install \
$(build_cd) $(kmake) $(build_O) $(conc_level) modules_install $(vdso) \
INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$(pkgdir)/ \
INSTALL_FW_PATH=$(pkgdir)/lib/firmware/$(abi_release)-$*
......@@ -213,7 +212,7 @@ ifneq ($(skipdbg),true)
# Debug image is simple
install -m644 -D $(builddir)/build-$*/vmlinux \
$(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
$(build_cd) $(kmake) $(build_O) modules_install \
$(build_cd) $(kmake) $(build_O) modules_install $(vdso) \
INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
# Add .gnu_debuglink sections to each stripped .ko
# pointing to unstripped verson
......@@ -246,8 +245,10 @@ endif
# Copy over the compilation version.
cp "$(builddir)/build-$*/include/generated/compile.h" \
"$(hdrdir)/include/generated/compile.h"
# powerpc seems to need some .o files for external module linking. Add them in.
ifeq ($(arch),powerpc)
# Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
echo "#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir)/include/generated/utsrelease.h
# powerpc kernel arch seems to need some .o files for external module linking. Add them in.
ifeq ($(build_arch),powerpc)
mkdir -p $(hdrdir)/arch/powerpc/lib
cp $(builddir)/build-$*/arch/powerpc/lib/*.o $(hdrdir)/arch/powerpc/lib
endif
......@@ -296,9 +297,29 @@ endif
$(pkgdir)/lib/modules/$(abi_release)-$*
rmdir $(pkgdir)/lib/modules/$(abi_release)-$*/_
# Create the linux-tools version-flavour link
install -d $(toolspkgdir)/usr/lib/linux-tools
ln -s ../$(src_pkg_name)-tools-$(abi_release) $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ifeq ($(do_linux_tools),true)
# Create the linux-tools tool links
install -d $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ifeq ($(do_tools_cpupower),true)
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/cpupower $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
endif
ifeq ($(do_tools_perf),true)
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/perf $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
endif
ifeq ($(do_tools_x86),true)
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/x86_energy_perf_policy $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/turbostat $(toolspkgdir)/usr/lib/linux-tools/$(abi_release)-$*
endif
endif
ifeq ($(do_cloud_tools),true)
ifeq ($(do_tools_hyperv),true)
# Create the linux-hyperv tool links
install -d $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/hv_kvp_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/hv_vss_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
ln -s ../../$(src_pkg_name)-tools-$(abi_release)/hv_fcopy_daemon $(cloudpkgdir)/usr/lib/linux-tools/$(abi_release)-$*
endif
endif
headers_tmp := $(CURDIR)/debian/tmp-headers
headers_dir := $(CURDIR)/debian/linux-libc-dev
......@@ -358,6 +379,7 @@ binary-%: pkghdr = $(hdrs_pkg_name)-$*
binary-%: dbgpkg = $(bin_pkg_name)-$*-dbgsym
binary-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
binary-%: pkgtools = $(tools_flavour_pkg_name)-$*
binary-%: pkgcloud = $(cloud_flavour_pkg_name)-$*
binary-%: target_flavour = $*
binary-%: install-%
@echo Debug: $@
......@@ -445,7 +467,7 @@ ifneq ($(skipdbg),true)
# into the debug system.
endif
ifeq ($(do_tools),true)
ifeq ($(do_linux_tools),true)
dh_installchangelogs -p$(pkgtools)
dh_installdocs -p$(pkgtools)
dh_compress -p$(pkgtools)
......@@ -456,6 +478,17 @@ ifeq ($(do_tools),true)
dh_md5sums -p$(pkgtools)
dh_builddeb -p$(pkgtools)
endif
ifeq ($(do_cloud_tools),true)
dh_installchangelogs -p$(pkgcloud)
dh_installdocs -p$(pkgcloud)
dh_compress -p$(pkgcloud)
dh_fixperms -p$(pkgcloud)
dh_shlibdeps -p$(pkgcloud)
dh_installdeb -p$(pkgcloud)
$(lockme) dh_gencontrol -p$(pkgcloud)
dh_md5sums -p$(pkgcloud)
dh_builddeb -p$(pkgcloud)
endif
ifneq ($(full_build),false)
# Clean out this flavours build directory.
......@@ -471,7 +504,7 @@ builddirpa = $(builddir)/tools-perarch
$(stampdir)/stamp-prepare-perarch:
@echo Debug: $@
ifeq ($(do_tools),true)
ifeq ($(do_any_tools),true)
rm -rf $(builddirpa)
install -d $(builddirpa)
for i in *; do ln -s $(CURDIR)/$$i $(builddirpa); done
......@@ -480,17 +513,17 @@ ifeq ($(do_tools),true)
endif
touch $@
$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch
$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch install-arch-headers
@echo Debug: $@
ifeq ($(do_tools),true)
ifeq ($(do_linux_tools),true)
ifeq ($(do_tools_cpupower),true)
# Allow for multiple installed versions of cpupower and libcpupower.so:
# Override LIB_MIN in order to to generate a versioned .so named
# libcpupower.so.$(abi_release) and link cpupower with that.
make -C $(builddirpa)/tools/power/cpupower \
CROSS_COMPILE=$(CROSS_COMPILE) \
LIB_MIN=$(abi_release) CPUFREQ_BENCH=false
endif
ifeq ($(do_tools_perf),true)
cd $(builddirpa)/tools/perf && \
make prefix=/usr HAVE_CPLUS_DEMANGLE=1 CROSS_COMPILE=$(CROSS_COMPILE) NO_LIBPYTHON=1 NO_LIBPERL=1 PYTHON=python2.7
......@@ -499,27 +532,31 @@ ifeq ($(do_tools_x86),true)
cd $(builddirpa)/tools/power/x86/x86_energy_perf_policy && make CROSS_COMPILE=$(CROSS_COMPILE)
cd $(builddirpa)/tools/power/x86/turbostat && make CROSS_COMPILE=$(CROSS_COMPILE)
endif
endif
ifeq ($(do_cloud_tools),true)
ifeq ($(do_tools_hyperv),true)
cd $(builddirpa)/tools/hv && make CROSS_COMPILE=$(CROSS_COMPILE)
cd $(builddirpa)/tools/hv && make CFLAGS="-I$(headers_dir)/usr/include -I$(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)" CROSS_COMPILE=$(CROSS_COMPILE) hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
endif
endif
@touch $@
install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
install-perarch: cloudpkgdir = $(CURDIR)/debian/$(cloud_pkg_name)
install-perarch: $(stampdir)/stamp-build-perarch
@echo Debug: $@
# Add the tools.
ifeq ($(do_tools),true)
ifeq ($(do_linux_tools),true)
install -d $(toolspkgdir)/usr/lib
install -d $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
ifeq ($(do_tools_cpupower),true)
install -m755 $(builddirpa)/tools/power/cpupower/cpupower \
$(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
# Install only the full versioned libcpupower.so.$(abi_release), not
# the usual symlinks to it.
install -m644 $(builddirpa)/tools/power/cpupower/libcpupower.so.$(abi_release) \
$(toolspkgdir)/usr/lib/
endif
ifeq ($(do_tools_perf),true)
install -m755 $(builddirpa)/tools/perf/perf $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
endif
......@@ -529,18 +566,25 @@ ifeq ($(do_tools_x86),true)
install -m755 $(builddirpa)/tools/power/x86/turbostat/turbostat \
$(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
endif
endif
ifeq ($(do_cloud_tools),true)
ifeq ($(do_tools_hyperv),true)
install -d $(cloudpkgdir)/usr/lib
install -d $(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
install -m755 $(builddirpa)/tools/hv/hv_kvp_daemon \
$(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
$(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
install -m755 $(builddirpa)/tools/hv/hv_vss_daemon \
$(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
$(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
install -m755 $(builddirpa)/tools/hv/hv_fcopy_daemon \
$(cloudpkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release)
endif
endif
binary-perarch: toolspkg = $(tools_pkg_name)
binary-perarch: cloudpkg = $(cloud_pkg_name)
binary-perarch: install-perarch
@echo Debug: $@
ifeq ($(do_tools),true)
ifeq ($(do_linux_tools),true)
dh_strip -p$(toolspkg)
dh_installchangelogs -p$(toolspkg)
dh_installdocs -p$(toolspkg)
......@@ -552,20 +596,30 @@ ifeq ($(do_tools),true)
dh_md5sums -p$(toolspkg)
dh_builddeb -p$(toolspkg)
endif
ifeq ($(do_cloud_tools),true)
dh_strip -p$(cloudpkg)
dh_installchangelogs -p$(cloudpkg)
dh_installdocs -p$(cloudpkg)
dh_compress -p$(cloudpkg)
dh_fixperms -p$(cloudpkg)
dh_shlibdeps -p$(cloudpkg)
dh_installdeb -p$(cloudpkg)
$(lockme) dh_gencontrol -p$(cloudpkg)
dh_md5sums -p$(cloudpkg)
dh_builddeb -p$(cloudpkg)
endif
binary-debs: signed = $(CURDIR)/debian/$(bin_pkg_name)-signed
binary-debs: signedv = $(CURDIR)/debian/$(bin_pkg_name)-signed/$(release)-$(revision)
binary-debs: signed_tar = $(src_pkg_name)_$(release)-$(revision)_$(arch).tar.gz
binary-debs: binary-perarch $(addprefix binary-,$(flavours))
@echo Debug: $@
ifeq ($(arch),amd64)
ifeq ($(uefi_signed),true)
echo $(release)-$(revision) > $(signedv)/version
cd $(signedv) && ls *.efi >flavours
cd $(signed) && tar czvf ../../../$(signed_tar) .
dpkg-distaddfile $(signed_tar) raw-uefi -
endif
endif
build-arch-deps-$(do_flavour_image_package) += $(addprefix $(stampdir)/stamp-build-,$(flavours))
build-arch: $(build-arch-deps-true)
......
......@@ -85,9 +85,18 @@ install-tools: toolspkg = $(tools_common_pkg_name)
install-tools: toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
install-tools: toolssbin = $(CURDIR)/debian/$(toolspkg)/usr/sbin
install-tools: toolsman = $(CURDIR)/debian/$(toolspkg)/usr/share/man
install-tools: cloudpkg = $(cloud_common_pkg_name)
install-tools: cloudbin = $(CURDIR)/debian/$(cloudpkg)/usr/bin
install-tools: cloudsbin = $(CURDIR)/debian/$(cloudpkg)/usr/sbin
install-tools: cloudman = $(CURDIR)/debian/$(cloudpkg)/usr/share/man
install-tools: install-source $(stampdir)/stamp-build-perarch
@echo Debug: $@
ifeq ($(do_tools),true)
rm -rf $(builddir)/tools
install -d $(builddir)/tools
for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools/; done
rm $(builddir)/tools/tools
rsync -a tools/ $(builddir)/tools/tools/
install -d $(toolsbin)
install -d $(toolsman)/man1
......@@ -95,39 +104,36 @@ ifeq ($(do_tools),true)
install -m755 debian/tools/generic $(toolsbin)/cpupower
install -m644 $(CURDIR)/tools/power/cpupower/man/*.1 $(toolsman)/man1/
ifeq ($(do_tools_perf),true)
install -m755 debian/tools/generic $(toolsbin)/perf
endif
ifeq ($(do_tools_x86),true)
install -m755 debian/tools/generic $(toolsbin)/x86_energy_perf_policy
install -m755 debian/tools/generic $(toolsbin)/turbostat
endif
ifeq ($(do_tools_hyperv),true)
install -d $(toolssbin)
install -m755 debian/tools/generic $(toolssbin)/hv_kvp_daemon
install -m755 debian/tools/generic $(toolssbin)/hv_vss_daemon
endif
rm -rf $(builddir)/tools
install -d $(builddir)/tools
for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools/; done
rm $(builddir)/tools/tools
rsync -a tools/ $(builddir)/tools/tools/
ifeq ($(do_tools_perf),true)
cd $(builddir)/tools/tools/perf && make man
install -m644 $(builddir)/tools/tools/perf/Documentation/*.1 \
$(toolsman)/man1
endif
ifeq ($(do_tools_x86),true)
install -d $(toolsman)/man8
install -m644 $(CURDIR)/tools/power/x86/x86_energy_perf_policy/*.8 $(toolsman)/man8
install -m644 $(CURDIR)/tools/power/x86/turbostat/*.8 $(toolsman)/man8
endif
ifeq ($(do_tools_hyperv),true)
install -m644 $(CURDIR)/tools/hv/*.8 $(toolsman)/man8
endif
endif
install -d $(cloudsbin)
install -m755 debian/tools/generic $(cloudsbin)/hv_kvp_daemon
install -m755 debian/tools/generic $(cloudsbin)/hv_vss_daemon
install -m755 debian/tools/generic $(cloudsbin)/hv_fcopy_daemon
install -m755 debian/cloud-tools/hv_get_dhcp_info $(cloudsbin)
install -m755 debian/cloud-tools/hv_get_dns_info $(cloudsbin)
install -m755 debian/cloud-tools/hv_set_ifconfig $(cloudsbin)
install -d $(cloudman)/man8
install -m644 $(CURDIR)/tools/hv/*.8 $(cloudman)/man8
dh_systemd_enable
dh_installinit -p$(cloudpkg) --name hv-kvp-daemon
dh_installinit -p$(cloudpkg) --name hv-vss-daemon
dh_installinit -p$(cloudpkg) --name hv-fcopy-daemon
dh_systemd_start
install-indep: install-tools
@echo Debug: $@
......
......@@ -44,22 +44,29 @@ do-binary-udebs: debian/control
done
# Generate the meta-udeb dependancy lists.
@gawk ' \
/Package: / { package=$$2 } \
(/Package-Type: udeb/ && package !~ /^'$(src_pkg_name)'-udebs-/) { \
match(package, "'$(release)'-'$(abinum)'-(.*)-di", bits); \
flavour = bits[1]; \
udebs[flavour] = udebs[flavour] package ", "; \
} \
END { \
for (flavour in udebs) { \
package="'$(src_pkg_name)'-udebs-" flavour; \
file="debian/" package ".substvars"; \
print("udeb:Depends=" udebs[flavour]) > file; \
metas="'$(builddir)'/udeb-meta-packages"; \
print(package) >metas \
} \
} \
@gawk ' \
/^Package:/ { \
package=$$2; flavour=""; parch="" } \
(/Package-Type: udeb/ && package !~ /^linux-udebs-/) { \
match(package, "'$(release)'-'$(abinum)'-(.*)-di", bits); \
flavour = bits[1]; \
} \
(/^Architecture:/ && $$0 " " ~ / '$(arch)'/) { \
parch=$$0; \
} \
(flavour != "" && parch != "") { \
udebs[flavour] = udebs[flavour] package ", "; \
flavour=""; parch=""; \
} \
END { \
for (flavour in udebs) { \
package="linux-udebs-" flavour; \
file="debian/" package ".substvars"; \
print("udeb:Depends=" udebs[flavour]) > file; \
metas="'$(builddir)'/udeb-meta-packages"; \
print(package) >metas \
} \
} \
' <$(CURDIR)/debian/control
@while read i; do \
$(lockme) dh_gencontrol -p$$i; \
......
......@@ -46,7 +46,7 @@ for arch in $archs; do
# Map debian archs to kernel archs
case "$arch" in
ppc64) kernarch="powerpc" ;;
ppc64|ppc64el) kernarch="powerpc" ;;
amd64) kernarch="x86_64" ;;
lpia) kernarch="x86" ;;
sparc) kernarch="sparc64" ;;
......
Tests: rebuild
Depends: build-essential
Restrictions: build-needed
Depends: @builddeps@, fakeroot
Restrictions: allow-stderr
#!/bin/true
#!/bin/sh
set -e
dpkg-buildpackage -rfakeroot -us -uc -b
......@@ -16,14 +16,45 @@ if [ -f "$this" ]; then
exec "$this" "$@"
fi
# Give them a hint as to what to install.
echo "`basename $0` not found for kernel $version" >&2
if dpkg --compare-versions "$full_version" lt "3.11.0"; then
# Before saucy kernels we had no flavour linkage.
if dpkg --compare-versions "$version" lt "3.11.0"; then
flavour=''
else
flavour="-$flavour"
fi
echo "You may need to install linux-tools-$version$flavour for this kernel." >&2
echo "You may also wish to install linux-tools$flavour or" >&2
echo "linux-image$flavour-lts-<series> to keep up to date." >&2
# Hint at the cloud tools if they exist (trusty and later)
if dpkg --compare-versions "$version" ge "3.13.0"; then
cld=""
else
cld=":"
fi
# Work out if this is an LTS backport or not.
codename=`lsb_release -cs`
case "$codename" in
precise) base='3.2.0-9999' ;;
trusty) base='3.13.0-9999' ;;
*) base='' ;;
esac
std=""
lts=":"
if [ "$base" != "" ]; then
if dpkg --compare-versions "$version" gt "$base"; then
std=":"
lts=""
fi
fi
# Give them a hint as to what to install.
echo "WARNING: `basename $0` not found for kernel $version" >&2
echo "" >&2
echo " You may need to install the following packages for this specific kernel:" >&2
echo " linux-tools-$version$flavour" >&2
$cld echo " linux-cloud-tools-$version$flavour" >&2
echo "" >&2
echo " You may also want to install one of the following packages to keep up to date:" >&2
$std echo " linux-tools$flavour" >&2
$std $cld echo " linux-cloud-tools$flavour" >&2
$lts echo " linux-tools$flavour-lts-<series>" >&2
$lts $cld echo " linux-cloud-tools$flavour-lts-<series>" >&2
exit 2
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment