diff options
author | jkh <jkh@FreeBSD.org> | 1999-11-08 11:51:57 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1999-11-08 11:51:57 +0000 |
commit | 4f4156cb2913971a49282a9a4d677e556c0b0cc9 (patch) | |
tree | 48cc2c69095b9a6f1d9af51c46ed3836f0d75d1d /usr.sbin/sysinstall | |
parent | 57a1b531681473ebf96e00f7b05d0e0165849abd (diff) | |
download | FreeBSD-src-4f4156cb2913971a49282a9a4d677e556c0b0cc9.zip FreeBSD-src-4f4156cb2913971a49282a9a4d677e556c0b0cc9.tar.gz |
Allow distributions to be excluded more easily in scripts.
Submitted by: Brian Dean <brdean@unx.sas.com>
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/dispatch.c | 1 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 48 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 1 |
3 files changed, 50 insertions, 0 deletions
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c index d1fdd96..3090a27 100644 --- a/usr.sbin/sysinstall/dispatch.c +++ b/usr.sbin/sysinstall/dispatch.c @@ -65,6 +65,7 @@ static struct _word { { "diskLabelCommit", diskLabelCommit }, { "distReset", distReset }, { "distSetCustom", distSetCustom }, + { "distUnsetCustom", distUnsetCustom }, { "distSetDeveloper", distSetDeveloper }, { "distSetXDeveloper", distSetXDeveloper }, { "distSetKernDeveloper", distSetKernDeveloper }, diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 9a2e489..edb8232 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -444,6 +444,29 @@ distSetByName(Distribution *dist, char *name) return status; } +static Boolean +distUnsetByName(Distribution *dist, char *name) +{ + int i, status = FALSE; + + /* Loop through current set */ + for (i = 0; dist[i].my_name; i++) { + /* This is shorthand for "dist currently disabled" */ + if (!dist[i].my_dir) + continue; + if (!strcmp(dist[i].my_name, name)) { + *(dist[i].my_mask) &= ~(dist[i].my_bit); + status = TRUE; + } + if (dist[i].my_dist) { + if (distUnsetByName(dist[i].my_dist, name)) { + status = TRUE; + } + } + } + return status; +} + /* Just for the dispatch stuff */ int distSetCustom(dialogMenuItem *self) @@ -470,6 +493,31 @@ distSetCustom(dialogMenuItem *self) return DITEM_SUCCESS; } +/* Just for the dispatch stuff */ +int +distUnsetCustom(dialogMenuItem *self) +{ + char *cp, *cp2, *tmp; + + if (!(tmp = variable_get(VAR_DISTS))) { + msgDebug("distUnsetCustom() called without %s variable set.\n", VAR_DISTS); + return DITEM_FAILURE; + } + + cp = alloca(strlen(tmp) + 1); + if (!cp) + msgFatal("Couldn't alloca() %d bytes!\n", strlen(tmp) + 1); + strcpy(cp, tmp); + while (cp) { + if ((cp2 = index(cp, ' ')) != NULL) + *(cp2++) = '\0'; + if (!distUnsetByName(DistTable, cp)) + msgDebug("distUnsetCustom: Warning, no such release \"%s\"\n", cp); + cp = cp2; + } + return DITEM_SUCCESS; +} + int distSetSrc(dialogMenuItem *self) { diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 55b2548..13a65c6 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -474,6 +474,7 @@ extern int dispatch_load_file(dialogMenuItem *self); extern int distReset(dialogMenuItem *self); extern int distConfig(dialogMenuItem *self); extern int distSetCustom(dialogMenuItem *self); +extern int distUnsetCustom(dialogMenuItem *self); extern int distSetDeveloper(dialogMenuItem *self); extern int distSetXDeveloper(dialogMenuItem *self); extern int distSetKernDeveloper(dialogMenuItem *self); |