28 lines
457 B
Bash
28 lines
457 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# sldm - Super Lightweight Device Mounter
|
||
|
|
||
|
#TODO: FIXME and make me nicer
|
||
|
|
||
|
|
||
|
devices=(/dev/sd??)
|
||
|
dontwant=sda
|
||
|
tomount=/media
|
||
|
for device in ${devices[@]}; do
|
||
|
|
||
|
last=$(echo $device | awk -F/ '{print $NF}')
|
||
|
|
||
|
if [ "${device#*$dontwant}" == "$device" ]; then
|
||
|
echo $device
|
||
|
mount | grep $device > /dev/null
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo "yop"
|
||
|
pa=$tomount/$last
|
||
|
mkdir -p $pa > /dev/null
|
||
|
|
||
|
mount $device $pa
|
||
|
fi;
|
||
|
echo $device
|
||
|
fi;
|
||
|
done;
|