#!/bin/sh # BasOS Jan 2006 # # Script for usbmount to remove standard symlinks to specific partitions # Patritions are defined in /etc/usbmount/partitions.conf setting the variable PARTITIONS # PARTITIONS is space delimited list of partition definitions and corresponding mount points # A partition definition is a comma dellimited list whith a -mpoint= entry specifying the # symlink, a -label= and/or -uuid= entry specifying a label match and/or uuid match. #e.g. PARTITIONS="-label=lab1,-mpoint=/mnt/a -uuid=EA32-3AE4,moint=/mnt/b # -label=lab2,-uuid=EADE-EA34,-moint=/mnt/c" # # Το παρόν χρησιμοποιείται με το usbmount και εγκαθίσταται στο /etc/usbmount/mount.d # Διαγραφει στανταρ slinks για συγκεκριμενα partitions τα οποία ορίζονται στο # /etc/usbmount/partitions.conf στη μεταβλητή PARTITIONS. Η τελευταία είναι μία λίστα χωριζόμενη # με κενά με ορισμούς partition. Καθε ορισμός partition είναι μια λίστο χωριζόμενη με κόμμα # που περιέχει μια καταχώρηση -mpoint= για το symlink του partition , μία καταχώρηση -label= # ή/και μια καταχώρηση -uuid= για τον προσδιορισμό του label ή/και του uuid ενος partition. # Τα στοιχεία (label,uuid) ενός partition τα βλέπουμε με το vol_id device # π.χ. PARTITIONS="-label=lab1,-mpoint=/mnt/a -uuid=EA32-3AE4,moint=/mnt/b # -label=lab2,-uuid=EADE-EA34,-moint=/mnt/c" # # This file is free software; the copyright holder gives unlimited # permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # This file is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # #v0.5 d="off"; # Log a string via the syslog facility. 2004, 2005 Martin Dickopp log() { if test $1 != "debug" || test "$d" = "on"; then logger -p user.$1 -t "partitionumount[$$]" -- "$2" fi } if test -r /etc/usbmount/partitions.conf; then . /etc/usbmount/partitions.conf else log warning "partitions.conf not found" exit 1; fi for v in $PARTITIONS; do mpoints=`echo $v | grep -o "\-mpoint=[^,]*" | sed "s/-mpoint=//"`; if (! test -z "$mpoints") ;then for mpoint in $mpoints ;do if test -L "$mpoint" && test `ls -l "$mpoint" | grep -o '\->.*' | sed "s/-> //"` = "$UM_MOUNTPOINT" ;then if test "$d" = "on" ;then echo "Removing $mpoint" fi rm -f "$mpoint" && log info "Removed $mpoint -> $UM_MOUNTPOINT for $UM_DEVICE" fi done else log warning "Erroneus partition description" fi done exit 0