# Path: chirp/common/conf.py



import getopt
import os
import re
import subprocess
import sys
from chirp.common.conf import MOUNT_BY_HDSN_ROOT
        not_mounted_fn = os.path.join(mount_dir, NOT_MOUNTED_MARKER)

        # If it isn't already there, create a new mount directory
        # containing a not-mounted marker file.
        if not os.path.exists(mount_dir):
            sys.stderr.write("Creating new mount directory %s\n" % mount_dir)
            os.makedirs(mount_dir)
            open(not_mounted_fn, "w").close()

        # If we can't see the not-mounted marker file, something is already
        # mounted at that directory.
        # TODO(trow): Check that the correct drive is mounted?
        if not os.path.exists(not_mounted_fn):
            sys.stderr.write("%s: already mounted\n" % dev_name)
            continue

        mount_cmd = [MOUNT_BIN, dev_name, mount_dir]
        ret_code = subprocess.call(mount_cmd)
        if ret_code:
            sys.stderr.write("%s: FAILED\n" % dev_name)
            continue
        sys.stderr.write("%s: mounted as %s\n" % (dev_name, mount_dir))

    sys.stderr.write("+++ Mounting CHIRP data drives: complete\n")


def do_unmount():
    """Unmount all data drives."""
    sys.stderr.write("+++ Unmounting CHIRP data drives\n")
    for serial_num in os.listdir(MOUNT_BY_HDSN_ROOT):

# Path: chirp/common/conf.py



# Path: chirp/sysadmin/do_automount.py
import getopt
import os
import re
import subprocess
import sys
from chirp.common.conf import MOUNT_BY_HDSN_ROOT

        not_mounted_fn = os.path.join(mount_dir, NOT_MOUNTED_MARKER)

        # If it isn't already there, create a new mount directory
        # containing a not-mounted marker file.
        if not os.path.exists(mount_dir):
            sys.stderr.write("Creating new mount directory %s\n" % mount_dir)
            os.makedirs(mount_dir)
            open(not_mounted_fn, "w").close()

        # If we can't see the not-mounted marker file, something is already
        # mounted at that directory.
        # TODO(trow): Check that the correct drive is mounted?
        if not os.path.exists(not_mounted_fn):
            sys.stderr.write("%s: already mounted\n" % dev_name)
            continue

        mount_cmd = [MOUNT_BIN, dev_name, mount_dir]
        ret_code = subprocess.call(mount_cmd)
        if ret_code:
            sys.stderr.write("%s: FAILED\n" % dev_name)
            continue
        sys.stderr.write("%s: mounted as %s\n" % (dev_name, mount_dir))

    sys.stderr.write("+++ Mounting CHIRP data drives: complete\n")


def do_unmount():
    """Unmount all data drives."""
    sys.stderr.write("+++ Unmounting CHIRP data drives\n")
    for serial_num in os.listdir(MOUNT_BY_HDSN_ROOT):

        mount_dir = os.path.join(MOUNT_BY_HDSN_ROOT, serial_num)