aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kahle <tomka@gentoo.org>2012-03-22 16:32:25 +0100
committerThomas Kahle <tomka@gentoo.org>2012-03-22 16:32:25 +0100
commitde906a60dc3db1c0d50a338fc562ad50caea3dc4 (patch)
tree90babc73573242ddcb1e7b30999e36694a13b9ab /scripts
parentFix -r option without -b (diff)
downloadtatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.tar.gz
tatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.tar.bz2
tatt-de906a60dc3db1c0d50a338fc562ad50caea3dc4.zip
Implement the safedir option
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/tatt11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/tatt b/scripts/tatt
index d8206c2..cecd7c7 100755
--- a/scripts/tatt
+++ b/scripts/tatt
@@ -92,11 +92,20 @@ try:
int(options.bugnum)
except ValueError:
print ("The bugnumber you gave with -b should be an integer.")
- exit(1);
+ exit(1)
except TypeError:
# This occurs if bugnum is None, that is, -b was not given
pass
+## If safedir is set, check for the current directory
+if config['safedir'] != "":
+ if os.getcwd().find(config['safedir']) == -1:
+ # Safedir not found
+ print ("Your safedir variable is set to '" + config['safedir'] + "',")
+ print ("but you are in " + os.getcwd())
+ print ("Exiting.")
+ exit (1)
+
## Checking for root, tatt should be run as a user, I guess.
## Remove on occasion.
if (Popen(['whoami'], stdout=PIPE).communicate()[0].rstrip() == 'root'):