aboutsummaryrefslogtreecommitdiff
blob: feef5b19557a96d5bef4f4b3e4061ef5461711db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
# vim: set sw=4 sts=4 et :
# Copyright: 2008 Gentoo Foundation
# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
# License: GPL-2
#
# Immortal lh!
#

from autotua import const

def clean_mounts():
    # /proc/mounts is more reliable than mtab (which is what `mount` uses)
    mounts = open('/proc/mounts', 'r').read()
    regex = re.compile(r'%s/[^ ]+' % const.AUTOTUA_DIR.replace(' ', r'\\040'))
    for mount in regex.findall(mounts):
        subprocess.check_call('umount "%s"' % mount.replace(r'\040', ' '), shell=True)

print "ZOMG!@~: WE DIED. Cleaning up stuff..."
clean_mounts