[PC-BSD Commits] r7257 - pcbsd-projects/txt-sysinstall

svn at pcbsd.org svn at pcbsd.org
Fri Jul 23 00:04:55 PDT 2010


Author: johnh
Date: 2010-07-23 00:04:54 -0700 (Fri, 23 Jul 2010)
New Revision: 7257

Modified:
   pcbsd-projects/txt-sysinstall/TODO
   pcbsd-projects/txt-sysinstall/components.c
   pcbsd-projects/txt-sysinstall/disksel.c
   pcbsd-projects/txt-sysinstall/ftp.c
   pcbsd-projects/txt-sysinstall/label.c
   pcbsd-projects/txt-sysinstall/main.c
   pcbsd-projects/txt-sysinstall/mainmenu.c
   pcbsd-projects/txt-sysinstall/medium.c
   pcbsd-projects/txt-sysinstall/netif.c
   pcbsd-projects/txt-sysinstall/packages.c
   pcbsd-projects/txt-sysinstall/partsel.c
   pcbsd-projects/txt-sysinstall/rootpass.c
   pcbsd-projects/txt-sysinstall/txt-sysinstall.h
   pcbsd-projects/txt-sysinstall/tzone.c
   pcbsd-projects/txt-sysinstall/useradd.c
   pcbsd-projects/txt-sysinstall/util.c
Log:
Initial support for different filesystem types and partitioning.


Modified: pcbsd-projects/txt-sysinstall/TODO
===================================================================
--- pcbsd-projects/txt-sysinstall/TODO	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/TODO	2010-07-23 07:04:54 UTC (rev 7257)
@@ -1,7 +1,5 @@
 * test install dvd
 * test install pc-bsd
-* support other packageTypes
-* add support for selecting components
 * add support for labeling the disk
 * support upgrade mode
 * add a inputbox to let the user type an URL when installing via FTP

Modified: pcbsd-projects/txt-sysinstall/components.c
===================================================================
--- pcbsd-projects/txt-sysinstall/components.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/components.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -76,8 +76,8 @@
 	return (DITEM_FAILURE);
 }
 
-void
-dialog_components(void)
+int
+dialog_components(void *args)
 {
 	char *token;
 	char *buf;
@@ -159,4 +159,5 @@
 
 	save_config();
 	do_install();
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/disksel.c
===================================================================
--- pcbsd-projects/txt-sysinstall/disksel.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/disksel.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -36,17 +36,36 @@
 #define MODULE "Disk Selection"
 #define MAXDISKS 12
 
+
+static void
+free_partsel(void *args)
+{
+	struct partsel *p = (struct partsel *)args;
+	if (p != NULL) {
+		free(p->disk);
+		free(p->diskname);
+		free(p);
+	}
+}
+
 static int
 disk_fire(dialogMenuItem *self)
 {
+	struct partsel *p;
 	appendconfig("disk0", self->prompt);
-	dialog_partsel(self->prompt, self->title);
 
+	p = safe_malloc(sizeof(*p));
+	if (self->prompt)
+		p->disk = safe_strdup(self->prompt);
+	if (self->title)
+		p->diskname = safe_strdup(self->title);
+
+	set_next_dialog(&dialog_partsel, p, &free_partsel);
 	return (0);
 }
 
-void
-dialog_disksel(void)
+int
+dialog_disksel(void *args)
 {
 	char *buf;
 	char *token;
@@ -91,4 +110,6 @@
 
 	free(menus);
 	free(buf);
+
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/ftp.c
===================================================================
--- pcbsd-projects/txt-sysinstall/ftp.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/ftp.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -73,8 +73,8 @@
 	return (0);
 }
 
-void
-dialog_ftp(void)
+int
+dialog_ftp(void *args)
 {
 	char *buf;
 	char *token;
@@ -110,4 +110,5 @@
 
 	free(menus);
 	free(buf);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/label.c
===================================================================
--- pcbsd-projects/txt-sysinstall/label.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/label.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -36,8 +36,8 @@
 #define MODULE "Disk label setup"
 #define MAXLABELS 64
 
-void
-dialog_label(int freemb)
+int
+dialog_label(void *args)
 {
 	int i;
 	char *buf;
@@ -64,8 +64,8 @@
 		appendconfig("disk0-part", "UFS+S 0 /usr");
 		appendconfig("commitDiskLabel", NULL);
 
-		dialog_useradd();
-		return;
+		dialog_useradd(NULL);
+		return (0);
 	}
 
 	menus = safe_malloc(sizeof(*menus)*MAXLABELS+2);
@@ -85,5 +85,6 @@
 	    menus+2, "", NULL, NULL);
 	free(menus);
 
-	dialog_useradd();
+	set_next_dialog(&dialog_useradd, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/main.c
===================================================================
--- pcbsd-projects/txt-sysinstall/main.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/main.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -56,10 +56,12 @@
 		}
 	}
 
