initial commit
This commit is contained in:
commit
b4501dd6ea
2 changed files with 16 additions and 0 deletions
15
mountUSB.sh
Normal file
15
mountUSB.sh
Normal 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
udev.rule
Normal file
1
udev.rule
Normal file
|
@ -0,0 +1 @@
|
|||
ACTION=="add", SUBSYSTEMS=="usb", KERNEL=="sd*", RUN+="/root/mountUSB.sh %k"
|
Loading…
Reference in a new issue