[PATCH] do not delete liveimg --url=file:/// file

Gene Czarcinski gczarcinski at ec.rr.com
Fri Nov 21 06:12:41 UTC 2014


On 11/18/2014 05:40 PM, Brian C. Lane wrote:
> On Tue, Nov 18, 2014 at 09:04:29AM +0100, Vratislav Podzimek wrote:
>> On Sun, 2014-11-16 at 13:58 -0500, Gene Czarcinski wrote:
>>> If liveimg --url=file:// do not delete the referenced file.  Only
>>> delete those files which are downloaded. (RHBZ 1164585)
>>> ---
>>>   pyanaconda/packaging/livepayload.py | 9 ++++++++-
>>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
>>> index fbdb38f..6b235ea 100644
>>> --- a/pyanaconda/packaging/livepayload.py
>>> +++ b/pyanaconda/packaging/livepayload.py
>>> @@ -431,13 +431,20 @@ class LiveImageKSPayload(LiveImagePayload):
>>>   
>>>       def postInstall(self):
>>>           """ Unmount image, remove image file from target
>>> +            unless filr:// specified in which case just
>>                      typo^^^
>>
>>> +            umount it.
>>>           """
>>>           super(LiveImageKSPayload, self).postInstall()
>>>   
>>>           if os.path.exists(IMAGE_DIR+"/LiveOS"):
>>>               blivet.util.umount(IMAGE_DIR)
>>>   
>>> -        if os.path.exists(self.image_path):
>>> +        if self.data.method.url.startswith("file://"):
>>> +            log.debug("live-postInstall: file://specified, just umount")
>>> +            blivet.util.umount(self.image_path)
>>> +
>>> +        elif os.path.exists(self.image_path):
>>> +            log.debug("live-postInstall: delete downloaded file")
>>>               os.unlink(self.image_path)
>> No umount in the elif branch.
> Actually, no umount should be needed here at all. It is mounted on
> INSTALL_TREE and that gets unmounted by the superclass. So just skipping
> the unlink is what it should do.
>
The final version of the patch witch is in the anaconda git repository 
and does not unlink if file:// is specified is good. Tested and this 
works form me.

Gene


More information about the anaconda-patches mailing list