+	setenv("DIALOGRC", style, 1);
 	sysinstall_init();
+	init_dialog();
 
-	setenv("DIALOGRC", style, 1);
-	init_dialog();
 	sysinstall();
+
 	end_dialog();
+	sysinstall_fini();
 }

Modified: pcbsd-projects/txt-sysinstall/mainmenu.c
===================================================================
--- pcbsd-projects/txt-sysinstall/mainmenu.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/mainmenu.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -38,24 +38,26 @@
 #define MODULE "Main Menu"
 #define	MAXLABELS 8
 
+
 static int
 next_fire(dialogMenuItem *self)
 {
-	dialog_disksel();
+	set_next_dialog(&dialog_disksel, NULL, NULL);
 	return (0);
 }
 
 static int
 exit_fire(dialogMenuItem *self)
 {
-	exit(0);
+	//set_next_dialog();
+	return (0);
 }
 
 static int
 install_fire(dialogMenuItem *self)
 {
 	appendconfig("installMode", "fresh");
-	dialog_disksel();
+	set_next_dialog(&dialog_disksel, NULL, NULL);
 
 	return (0);
 }
@@ -63,9 +65,8 @@
 static int
 upgrade_fire(dialogMenuItem *self)
 {
-
 	appendconfig("installMode", "upgrade");
-	dialog_disksel();
+	set_next_dialog(&dialog_disksel, NULL, NULL);
 
 	return (0);
 }
