--- deja-dup-14.2.orig/common/DuplicityInstance.vala
+++ deja-dup-14.2/common/DuplicityInstance.vala
@@ -149,6 +149,12 @@
         
         // We have to wrap all current args into one string.
         StringBuilder args = new StringBuilder();
+
+        // Set environment variables for subprocess here because sudo reserves
+        // the right to strip them.
+        foreach (string env in envp_in)
+          args.append("export %s\n".printf(env));
+
         foreach(string a in argv) {
           if (a == null)
             break;
--- deja-dup-14.2.orig/common/DuplicityInstance.c
+++ deja-dup-14.2/common/DuplicityInstance.c
@@ -220,14 +220,14 @@
 	char* user_cmd;
 	gboolean _tmp27_ = FALSE;
 	gboolean _tmp28_ = FALSE;
-	char* _tmp41_;
-	gboolean _tmp42_;
-	char* _tmp43_;
-	gboolean _tmp44_;
-	char** _tmp46_;
+	char* _tmp42_;
+	gboolean _tmp43_;
+	char* _tmp44_;
+	gboolean _tmp45_;
+	char** _tmp47_;
 	gint _real_argv_size_;
 	gint real_argv_length1;
-	gint _tmp45_;
+	gint _tmp46_;
 	char** real_argv;
 	g_return_if_fail (self != NULL);
 	_inner_error_ = NULL;
@@ -549,9 +549,9 @@
 			gint scriptfd;
 			GFile* _tmp34_;
 			GString* args;
-			GList* _tmp38_;
+			GList* _tmp39_;
+			char* _tmp41_;
 			char* _tmp40_;
-			char* _tmp39_;
 			scriptname = NULL;
 			scriptfd = (_tmp32_ = g_file_open_tmp (PACKAGE "-XXXXXX", &_tmp31_, &_inner_error_), scriptname = (_tmp33_ = _tmp31_, _g_free0 (scriptname), _tmp33_), _tmp32_);
 			if (_inner_error_ != NULL) {
@@ -562,6 +562,21 @@
 			close (scriptfd);
 			args = g_string_new ("");
 			{
+				GList* env_collection;
+				GList* env_it;
+				env_collection = envp_in;
+				for (env_it = env_collection; env_it != NULL; env_it = env_it->next) {
+					char* env;
+					env = g_strdup ((const char*) env_it->data);
+					{
+						char* _tmp35_;
+						g_string_append (args, _tmp35_ = g_strdup_printf ("export %s\n", env));
+						_g_free0 (_tmp35_);
+						_g_free0 (env);
+					}
+				}
+			}
+			{
 				GList* a_collection;
 				GList* a_it;
 				a_collection = argv;
@@ -574,15 +589,15 @@
 							break;
 						}
 						if (args->len == 0) {
-							char* _tmp35_;
-							g_string_append (args, _tmp35_ = g_shell_quote (a));
-							_g_free0 (_tmp35_);
+							char* _tmp36_;
+							g_string_append (args, _tmp36_ = g_shell_quote (a));
+							_g_free0 (_tmp36_);
 						} else {
+							char* _tmp38_;
 							char* _tmp37_;
-							char* _tmp36_;
-							g_string_append (args, _tmp37_ = g_strconcat (" ", _tmp36_ = g_shell_quote (a), NULL));
+							g_string_append (args, _tmp38_ = g_strconcat (" ", _tmp37_ = g_shell_quote (a), NULL));
+							_g_free0 (_tmp38_);
 							_g_free0 (_tmp37_);
-							_g_free0 (_tmp36_);
 						}
 						_g_free0 (a);
 					}
@@ -594,10 +609,10 @@
 				_g_string_free0 (args);
 				goto __catch27_g_error;
 			}
-			argv = (_tmp38_ = NULL, __g_list_free_g_free0 (argv), _tmp38_);
-			argv = g_list_prepend (argv, g_strdup_printf ("sh %s", _tmp40_ = g_shell_quote (_tmp39_ = g_file_get_path (self->priv->scriptfile))));
+			argv = (_tmp39_ = NULL, __g_list_free_g_free0 (argv), _tmp39_);
+			argv = g_list_prepend (argv, g_strdup_printf ("sh %s", _tmp41_ = g_shell_quote (_tmp40_ = g_file_get_path (self->priv->scriptfile))));
+			_g_free0 (_tmp41_);
 			_g_free0 (_tmp40_);
-			_g_free0 (_tmp39_);
 			argv = g_list_prepend (argv, g_strdup (g_get_application_name ()));
 			argv = g_list_prepend (argv, g_strdup ("--description"));
 			argv = g_list_prepend (argv, g_strdup ("gksu"));
@@ -611,7 +626,7 @@
 			e = _inner_error_;
 			_inner_error_ = NULL;
 			{
-				g_warning ("DuplicityInstance.vala:173: %s\n", e->message);
+				g_warning ("DuplicityInstance.vala:179: %s\n", e->message);
 				_g_error_free0 (e);
 			}
 		}
@@ -639,15 +654,15 @@
 			}
 		}
 	}
