diff --git a/qubesmanager/backup_utils.py b/qubesmanager/backup_utils.py index d7ab726..4cec39c 100644 --- a/qubesmanager/backup_utils.py +++ b/qubesmanager/backup_utils.py @@ -35,6 +35,7 @@ from thread_monitor import * from datetime import datetime from string import replace +mount_for_backup_path = '/usr/libexec/qubes-manager/mount_for_backup.sh' def check_if_mounted(dev_path): mounts_file = open("/proc/mounts") @@ -47,7 +48,7 @@ def check_if_mounted(dev_path): def mount_device(dev_path): try: mount_dir_name = "backup" + replace(str(datetime.now()),' ', '-').split(".")[0] - pmount_cmd = ["pmount", dev_path, mount_dir_name] + pmount_cmd = [mount_for_backup_path, dev_path, mount_dir_name] res = subprocess.check_call(pmount_cmd) except Exception as ex: QMessageBox.warning (None, "Error mounting selected device!", "ERROR: {0}".format(ex)) diff --git a/qubesmanager/mount_for_backup.sh b/qubesmanager/mount_for_backup.sh new file mode 100755 index 0000000..6c7ae2f --- /dev/null +++ b/qubesmanager/mount_for_backup.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +#args: +# 1) device path +# 2) mountpoint name + +#check if path exists +if [ ! -e $1 ]; then + exit 1; #no such path +fi + +#check if luks-encrypted +if sudo cryptsetup isLuks $1 ; then + # Is a luks device + if ! kdialog --password "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then + exit 1; + fi +else + #not luks! + if ! sudo pmount $1 $2 ; then + exit 1; + fi +fi + +#all ok :) +exit 0; + diff --git a/rpm_spec/qmgr.spec b/rpm_spec/qmgr.spec index 554d8eb..0942ec3 100644 --- a/rpm_spec/qmgr.spec +++ b/rpm_spec/qmgr.spec @@ -12,7 +12,7 @@ Vendor: Invisible Things Lab License: GPL URL: http://fixme Requires: python, PyQt4, qubes-core-dom0 >= 1.7.15, kdebase -Requires: pmount +Requires: pmount, cryptsetup BuildRequires: PyQt4-devel AutoReq: 0 @@ -31,6 +31,9 @@ mkdir -p $RPM_BUILD_ROOT/usr/bin/ cp qubes-manager $RPM_BUILD_ROOT/usr/bin cp qubes-appmenu-select $RPM_BUILD_ROOT/usr/bin +mkdir -p $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ +cp qubesmanager/mount_for_backup.sh $RPM_BUILD_ROOT/usr/libexec/qubes-manager/ + mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager/ cp qubesmanager/main.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager cp qubesmanager/appmenu_select.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager @@ -72,6 +75,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root,-) /usr/bin/qubes-manager /usr/bin/qubes-appmenu-select +/usr/libexec/qubes-manager/mount_for_backup.sh %{python_sitearch}/qubesmanager/__init__.py %{python_sitearch}/qubesmanager/__init__.pyo %{python_sitearch}/qubesmanager/__init__.pyc