summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2016-07-17 15:38:01 +0100
committerNeil Williams <codehelp@debian.org>2016-07-17 15:38:01 +0100
commit88d8b498b9fa2fe99d86612454eea20533744dc6 (patch)
tree0e48968e7ee7387d418891ab93ccb9740cc5113b
parent4ab9ab31ec8b302a2643712722424c2dc355f245 (diff)
downloadvmdebootstrap-88d8b498b9fa2fe99d86612454eea20533744dc6.tar.gz
Reset umask before creating files
-rwxr-xr-xbin/vmdebootstrap5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index 63de77b..b958b9d 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -53,6 +53,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
self.mount_points = []
self.bootdir = None
self.include = []
+ self.user_mask = None
self.handlers = {
Base.name: Base(),
Uefi.name: Uefi(),
@@ -274,6 +275,7 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
network = self.handlers[Networking.name]
distro = self.handlers[Codenames.name]
try:
+ self.user_mask = os.umask(0o022)
if self.settings['image']:
self._image_preparations()
rootdir = filesystem.devices['rootdir']
@@ -528,5 +530,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
for dirname in self.remove_dirs:
shutil.rmtree(dirname)
+ if self.user_mask:
+ os.umask(self.user_mask)
+
if __name__ == '__main__':
VmDebootstrap(version=__version__).run()