sade.h revision 8313
10SN/A/* 21472SN/A * The new sysinstall program. 30SN/A * 40SN/A * This is probably the last attempt in the `sysinstall' line, the next 50SN/A * generation being slated to essentially a complete rewrite. 60SN/A * 70SN/A * $Id: sysinstall.h,v 1.9 1995/05/06 09:34:20 jkh Exp $ 80SN/A * 90SN/A * Copyright (c) 1995 100SN/A * Jordan Hubbard. All rights reserved. 110SN/A * 120SN/A * Redistribution and use in source and binary forms, with or without 130SN/A * modification, are permitted provided that the following conditions 140SN/A * are met: 150SN/A * 1. Redistributions of source code must retain the above copyright 160SN/A * notice, this list of conditions and the following disclaimer, 170SN/A * verbatim and that no modifications are made prior to this 180SN/A * point in the file. 191472SN/A * 2. Redistributions in binary form must reproduce the above copyright 201472SN/A * notice, this list of conditions and the following disclaimer in the 211472SN/A * documentation and/or other materials provided with the distribution. 220SN/A * 3. All advertising materials mentioning features or use of this software 230SN/A * must display the following acknowledgement: 240SN/A * This product includes software developed by Jordan Hubbard 250SN/A * for the FreeBSD Project. 260SN/A * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to 270SN/A * endorse or promote products derived from this software without specific 280SN/A * prior written permission. 290SN/A * 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 180typedef struct _part_info { 181 Boolean newfs; 182 char mountpoint[FILENAME_MAX]; 183} PartInfo; 184 185 186/*** Externs ***/ 187extern int CpioFD; /* The file descriptor for our CPIO floppy */ 188extern int DebugFD; /* Where diagnostic output goes */ 189extern Boolean OnCDROM; /* Are we running off of a CDROM? */ 190extern Boolean OnSerial; /* Are we on a serial console? */ 191extern Boolean SystemWasInstalled; /* Did we install it? */ 192extern Boolean DialogActive; /* Is the dialog() stuff up? */ 193extern Boolean ColorDisplay; /* Are we on a color display? */ 194extern Boolean OnVTY; /* On a syscons VTY? */ 195extern Variable *VarHead; /* The head of the variable chain */ 196extern unsigned int Dists; /* Which distributions we want */ 197extern unsigned int SrcDists; /* Which src distributions we want */ 198 199 200/*** Prototypes ***/ 201 202/* globals.c */ 203extern void globalsInit(void); 204 205/* install.c */ 206extern int installCustom(char *str); 207extern int installExpress(char *str); 208extern int installMaint(char *str); 209 210/* dist.c */ 211extern int distSetDeveloper(char *str); 212extern int distSetXDeveloper(char *str); 213extern int distSetUser(char *str); 214extern int distSetXUser(char *str); 215extern int distSetMinimum(char *str); 216extern int distSetEverything(char *str); 217 218/* system.c */ 219extern void systemInitialize(int argc, char **argv); 220extern void systemShutdown(void); 221extern void systemWelcome(void); 222extern int systemExecute(char *cmd); 223extern int systemShellEscape(void); 224extern int systemDisplayFile(char *file); 225extern char *systemHelpFile(char *file, char *buf); 226extern void systemChangeFont(const u_char font[]); 227extern void systemChangeLang(char *lang); 228extern void systemChangeTerminal(char *color, const u_char c_termcap[], 229 char *mono, const u_char m_termcap[]); 230extern void systemChangeScreenmap(const u_char newmap[]); 231extern int vsystem(char *fmt, ...); 232 233/* disks.c */ 234extern void partition_disks(struct disk **disks); 235extern int write_disks(struct disk **disks); 236extern void make_filesystems(struct disk **disks); 237extern void cpio_extract(struct disk **disks); 238extern void extract_dists(struct disk **disks); 239extern void install_configuration_files(struct disk **disks); 240extern void do_final_setup(struct disk **disks); 241 242/* dmenu.c */ 243extern void dmenuOpen(DMenu *menu, int *choice, int *scroll, 244 int *curr, int *max); 245 246/* misc.c */ 247extern Boolean file_readable(char *fname); 248extern Boolean file_executable(char *fname); 249extern char *string_concat(char *p1, char *p2); 250extern char *string_prune(char *str); 251extern char *string_skipwhite(char *str); 252extern void safe_free(void *ptr); 253extern void *safe_malloc(size_t size); 254extern char **item_add(char **list, char *item, int *curr, int *max); 255extern char **item_add_pair(char **list, char *item1, char *item2, 256 int *curr, int *max); 257extern void items_free(char **list, int *curr, int *max); 258 259/* termcap.c */ 260extern int set_termcap(void); 261 262/* msg.c */ 263extern void msgInfo(char *fmt, ...); 264extern void msgYap(char *fmt, ...); 265extern void msgWarn(char *fmt, ...); 266extern void msgError(char *fmt, ...); 267extern void msgFatal(char *fmt, ...); 268extern void msgConfirm(char *fmt, ...); 269extern void msgNotify(char *fmt, ...); 270extern int msgYesNo(char *fmt, ...); 271extern char *msgGetInput(char *buf, char *fmt, ...); 272 273/* media.c */ 274extern int mediaSetCDROM(char *str); 275extern int mediaSetFloppy(char *str); 276extern int mediaSetDOS(char *str); 277extern int mediaSetTape(char *str); 278extern int mediaSetFTP(char *str); 279extern int mediaSetFS(char *str); 280 281/* devices.c */ 282extern Device *device_get_all(DeviceType type, int *ndevs); 283extern struct disk *device_slice_disk(struct disk *d); 284extern DMenu *device_create_disk_menu(DMenu *menu, Device **rdevs, 285 int (*func)()); 286 287/* variables.c */ 288extern void variable_set(char *var); 289extern void variable_set2(char *name, char *value); 290 291/* lang.c */ 292extern void lang_set_Danish(char *str); 293extern void lang_set_Dutch(char *str); 294extern void lang_set_English(char *str); 295extern void lang_set_French(char *str); 296extern void lang_set_German(char *str); 297extern void lang_set_Italian(char *str); 298extern void lang_set_Japanese(char *str); 299extern void lang_set_Norwegian(char *str); 300extern void lang_set_Russian(char *str); 301extern void lang_set_Spanish(char *str); 302extern void lang_set_Swedish(char *str); 303 304/* makedevs.c (auto-generated) */ 305extern const char termcap_vt100[]; 306extern const char termcap_cons25[]; 307extern const char termcap_cons25_m[]; 308extern const char termcap_cons25r[]; 309extern const char termcap_cons25r_m[]; 310extern const char termcap_cons25l1[]; 311extern const char termcap_cons25l1_m[]; 312extern const u_char font_iso_8x14[]; 313extern const u_char font_cp850_8x14[]; 314extern const u_char font_koi8_r_8x14[]; 315extern const u_char koi8_r2cp866[]; 316 317/* wizard.c */ 318extern void slice_wizard(struct disk *d); 319 320#endif 321/* _SYSINSTALL_H_INCLUDE */ 322