-	if ((_tmp42_ = (_tmp41_ = g_find_program_in_path ("ionice")) != NULL, _g_free0 (_tmp41_), _tmp42_)) {
+	if ((_tmp43_ = (_tmp42_ = g_find_program_in_path ("ionice")) != NULL, _g_free0 (_tmp42_), _tmp43_)) {
 		argv = g_list_prepend (argv, g_strdup ("-n7"));
 		argv = g_list_prepend (argv, g_strdup ("-c2"));
 		argv = g_list_prepend (argv, g_strdup ("ionice"));
 	}
-	if ((_tmp44_ = (_tmp43_ = g_find_program_in_path ("nice")) != NULL, _g_free0 (_tmp43_), _tmp44_)) {
+	if ((_tmp45_ = (_tmp44_ = g_find_program_in_path ("nice")) != NULL, _g_free0 (_tmp44_), _tmp45_)) {
 		argv = g_list_prepend (argv, g_strdup ("nice"));
 	}
-	real_argv = (_tmp46_ = g_new0 (char*, (_tmp45_ = g_list_length (argv)) + 1), real_argv_length1 = _tmp45_, _real_argv_size_ = real_argv_length1, _tmp46_);
+	real_argv = (_tmp47_ = g_new0 (char*, (_tmp46_ = g_list_length (argv)) + 1), real_argv_length1 = _tmp46_, _real_argv_size_ = real_argv_length1, _tmp47_);
 	i = 0;
 	{
 		GList* a_collection;
@@ -657,10 +672,10 @@
 			char* a;
 			a = g_strdup ((const char*) a_it->data);
 			{
-				char* _tmp48_;
-				char* *_tmp47_;
-				_tmp47_ = &real_argv[i++];
-				(*_tmp47_) = (_tmp48_ = g_strdup (a), _g_free0 ((*_tmp47_)), _tmp48_);
+				char* _tmp49_;
+				char* *_tmp48_;
+				_tmp48_ = &real_argv[i++];
+				(*_tmp48_) = (_tmp49_ = g_strdup (a), _g_free0 ((*_tmp48_)), _tmp49_);
 				_g_free0 (a);
 			}
 		}
@@ -690,7 +705,7 @@
 			return;
 		}
 	}
-	g_debug ("DuplicityInstance.vala:199: Running the following duplicity (%i) comma" \
+	g_debug ("DuplicityInstance.vala:205: Running the following duplicity (%i) comma" \
 "nd: %s\n", (gint) self->priv->child_pid, user_cmd);
 	self->priv->watch_id = g_child_watch_add (self->priv->child_pid, _deja_dup_duplicity_instance_spawn_finished_gchild_watch_func, self);
 	if (self->priv->pipes[1] != (-1)) {
@@ -876,7 +891,7 @@
 				data->err = data->_inner_error_;
 				data->_inner_error_ = NULL;
 				{
-					g_warning ("DuplicityInstance.vala:309: %s\n", data->err->message);
+					g_warning ("DuplicityInstance.vala:315: %s\n", data->err->message);
 					_g_error_free0 (data->err);
 					break;
 				}
@@ -903,7 +918,7 @@
 				data->e2 = data->_inner_error_;
 				data->_inner_error_ = NULL;
 				{
-					g_warning ("DuplicityInstance.vala:319: %s\n", data->e2->message);
+					g_warning ("DuplicityInstance.vala:325: %s\n", data->e2->message);
 					_g_error_free0 (data->e2);
 				}
 			}
@@ -997,7 +1012,7 @@
 			data->e = data->_inner_error_;
 			data->_inner_error_ = NULL;
 			{
-				g_warning ("DuplicityInstance.vala:338: %s\n", data->e->message);
+				g_warning ("DuplicityInstance.vala:344: %s\n", data->e->message);
 				g_signal_emit_by_name (data->self, "done", FALSE, FALSE);
 				_g_error_free0 (data->e);
 				{
@@ -1490,9 +1505,9 @@
 	if (WIFEXITED (status)) {
 		gint exitval;
 		exitval = WEXITSTATUS (status);
-		g_debug ("DuplicityInstance.vala:552: duplicity (%i) exited with value %i\n", (gint) pid, exitval);
+		g_debug ("DuplicityInstance.vala:558: duplicity (%i) exited with value %i\n", (gint) pid, exitval);
 	} else {
-		g_debug ("DuplicityInstance.vala:555: duplicity (%i) process killed\n", (gint) pid);
+		g_debug ("DuplicityInstance.vala:561: duplicity (%i) process killed\n", (gint) pid);
 	}
 	self->priv->watch_id = (guint) 0;
 	g_spawn_close_pid (pid);
@@ -1614,7 +1629,7 @@
 			g_source_remove (self->priv->watch_id);
 		}
 		if (deja_dup_duplicity_instance_is_started (self)) {
-			g_debug ("DuplicityInstance.vala:254: duplicity (%i) process killed\n", (gint) self->priv->child_pid);
+			g_debug ("DuplicityInstance.vala:260: duplicity (%i) process killed\n", (gint) self->priv->child_pid);
 			deja_dup_duplicity_instance_kill_child (self);
 		}
 		{
@@ -1632,7 +1647,7 @@
 			e = _inner_error_;
 			_inner_error_ = NULL;
 			{
-				g_warning ("DuplicityInstance.vala:262: %s\n", e->message);
+				g_warning ("DuplicityInstance.vala:268: %s\n", e->message);
 				_g_error_free0 (e);
 			}
 		}
