47 lines
1.4 KiB
Plaintext
Executable File
47 lines
1.4 KiB
Plaintext
Executable File
# usb key funct taken from Medion live and adapted for buffalo
|
|
# modified by Mario Fetka (geos_one) <mario.fetka@gmail.com>
|
|
|
|
Exe_USB_KEY()
|
|
{
|
|
# Check model name
|
|
export MODEL_NAME="@@NASKERNELNAME@@"
|
|
|
|
# Scan USB disk for HW test.
|
|
any_usb=`ls /sys/block/ | grep sd`
|
|
echo "${any_usb}"
|
|
if [ -n "${any_usb}" ]; then
|
|
#/bin/mkdir /mnt/parnerkey
|
|
for usb in ${any_usb}
|
|
do
|
|
echo "checking ${usb}"
|
|
#Get the number of question marks
|
|
qmark_num=`fdisk -l /dev/${usb} | grep "^"/dev/${usb} | grep -c "?"`
|
|
partition_num=`fdisk -l /dev/${usb} | grep "^"/dev/${usb}`
|
|
if [ "${qmark_num}" == "4" ] || [ "${partition_num}" == "" ]; then
|
|
mnt_point=/dev/${usb}
|
|
echo "Trying to mount ${mnt_point}"
|
|
mount -o iocharset=utf8,shortname=mixed,ro ${mnt_point} /mnt/parnerkey
|
|
else
|
|
mnt_point=`fdisk -l /dev/${usb} | grep "^"/dev/${usb} | awk '{print $1}' | sed -n '1p'`
|
|
echo "Trying to mount ${mnt_point}"
|
|
mount -o iocharset=utf8,shortname=mixed,ro ${mnt_point} /mnt/parnerkey
|
|
fi
|
|
|
|
mount_SUC=`cat /proc/mounts | grep /mnt/parnerkey`
|
|
if [ "${mount_SUC}" != "" ]; then
|
|
if [ -e /mnt/parnerkey/${MODEL_NAME}_check_file ]; then
|
|
#/mnt/parnerkey/usb_key_func.sh
|
|
script_path=`cat /mnt/parnerkey/${MODEL_NAME}_check_file | sed -n '1p'`
|
|
${script_path}
|
|
if [ $? == 0 ]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
umount /mnt/parnerkey
|
|
else
|
|
echo "Fail to mount ${mnt_point}"
|
|
fi
|
|
done
|
|
#rmdir /mnt/parnerkey
|
|
fi
|
|
} |