@@ -73,16 +74,13 @@
 static int
 netif_fire(dialogMenuItem *self)
 {
-
-	dialog_netif();
-
+	set_next_dialog(&dialog_netif, NULL, NULL);
 	return (0);
 }
 
 static int
 shell_fire(dialogMenuItem *self)
 {
-
 	end_dialog();
 	if (fork() == 0) {
 		execl("/bin/tcsh", "tcsh", NULL);
@@ -94,13 +92,12 @@
 	return (0);
 }
 
-void
-sysinstall(void)
+int
+dialog_sysinstall(void *args)
 {
 	int i;
+	int res;
 	dialogMenuItem *menus;
-	dialog_clear();
-	end_dialog();
 
 	i = 0;
 	menus = safe_malloc(sizeof(*menus)*MAXLABELS+2);
@@ -111,15 +108,25 @@
 	DMENUF(&menus[i++], "Configure Network", "Setup network interfaces", netif_fire);
 	DMENUF(&menus[i++], "Shell", "Run tcsh", shell_fire);
 
-	for (;;) {
-		screen_clear(MODULE);
-		if (dialog_menu("Welcome to PC-BSD install",
-		    "Welcome to the PC-BSD installer.\nPlease select your "
-		    "choice from the menu below.",
-		    12, 60, 4, -4, menus+2, "", 
-		    NULL, NULL))
-			return;
-	}	
+	screen_clear(MODULE);
+	res = dialog_menu("Welcome to "OSNAME" install",
+	    "Welcome to the "OSNAME" installer.\nPlease select your "
+	    "choice from the menu below.",
+	    12, 60, 4, -4, menus+2, "", 
+	    NULL, NULL);
 
 	free(menus);
+	return (res);
 }
+
+void
+sysinstall(void)
+{
+	struct dialog_state *ds;
+
+	for (;;) {
+		if ((ds = get_next_dialog()) != NULL)
+			if (ds->dialog(ds->args))
+				break;
+	}
+}

Modified: pcbsd-projects/txt-sysinstall/medium.c
===================================================================
--- pcbsd-projects/txt-sysinstall/medium.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/medium.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -44,7 +44,7 @@
 	appendconfig("installMedium", self->data);
 
 	if (!strcmp(self->data, "ftp")) {
-		dialog_ftp();
+		dialog_ftp(NULL);
 /*
 		screen_clear(MODULE);
 		dialog_inputbox("FTP/HTTP mirror", "Please type the "
@@ -58,8 +58,8 @@
 }
 
 
-void
-dialog_medium(void)
+int
+dialog_medium(void *args)
 {
 	dialogMenuItem menus[6];
 	int i;
@@ -82,5 +82,6 @@
 	dialog_menu(MODULE, "Please select the install medium:",
 	    7+i-2, 70, i-2, -i+2, menus+2, "", NULL, NULL);
 
-	dialog_components();
+	set_next_dialog(&PKGFUNC, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/netif.c
===================================================================
--- pcbsd-projects/txt-sysinstall/netif.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/netif.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -80,8 +80,8 @@
 	return 0;
 }
 
-void
-dialog_netif(void)
+int
+dialog_netif(void *args)
 {
 	char *token;
 	char *buf;
@@ -112,4 +112,6 @@
 	    7+i, 70, i, -i, menus, NULL, NULL, NULL);
 	free(buf);
 	free(menus);
+
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/packages.c
===================================================================
--- pcbsd-projects/txt-sysinstall/packages.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/packages.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -339,8 +339,8 @@
 	free(pkgstr);
 }
 
-void
-dialog_packages(void)
+int
+dialog_packages(void *args)
 {
 	char *buf;
 
@@ -361,4 +361,7 @@
 	hdestroy();
 
 	free(buf);
+	save_config();
+	do_install();
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/partsel.c
===================================================================
--- pcbsd-projects/txt-sysinstall/partsel.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/partsel.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -34,25 +34,125 @@
 
 #include "txt-sysinstall.h"
 
-#define MODULE "Partition Manager"
-#define MAXPARTS 64
+#define MODULE		"Partition Manager"
+#define MAXPARTS	64
+#define	MAXTYPES	10	
 
+#define	FS_UFS					0x00000001
+#define	FS_ZFS					0x00000002
+#define	FS_SWAP					0x00000003
+#define	FS_MIRROR				0x00000004
+
+#define	FS_FLAGS_GJOURNAL		0x00010000
+#define	FS_FLAGS_SOFTUPDATES	0x00020000	
+#define	FS_FLAGS_ENCRYPT		0x00040000
+#define	FS_FLAGS_MIRROR			0x00080000
+
+#define	ZFS_POOL_BASIC			0x00010000
+#define	ZFS_POOL_MIRROR			0x00020000
+#define	ZFS_POOL_RAIDZ			0x00040000	
+
+#define	MIRROR_LOAD				0x00100000
+#define	MIRROR_PREFER			0x00200000
+#define	MIRROR_ROUNDROBIN		0x00400000
+#define	MIRROR_SPLIT			0x00800000
+
+#define	GET_FS_TYPE(type) 		(type & 0xffff0000)
+#define	GET_FS_FLAGS(type)		(type & 0x0000ffff)
+
 enum {
 	USEALL  = 1,
 	USENEW  = 2
 };
 
 static int
+ufs_fire(dialogMenuItem *self)
+{
+	long flags;
+
+	flags = GET_FS_FLAGS(self->aux);
+
+	return (0);
+}
+
+static int
+zfs_fire(dialogMenuItem *self)
+{
+	long flags;
+
+	flags = GET_FS_FLAGS(self->aux);
+
+	return (0);
+}
+
+static int
+swap_fire(dialogMenuItem *self)
+{
+	long flags;
+
+	flags = GET_FS_FLAGS(self->aux);
+
+	return (0);
+}
+
+static int
+mirror_fire(dialogMenuItem *self)
+{
+	long flags;
+
+	flags = GET_FS_FLAGS(self->aux);
+
+	return (0);
+}
+
+static void
+dialog_partition(char *prompt)
+{
+	int i;
+	char *disk;
+	dialogMenuItem *menus;
+
+	disk = safe_strdup(prompt);
+
+	i = 0;
+	menus = safe_malloc(sizeof(*menus)*MAXTYPES+2);
+	DMENUF(&menus[i++], "Next", NULL, NULL);
+	DMENUF(&menus[i++], "Back", NULL, NULL);
+
+	DMENUFA(&menus[i++], "UFS", "UFS filesystem",
+		ufs_fire, FS_UFS);
+	DMENUFA(&menus[i++], "UFS+S", "UFS + soft updates",
+		ufs_fire, FS_UFS | FS_FLAGS_SOFTUPDATES);
+	DMENUFA(&menus[i++], "UFS+J", "UFS + gjournal",
+		ufs_fire, FS_UFS | FS_FLAGS_GJOURNAL);
+	DMENUFA(&menus[i++], "ZFS", "zeta filesystem",
+		zfs_fire, FS_ZFS);
+	DMENUFA(&menus[i++], "SWAP", "swap partition" ,
+		swap_fire, FS_SWAP);
+	DMENUFA(&menus[i++], "MIRROR", "gmirror a parition",
+		mirror_fire, FS_MIRROR);
+
+	screen_clear(MODULE);
+	dialog_menu(MODULE, "Please select a filesystem:",
+		17, 60, 10, -i+2, menus+2, "", NULL, NULL);
+	
+	free(disk);
+	free(menus);
+}
+
+static int
 part_fire(dialogMenuItem *self)
 {
-
 	switch (self->aux) {
 	case USEALL:
 		appendconfig("partition", "all");
+		dialog_partition(self->prompt);
 		break;
+
 	case USENEW:
 		appendconfig("partition", "free");
 		break;
+
 	default:
 		appendconfig("partition", self->prompt);
 	}
@@ -60,28 +160,32 @@
 	return (0);
 }
 
-void
-dialog_partsel(const char *disk, const char *diskname)
+int
+dialog_partsel(void *args)
 {
 	char *buf;
 	char *token;
 	dialogMenuItem *menus;
 	int i;
 	char strfreemb[6];
-	int freemb;
 	int status;
 	char *format;
 	char prompt[1024];
 	int bootloader;
+	struct partsel *p;
 
+
 	screen_clear(MODULE);
 	dialog_busy(5, 60, "Reading partition list...");
 
+	format = NULL;
+	p = (struct partsel *)args;
+
 	buf = safe_malloc(BUFSZ+1);
-	status = run_pcsysinstall(buf, BUFSZ, "disk-part", disk);
+	status = run_pcsysinstall(buf, BUFSZ, "disk-part", p->disk);
 	if (!strncmp(buf, "Error", 5)) {
 		free(buf);
-		return;
+		return (-1);
 	}
 
 	menus = safe_malloc(sizeof(*menus)*MAXPARTS+4);
@@ -112,9 +216,9 @@
 		}
 	}
 	
-	DMENU(&menus[i++], __DECONST(char *, disk), "Use entire disk",
+	DMENU(&menus[i++], __DECONST(char *, p->disk), "Use entire disk",
 		NULL, NULL, part_fire, NULL, USEALL);
-	DMENU(&menus[i++], __DECONST(char *, disk),
+	DMENU(&menus[i++], __DECONST(char *, p->disk),
 		"Create a new partition using free space",
 		NULL, NULL, part_fire, NULL, USENEW);
 
@@ -122,7 +226,7 @@
 	snprintf(prompt, sizeof(prompt), "The disk %s <%s>\n"
 	    "is formatted using %s and has %s free\n\n"
 	    "Please select the partition you want to use for the installation:",
-	    disk, diskname, format, strfreemb);
+	    p->disk, p->diskname, format, strfreemb);
 	dialog_menu(MODULE, prompt,
 	    10+i-2, 70, i-2, -i+2, menus+2, "", NULL, NULL);
 	free(menus);
@@ -137,5 +241,6 @@
 		appendconfig("bootManager", "none");
 	appendconfig("commitDiskPart", NULL);
 
-	dialog_label(freemb);
+	set_next_dialog(&dialog_label, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/rootpass.c
===================================================================
--- pcbsd-projects/txt-sysinstall/rootpass.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/rootpass.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -37,8 +37,8 @@
 #define MODULE	"Root password"
 
 
-void
-dialog_rootpass(void)
+int
+dialog_rootpass(void *args)
 {
 	int loop;
 	char rootPass1[64];
@@ -68,5 +68,6 @@
 
 	appendconfig("rootPass", rootPass2);
 
-	dialog_tzone();
+	set_next_dialog(&dialog_tzone, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/txt-sysinstall.h
===================================================================
--- pcbsd-projects/txt-sysinstall/txt-sysinstall.h	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/txt-sysinstall.h	2010-07-23 07:04:54 UTC (rev 7257)
@@ -24,10 +24,15 @@
  * SUCH DAMAGE. 
  */
 
+#include <sys/types.h>
+#include <sys/queue.h>
+
 #ifdef	__PCBSD__
 #define	OSNAME	"PC-BSD"
+#define	PKGFUNC	dialog_components
 #else
 #define	OSNAME	"FreeBSD"
+#define	PKGFUNC	dialog_packages
 #endif
 
 #define SCRIPTS_PATH	"/usr/sbin/"
@@ -52,26 +57,42 @@
 #define	DMENUF(m, p, t, f) \
 	DMENU(m, p, t, NULL, NULL, f, NULL, 0)
 
+#define	DMENUFA(m, p, t, f, a) \
+	DMENU(m, p, t, NULL, NULL, f, NULL, a)
+
 #define	DMENUFC(m, p, t, f, c) \
 	DMENU(m, p, t, c, NULL, f, NULL, 0)
 
 #define	DMENUFD(m, p, t, f, d) \
 	DMENU(m, p, t, NULL, NULL, f, d, 0)
 
+struct dialog_state {
+	int (*dialog)(void *);
+	void *args;
+	void (*free_args)(void *);
+	STAILQ_ENTRY(dialog_state) entries;
+};
+
+struct partsel {
+	char *disk;
+	char *diskname;
+};
+
 /* dialogs */
 void		sysinstall(void);
-void		dialog_disksel(void);
-void		dialog_useradd(void);
-void		dialog_netif(void);
-void		dialog_rootpass(void);
-void		dialog_partsel(const char *, const char *);
-void		dialog_tzone(void);
+int			dialog_sysinstall(void *);
+int			dialog_disksel(void *);
+int			dialog_useradd(void *);
+int			dialog_netif(void *);
+int			dialog_rootpass(void *);
+int			dialog_partsel(void *);
+int			dialog_tzone(void *);
+int			dialog_components(void *);
+int			dialog_medium(void *);
+int			dialog_label(void *);
+int			dialog_ftp(void *);
+int			dialog_packages(void *);
 void		dialog_busy(int, int, const char *);
-void		dialog_components(void);
-void		dialog_medium(void);
-void		dialog_label(int);
-void		dialog_ftp(void);
-void		dialog_packages(void);
 void		do_install(void);
 
 /* utility functions */
@@ -85,3 +106,7 @@
 int			run_pcsysinstall(char *, size_t, const char *, const char *);
 void		appendconfig(const char *, const char *);
 void		save_config(void);
+
+struct dialog_state *get_next_dialog(void);
+struct dialog_state *get_prev_dialog(void);
+void set_next_dialog(int (*)(void *), void *, void (*)(void *));

Modified: pcbsd-projects/txt-sysinstall/tzone.c
===================================================================
--- pcbsd-projects/txt-sysinstall/tzone.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/tzone.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -53,8 +53,8 @@
 	return (0);
 }
 
-void
-dialog_tzone(void)
+int
+dialog_tzone(void *args)
 {
 	char *token;
 	char *buf;
@@ -89,5 +89,6 @@
 		appendconfig("enableNTP", "yes");
 	}
 
-	dialog_medium();
+	set_next_dialog(&dialog_medium, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/useradd.c
===================================================================
--- pcbsd-projects/txt-sysinstall/useradd.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/useradd.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -45,8 +45,8 @@
 	return (0);
 }
 
-void
-dialog_useradd(void)
+int
+dialog_useradd(void *args)
 {
 	unsigned char username[64], realname[64];
 	unsigned char password1[64];
@@ -112,5 +112,6 @@
 		}
 	}
 
