Deleted Added
full compact
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
7 * $Id: sysinstall.h,v 1.10 1995/05/07 02:04:29 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
16 * notice, this list of conditions and the following disclaimer,
17 * verbatim and that no modifications are made prior to this
18 * point in the file.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by Jordan Hubbard
25 * for the FreeBSD Project.
26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
27 * endorse or promote products derived from this software without specific
28 * prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 */
43
44#ifndef _SYSINSTALL_H_INCLUDE
45#define _SYSINSTALL_H_INCLUDE
46
47#include <stdio.h>
48#include <stdlib.h>
49#include <string.h>
50#include <unistd.h>
51#include <dialog.h>
52#include "libdisk.h"
53
54/*** Defines ***/
55
56/* Bitfields for menu options */
57#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */
58#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */
59#define DMENU_MULTIPLE_TYPE 0x4 /* Multiple choice menu */
60#define DMENU_SELECTION_RETURNS 0x8 /* Select item then exit */
61
62/* Bitfields for distributions - hope we never have more than 32! :-) */
63#define DIST_BIN 0x1
64#define DIST_GAMES 0x2
65#define DIST_MANPAGES 0x4
66#define DIST_PROFLIBS 0x8
67#define DIST_DICT 0x10
68#define DIST_SRC 0x20
69#define DIST_DES 0x40
70#define DIST_COMPAT1X 0x80
71#define DIST_XFREE86 0x100
72#define DIST_ALL 0xFFF
73
74/* Canned distribution sets */
75#define _DIST_DEVELOPER \
76 (DIST_BIN | DIST_MANPAGES | DIST_DICT | DIST_PROFLIBS | DIST_SRC)
77
78#define _DIST_XDEVELOPER \
79 (_DIST_DEVELOPER | DIST_XFREE86)
80
81#define _DIST_USER \
82 (DIST_BIN | DIST_MANPAGES | DIST_DICT | DIST_COMPAT1X)
83
84#define _DIST_XUSER \
85 (_DIST_USER | DIST_XFREE86)
86
87
88/* Subtypes for SRC distribution */
89#define DIST_SRC_BASE 0x1
90#define DIST_SRC_GNU 0x2
91#define DIST_SRC_ETC 0x4
92#define DIST_SRC_GAMES 0x8
93#define DIST_SRC_INCLUDE 0x10
94#define DIST_SRC_LIB 0x20
95#define DIST_SRC_LIBEXEC 0x40
96#define DIST_SRC_LKM 0x80
97#define DIST_SRC_RELEASE 0x100
98#define DIST_SRC_SBIN 0x200
99#define DIST_SRC_SHARE 0x400
100#define DIST_SRC_SYS 0x800
101#define DIST_SRC_UBIN 0x1000
102#define DIST_SRC_USBIN 0x2000
103#define DIST_SRC_ALL 0xFFFF
104
105/* variable limits */
106#define VAR_NAME_MAX 128
107#define VAR_VALUE_MAX 1024
108
109/* device limits */
110#define DEV_NAME_MAX 128
111
112/* handy */
113#define ONE_MEG 1048576
114
115
116/*** Types ***/
117typedef unsigned int Boolean;
118
119typedef enum {
120 DMENU_SHELL_ESCAPE, /* Fork a shell */
121 DMENU_DISPLAY_FILE, /* Display a file's contents */
122 DMENU_SUBMENU, /* Recurse into another menu */
123 DMENU_SYSTEM_COMMAND, /* Run shell commmand */
124 DMENU_SYSTEM_COMMAND_BOX, /* Same as above, but in prgbox */
125 DMENU_SET_VARIABLE, /* Set an environment/system var */
126 DMENU_CALL, /* Call back a C function */
127 DMENU_CANCEL, /* Cancel out of this menu */
128 DMENU_NOP, /* Do nothing special for item */
129} DMenuItemType;
130
131typedef struct _dmenuItem {
132 char *title; /* Our title */
133 char *prompt; /* Our prompt */
134 DMenuItemType type; /* What type of item we are */
135 void *ptr; /* Generic data ptr */
136 Boolean disabled; /* Are we temporarily disabled? */
137} DMenuItem;
138
139typedef struct _dmenu {
140 unsigned int options; /* What sort of menu we are */
141 char *title; /* Our title */
142 char *prompt; /* Our prompt */
143 char *helpline; /* Line of help at bottom */
144 char *helpfile; /* Help file for "F1" */
145 DMenuItem items[0]; /* Array of menu items */
146} DMenu;
147
148/* A sysconfig variable */
149typedef struct _variable {
150 struct _variable *next;
151 char name[VAR_NAME_MAX];
152 char value[VAR_VALUE_MAX];
153} Variable;
154
155typedef enum {
156 DEVICE_TYPE_ANY,
157 DEVICE_TYPE_DISK,
158 DEVICE_TYPE_FLOPPY,
159 DEVICE_TYPE_NETWORK,
160 DEVICE_TYPE_CDROM,
161 DEVICE_TYPE_TAPE,
162 DEVICE_TYPE_SERIAL,
163 DEVICE_TYPE_PARALLEL,
164} DeviceType;
165
166/* A "device" from sysinstall's point of view */
167typedef struct _device {
168 char name[DEV_NAME_MAX];
169 DeviceType type;
170} Device;
171
172/* Some internal representations of partitions */
173typedef enum {
174 PART_NONE,
175 PART_SLICE,
176 PART_SWAP,
177 PART_FILESYSTEM
178} PartType;
179
180/* The longest newfs command we'll hand to system() */
181#define NEWFS_CMD_MAX 256
182
183typedef struct _part_info {
184 Boolean newfs;
185 char mountpoint[FILENAME_MAX];
186 char newfs_cmd[NEWFS_CMD_MAX];
187} PartInfo;
188
189
190/*** Externs ***/
191extern int CpioFD; /* The file descriptor for our CPIO floppy */
192extern int DebugFD; /* Where diagnostic output goes */
193extern Boolean OnCDROM; /* Are we running off of a CDROM? */
194extern Boolean OnSerial; /* Are we on a serial console? */
195extern Boolean SystemWasInstalled; /* Did we install it? */
196extern Boolean DialogActive; /* Is the dialog() stuff up? */
197extern Boolean ColorDisplay; /* Are we on a color display? */
198extern Boolean OnVTY; /* On a syscons VTY? */
199extern Variable *VarHead; /* The head of the variable chain */
200extern unsigned int Dists; /* Which distributions we want */
201extern unsigned int SrcDists; /* Which src distributions we want */
202
203
204/*** Prototypes ***/
205
206/* globals.c */
207extern void globalsInit(void);
208
209/* install.c */
210extern int installCustom(char *str);
211extern int installExpress(char *str);
212extern int installMaint(char *str);
213
214/* dist.c */
215extern int distSetDeveloper(char *str);
216extern int distSetXDeveloper(char *str);
217extern int distSetUser(char *str);
218extern int distSetXUser(char *str);
219extern int distSetMinimum(char *str);
220extern int distSetEverything(char *str);
221
222/* system.c */
223extern void systemInitialize(int argc, char **argv);
224extern void systemShutdown(void);
225extern void systemWelcome(void);
226extern int systemExecute(char *cmd);
227extern int systemShellEscape(void);
228extern int systemDisplayFile(char *file);
229extern char *systemHelpFile(char *file, char *buf);
230extern void systemChangeFont(const u_char font[]);
231extern void systemChangeLang(char *lang);
232extern void systemChangeTerminal(char *color, const u_char c_termcap[],
233 char *mono, const u_char m_termcap[]);
234extern void systemChangeScreenmap(const u_char newmap[]);
235extern int vsystem(char *fmt, ...);
236
237/* disks.c */
238extern void partition_disks(struct disk **disks);
239extern int write_disks(struct disk **disks);
240extern void make_filesystems(struct disk **disks);
241extern void cpio_extract(struct disk **disks);
242extern void extract_dists(struct disk **disks);
243extern void install_configuration_files(struct disk **disks);
244extern void do_final_setup(struct disk **disks);
245
246/* dmenu.c */
247extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
248 int *curr, int *max);
249
250/* misc.c */
251extern Boolean file_readable(char *fname);
252extern Boolean file_executable(char *fname);
253extern char *string_concat(char *p1, char *p2);
254extern char *string_prune(char *str);
255extern char *string_skipwhite(char *str);
256extern void safe_free(void *ptr);
257extern void *safe_malloc(size_t size);
258extern char **item_add(char **list, char *item, int *curr, int *max);
259extern char **item_add_pair(char **list, char *item1, char *item2,
260 int *curr, int *max);
261extern void items_free(char **list, int *curr, int *max);
262
263/* termcap.c */
264extern int set_termcap(void);
265
266/* msg.c */
267extern void msgInfo(char *fmt, ...);
268extern void msgYap(char *fmt, ...);
269extern void msgWarn(char *fmt, ...);
270extern void msgError(char *fmt, ...);
271extern void msgFatal(char *fmt, ...);
272extern void msgConfirm(char *fmt, ...);
273extern void msgNotify(char *fmt, ...);
274extern int msgYesNo(char *fmt, ...);
275extern char *msgGetInput(char *buf, char *fmt, ...);
276
277/* media.c */
278extern int mediaSetCDROM(char *str);
279extern int mediaSetFloppy(char *str);
280extern int mediaSetDOS(char *str);
281extern int mediaSetTape(char *str);
282extern int mediaSetFTP(char *str);
283extern int mediaSetFS(char *str);
284
285/* devices.c */
286extern Device *device_get_all(DeviceType type, int *ndevs);
287extern struct disk *device_slice_disk(struct disk *d);
288extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs,
289 int (*func)());
290
291/* variables.c */
292extern void variable_set(char *var);
293extern void variable_set2(char *name, char *value);
294
295/* lang.c */
296extern void lang_set_Danish(char *str);
297extern void lang_set_Dutch(char *str);
298extern void lang_set_English(char *str);
299extern void lang_set_French(char *str);
300extern void lang_set_German(char *str);
301extern void lang_set_Italian(char *str);
302extern void lang_set_Japanese(char *str);
303extern void lang_set_Norwegian(char *str);
304extern void lang_set_Russian(char *str);
305extern void lang_set_Spanish(char *str);
306extern void lang_set_Swedish(char *str);
307
308/* makedevs.c (auto-generated) */
309extern const char termcap_vt100[];
310extern const char termcap_cons25[];
311extern const char termcap_cons25_m[];
312extern const char termcap_cons25r[];
313extern const char termcap_cons25r_m[];
314extern const char termcap_cons25l1[];
315extern const char termcap_cons25l1_m[];
316extern const u_char font_iso_8x14[];
317extern const u_char font_cp850_8x14[];
318extern const u_char font_koi8_r_8x14[];
319extern const u_char koi8_r2cp866[];
320
321/* wizard.c */
322extern void slice_wizard(struct disk *d);
323
324#endif
325/* _SYSINSTALL_H_INCLUDE */