Add udev rules for controlling where keys are found in /dev

pull/46/head
Dan Puttick 2017-01-17 10:15:36 -05:00
parent b1353fa5bf
commit 5632c9096a
4 changed files with 15 additions and 10 deletions

View File

@ -0,0 +1,6 @@
# The purpose of this rules file is to ensure that the top left usb port and its partitions have a symlink to /dev/source_key[num], and the other ports to /dev/dest_key[num]
KERNELS=="1-1.2", SUBSYSTEMS=="usb", SYMLINK+="source_key%n"
KERNELS=="1-1.[3-5]*", SUBSYSTEMS=="usb", SYMLINK+="dest_key%n"
# KERNELS=="1-1.2", SUBSYSTEMS=="usb", ENV{USB} SYMLINK+="source_key%n"
# KERNELS=="1-1.[3-5]*", SUBSYSTEMS=="usb", SYMLINK+="dest_key%n"

View File

@ -4,13 +4,11 @@ ID=`/usr/bin/id -u`
# Paths used in multiple scripts
SRC="src"
DEV_SRC="/dev/sda"
DEV_SRC_ONE="/dev/sda1"
DEV_SRC="/dev/source_key"
SRC_MNT="/media/src"
DST="dst"
DEV_DST="/dev/sdb"
DEV_DST_ONE="/dev/sdb1"
DEV_DST="/dev/dest_key"
DST_MNT="/media/dst"
TEMP="${DST_MNT}/temp"

View File

@ -26,7 +26,8 @@ trap clean EXIT TERM INT
./music.sh &
echo $! > /tmp/music.pid
# List block storage devices (for debugging)
lsblk |& tee ${GROOM_LOG}
# List block storage devices for debugging
# Make sure to set tee in append (-a) mode below if you uncomment
# lsblk |& tee ${GROOM_LOG}
su ${USERNAME} -c ./mount_dest.sh |& tee -a ${GROOM_LOG}
su ${USERNAME} -c ./mount_dest.sh |& tee ${GROOM_LOG}

View File

@ -54,12 +54,12 @@ fi
# Mount the first partition of DST (/dev/sdb1)
# pmount automatically mounts on /media/ (at /media/dst in this case).
${PMOUNT} -w ${DEV_DST_ONE} ${DST}
${PMOUNT} -w /dev/dest_key1 ${DST}
if [ ${?} -ne 0 ]; then
echo "GROOMER: Unable to mount ${DEV_DST_ONE} on ${DST_MNT}"
echo "GROOMER: Unable to mount ${DEV_DST}1 on ${DST_MNT}"
exit
else
echo "GROOMER: Destination USB device (${DEV_DST_ONE}) mounted at ${DST_MNT}"
echo "GROOMER: Destination USB device (${DEV_DST}1) mounted at ${DST_MNT}"
# Remove any existing "FROM_PARTITION_" directories
rm -rf "/media/${DST}/FROM_PARTITION_"*