dist.c (8405) | dist.c (8549) |
---|---|
1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * | 1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * |
7 * $Id: dist.c,v 1.2 1995/05/08 21:39:34 jkh Exp $ | 7 * $Id: dist.c,v 1.3 1995/05/10 07:44:55 jkh Exp $ |
8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 82 unchanged lines hidden (view full) --- 98 distSetXF86(NULL); 99 return 0; 100} 101 102int 103distSetSrc(char *str) 104{ 105 extern DMenu MenuSrcDistributions; | 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 82 unchanged lines hidden (view full) --- 98 distSetXF86(NULL); 99 return 0; 100} 101 102int 103distSetSrc(char *str) 104{ 105 extern DMenu MenuSrcDistributions; |
106 int choice, scroll, curr, max; | |
107 | 106 |
108 choice = scroll = curr = max; 109 dmenuOpen(&MenuSrcDistributions, &choice, &scroll, &curr, &max); | 107 dmenuOpenSimple(&MenuSrcDistributions); |
110 if (SrcDists) 111 Dists |= DIST_SRC; 112 return 0; 113} 114 115static int 116distSetXF86(char *str) 117{ 118 extern DMenu MenuXF86; | 108 if (SrcDists) 109 Dists |= DIST_SRC; 110 return 0; 111} 112 113static int 114distSetXF86(char *str) 115{ 116 extern DMenu MenuXF86; |
119 int choice, scroll, curr, max; | |
120 | 117 |
121 choice = scroll = curr = max; 122 dmenuOpen(&MenuXF86, &choice, &scroll, &curr, &max); | 118 dmenuOpenSimple(&MenuXF86); |
123 return 0; 124} 125 | 119 return 0; 120} 121 |
126static struct _dist { | 122typedef struct _dist { |
127 char *my_name; | 123 char *my_name; |
124 unsigned int *my_mask; |
|
128 unsigned int my_bit; | 125 unsigned int my_bit; |
129} DistTable[] = { 130{ "bin", DIST_BIN }, 131{ "games", DIST_GAMES }, 132{ "manpages", DIST_MANPAGES }, 133{ "proflibs", DIST_PROFLIBS }, 134{ "dict", DIST_DICT }, 135{ "src", DIST_SRC }, 136{ "des", DIST_DES }, 137{ "compat1x", DIST_COMPAT1X }, 138{ "xf86311", DIST_XF86 }, 139{ NULL, 0 }, | 126 struct _dist *my_dist; 127} Distribution; 128 129extern Distribution SrcDistTable[]; 130extern Distribution XF86DistTable[]; 131extern Distribution XF86FontDistTable[]; 132extern Distribution XF86ServerDistTable[]; 133 134 135/* The top-level distribution categories */ 136static Distribution DistTable[] = { 137{ "bin", &Dist, DIST_BIN, NULL }, 138{ "games", &Dist, DIST_GAMES, NULL }, 139{ "manpages", &Dist, DIST_MANPAGES, NULL }, 140{ "proflibs", &Dist, DIST_PROFLIBS, NULL }, 141{ "dict", &Dist, DIST_DICT, NULL }, 142{ "src/", &Dist, DIST_SRC, &SrcDistTable }, 143{ "des", &Dist, DIST_DES, NULL }, 144{ "compat1x", &Dist, DIST_COMPAT1X, NULL }, 145{ "xf86311/", &Dist, DIST_XF86, &XF86DistTable }, 146{ NULL }, |
140}; 141 | 147}; 148 |
142static struct _dist SrcDistTable[] = { 143{ "base", DIST_SRC_BASE }, 144{ "gnu", DIST_SRC_GNU }, 145{ "etc", DIST_SRC_ETC }, 146{ "games", DIST_SRC_GAMES }, 147{ "include", DIST_SRC_INCLUDE}, 148{ "lib", DIST_SRC_LIB }, 149{ "libexec", DIST_SRC_LIBEXEC}, 150{ "lkm", DIST_SRC_LKM }, 151{ "release", DIST_SRC_RELEASE}, 152{ "sbin", DIST_SRC_SBIN }, 153{ "share", DIST_SRC_SHARE }, 154{ "sys", DIST_SRC_SYS }, 155{ "ubin", DIST_SRC_UBIN }, 156{ "usbin", DIST_SRC_USBIN }, | 149/* The /usr/src distribution */ 150static Distribution SrcDistTable[] = { 151{ "base", &SrcDist, DIST_SRC_BASE, NULL }, 152{ "gnu", &SrcDist, DIST_SRC_GNU, NULL }, 153{ "etc", &SrcDist, DIST_SRC_ETC, NULL }, 154{ "games", &SrcDist, DIST_SRC_GAMES, NULL }, 155{ "include", &SrcDist, DIST_SRC_INCLUDE, NULL }, 156{ "lib", &SrcDist, DIST_SRC_LIB, NULL }, 157{ "libexec", &SrcDist, DIST_SRC_LIBEXEC, NULL }, 158{ "lkm", &SrcDist, DIST_SRC_LKM, NULL }, 159{ "release", &SrcDist, DIST_SRC_RELEASE, NULL }, 160{ "sbin", &SrcDist, DIST_SRC_SBIN, NULL }, 161{ "share", &SrcDist, DIST_SRC_SHARE, NULL }, 162{ "sys", &SrcDist, DIST_SRC_SYS, NULL }, 163{ "ubin", &SrcDist, DIST_SRC_UBIN, NULL }, 164{ "usbin", &SrcDist, DIST_SRC_USBIN, NULL }, |
157{ NULL, 0 }, 158}; 159 | 165{ NULL, 0 }, 166}; 167 |
160static struct _dist XFree86DistTable[] = { 161{ "bin", DIST_XF86_BIN }, 162{ "lib", DIST_XF86_LIB }, 163{ "doc", DIST_XF86_DOC }, 164{ "man", DIST_XF86_MAN }, 165{ "prog", DIST_XF86_PROG }, 166{ "link", DIST_XF86_LINK }, 167{ "pex", DIST_XF86_PEX }, 168{ "lbx", DIST_XF86_LBX }, 169{ "xicf", DIST_XF86_XINIT }, 170{ "xdmcf", DIST_XF86_XDMCF }, 171{ NULL, 0 }, | 168/* The XFree86 distribution */ 169static Distribution XF86DistTable[] = { 170{ "bin", &XF86Dist, DIST_XF86_BIN, NULL }, 171{ "lib", &XF86Dist, DIST_XF86_LIB, NULL }, 172{ "doc", &XF86Dist, DIST_XF86_DOC, NULL }, 173{ "xf86311/", &XF86Dist, DIST_XF86_FONTS, &XF86FontDistTable }, 174{ "man", &XF86Dist, DIST_XF86_MAN, NULL }, 175{ "prog", &XF86Dist, DIST_XF86_PROG, NULL }, 176{ "link", &XF86Dist, DIST_XF86_LINK, NULL }, 177{ "pex", &XF86Dist, DIST_XF86_PEX, NULL }, 178{ "lbx", &XF86Dist, DIST_XF86_LBX, NULL }, 179{ "xicf", &XF86Dist, DIST_XF86_XINIT, NULL }, 180{ "xdmcf", &XF86Dist, DIST_XF86_XDMCF, NULL }, 181{ "xf86311/", &XF86Dist, DIST_XF86_SERVER, &XF86ServerDistTable }, 182{ NULL }, |
172}; 173 | 183}; 184 |
174static struct _dist XFree86ServerDistTable[] = { 175{ "8514", DIST_XF86_SERVER_8514 }, 176{ "AGX", DIST_XF86_SERVER_AGX }, 177{ "Mch3", DIST_XF86_SERVER_MACH32 }, 178{ "Mch8", DIST_XF86_SERVER_MACH8 }, 179{ "Mono", DIST_XF86_SERVER_MONO }, 180{ "P9K", DIST_XF86_SERVER_P9000 }, 181{ "S3", DIST_XF86_SERVER_S3 }, 182{ "SVGA", DIST_XF86_SERVER_SVGA }, 183{ "VGA16", DIST_XF86_SERVER_VGA16 }, 184{ "W32", DIST_XF86_SERVER_W32 }, 185{ "nest", DIST_XF86_SERVER_NEST }, 186{ NULL, 0 }, | 185/* The XFree86 server distribution */ 186static Distribution XF86ServerDistTable[] = { 187{ "X3118514", &XF86ServerDist,DIST_XF86_SERVER_8514, NULL }, 188{ "X311AGX", &XF86ServerDist,DIST_XF86_SERVER_AGX, NULL }, 189{ "X311Mch3", &XF86ServerDist,DIST_XF86_SERVER_MACH32,NULL }, 190{ "X311Mch8", &XF86ServerDist,DIST_XF86_SERVER_MACH8, NULL }, 191{ "X311Mono", &XF86ServerDist,DIST_XF86_SERVER_MONO, NULL }, 192{ "X311P9K", &XF86ServerDist,DIST_XF86_SERVER_P9000, NULL }, 193{ "X311S3", &XF86ServerDist,DIST_XF86_SERVER_S3, NULL }, 194{ "X311SVGA", &XF86ServerDist,DIST_XF86_SERVER_SVGA, NULL }, 195{ "X311VGA16", &XF86ServerDist,DIST_XF86_SERVER_VGA16, NULL }, 196{ "X311W32", &XF86ServerDist,DIST_XF86_SERVER_W32, NULL }, 197{ "X311nest", &XF86ServerDist,DIST_XF86_SERVER_NEST, NULL }, 198{ NULL }, |
187}; 188 | 199}; 200 |
189static struct _dist XFree86FontDistTable[] = { 190{ "fnts", DIST_XF86_FONTS_MISC }, 191{ "f100", DIST_XF86_FONTS_100 }, 192{ "fscl", DIST_XF86_FONTS_SCALE }, 193{ "fnon", DIST_XF86_FONTS_NON }, 194{ "fsrv", DIST_XF86_FONTS_SERVER }, | 201/* The XFree86 font distribution */ 202static Distribution XF86FontDistTable[] = { 203{ "X311fnts", &XF86FontDist, DIST_XF86_FONTS_MISC, NULL }, 204{ "X311f100", &XF86FontDist, DIST_XF86_FONTS_100, NULL }, 205{ "X311fscl", &XF86FontDist, DIST_XF86_FONTS_SCALE, NULL }, 206{ "X311fnon", &XF86FontDist, DIST_XF86_FONTS_NON, NULL }, 207{ "X311fsrv", &XF86FontDist, DIST_XF86_FONTS_SERVER, NULL }, 208{ NULL }, |
195}; 196 | 209}; 210 |
197static Boolean 198dist_extract(char *name) | 211static int 212distExtract(char *parent, Distribution *me) |
199{ | 213{ |
200 if (!strcmp(name, "src")) { | 214 int i, status; 215 FILE *fp; 216 217 status = 0; 218 for (i = 0; me[i].my_name; i++) { 219 if (me[i].my_bit & *(me[i].my_mask)) { 220 if (me[i].my_dist) 221 status = distExtract(me[i].my_name, me[i].my_dist); 222 else { 223 fp = mediaOpen(parent, me[i].my_name); 224 if (fp) { 225 status = extract_dist(fp); 226 close(fp); 227 } 228 else { 229 if (getenv(NO_CONFIRMATION)) 230 status = 0; 231 else 232 status = msgYesNo("Unable to retreive the %s distribution from %s.\nDo you want to retry that distribution later?"); 233 } 234 } 235 if (!status) { 236 /* 237 * Extract was successful, remove ourselves from further 238 * consideration 239 */ 240 *(me[i].my_mask) &= ~(me[i].my_bit); 241 } 242 } |
201 } | 243 } |
202 else if (!strcmp(name, "xf86311l")) { 203 } 204 else { 205 } 206 return FALSE; | 244 return status; |
207} | 245} |
208 | 246 |
209void 210distExtractAll(void) 211{ | 247void 248distExtractAll(void) 249{ |
212 int i; 213 214 while (Dists) { 215 for (i = 0; DistTable[i].my_name; i++) { 216 if (Dists & DistTable[i].my_bit) { 217 if (dist_extract(DistTable[i].my_name)) 218 Dists &= ~DistTable[i].my_bit; 219 else 220 continue; 221 } 222 } 223 } | 250 distExtract(NULL, DistTable); |
224} | 251} |