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.11 1995/05/07 23:37:34 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/* command.c */
207extern void command_clear(void);
208extern void command_sort(void);
209extern void command_execute(void);
210extern void command_add(char *key, char *fmt, ...);
211
212/* globals.c */
213extern void globalsInit(void);
214
215/* install.c */
216extern int installCustom(char *str);
217extern int installExpress(char *str);
218extern int installMaint(char *str);
219
220/* dist.c */
221extern int distSetDeveloper(char *str);
222extern int distSetXDeveloper(char *str);
223extern int distSetUser(char *str);
224extern int distSetXUser(char *str);
225extern int distSetMinimum(char *str);
226extern int distSetEverything(char *str);
227
228/* system.c */
229extern void systemInitialize(int argc, char **argv);
230extern void systemShutdown(void);
231extern void systemWelcome(void);
232extern int systemExecute(char *cmd);
233extern int systemShellEscape(void);
234extern int systemDisplayFile(char *file);
235extern char *systemHelpFile(char *file, char *buf);
236extern void systemChangeFont(const u_char font[]);
237extern void systemChangeLang(char *lang);
238extern void systemChangeTerminal(char *color, const u_char c_termcap[],
239 char *mono, const u_char m_termcap[]);
240extern void systemChangeScreenmap(const u_char newmap[]);
241extern int vsystem(char *fmt, ...);
242
243/* disks.c */
244extern void partition_disks(struct disk **disks);
245extern int write_disks(struct disk **disks);
246extern void make_filesystems(struct disk **disks);
247extern void cpio_extract(void);
248extern void extract_dists(struct disk **disks);
249extern void install_configuration_files(struct disk **disks);
250extern void do_final_setup(struct disk **disks);
251
252/* dmenu.c */
253extern void dmenuOpen(DMenu *menu, int *choice, int *scroll,
254 int *curr, int *max);
255
256/* misc.c */
257extern Boolean file_readable(char *fname);
258extern Boolean file_executable(char *fname);
259extern char *string_concat(char *p1, char *p2);
260extern char *string_prune(char *str);
261extern char *string_skipwhite(char *str);
262extern void safe_free(void *ptr);
263extern void *safe_malloc(size_t size);
264extern char **item_add(char **list, char *item, int *curr, int *max);
265extern char **item_add_pair(char **list, char *item1, char *item2,
266 int *curr, int *max);
267extern void items_free(char **list, int *curr, int *max);
268
269/* termcap.c */
270extern int set_termcap(void);
271
272/* msg.c */
273extern void msgInfo(char *fmt, ...);
274extern void msgYap(char *fmt, ...);
275extern void msgWarn(char *fmt, ...);
276extern void msgDebug(char *fmt, ...);
277extern void msgError(char *fmt, ...);
278extern void msgFatal(char *fmt, ...);
279extern void msgConfirm(char *fmt, ...);
280extern void msgNotify(char *fmt, ...);
281extern int msgYesNo(char *fmt, ...);
282extern char *msgGetInput(char *buf, char *fmt, ...);
283
284/* media.c */
285extern int mediaSetCDROM(char *str);
286extern int mediaSetFloppy(char *str);
287extern int mediaSetDOS(char *str);
288extern int mediaSetTape(char *str);
289extern int mediaSetFTP(char *str);
290extern int mediaSetFS(char *str);
291
292/* devices.c */
293extern Device *device_get_all(DeviceType type, int *ndevs);
294extern struct disk *device_slice_disk(struct disk *d);
295extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs,
296 int (*func)());
297
298/* variables.c */
299extern void variable_set(char *var);
300extern void variable_set2(char *name, char *value);
301
302/* lang.c */
303extern void lang_set_Danish(char *str);
304extern void lang_set_Dutch(char *str);
305extern void lang_set_English(char *str);
306extern void lang_set_French(char *str);
307extern void lang_set_German(char *str);
308extern void lang_set_Italian(char *str);
309extern void lang_set_Japanese(char *str);
310extern void lang_set_Norwegian(char *str);
311extern void lang_set_Russian(char *str);
312extern void lang_set_Spanish(char *str);
313extern void lang_set_Swedish(char *str);
314
315/* makedevs.c (auto-generated) */
316extern const char termcap_vt100[];
317extern const char termcap_cons25[];
318extern const char termcap_cons25_m[];
319extern const char termcap_cons25r[];
320extern const char termcap_cons25r_m[];
321extern const char termcap_cons25l1[];
322extern const char termcap_cons25l1_m[];
323extern const u_char font_iso_8x14[];
324extern const u_char font_cp850_8x14[];
325extern const u_char font_koi8_r_8x14[];
326extern const u_char koi8_r2cp866[];
327
328/* wizard.c */
329extern void slice_wizard(struct disk *d);
330
331#endif
332/* _SYSINSTALL_H_INCLUDE */