Skip to content

Commit

Permalink
add more options for configure scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Germar committed Oct 12, 2013
1 parent 7a1c4a5 commit 26474f8
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Back In Time

Version 1.0.28
* add more options for configure scripts; update README
* add udev shedule (run BIT as soon as the drive is connected)
* Fix bug: AttributeError with python-keyring>1.6.1 [#1234024](https://bugs.launchpad.net/backintime/+bug/1234024)
* Fix bug: TypeError: KDirModel.removeColumns() is a private method in kde4/app.py [#1232694](https://bugs.launchpad.net/backintime/+bug/1232694)
Expand Down
17 changes: 15 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,21 @@ Copyright (C) 2008-2013 Oprea Dan, Bart de Koning, Richard Bailey, Germar Reitze
sudo make install


NOTE: if want to run configure without check (gnome or kde), just run:
./configure --no-check
2.3. configure options
first value is default:
--check | --no-check (only GNOME and KDE4)
Check if Gnome respectively KDE4 is available

--fuse-group | --no-fuse-group (only COMMON)
Some distributions require user to be in group 'fuse' to use
sshfs and encfs. This toggles the check on or off.

--kdesudo | --kdesu (only KDE4)
Use either 'kdesudo' or 'kdesu' to start Backintime as root

--python | --python2 (all)
Use either 'python' or 'python2' to start Python Version 2.x


3. Integrate with filemanager

Expand Down
35 changes: 35 additions & 0 deletions common/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@ if [ -e Makefile ]; then
rm Makefile;
fi

#set default options
PYTHON="--python"
FUSE_GROUP="--fuse-group"

USR_BIN_FILES="backintime backintime-askpass"
FUSE_FILES="sshtools.py encfstools.py"

#get commandline arguments
for arg in $*; do
case $arg in
--python | --python2) PYTHON=$arg;;
--fuse-group | --no-fuse-group) FUSE_GROUP=$arg;;
esac
done

#patch python command
#use 'python' or 'python2' to start Python Version 2.x
case $PYTHON in
--python) sed -e "s/^python2\? /python /g" \
-e "s/^ssh-agent python2\? /ssh-agent python /g" \
-i $USR_BIN_FILES
;;
--python2) sed -e "s/^python2\? /python2 /g" \
-e "s/^ssh-agent python2\? /ssh-agent python2 /g" \
-i $USR_BIN_FILES
;;
esac

#patch check for 'fuse' group
#Some distributions require user to be in group 'fuse' to use sshfs and encfs
case $FUSE_GROUP in
--fuse-group) sed -e "s/CHECK_FUSE_GROUP = \(True\|False\)/CHECK_FUSE_GROUP = True/" -i $FUSE_FILES;;
--no-fuse-group) sed -e "s/CHECK_FUSE_GROUP = \(True\|False\)/CHECK_FUSE_GROUP = False/" -i $FUSE_FILES;;
esac

#check languages
mos=""
langs=""
Expand Down
18 changes: 11 additions & 7 deletions common/encfstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class EncFS_mount(mount.MountControl):
"""
Mount encrypted paths with encfs.
"""

CHECK_FUSE_GROUP = True

def __init__(self, cfg = None, profile_id = None, hash_id = None, tmp_mount = False, parent = None, symlink = True, **kwargs):
self.config = cfg
if self.config is None:
Expand Down Expand Up @@ -161,13 +164,14 @@ def check_fuse(self):
"""check if encfs is installed and user is part of group fuse"""
if not tools.check_command('encfs'):
raise mount.MountException( _('encfs not found. Please install e.g. \'apt-get install encfs\'') )
user = self.config.get_user()
try:
fuse_grp_members = grp.getgrnam('fuse')[3]
except KeyError:
fuse_grp_members = []
if not user in fuse_grp_members:
raise mount.MountException( _('%(user)s is not member of group \'fuse\'.\n Run \'sudo adduser %(user)s fuse\'. To apply changes logout and login again.\nLook at \'man backintime\' for further instructions.') % {'user': user})
if self.CHECK_FUSE_GROUP:
user = self.config.get_user()
try:
fuse_grp_members = grp.getgrnam('fuse')[3]
except KeyError:
fuse_grp_members = []
if not user in fuse_grp_members:
raise mount.MountException( _('%(user)s is not member of group \'fuse\'.\n Run \'sudo adduser %(user)s fuse\'. To apply changes logout and login again.\nLook at \'man backintime\' for further instructions.') % {'user': user})

def check_version(self):
"""check encfs version.
Expand Down
18 changes: 11 additions & 7 deletions common/sshtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class SSH(mount.MountControl):
Mount remote path with sshfs. The real take_snapshot process will use
rsync over ssh. Other commands run remote over ssh.
"""

CHECK_FUSE_GROUP = True

def __init__(self, cfg = None, profile_id = None, hash_id = None, tmp_mount = False, parent = None, symlink = True, **kwargs):
self.config = cfg
if self.config is None:
Expand Down Expand Up @@ -194,13 +197,14 @@ def check_fuse(self):
"""check if sshfs is installed and user is part of group fuse"""
if not self.pathexists('sshfs'):
raise mount.MountException( _('sshfs not found. Please install e.g. \'apt-get install sshfs\'') )
user = self.config.get_user()
try:
fuse_grp_members = grp.getgrnam('fuse')[3]
except KeyError:
fuse_grp_members = []
if not user in fuse_grp_members:
raise mount.MountException( _('%(user)s is not member of group \'fuse\'.\n Run \'sudo adduser %(user)s fuse\'. To apply changes logout and login again.\nLook at \'man backintime\' for further instructions.') % {'user': user})
if self.CHECK_FUSE_GROUP:
user = self.config.get_user()
try:
fuse_grp_members = grp.getgrnam('fuse')[3]
except KeyError:
fuse_grp_members = []
if not user in fuse_grp_members:
raise mount.MountException( _('%(user)s is not member of group \'fuse\'.\n Run \'sudo adduser %(user)s fuse\'. To apply changes logout and login again.\nLook at \'man backintime\' for further instructions.') % {'user': user})

def pathexists(self, filename):
"""Checks if 'filename' is present in the system PATH.
Expand Down
21 changes: 20 additions & 1 deletion gnome/configure
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
#!/bin/bash

#set default options
CHECK="--check"
PYTHON="--python"

USR_BIN_FILES="backintime-gnome"

#get commandline arguments
for arg in $*; do
case $arg in
--check | --no-check) CHECK=$arg
--check | --no-check) CHECK=$arg;;
--python | --python2) PYTHON=$arg;;
esac
done

#patch python command
#use 'python' or 'python2' to start Python Version 2.x
case $PYTHON in
--python) sed -e "s/^python2\? /python /g" \
-e "s/^ssh-agent python2\? /ssh-agent python /g" \
-i $USR_BIN_FILES
;;
--python2) sed -e "s/^python2\? /python2 /g" \
-e "s/^ssh-agent python2\? /ssh-agent python2 /g" \
-i $USR_BIN_FILES
;;
esac

if [ -e Makefile ]; then
rm Makefile;
fi
Expand Down
19 changes: 19 additions & 0 deletions kde4/configure
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash

#set default options
CHECK="--check"
SUDO="--kdesudo"
PYTHON="--python"

USR_BIN_FILES="backintime-kde4"

#get commandline arguments
for arg in $*; do
case $arg in
--check | --no-check) CHECK=$arg;;
--kdesu | --kdesudo) SUDO=$arg;;
--python | --python2) PYTHON=$arg;;
esac
done

Expand All @@ -24,6 +30,19 @@ case $SUDO in
--kdesu) sed -i -e "s/Exec=\(.*\)backintime-kde4/Exec=kdesu -c backintime-kde4/" backintime-kde4-root.desktop;;
esac

#patch python command
#use 'python' or 'python2' to start Python Version 2.x
case $PYTHON in
--python) sed -e "s/^python2\? /python /g" \
-e "s/^ssh-agent python2\? /ssh-agent python /g" \
-i $USR_BIN_FILES
;;
--python2) sed -e "s/^python2\? /python2 /g" \
-e "s/^ssh-agent python2\? /ssh-agent python2 /g" \
-i $USR_BIN_FILES
;;
esac

cp Makefile.template Makefile

echo "All OK. Now run:"
Expand Down

0 comments on commit 26474f8

Please sign in to comment.