diff options
Diffstat (limited to 'debian/patches/000_ubuntu_init_resolvconf.patch')
-rw-r--r-- | debian/patches/000_ubuntu_init_resolvconf.patch | 153 |
1 files changed, 0 insertions, 153 deletions
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: |