Merge pull request #8 from utlemming/master

Ubuntu Packaging
This commit is contained in:
Stephen A. Zarkos
2013-02-05 11:11:01 -08:00
19 changed files with 347 additions and 8 deletions
+26
View File
@@ -0,0 +1,26 @@
The preferred method of installing WALinuxAgent for Ubuntu is to use Debian
Packaging. Ubuntu supports the official Ubuntu WALinuxAgent version, which
can be found here: https://launchpad.net/ubuntu/+source/walinuxagent . The
Debian packaging is derived from the source here.
These instructions tell you build the package with out having to install
too many extra packages, and keep your source directory clean.
Run once:
1. Install required packages:
sudo apt-get -y install ubuntu-dev-tools pbuilder
2. Create the pbuilder environment:
sudo pbuilder create --debootstrapopts --variant=buildd
To compile the package:
From the top-most directory, (i.e. not debian), run:
1. Build the source package:
dpkg-buildpackage -S
2. Build the package:
sudo pbuilder build ../walinuxagent_1.3-0ubuntu1.dsc
3. Fetch the built package, usually from /var/cache/pbuilder/results
+1
View File
@@ -0,0 +1 @@
version=3
+80
View File
@@ -0,0 +1,80 @@
walinuxagent (1.3-0ubuntu1) raring; urgency=low
* New upstream version (LP: #1101371)
- Add some error checking and robustness to DVD mounting operation during
provisioning
- Remove redundant check for IP and Port in LoadBalancerProbe
- Add check to self.computername to detect empty hostname in configuration
- Fix manual uninstall on Ubuntu
* Modified walinuxagent to recognize when its been packaged.
-- Ben Howard <ben.howard@ubuntu.com> Fri, 18 Jan 2013 15:43:08 -0700
walinuxagent (1.2-0ubuntu1) raring; urgency=low
* New upstream version (LP: #1077148)
* Upstream features:
- Added - load ata_piix.ko module loaded if needed for CDROM device support
- Additional logging for DoDhcpWork()
- Update sock.recv timeout from 30 to 10 seconds
- Fix: Linux waagent deprovision, user is not deleted properly
- Fix: Make LBProbeResponder construction more robust
- Fix: Agent fails to provision user with public/private key pairs
- Fix: DHCP broadcast response not received
- Fix: Linux agent fails to delete root user password
- Fix: Linux agent should report error messages to Fabric when
passed an invalid hostname.
* Dropped Ubuntu specific patches
- Removed debian/patches/000_resolv-conf.patch as upstream now supports
resolvconf properly.
- Removed debian/patches/001-strip-init-d.patch as redundant now that
upstream understands Ubuntu upstart. Upstream script does not
handle the removal of the upstart job anyway.
* Added debian/patches/000_use_package_upstart.patch to use packaged
upstart job over in-script upstart.
-- Ben Howard <ben.howard@ubuntu.com> Fri, 07 Dec 2012 16:52:42 -0700
walinuxagent (1.1-0ubuntu2) raring; urgency=low
* Stop upgrades purging walinuxagent meta-data and configuration files
(LP: #1079897):
- d/{control,walinuxagent-data-saver.preinst}: Added
walinuxagent-data-saver package to ensure that agent generated data is
not lost on upgrade by diverting /usr/sbin/waagent during the upgrade
process.
- d/walinuxagent-data-saver.lintian-overrides: Override errors about use
of dpkg-divert in this package.
- d/control: Added Pre-Depends to walinuxagent on walinuxagent-data-saver.
- d/prerm: Stop calling waagent --uninstall during reconfiguration
and upgrade, specify files to remove manually for purge.
- d/postinst: Remove divert of /usr/sbin/waagent prior to completion of
package install.
* d/preinst: If upgrading from package version with unmanaged waagent upstart
configuration stop the agent and remove the upstart configuration.
* d/upstart: Tidied description in upstart job.
-- James Page <james.page@ubuntu.com> Fri, 23 Nov 2012 16:07:41 +0000
walinuxagent (1.1-0ubuntu1) raring; urgency=low
* New upstream version (LP: #1078074, #1077147).
* Moved upstart job to be managed by packaging.
-- Ben Howard <ben.howard@ubuntu.com> Wed, 14 Nov 2012 10:59:37 -0700
walinuxagent (1.0~git20120606.c16f5e9-0ubuntu2) quantal; urgency=low
* Restrict target architectures to i386 and amd64.
-- James Page <james.page@ubuntu.com> Mon, 06 Aug 2012 10:24:07 +0100
walinuxagent (1.0~git20120606.c16f5e9-0ubuntu1) quantal; urgency=low
* Initial package import (LP: #1014864).
* Ubuntu specific modifications:
- Made resolvconf aware during deprovisioning
- Added Ubuntu upstart job
- Added ability to prevent agent startup.
-- Ben Howard <ben.howard@ubuntu.com> Fri, 22 Jun 2012 09:10:22 -0600
+1
View File
@@ -0,0 +1 @@
8
+35
View File
@@ -0,0 +1,35 @@
Source: walinuxagent
Section: python
Priority: extra
Maintainer: Ben Howard <ben.howard@ubuntu.com>
XSBC-Original-Maintainer: Microsoft Corporation <walinuxagent@microsoft.com>
Build-Depends: debhelper (>= 8), python-all
Standards-Version: 3.9.3
XS-Python-Version: all
Homepage: http://go.microsoft.com/fwlink/?LinkId=250998
Package: walinuxagent
Architecture: i386 amd64
Pre-Depends: walinuxagent-data-saver (= ${binary:Version})
Depends: python (>= 2.4),
openssl (>=1.0),
openssh-server (>=1:5.9p1),
passwd (>=4.1.4.2),
util-linux (>=2.0),
linux-image-extra-virtual,
${misc:Depends},
${python:Depends}
Conflicts: network-manager
Description: Windows Azure Linux Agent
The Windows Azure Linux Agent supports the provisioning and running of Linux
VMs in the Windows Azure cloud. This package should be installed on Linux
disk images that are built to run in the Windows Azure environment.
Package: walinuxagent-data-saver
Architecture: i386 amd64
Depends: ${misc:Depends}
Description: Helper package which ensures safe upgrade for walinuxagent
Early versions of walinuxagent contained a bug the deleted configuration and
data on reconfiguration or upgrade.
.
This package is used to ensure safe upgrades.
+21
View File
@@ -0,0 +1,21 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
Upstream-Name: walinuxagent
Upstream-Contact: Microsoft Corporation <walinuxagent@microsoft.com>
Source: https://github.com/Windows-Azure/WALinuxAgent/
Files: *
Copyright: 2012, Microsoft Corporation <walinuxagent@microsoft.com>
License: Apache-2.0
Files: waaagent
Copyright: 2012, Microsoft Corporation <walinuxagent@microsoft.com>
2012, Ben Howard <ben.howard@canonical.com>
License: Apache-2.0
Files: debian/*
Copyright: 2012, Ben Howard <ben.howard@canonical.com>
License: Apache-2.0
License: Apache-2.0
On Debian systems, the complete text of the Apache version 2.0 license
can be found in "/usr/share/common-licenses/Apache-2.0".
+6
View File
@@ -0,0 +1,6 @@
# To disable the Windows Azure Agent, set WALINUXAGENT_ENABLED=0
WALINUXAGENT_ENABLED=1
# Setting this variable to anything other than 1, runs the script
# in stand-alone mode. This is heavily, heavily discouraged.
WAXLINUXAGENT_PACKAGED=1
Vendored
+1
View File
@@ -0,0 +1 @@
/usr/share/doc/walinuxagent
Vendored
+3
View File
@@ -0,0 +1,3 @@
NOTICE
LICENSE-2.0.txt
README
+1
View File
@@ -0,0 +1 @@
waagent usr/sbin
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
set -e
if [ -f /usr/sbin/waagent.save ]; then
dpkg-divert --package walinuxagent-data-saver --rename --remove /usr/sbin/waagent
fi
case "$1" in
configure)
waagent --setup --force
;;
abort-upgrade|abort-remove|abort-deconfigure)
if [ -f /etc/init.d/waagent ]; then
rm /etc/init.d/waagent
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -e
# If upgrading from package version
# with unmanaged upstart configuration
# and agent stop the agent and remove
# the upstart configuration.
if [ -f /etc/init/waagent.conf ]; then
stop waagent 2>&1 > /dev/null || true
rm -f /etc/init/waagent.conf
fi
#DEBHELPER#
exit 0
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
set -e
case "$1" in
purge)
rm /etc/waagent.conf > /dev/null || true
rm -rf /var/lib/waagent > /dev/null || true
rm /etc/ssh/*waagent > /dev/null || true
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
Vendored Executable
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@ --with python2
+1
View File
@@ -0,0 +1 @@
3.0 (native)
+24
View File
@@ -0,0 +1,24 @@
description "Windows Azure Linux agent"
author "Ben Howard <ben.howard@canonical.com>"
start on mounted MOUNTPOINT=/
stop on runlevel [!2345]
pre-start script
[ -r /etc/default/walinuxagent ] && . /etc/default/walinuxagent
if [ "$WALINUXAGENT_ENABLED" != "1" ]; then
stop ; exit 0
fi
if [ ! -x /usr/sbin/waagent ]; then
stop ; exit 0
fi
#Load the udf module
modprobe -b udf
end script
exec /usr/sbin/waagent -daemon
+10
View File
@@ -0,0 +1,10 @@
# This package exists purely to stop older version of
# walinuxagent purging all local meta-data, sudo config
# and configuration file on upgrade.
# It does this by diverting the waagent binary during the
# upgrade process; the diversion is removed by the walinuxagent
# postinst script.
walinuxagent-data-saver: orphaned-diversion usr/sbin/waagent preinst
walinuxagent-data-saver: diversion-for-unknown-file usr/sbin/waagent preinst:11
walinuxagent-data-saver: empty-binary-package
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -e
if [ -f /usr/sbin/waagent ]; then
# Divert the waagent binary so that the prerm script
# in earlier versions of walinuxagent can't purge its
# user data
dpkg-divert --add --rename \
--package walinuxagent-data-saver \
--divert /usr/sbin/waagent.save /usr/sbin/waagent
fi
#DEBHELPER#
exit 0
+50 -8
View File
@@ -52,6 +52,7 @@ ProtocolVersion = "2011-12-31"
Config = None
LinuxDistro = "UNKNOWN"
PackagedForDistro = "UNKNOWN"
Verbose = False
WaAgent = None
DiskActivated = False
@@ -79,11 +80,24 @@ def IsLinux():
def DetectLinuxDistro():
global LinuxDistro
global PackagedForDistro
if os.path.isfile("/etc/redhat-release"):
LinuxDistro = "RedHat"
return True
if os.path.isfile("/etc/lsb-release") and "Ubuntu" in GetFileContents("/etc/lsb-release"):
LinuxDistro = "Ubuntu"
# Should this run as if it is packaged Ubuntu?
try:
cmd="dpkg -S %s" % os.path.basename(__file__)
retcode, krn = RunSafe(cmd)
if not retcode:
PackagedForDistro = "Ubuntu"
except IOError as e:
pass
return True
if os.path.isfile("/etc/debian_version"):
LinuxDistro = "Debian"
@@ -99,12 +113,21 @@ def IsRedHat():
def IsUbuntu():
return "Ubuntu" in LinuxDistro
def IsPackagedUbuntu():
return "Ubuntu" in PackagedForDistro
def IsDebian():
return IsUbuntu() or "Debian" in LinuxDistro
def IsSuse():
return "Suse" in LinuxDistro
def IsPackaged():
if PackagedForDistro == "UNKNOWN":
return False
return True
def UsesRpm():
return IsRedHat() or IsSuse()
@@ -2252,14 +2275,14 @@ def Install():
shutil.move(a, ".")
Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) )
if IsUbuntu():
if IsUbuntu() and not IsPackagedUbuntu():
# Support for Ubuntu's upstart configuration
filename="waagent.conf"
filepath = "/etc/init/" + filename
SetFileContents(filepath, Init_Ubuntu)
os.chmod(filepath, 0644)
else:
elif not IsPackagedUbuntu():
# Regular init.d configurations
filename = "waagent"
filepath = "/etc/init.d/" + filename
@@ -2273,6 +2296,7 @@ def Install():
SetFileContents(filepath, init[0])
os.chmod(filepath, 0755)
Run(init[1])
if os.path.isfile("/etc/waagent.conf"):
try:
os.remove("/etc/waagent.conf.old")
@@ -2310,12 +2334,30 @@ def Uninstall():
if a == 0:
Error("Unable to detect Linux Distribution.")
return 1
Run("service " + filename + " stop")
cmd = ["chkconfig --del " + filename,
"update-rc.d -f " + filename + " remove",
"insserv -r " + filename][a - 1]
Run(cmd)
for f in os.listdir(LibDir) + ["/etc/init/waagent.conf","/etc/init.d/" + filename, "/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"]:
# Managed by dpkg for Packaged Ubuntu
if not IsPackaged():
Run("service " + filename + " stop")
cmd = ["chkconfig --del " + filename,
"update-rc.d -f " + filename + " remove",
"insserv -r " + filename][a - 1]
Run(cmd)
remove_f = [
"/etc/waagent.conf",
"/etc/logrotate.d/waagent",
"/etc/sudoers.d/waagent",
]
# For packaged Ubuntu, the script should let the packaging
# manage the removal of these files
if not IsPackagedUbuntu():
remove_f.append([
"/etc/init/waagent.conf",
"/etc/init.d/" + filename,
])
for f in os.listdir(LibDir) + remove_f:
try:
os.remove(f)
except: