Error out if a pre-existing ecryptfs setup is found, allow for a
--force override.
--
:-Dustin
Dustin Kirkland
Ubuntu Server Developer
Canonical, LTD
[EMAIL PROTECTED]
GPG: 1024D/83A61194
diff -upr ecryptfs-utils-53/src/utils/ecryptfs-setup-private ecryptfs-utils-53.new/src/utils/ecryptfs-setup-private
--- ecryptfs-utils-53/src/utils/ecryptfs-setup-private 2008-07-23 15:00:12.000000000 -0500
+++ ecryptfs-utils-53.new/src/utils/ecryptfs-setup-private 2008-08-15 13:45:30.259089175 -0500
@@ -20,6 +20,7 @@ usage() {
echo " --loginpass System passphrase for USER, used to wrap MOUNTPASS"
echo " --mountpass Passphrase for mounting the ecryptfs directory,"
echo " defaults to a randomly generated 16 bytes"
+ echo " --force Force overwriting of an existing setup"
echo
echo " Be sure to properly escape your parameters according to your"
echo " shell's special character nuances, and also surround the"
@@ -66,6 +67,10 @@ while [ ! -z "$1" ]; do
MOUNTPASS="$2"
shift 2
;;
+ --force)
+ FORCE=1
+ shift 1
+ ;;
*)
usage
;;
@@ -99,6 +104,14 @@ if [ ! -d "$HOME" ]; then
error "User home directory [$HOME] does not exist"
fi
+# Check for previously setup private directory
+if [ -s "$HOME/.ecryptfs/wrapped-passphrase" -a "$FORCE" != "1" ]; then
+ error "wrapped-passphrase file already exists, use --force to overwrite."
+fi
+if [ -s "$HOME/.ecryptfs/$PRIVATE_DIR.sig" -a "$FORCE" != "1" ]; then
+ error "$PRIVATE_DIR.sig file already exists, use --force to overwrite."
+fi
+
# Check for active mounts
MOUNTPOINT="$HOME/$PRIVATE_DIR"
CRYPTDIR="$HOME/.$PRIVATE_DIR"
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
eCryptfs-devel mailing list
eCryptfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecryptfs-devel