From e3f98c904da677bc0f9cdcec096457963c0719ac Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 3 Feb 2014 03:20:35 +0100 Subject: [PATCH] =?utf8?q?[mountdisk]=20Corrections,=20ajout=20du=20"all"?= =?utf8?q?=20+=20script=20pour=20d=C3=A9monter/monter=20au=20reboot?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- mountdisk.py | 17 +++++++++++++++-- mountdisks.sh | 9 +++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 mountdisks.sh diff --git a/mountdisk.py b/mountdisk.py index 1466545..9b69a5f 100755 --- a/mountdisk.py +++ b/mountdisk.py @@ -9,7 +9,7 @@ import subprocess import sys - +import traceback DISKS = ["Bêta", "Epsilon", "Delta", "Zêta"] @@ -23,10 +23,23 @@ def mount(dev, name): print out +def mount_by_name(name): + """Rajoute les paths habituels""" + mount("/dev/disk/by-label/%s" % name, "/media/%s" % name) + if __name__ == "__main__": param = sys.argv[1] if param == "-l": for i in DISKS: print i sys.exit(0) - mount("/dev/disk/by-label/%s" % param, "/media/%s" % param) + elif param == "all": + print "Mounting all the disk : %s" % ", ".join(DISKS) + mountlist = DISKS + else: + mountlist = [param] + for disk in mountlist: + try: + mount_by_name(disk) + except RuntimeError: + print traceback.format_exc() diff --git a/mountdisks.sh b/mountdisks.sh new file mode 100755 index 0000000..03967d3 --- /dev/null +++ b/mountdisks.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Pour monter tous les disques externes d'un coup + + +# On vire le gardbage créé par les automount anarchiques +umount /media/*_ + +/home/vincent/scripts/mountdisk.py all -- 2.39.2