deja-dup-team team mailing list archive
-
deja-dup-team team
-
Mailing list archive
-
Message #00468
[Merge] lp:~mterry/deja-dup/pkexec into lp:deja-dup
Michael Terry has proposed merging lp:~mterry/deja-dup/pkexec into lp:deja-dup.
Requested reviews:
Ken VanDine (ken-vandine)
For more details, see:
https://code.launchpad.net/~mterry/deja-dup/pkexec/+merge/111478
Since gksu is poorly maintained these days and the official replacement is pkexec, I figured it was time to change in deja-dup too.
Here's a branch that makes that swap.
To test, make a local backup of any old thing. Then try to restore into /tmp/restore or some such. (Deja Dup has naive 'do I need to prompt for the root password?' logic that will trigger on any non-HOME restore, so /tmp will do just fine, despite the fact that your user can write to it.)
With gksu, you should get loads of root prompts. With pkexec, you'll get just one! (Though we do suffer a bit, because now it says "do you want to allow /bin/sh" instead of "do you want to allow Deja Dup", but I'll take what I can get. This is not a common scenario, so I'm not worried about the ugliness.)
--
https://code.launchpad.net/~mterry/deja-dup/pkexec/+merge/111478
Your team Déjà Dup Developers is subscribed to branch lp:deja-dup.
=== modified file 'tests/base.py'
--- tests/base.py 2012-03-17 04:02:46 +0000
+++ tests/base.py 2012-06-21 19:11:59 +0000
@@ -154,7 +154,7 @@
def cleanup(success):
global temp_dir, cleanup_dirs, cleanup_mounts, cleanup_pids, cleanup_envs
for d in cleanup_mounts:
- os.system('gksudo "umount %s"' % d)
+ os.system('pkexec umount %s' % d)
for d in cleanup_dirs:
os.system("rm -rf %s" % d)
for p in cleanup_pids:
@@ -262,7 +262,7 @@
args = ',umask=0000'
else:
args = ''
- if os.system('gksudo "mount -t %s -o loop,sizelimit=%d%s %s %s"' % (mtype, size*1024*1024, args, path, mount_dir)):
+ if os.system('pkexec mount -t %s -o loop,sizelimit=%d%s %s %s' % (mtype, size*1024*1024, args, path, mount_dir)):
raise Exception("Couldn't mount")
cleanup_mounts += [mount_dir]
return mount_dir
=== modified file 'tools/duplicity/DuplicityInstance.vala'
--- tools/duplicity/DuplicityInstance.vala 2012-04-30 00:18:18 +0000
+++ tools/duplicity/DuplicityInstance.vala 2012-06-21 19:11:59 +0000
@@ -130,10 +130,10 @@
// Run as root if needed
if (as_root &&
- Environment.find_program_in_path("gksu") != null &&
+ Environment.find_program_in_path("pkexec") != null &&
Environment.find_program_in_path("sh") != null) {
- // gksu has a restrictive command line maximum length. To work around
- // that, we stick the duplicity command inside a temporary script.
+ // pkexec does not preserve environment variables, so we need to stuff
+ // the ones we care about in a shell script.
string scriptname;
var scriptfd = FileUtils.open_tmp(Config.PACKAGE + "-XXXXXX", out scriptname);
@@ -160,12 +160,9 @@
argv = new List<string>(); // reset
- // gksu command must be one string
- argv.prepend("sh %s".printf(Shell.quote(scriptname)));
-
- argv.prepend(Environment.get_application_name());
- argv.prepend("--description");
- argv.prepend("gksu");
+ argv.prepend(scriptname);
+ argv.prepend("sh");
+ argv.prepend("pkexec");
}
string[] real_argv = new string[argv.length()];
@@ -577,8 +574,8 @@
bool cancelled = !Process.if_exited(status);
if (Process.if_exited(status) && !processed_a_message &&
- (Process.exit_status(status) == 255 || // gksu returns 255 on cancel
- Process.exit_status(status) == 3)) // and 3 on bad password
+ (Process.exit_status(status) == 126 || // pkexec returns 126 on cancel
+ Process.exit_status(status) == 127)) // and 127 on bad password
cancelled = true;
if (Process.if_exited(status))
Follow ups