void
finish_install_cleanup () 
{
    g_debug ("finish install cleanup\n");
    static gboolean cleaned = FALSE;
    if (cleaned) {
        g_warning ("finish install cleanup:already cleaned\n");
        return;
    }
    cleaned = TRUE;

    extern const gchar *target;
    if (target == NULL) {
        g_warning ("finish install:target is NULL\n");
    } 
    extern gboolean in_chroot;
    extern int chroot_fd;

    if (in_chroot) {
        fix_networkmanager ();
        remove_packages ();
        if (fchdir (chroot_fd) < 0) {
            g_warning ("finish install:reset to chroot fd dir failed\n");
        } else {
            int i = 0;
            for (i = 0; i < 1024; i++) {
                chdir ("..");
            }
            chroot (".");
        }
        in_chroot = FALSE;
    }
    unmount_target ();
    ped_device_free_all ();
}
Exemple #2
0
void clear_mounts(controller *c){
	unmount_target();
	while(c){
		device *d;

		for(d = c->blockdevs ; d ; d = d->next){
			device *p;

			// Don't free mnttype. There's still a filesystem.
			free_stringlist(&d->mnt);
			free_stringlist(&d->mntops);
			for(p = d->parts ; p ; p = p->next){
				free_stringlist(&p->mnt);
				free_stringlist(&p->mntops);
			}
		}
		c = c->next;
	}
}
Exemple #3
0
int unmount(device *d,const char *path){
	unsigned z;

	if(d->mnt.count == 0){
		diag("%s is not mounted\n",d->name);
		return -1;
	}
	for(z = 0 ; z < d->mnt.count ; ++z){
		if(path && strcmp(d->mnt.list[z],path) == 0){
			continue;
		}
		diag("Unmounting %s from %s\n",d->name,d->mnt.list[z]);
		if(strcmp(d->mnt.list[z],growlight_target) == 0){
			unmount_target();
		}
		if(umount2(d->mnt.list[z],UMOUNT_NOFOLLOW)){
			diag("Error unmounting %s at %s (%s?)\n",
					d->name,d->mnt.list[z],strerror(errno));
			return -1;
		}
	}
	return 0;
}