קוד: |
DEVTYPE=="disk", ID_FS_LABEL=="DIEGO", ACTION=="add", RUN+="logger added" DEVTYPE=="disk", ID_FS_LABEL=="DIEGO", ACTION=="remove", RUN+="logger remove " |
קוד: |
udevadm monitor |
קוד: |
udevadm test /dev/bus/usb/001/001 |
קוד: |
May 15 17:18:35 raspberrypi usbmount[1276]: executing command: mount -tvfat -osync,noexec,nodev,noatime,nodiratime /dev/sda /media/usb1 |
קוד: |
udevadm control --reload-rules |
elcuco : | ||||||
יש לי מחשב שמריץ דביאן, ואני רוצה שהוא יעשה automount להתקני USB-DISK. כאשר מריצים שולחן עבודה זה קורה, אבל כאשר אין X זה מסורבל יותר.
ניסיתי לתפוס את ה udev rules וזה אמור להיות מתאים למחשב שלי:
את הערכים שם מצאתי דרך
ניסיתי לבדוק בעזרת
הקוד שלי לא נקרא. אשמח לקבל עזרה? |
Anonymous : |
אולי כאן?
http://www.hellonull.com/?p=171 |
קוד: |
root@raspberrypi:~# cat /etc/udev/rules.d/99-disk.rules # Custom udev rules. Note that udev rules are run in order based # on the filename. Rules in filenames that start with numbers # are run before this one. # This rule detects USB drives that are added to the system so # that they can be mounted automagically by the script. # It is based off of the replies to a question on superuser.com. # http://superuser.com/questions/53978/ubuntu-automatically-mount-external-drives-to-media-label-on-boot-without-a-u #ENV{ID_FS_USAGE}=="filesystem", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/root/auto-usb.sh mount %k" #ENV{ID_FS_USAGE}=="filesystem", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="/root/auto-usb.sh cleanup %k" # the mount options are different depending on the file system type ENV{ID_FS_USAGE}=="filesystem", ENV{ID_FS_TYPE}=="vfat", SUBSYSTEMS=="usb", ACTION=="add", ENV{MOUNT_OPTIONS}="-o gid=plugdev,dmask=007,fmask=117", RUN+="/root/auto-usb.sh mount %k" ENV{ID_FS_USAGE}=="filesystem", ENV{ID_FS_TYPE}=="vfat", SUBSYSTEMS=="usb", ACTION=="remove", ENV{MOUNT_OPTIONS}="-o gid=plugdev,dmask=007,fmask=117", RUN+="/root/auto-usb.sh cleanup %k" root@raspberrypi:~# cat /root/auto-usb.sh #! /bin/bash logger $0 $1 $2 $3 $4 $5 $6 $7 set -x set -e MOUNT_POINT=/media # # This script is called by a udev rule whenever a usb drive is # plugged into the system or removed from the system. # Usage: # auto-usb.sh MODE DEVICE # where MODE is either mount or cleanup # and DEVICE is the device basename, i.e. /dev/DEVICE if [ "$1" = "mount" ]; then # The ID_FS_LABEL enviroment variable is only available # When this script is caleld by udev mkdir -p "$MOUNT_POINT/$ID_FS_LABEL" || logger "Could not create $MOUNT_POINT/$ID_FS_LABEL" $(mount | grep -q "/media/$ID_FS_LABEL") || mount $MOUNT_OPTIONS /dev/$2 "$MOUNT_POINT/$ID_FS_LABEL" logger " ---- mount $MOUNT_OPTIONS /dev/$2 $MOUNT_POINT/$ID_FS_LABEL" elif [ "$1" = "cleanup" ]; then umount /dev/$2 rmdir "$MOUNT_POINT/$ID_FS_LABEL" else echo "ERROR: Mode $1 should be 'mount' or 'cleanup'." fi |
Anonymous : |
עדיף לך autofs שהוא לפחות עובר עידכונים מאשר usbmount |
elcuco : | ||||
על זה דווקא הסתכלתי. ממנו התחלתי - והוא לא ממש עובד כיום. עריכה: התסכלתי שוב. זה התסריטים שאני עובד איתם:
המקום שבו זה נכשל, הוא הכי אידיוטי: mkdir / rmdir לא עובדים. התסריט מורץ על ידי udev תחת משתמש root. המשתמש הזה, מה-cli (טוב ssh לא להתקטנן) מסוגל ליצור או למחוק את הנתיב הזה. ניסיתי סתם בשביל הספורט לעשות mount אל /tmp/. כל זה נכשל. מה אני מפספס פה..??! |
Anonymous : | ||||||
יש לך שני סוגי גרשיים - זה באמת או שזה טעות בהעתקה ? |