Support for LUKS devices in backup/restore ( ticket #487)
This commit is contained in:
parent
5fe54c066b
commit
7cf25ccffd
@ -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))
|
||||
|
27
qubesmanager/mount_for_backup.sh
Executable file
27
qubesmanager/mount_for_backup.sh
Executable file
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user