From e8653448bc2683edf68211749babf47b2f8380c0 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sun, 6 Apr 2008 17:25:11 +0000 Subject: Add checking for non-blank local filesystems after mounting git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/gli/trunk@1892 f8877401-5920-0410-a79b-8e2d7e04ca0d --- ChangeLog | 4 ++++ src/GLIArchitectureTemplate.py | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22134f3..c1150e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ # Copyright 2005-2008 Gentoo Foundation; Distributed under the GPL v2 # $Id: $ + 06 Apr 2008; Andrew Gaffney + src/GLIArchitectureTemplate.py: + Add checking for non-blank local filesystems after mounting + 06 Apr 2008; Andrew Gaffney src/GLIArchitectureTemplate.py: Update post-install networking config to use newer conf.d/net syntax diff --git a/src/GLIArchitectureTemplate.py b/src/GLIArchitectureTemplate.py index 7c7f461..9157d9a 100644 --- a/src/GLIArchitectureTemplate.py +++ b/src/GLIArchitectureTemplate.py @@ -346,8 +346,11 @@ class ArchitectureTemplate: ret = GLIUtility.spawn("mount " + partition_type + mountopts + partition + " " + self._chroot_dir + mountpoint, display_on_tty8=True, logfile=self._compile_logfile, append_log=True) if not GLIUtility.exitsuccess(ret): raise GLIException("MountError", 'fatal','mount_local_partitions','Could not mount a partition') - else: - self._mounted_devices.append(mountpoint) + self._mounted_devices.append(mountpoint) + mount_files = os.listdir(self._chroot_dir + mountpoint) + for mount_file in mount_files: + if os.path.isdir(self._chroot_dir + mountpoint + '/' + mount_file) and mount_file != "lost+found": + raise GLIException("MountError", "fatal", "mount_local_partition", "The partition %s (mounted at %s) already has files! The installer only supports installing to a blank filesystem" % (partition, mountpoint)) # double check in /proc/mounts # This current code doesn't work and needs to be fixed, because there is a case that it is needed for - robbat2 #ret, output = GLIUtility.spawn('awk \'$2 == "%s" { print "Found" }\' /proc/mounts | head -n1' % (self._chroot_dir + mountpoint), display_on_tty8=True, return_output=True) -- cgit v1.2.3-65-gdbad