-	dialog_rootpass();
+	set_next_dialog(&dialog_rootpass, NULL, NULL);
+	return (0);
 }

Modified: pcbsd-projects/txt-sysinstall/util.c
===================================================================
--- pcbsd-projects/txt-sysinstall/util.c	2010-07-22 19:28:47 UTC (rev 7256)
+++ pcbsd-projects/txt-sysinstall/util.c	2010-07-23 07:04:54 UTC (rev 7257)
@@ -48,7 +48,45 @@
 };
 STAILQ_HEAD(confighead, config) configlist;
 
+STAILQ_HEAD(dialog_state_head, dialog_state) dialog_state_list;
+
+
+struct dialog_state *
+get_next_dialog(void)
+{
+	return (STAILQ_FIRST(&dialog_state_list));
+}
+
+struct dialog_state *
+get_prev_dialog(void)
+{
+	struct dialog_state *first;
+	struct dialog_state *prev;
+
+	prev = NULL;
+	first = STAILQ_FIRST(&dialog_state_list);
+	if (first) {
+		prev = STAILQ_NEXT(first, entries);
+	}
+
+	return (prev);
+}
+
 void
+set_next_dialog(int (*next)(void *), void *args, void (*free_args)(void *))
+{
+	struct dialog_state *ds;
+
+	ds = safe_malloc(sizeof(*ds));
+	ds->dialog = next;
+	ds->args = args;
+	ds->free_args = free_args;
+
+	STAILQ_INSERT_HEAD(&dialog_state_list, ds, entries);
+}
+
+
+void
 screen_clear(const char *module)
 {
 	dialog_clear();
@@ -173,19 +211,30 @@
 sysinstall_init(void)
 {
 	STAILQ_INIT(&configlist);
+	STAILQ_INIT(&dialog_state_list);
+
+	set_next_dialog(&dialog_sysinstall, NULL, NULL);
 }
 
 void
 sysinstall_fini(void)
 {
-	struct config *c, *temp;
+	struct config *c, *c_temp;
+	struct dialog_state *ds, *ds_temp;
 
-	STAILQ_FOREACH_SAFE(c, &configlist, entries, temp) {
+	STAILQ_FOREACH_SAFE(c, &configlist, entries, c_temp) {
 		STAILQ_REMOVE(&configlist, c, config, entries);
 		free(c->key);
 		free(c->value);
 		free(c);
 	}
+
+	STAILQ_FOREACH_SAFE(ds, &dialog_state_list, entries, ds_temp) {
+		STAILQ_REMOVE(&dialog_state_list, ds, dialog_state, entries);
+		if (ds->free_args != NULL)
+			ds->free_args(ds->args);
+		free(ds);
+	}
 }
 
 void



More information about the Commits mailing list