From: Vincent Le Gallic Date: Mon, 3 Feb 2014 02:20:35 +0000 (+0100) Subject: [mountdisk] Corrections, ajout du "all" + script pour démonter/monter au reboot X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=e3f98c904da677bc0f9cdcec096457963c0719ac;p=scripts-20-100.git [mountdisk] Corrections, ajout du "all" + script pour démonter/monter au reboot --- 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