admin: restore current-etc symlink

It is useful now like it was before, and it is used by the grub
update script.

https://bugzilla.gnome.org/show_bug.cgi?id=690743
This commit is contained in:
Giovanni Campagna 2012-12-22 00:21:28 +01:00
parent 9598efd001
commit 6c9c7b0173

View File

@ -65,8 +65,10 @@ update_current (OtAdminDeploy *self,
{
gboolean ret = FALSE;
ot_lobj GFile *current_path = NULL;
ot_lobj GFile *current_etc_path = NULL;
ot_lobj GFile *previous_path = NULL;
ot_lobj GFile *tmp_current_path = NULL;
ot_lobj GFile *tmp_current_etc_path = NULL;
ot_lobj GFile *tmp_previous_path = NULL;
ot_lobj GFileInfo *previous_info = NULL;
ot_lfree char *relative_current = NULL;
@ -74,6 +76,7 @@ update_current (OtAdminDeploy *self,
ot_lfree char *relative_previous = NULL;
current_path = g_file_get_child (self->osname_dir, "current");
current_etc_path = g_file_get_child (self->osname_dir, "current-etc");
previous_path = g_file_get_child (self->osname_dir, "previous");
relative_current = g_file_get_relative_path (self->osname_dir, deploy_target);
@ -112,9 +115,20 @@ update_current (OtAdminDeploy *self,
goto out;
}
tmp_current_etc_path = g_file_get_child (self->osname_dir, "tmp-current-etc");
(void) gs_file_unlink (tmp_current_etc_path, NULL, NULL);
if (symlink (relative_current_etc, gs_file_get_path_cached (tmp_current_etc_path)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
if (!gs_file_rename (tmp_current_path, current_path,
cancellable, error))
goto out;
if (!gs_file_rename (tmp_current_etc_path, current_etc_path,
cancellable, error))
goto out;
if (tmp_previous_path)
{