Browse Source

initial commit

master
bytewerk 4 years ago
commit
b4501dd6ea
2 changed files with 16 additions and 0 deletions
  1. +15
    -0
      mountUSB.sh
  2. +1
    -0
      udev.rule

+ 15
- 0
mountUSB.sh View File

@@ -0,0 +1,15 @@
#!/bin/sh
device=$1

if [ ${#device} -gt "3" ]; then
label=$(blkid "/dev/$device" -s LABEL -o value)
if [ ${#label} -gt "0" ]; then
mountName="$label"
else
mountName="$device"
fi
fi

mkdir -p "/media/$mountName"
mount -o ro "/dev/disk/by-uuid/$(blkid "/dev/$device" -s UUID -o value)" "/media/$mountName"
echo "Mounted $(blkid "/dev/$device" -s UUID -o value) to $mountName inside media"

+ 1
- 0
udev.rule View File

@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="sd*", RUN+="/root/mountUSB.sh %k"

Loading…
Cancel
Save