summaryrefslogtreecommitdiff
path: root/vmdebootstrap
diff options
context:
space:
mode:
authorNeil Williams <codehelp@debian.org>2015-11-05 16:38:55 +0000
committerNeil Williams <codehelp@debian.org>2015-11-05 16:38:55 +0000
commit261af90a7aad0a72c776235b462fa8d1bf312679 (patch)
tree6de62aa77b254be456528db705bf4eba08f10536 /vmdebootstrap
parent0100446b4febb76cf96cfd9559d1d22d8dcd83aa (diff)
downloadvmdebootstrap-261af90a7aad0a72c776235b462fa8d1bf312679.tar.gz
Exclude dev, proc, sys and run from mksquashfs
Diffstat (limited to 'vmdebootstrap')
-rw-r--r--vmdebootstrap/filesystem.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/vmdebootstrap/filesystem.py b/vmdebootstrap/filesystem.py
index df3e7b5..a26145c 100644
--- a/vmdebootstrap/filesystem.py
+++ b/vmdebootstrap/filesystem.py
@@ -24,6 +24,7 @@
import os
import cliapp
import logging
+import tempfile
from vmdebootstrap.base import (
Base,
runcmd,
@@ -181,10 +182,18 @@ class Filesystem(Base):
suffixed = os.path.join(self.settings['squash'], "filesystem.squashfs")
if os.path.exists(suffixed):
os.unlink(suffixed)
+ _, exclusions = tempfile.mkstemp()
+ with open(exclusions, 'w') as exclude:
+ exclude.write("/proc\n")
+ exclude.write("/dev\n")
+ exclude.write("/sys\n")
+ exclude.write("/run\n")
self.message("Running mksquashfs on rootfs.")
msg = runcmd(
['mksquashfs', self.devices['rootdir'], suffixed,
- '-no-progress', '-comp', 'xz'], ignore_fail=False)
+ '-no-progress', '-comp', 'xz',
+ '-e', exclusions], ignore_fail=False)
+ os.unlink(exclusions)
logging.debug(msg)
check_size = os.path.getsize(suffixed)
logging.debug("Created squashfs: %s", suffixed)