Browse code

Remove copied etc/resolv.conf after install for systemd-resolved to create symbolic links correctly

Change-Id: Ibdfc15631c6597d562aaad5252d7ecf4a9059a4f
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1792
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>

suezzelur authored on 2016/12/01 06:25:46
Showing 1 changed files
... ...
@@ -140,6 +140,7 @@ class Installer(object):
140 140
         if self.iso_installer:
141 141
             self.progress_bar.show_loading('Finalizing installation')
142 142
 
143
+        shutil.copy("/etc/resolv.conf", self.photon_root + '/etc/.')
143 144
         self.finalize_system()
144 145
 
145 146
         if not self.install_config['iso_system']:
... ...
@@ -160,6 +161,9 @@ class Installer(object):
160 160
 
161 161
             self.update_fstab()
162 162
 
163
+        if os.path.exists(self.photon_root + '/etc/resolv.conf'):
164
+            os.remove(self.photon_root + '/etc/resolv.conf')
165
+
163 166
         command = [self.unmount_disk_command, '-w', self.photon_root]
164 167
         if not self.install_config['iso_system']:
165 168
             command.extend(self.generate_partitions_param(reverse = True))
... ...
@@ -290,7 +294,6 @@ class Installer(object):
290 290
     
291 291
     def finalize_system(self):
292 292
         #Setup the disk
293
-        shutil.copy("/etc/resolv.conf", self.photon_root + '/etc/.')
294 293
         process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, self.finalize_command, '-w', self.photon_root], stdout=self.output)
295 294
         retval = process.wait()
296 295
         if self.iso_installer: