2012-03-19 14:22:51 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#args:
|
|
|
|
# 1) device path
|
|
|
|
# 2) mountpoint name
|
|
|
|
|
|
|
|
#check if path exists
|
|
|
|
if [ ! -e $1 ]; then
|
|
|
|
exit 1; #no such path
|
|
|
|
fi
|
|
|
|
|
2013-02-12 01:06:32 +01:00
|
|
|
if type kdialog &> /dev/null; then
|
|
|
|
PROMPT="kdialog --title Qubes --password"
|
|
|
|
else
|
|
|
|
PROMPT="zenity --entry --title Qubes --hide-text --text"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2012-03-19 14:22:51 +01:00
|
|
|
#check if luks-encrypted
|
|
|
|
if sudo cryptsetup isLuks $1 ; then
|
|
|
|
# Is a luks device
|
2013-02-12 01:06:32 +01:00
|
|
|
if ! $PROMPT "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then
|
2014-02-23 00:44:08 +01:00
|
|
|
exit 1
|
2012-03-19 14:22:51 +01:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
#not luks!
|
|
|
|
if ! sudo pmount $1 $2 ; then
|
2014-02-23 00:44:08 +01:00
|
|
|
exit 1
|
2012-03-19 14:22:51 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#all ok :)
|
2014-02-23 00:44:08 +01:00
|
|
|
exit 0
|
2012-03-19 14:22:51 +01:00
|
|
|
|