diff options
author | Ben Howard <ben.howard@ubuntu.com> | 2012-11-14 10:59:37 -0700 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2012-11-15 16:03:16 +0000 |
commit | 49a663c4bc1499f974cca254a9c13016c4382a1b (patch) | |
tree | faedbd4c5107039cdb6f8c3c2eba64a9dbababcb /debian | |
parent | c7b6a6ea935ab4f2dec9f29913f996d615cf2fde (diff) | |
download | vyos-walinuxagent-49a663c4bc1499f974cca254a9c13016c4382a1b.tar.gz vyos-walinuxagent-49a663c4bc1499f974cca254a9c13016c4382a1b.zip |
Import patches-unapplied version 1.1-0ubuntu1 to ubuntu/raring-proposed
Imported using git-ubuntu import.
Changelog parent: c7b6a6ea935ab4f2dec9f29913f996d615cf2fde
New changelog entries:
* New upstream version (LP: #1078074, #1077147).
* Moved upstart job to be managed by packaging.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/patches/000_resolv-conf.patch | 32 | ||||
-rw-r--r-- | debian/patches/000_ubuntu_init_resolvconf.patch | 153 | ||||
-rw-r--r-- | debian/patches/001-strip-init-d.patch | 36 | ||||
-rw-r--r-- | debian/patches/001_ubuntu_agent_startup.patch | 22 | ||||
-rw-r--r-- | debian/patches/series | 4 | ||||
-rw-r--r-- | debian/postinst | 4 | ||||
-rwxr-xr-x | debian/rules | 7 | ||||
-rw-r--r-- | debian/upstart | 26 |
9 files changed, 108 insertions, 183 deletions
diff --git a/debian/changelog b/debian/changelog index ba4f985..f5be404 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +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. diff --git a/debian/patches/000_resolv-conf.patch b/debian/patches/000_resolv-conf.patch new file mode 100644 index 0000000..23404da --- /dev/null +++ b/debian/patches/000_resolv-conf.patch @@ -0,0 +1,32 @@ +Index: wa-new/waagent +=================================================================== +--- wa-new.orig/waagent 2012-11-14 11:06:12.227371000 -0700 ++++ wa-new/waagent 2012-11-14 11:07:53.093401274 -0700 +@@ -2262,7 +2262,26 @@ + Run("rm -f " + a + "/*") + + # Clear LibDir, remove nameserver and root bash history +- for f in os.listdir(LibDir) + ["/etc/resolv.conf", "/root/.bash_history", "/var/log/waagent.log"]: ++ fileBlackList = [ "/root/.bash_history", "/var/log/waagent.log" ] ++ ++ if IsUbuntu(): ++ # Ubuntu uses resolv.conf by default, so removing /etc/resolv.conf will ++ # break resolvconf. Therefore, we check to see if resolvconf is in use, ++ # and if so, we remove the resolvconf artifacts. ++ ++ if os.path.realpath('/etc/resolv.conf') != '/run/resolvconf/resolv.conf': ++ Log("resolvconf is not configured. Removing /etc/resolv.conf") ++ fileBlackList.append('/etc/resolv.conf') ++ else: ++ Log("resolvconf is enabled; leaving /etc/resolv.conf intact") ++ resolvConfD = '/etc/resolvconf/resolv.conf.d/' ++ fileBlackList.extend([resolvConfD + 'tail', resolvConfD + 'originial' ]) ++ else: ++ fileBlackList.append(os.listdir(LibDir) + '/etc/resolv.conf') ++ ++ ++ # Clear LibDir, remove nameserver and root bash history ++ for f in os.listdir(LibDir) + fileBlackList: + try: + os.remove(f) + except: diff --git a/debian/patches/000_ubuntu_init_resolvconf.patch b/debian/patches/000_ubuntu_init_resolvconf.patch deleted file mode 100644 index 70c0097..0000000 --- a/debian/patches/000_ubuntu_init_resolvconf.patch +++ /dev/null @@ -1,153 +0,0 @@ -Description: Microsoft provided walinuxagent does not include the - required UFS module, is not resolvconf aware, and does not provide - an upstart script; this patch fixes all of that. -Author: Ben Howard <ben.howard@ubuntu.com> -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1014864 -Forwarded: yes - ---- a/waagent -+++ b/waagent -@@ -1970,6 +1970,26 @@ esac - exit $RETVAL - """ - -+Init_Ubuntu = """\ -+#walinuxagent - start Windows Azure agent -+ -+description "walinuxagent" -+author "Ben Howard <ben.howard@canonical.com>" -+ -+start on (filesystem and started rsyslog) -+ -+pre-start script -+ if [ ! -x /usr/sbin/waagent ]; then -+ exit 1 -+ fi -+ -+ #Load the udf module -+ modprobe -b udf -+end script -+ -+exec /usr/sbin/waagent -daemon -+""" -+ - Init_Debian = """\ - #!/bin/sh - ### BEGIN INIT INFO -@@ -2135,18 +2155,30 @@ def Install(): - os.remove(GetLastPathElement(a)) - shutil.move(a, ".") - Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) ) -- filename = "waagent" -- filepath = "/etc/init.d/" + filename -- distro = IsRedHat() + IsDebian() * 2 + IsSuse() * 3 -- if distro == 0: -- Error("Unable to detect Linux Distribution.") -- return 1 -- init = [[Init_RedHat, "chkconfig --add " + filename], -- [Init_Debian, "update-rc.d " + filename + " defaults"], -- [Init_Suse, "insserv " + filename]][distro - 1] -- SetFileContents(filepath, init[0]) -- os.chmod(filepath, 0755) -- Run(init[1]) -+ -+ if IsUbuntu(): -+ # Support for Ubuntu's upstart configuration -+ filename="waagent.conf" -+ filepath = "/etc/init/" + filename -+ SetFileContents(filepath, Init_Ubuntu) -+ os.chmod(filepath, 0644) -+ -+ else: -+ # Regular init.d configurations -+ filename = "waagent" -+ filepath = "/etc/init.d/" + filename -+ -+ distro = IsRedHat() + IsDebian() * 2 + IsSuse() -+ if distro == 0: -+ Error("Unable to detect Linux Distribution.") -+ return 1 -+ init = [[Init_RedHat, "chkconfig --add " + filename], -+ [Init_Debian, "update-rc.d " + filename + " defaults"], -+ [Init_Suse, "insserv " + filename]][distro - 1] -+ 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") -@@ -2179,17 +2211,26 @@ def Uninstall(): - Warn("Moved " + LibDir + "/" + GetLastPathElement(a) + " -> " + a ) - except: - pass -+ -+ filepath = "/etc/init.d/" - filename = "waagent" -- a = IsRedHat() + IsDebian() * 2 + IsSuse() * 3 -- 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.d/" + filename, "/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"]: -+ -+ if IsUbuntu(): -+ Run("stop " + filename) -+ filepath = "/etc/init/" -+ filename = "waagent.conf" -+ else: -+ a = IsRedHat() + IsDebian() * 2 + IsSuse() * 3 -+ 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) + [filepath + filename, "/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"]: - try: - os.remove(f) - except: -@@ -2217,7 +2258,12 @@ def Deprovision(force, deluser): - - print("WARNING! The waagent service will be stopped.") - print("WARNING! All SSH host key pairs will be deleted.") -- print("WARNING! Nameserver configuration in /etc/resolv.conf will be deleted.") -+ -+ if IsUbuntu(): -+ print("WARNING! Nameserver configuration in /etc/resolvconf/resolv.conf.d/{tail,originial} will be deleted.") -+ else: -+ print("WARNING! Nameserver configuration in /etc/resolv.conf will be deleted.") -+ - print("WARNING! Cached DHCP leases will be deleted.") - - delRootPass = Config.get("Provisioning.DeleteRootPassword") -@@ -2253,7 +2299,21 @@ def Deprovision(force, deluser): - Run("rm -f " + a + "/*") - - # Clear LibDir, remove nameserver and root bash history -- for f in os.listdir(LibDir) + ["/etc/resolv.conf", "/root/.bash_history", "/var/log/waagent.log"]: -+ fileBlackList = [ "/root/.bash_history", "/var/log/waagent.log" ] -+ -+ # Ubuntu uses resolvconf, so we want to preserve the ability to use resolvconf -+ if IsUbuntu(): -+ if os.path.realpath('/etc/resolv.conf') != '/run/resolvconf/resolv.conf': -+ Log("resolvconf is not configured. Removing /etc/resolv.conf") -+ fileBlackList.append('/etc/resolv.conf') -+ else: -+ Log("resolvconf is enabled; leaving /etc/resolv.conf intact") -+ resolvConfD = '/etc/resolvconf/resolv.conf.d/' -+ fileBlackList.extend([resolvConfD + 'tail', resolvConfD + 'originial' ]) -+ else: -+ fileBlackList.append(os.listdir(LibDir) + '/etc/resolv.conf') -+ -+ for f in os.listdir(LibDir) + fileBlackList: - try: - os.remove(f) - except: diff --git a/debian/patches/001-strip-init-d.patch b/debian/patches/001-strip-init-d.patch new file mode 100644 index 0000000..0d88fe4 --- /dev/null +++ b/debian/patches/001-strip-init-d.patch @@ -0,0 +1,36 @@ +--- a/waagent ++++ b/waagent +@@ -2141,18 +2141,21 @@ def Install(): + os.remove(GetLastPathElement(a)) + shutil.move(a, ".") + Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) ) +- filename = "waagent" +- filepath = "/etc/init.d/" + filename +- distro = IsRedHat() + IsDebian() * 2 + IsSuse() * 3 +- if distro == 0: +- Error("Unable to detect Linux Distribution.") +- return 1 +- init = [[Init_RedHat, "chkconfig --add " + filename], +- [Init_Debian, "update-rc.d " + filename + " defaults"], +- [Init_Suse, "insserv " + filename]][distro - 1] +- SetFileContents(filepath, init[0]) +- os.chmod(filepath, 0755) +- Run(init[1]) ++ ++ if not IsUbuntu(): ++ filename = "waagent" ++ filepath = "/etc/init.d/" + filename ++ distro = IsRedHat() + IsDebian() * 2 + IsSuse() * 3 ++ if distro == 0: ++ Error("Unable to detect Linux Distribution.") ++ return 1 ++ init = [[Init_RedHat, "chkconfig --add " + filename], ++ [Init_Debian, "update-rc.d " + filename + " defaults"], ++ [Init_Suse, "insserv " + filename]][distro - 1] ++ 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") diff --git a/debian/patches/001_ubuntu_agent_startup.patch b/debian/patches/001_ubuntu_agent_startup.patch deleted file mode 100644 index 118bdb0..0000000 --- a/debian/patches/001_ubuntu_agent_startup.patch +++ /dev/null @@ -1,22 +0,0 @@ -Description: Enablement/disablement via /etc/default/waagent - Allow users to control the startup of waagent via /etc/default/waagent. - Setting "WAAGENT_ENABLED=0" will turn off the agent at boot time. -Author: Ben Howard <ben.howard@ubuntu.com> -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1014864 - ---- a/waagent -+++ b/waagent -@@ -1979,6 +1979,13 @@ author "Ben Howard <ben.howard@canonical - start on (filesystem and started rsyslog) - - pre-start script -+ -+ [ -r /etc/default/walinuxagent ] && . /etc/default/walinuxagent -+ -+ if [ "$WALINUXAGENT_ENABLED" != "1" ]; then -+ exit 1 -+ fi -+ - if [ ! -x /usr/sbin/waagent ]; then - exit 1 - fi diff --git a/debian/patches/series b/debian/patches/series index 233ee46..96a325a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,2 @@ -000_ubuntu_init_resolvconf.patch -001_ubuntu_agent_startup.patch +000_resolv-conf.patch +001-strip-init-d.patch diff --git a/debian/postinst b/debian/postinst index b18aa8e..263f5a6 100644 --- a/debian/postinst +++ b/debian/postinst @@ -6,8 +6,8 @@ case "$1" in ;; abort-upgrade|abort-remove|abort-deconfigure) - if [ -f /etc/init/waagent ]; then - rm /etc/init/waagent + if [ -f /etc/init.d/waagent ]; then + rm /etc/init.d/waagent fi ;; diff --git a/debian/rules b/debian/rules index 7923b65..cbb7be8 100755 --- a/debian/rules +++ b/debian/rules @@ -1,14 +1,13 @@ #!/usr/bin/make -f -DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') -ORIG_COMMIT=$(shell echo $(DEB_UPSTREAM_VERSION) | cut -f3 -d\. ) +DEB_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') ORIG_SRC=https://github.com/Windows-Azure/WALinuxAgent get-packaged-orig-source: git clone --separate-git-dir=.git \ $(ORIG_SRC) orig_source - git archive --format=tar.gz $(ORIG_COMMIT) \ - -o walinuxagent_$(DEB_UPSTREAM_VERSION).orig.tar.gz + git archive --format=tar.gz WALinuxAgent-$(DEB_VERSION) \ + -o walinuxagent_$(DEB_VERSION).orig.tar.gz %: dh $@ --with python2 diff --git a/debian/upstart b/debian/upstart new file mode 100644 index 0000000..860d43a --- /dev/null +++ b/debian/upstart @@ -0,0 +1,26 @@ +#walinuxagent - start Windows Azure agent + +description "walinuxagent" +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 |