diff options
Diffstat (limited to 'usr.sbin/sysinstall/sysinstall.h')
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 271 |
1 files changed, 198 insertions, 73 deletions
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index b1b1ba3..b8e1f43 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.42.2.1 1995/07/21 10:54:06 rgrimes Exp $ + * $Id: sysinstall.h,v 1.43 1995/09/18 16:52:35 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -49,8 +49,11 @@ #include <string.h> #include <unistd.h> #include <dialog.h> +#include <sys/types.h> +#include <sys/wait.h> #include "libdisk.h" #include "dist.h" +#include "version.h" /*** Defines ***/ @@ -66,10 +69,14 @@ #define VAR_VALUE_MAX 1024 /* device limits */ -#define DEV_NAME_MAX 128 /* The maximum length of a device name */ -#define DEV_MAX 200 /* The maximum number of devices we'll deal with */ +#define DEV_NAME_MAX 64 /* The maximum length of a device name */ +#define DEV_MAX 100 /* The maximum number of devices we'll deal with */ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ -#define MAX_FTP_RETRIES 3 /* How many times to beat our heads against the wall */ +#define MAX_FTP_RETRIES "4" /* How many times to beat our heads against the wall */ + +#define RET_FAIL -1 +#define RET_SUCCESS 0 +#define RET_DONE 1 /* * I make some pretty gross assumptions about having a max of 50 chunks @@ -79,36 +86,65 @@ * For 2.1 I'll revisit this and try to make it more dynamic, but since * this will catch 99.99% of all possible cases, I'm not too worried. */ -#define MAX_CHUNKS 50 +#define MAX_CHUNKS 40 -/* Internal flag variables */ +/* Internal environment variable names */ #define DISK_PARTITIONED "_diskPartitioned" #define DISK_LABELLED "_diskLabelled" +#define DISK_SELECTED "_diskSelected" +#define SYSTEM_STATE "_systemState" #define RUNNING_ON_ROOT "_runningOnRoot" #define TCP_CONFIGURED "_tcpConfigured" -#define FTP_USER "_ftpUser" -#define FTP_PASS "_ftpPass" - -#define OPT_NO_CONFIRM 0x0001 -#define OPT_NFS_SECURE 0x0002 -#define OPT_DEBUG 0x0004 -#define OPT_FTP_ACTIVE 0x0008 -#define OPT_FTP_PASSIVE 0x0010 -#define OPT_FTP_RESELECT 0x0020 -#define OPT_FTP_ABORT 0x0040 -#define OPT_SLOW_ETHER 0x0080 -#define OPT_EXPLORATORY_GET 0x0100 -#define OPT_LEAVE_NETWORK_UP 0x0200 - -#define VAR_HOSTNAME "hostname" -#define VAR_DOMAINNAME "domainname" -#define VAR_NAMESERVER "nameserver" -#define VAR_GATEWAY "defaultrouter" -#define VAR_IPADDR "ipaddr" - -#define VAR_IFCONFIG "ifconfig_" -#define VAR_INTERFACES "network_interfaces" +/* Ones that can be tweaked from config files */ +#define VAR_BLANKTIME "blanktime" +#define VAR_BOOTMGR "bootManager" +#define VAR_BROWSER_BINARY "browserBinary" +#define VAR_BROWSER_PACKAGE "browserPackage" +#define VAR_CONFIG_FILE "configFile" +#define VAR_CPIO_VERBOSITY "cpioVerbose" +#define VAR_DEBUG "debug" +#define VAR_DISK "disk" +#define VAR_DISKSPACE "diskSpace" +#define VAR_DOMAINNAME "domainname" +#define VAR_EXTRAS "ifconfig_" +#define VAR_FTP_ONERROR "ftpOnError" +#define VAR_FTP_PASS "ftpPass" +#define VAR_FTP_PATH "ftp" +#define VAR_FTP_RETRIES "ftpRetryCount" +#define VAR_FTP_STATE "ftpState" +#define VAR_FTP_USER "ftpUser" +#define VAR_GATEWAY "defaultrouter" +#define VAR_GEOMETRY "geometry" +#define VAR_HOSTNAME "hostname" +#define VAR_IFCONFIG "ifconfig_" +#define VAR_INTERFACES "network_interfaces" +#define VAR_IPADDR "ipaddr" +#define VAR_LABEL "label" +#define VAR_LABEL_COUNT "labelCount" +#define VAR_MEDIA_TYPE "mediaType" +#define VAR_NAMESERVER "nameserver" +#define VAR_NETMASK "netmask" +#define VAR_NFS_PATH "nfs" +#define VAR_NFS_SECURE "nfsSecure" +#define VAR_NO_CONFIRM "noConfirm" +#define VAR_NTPDATE "ntpDate" +#define VAR_PORTS_PATH "ports" +#define VAR_RELNAME "releaseName" +#define VAR_ROOT_SIZE "rootSize" +#define VAR_ROUTEDFLAGS "routedflags" +#define VAR_SLOW_ETHER "slowEthernetCard" +#define VAR_SWAP_SIZE "swapSize" +#define VAR_TAPE_BLOCKSIZE "tapeBlocksize" +#define VAR_UFS_PATH "ufs" +#define VAR_USR_SIZE "usrSize" +#define VAR_VAR_SIZE "varSize" +#define VAR_SERIAL_SPEED "serialSpeed" + +#define DEFAULT_TAPE_BLOCKSIZE "20" + +/* One MB worth of blocks */ +#define ONE_MEG 2048 /* The help file for the TCP/IP setup screen */ #define TCP_HELPFILE "tcp" @@ -136,7 +172,7 @@ typedef struct _dmenuItem { char *prompt; /* Our prompt */ DMenuItemType type; /* What type of item we are */ void *ptr; /* Generic data ptr */ - u_long parm; /* Parameter for above */ + int parm; /* Parameter for above */ Boolean disabled; /* Are we temporarily disabled? */ char * (*check)(struct _dmenuItem *); /* Our state */ } DMenuItem; @@ -157,13 +193,14 @@ typedef struct _variable { char value[VAR_VALUE_MAX]; } Variable; +/* For attribs */ #define MAX_ATTRIBS 200 -#define MAX_NAME 511 -#define MAX_VALUE 4095 +#define MAX_NAME 64 +#define MAX_VALUE 256 typedef struct _attribs { - char *name; - char *value; + char name[MAX_NAME]; + char value[MAX_VALUE]; } Attribs; typedef enum { @@ -188,7 +225,7 @@ typedef struct _device { DeviceType type; Boolean enabled; Boolean (*init)(struct _device *dev); - int (*get)(struct _device *dev, char *file, Attribs *dist_attrs); + int (*get)(struct _device *dev, char *file, Boolean tentative); Boolean (*close)(struct _device *dev, int fd); void (*shutdown)(struct _device *dev); void *private; @@ -213,11 +250,49 @@ typedef struct _part_info { char newfs_cmd[NEWFS_CMD_MAX]; } PartInfo; +/* An option */ +typedef struct _opt { + char *name; + char *desc; + enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type; + void *data; + void *aux; + char *(*check)(); +} Option; + +/* Weird index nodey things we use for keeping track of package information */ +typedef enum { PACKAGE, PLACE } node_type; /* Types of nodes */ + +typedef struct _pkgnode { /* A node in the reconstructed hierarchy */ + struct _pkgnode *next; /* My next sibling */ + node_type type; /* What am I? */ + char *name; /* My name */ + char *desc; /* My description (Hook) */ + struct _pkgnode *kids; /* My little children */ + void *data; /* A place to hang my data */ +} PkgNode; +typedef PkgNode *PkgNodePtr; + +/* A single package */ +typedef struct _indexEntry { /* A single entry in an INDEX file */ + char *name; /* name */ + char *path; /* full path to port */ + char *prefix; /* port prefix */ + char *comment; /* one line description */ + char *descrfile; /* path to description file */ + char *maintainer; /* maintainer */ +} IndexEntry; +typedef IndexEntry *IndexEntryPtr; + typedef int (*commandFunc)(char *key, void *data); -#define HOSTNAME_FIELD_LEN 256 +#define HOSTNAME_FIELD_LEN 128 #define IPADDR_FIELD_LEN 16 -#define EXTRAS_FIELD_LEN 256 +#define EXTRAS_FIELD_LEN 128 + +/* Verbosity levels for CPIO as expressed by cpio arguments - yuck */ +#define CPIO_VERBOSITY (!strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "low") ? "" : \ + !strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "medium") ? "-V" : "-v") /* This is the structure that Network devices carry around in their private, erm, structures */ typedef struct _devPriv { @@ -242,9 +317,7 @@ extern unsigned int SrcDists; /* Which src distributions we want */ extern unsigned int XF86Dists; /* Which XFree86 dists we want */ extern unsigned int XF86ServerDists; /* The XFree86 servers we want */ extern unsigned int XF86FontDists; /* The XFree86 fonts we want */ -extern unsigned int OptFlags; /* Global options */ extern int BootMgr; /* Which boot manager to use */ -extern char *InstallPrefix; /* A location bias */ extern DMenu MenuInitial; /* Initial installation menu */ @@ -255,6 +328,7 @@ extern DMenu MenuFTPOptions; /* FTP Installation options */ extern DMenu MenuOptions; /* Installation options */ extern DMenu MenuOptionsLanguage; /* Language options menu */ extern DMenu MenuMedia; /* Media type menu */ +extern DMenu MenuMouse; /* Mouse type menu */ extern DMenu MenuMediaCDROM; /* CDROM media menu */ extern DMenu MenuMediaDOS; /* DOS media menu */ extern DMenu MenuMediaFloppy; /* Floppy media menu */ @@ -268,8 +342,8 @@ extern DMenu MenuSysconsKeyrate; /* System console keyrate configuration menu * extern DMenu MenuSysconsSaver; /* System console saver configuration menu */ extern DMenu MenuNetworking; /* Network configuration menu */ extern DMenu MenuInstallCustom; /* Custom Installation menu */ -extern DMenu MenuInstallType; /* Installation type menu */ extern DMenu MenuDistributions; /* Distribution menu */ +extern DMenu MenuSubDistributions; /* Custom distribution menu */ extern DMenu MenuDESDistributions; /* DES distribution menu */ extern DMenu MenuSrcDistributions; /* Source distribution menu */ extern DMenu MenuXF86; /* XFree86 main menu */ @@ -278,17 +352,25 @@ extern DMenu MenuXF86SelectCore; /* XFree86 core distribution menu */ extern DMenu MenuXF86SelectServer; /* XFree86 server distribution menu */ extern DMenu MenuXF86SelectFonts; /* XFree86 font selection menu */ extern DMenu MenuDiskDevices; /* Disk devices menu */ +extern DMenu MenuHTMLDoc; /* HTML Documentation menu */ /*** Prototypes ***/ +/* apache.c */ +extern int configApache(char *str); + +/* anonFTP.c */ +extern int configAnonFTP(char *unused); + /* attrs.c */ -extern const char *attr_match(Attribs *attr, char *name); -extern int attr_parse(Attribs **attr, char *file); +extern char *attr_match(Attribs *attr, char *name); +extern int attr_parse_file(Attribs *attr, char *file); +extern int attr_parse(Attribs *attr, int fd); /* cdrom.c */ extern Boolean mediaInitCDROM(Device *dev); -extern int mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetCDROM(Device *dev, char *file, Boolean tentative); extern void mediaShutdownCDROM(Device *dev); /* command.c */ @@ -299,7 +381,7 @@ extern void command_shell_add(char *key, char *fmt, ...); extern void command_func_add(char *key, commandFunc func, void *data); /* config.c */ -extern void configFstab(void); +extern int configFstab(void); extern void configSysconfig(void); extern void configResolv(void); extern int configPorts(char *str); @@ -313,8 +395,8 @@ extern int crc(int, unsigned long *, unsigned long *); /* decode.c */ extern DMenuItem *decode(DMenu *menu, char *name); -extern Boolean dispatch(DMenuItem *tmp, char *name); -extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names); +extern int dispatch(DMenuItem *tmp, char *name); +extern int decode_and_dispatch_multiple(DMenu *menu, char *names); /* devices.c */ extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)()); @@ -323,11 +405,11 @@ extern Device **deviceFind(char *name, DeviceType type); extern int deviceCount(Device **devs); extern Device *new_device(char *name); extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled, - Boolean (*init)(Device *mediadev), int (*get)(Device *dev, char *file, Attribs *dist_attrs), + Boolean (*init)(Device *mediadev), int (*get)(Device *dev, char *file, Boolean tentative), Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev), void *private); extern Boolean dummyInit(Device *dev); -extern int dummyGet(Device *dev, char *dist, Attribs *dist_attrs); +extern int dummyGet(Device *dev, char *dist, Boolean tentative); extern Boolean dummyClose(Device *dev, int fd); extern void dummyShutdown(Device *dev); @@ -337,6 +419,7 @@ extern int diskPartitionWrite(char *unused); /* dist.c */ extern int distReset(char *str); +extern int distSetCustom(char *str); extern int distSetDeveloper(char *str); extern int distSetXDeveloper(char *str); extern int distSetKernDeveloper(char *str); @@ -356,49 +439,66 @@ extern char *dmenuVarCheck(DMenuItem *item); extern char *dmenuFlagCheck(DMenuItem *item); extern char *dmenuRadioCheck(DMenuItem *item); +/* doc.c */ +extern int docBrowser(char *junk); +extern int docShowDocument(char *str); + /* dos.c */ extern Boolean mediaInitDOS(Device *dev); -extern int mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetDOS(Device *dev, char *file, Boolean tentative); extern void mediaShutdownDOS(Device *dev); /* floppy.c */ extern int getRootFloppy(void); extern Boolean mediaInitFloppy(Device *dev); -extern int mediaGetFloppy(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetFloppy(Device *dev, char *file, Boolean tentative); extern void mediaShutdownFloppy(Device *dev); /* ftp_strat.c */ extern Boolean mediaCloseFTP(Device *dev, int fd); extern Boolean mediaInitFTP(Device *dev); -extern int mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetFTP(Device *dev, char *file, Boolean tentative); extern void mediaShutdownFTP(Device *dev); -extern int mediaSetFtpUserPass(char *str); /* globals.c */ extern void globalsInit(void); +/* index.c */ +int index_get(char *fname, PkgNodePtr papa); +int index_read(int fd, PkgNodePtr papa); +int index_menu(PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll); +void index_init(PkgNodePtr top, PkgNodePtr plist); +void index_node_free(PkgNodePtr top, PkgNodePtr plist); +void index_sort(PkgNodePtr top); +void index_print(PkgNodePtr top, int level); +int index_extract(Device *dev, PkgNodePtr plist); + /* install.c */ extern int installCommit(char *str); extern int installExpress(char *str); -extern Boolean installFilesystems(void); - -/* lang.c */ -extern void lang_set_Danish(char *str); -extern void lang_set_Dutch(char *str); -extern void lang_set_English(char *str); -extern void lang_set_French(char *str); -extern void lang_set_German(char *str); -extern void lang_set_Italian(char *str); -extern void lang_set_Japanese(char *str); -extern void lang_set_Norwegian(char *str); -extern void lang_set_Russian(char *str); -extern void lang_set_Spanish(char *str); -extern void lang_set_Swedish(char *str); +extern int installNovice(char *str); +extern int installFixit(char *str); +extern int installFixup(char *str); +extern int installUpgrade(char *str); +extern int installPreconfig(char *str); +extern int installFilesystems(char *str); +extern int installVarDefaults(char *str); +extern Boolean copySelf(void); +extern Boolean rootExtract(void); + +/* installFinal.c */ +extern int configGated(char *unused); +extern int configSamba(char *unused); +extern int configPCNFSD(char *unused); +extern int configNFSServer(char *unused); /* label.c */ extern int diskLabelEditor(char *str); extern int diskLabelCommit(char *str); +/* lndir.c */ +extern int lndir(char *from, char *to); + /* makedevs.c (auto-generated) */ extern const char termcap_vt100[]; extern const char termcap_cons25[]; @@ -414,6 +514,7 @@ extern const u_char koi8_r2cp866[]; extern u_char default_scrnmap[]; /* media.c */ +extern char *cpioVerbosity(void); extern int mediaSetCDROM(char *str); extern int mediaSetFloppy(char *str); extern int mediaSetDOS(char *str); @@ -423,7 +524,10 @@ extern int mediaSetFTPActive(char *str); extern int mediaSetFTPPassive(char *str); extern int mediaSetUFS(char *str); extern int mediaSetNFS(char *str); -extern Boolean mediaGetType(void); +extern int mediaSetFtpOnError(char *str); +extern int mediaSetFtpUserPass(char *str); +extern int mediaSetCPIOVerbosity(char *str); +extern int mediaGetType(char *str); extern Boolean mediaExtractDist(char *dir, int fd); extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic); extern Boolean mediaExtractDistEnd(int zpid, int cpid); @@ -432,9 +536,13 @@ extern Boolean mediaVerify(void); /* misc.c */ extern Boolean file_readable(char *fname); extern Boolean file_executable(char *fname); +extern Boolean directoryExists(const char *dirname); extern char *string_concat(char *p1, char *p2); +extern char *string_concat3(char *p1, char *p2, char *p3); extern char *string_prune(char *str); extern char *string_skipwhite(char *str); +extern char *string_copy(char *s1, char *s2); +extern char *pathBaseName(const char *path); extern void safe_free(void *ptr); extern void *safe_malloc(size_t size); extern void *safe_realloc(void *orig, size_t size); @@ -458,6 +566,8 @@ extern void msgNotify(char *fmt, ...); extern void msgWeHaveOutput(char *fmt, ...); extern int msgYesNo(char *fmt, ...); extern char *msgGetInput(char *buf, char *fmt, ...); +extern int msgSimpleConfirm(char *); +extern int msgSimpleNotify(char *); /* network.c */ extern Boolean mediaInitNetwork(Device *dev); @@ -465,30 +575,42 @@ extern void mediaShutdownNetwork(Device *dev); /* nfs.c */ extern Boolean mediaInitNFS(Device *dev); -extern int mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetNFS(Device *dev, char *file, Boolean tentative); extern void mediaShutdownNFS(Device *dev); +/* options.c */ +extern int optionsEditor(char *str); + +/* package.c */ +extern int package_add(char *name); +extern int package_extract(Device *dev, char *name); + /* system.c */ extern void systemInitialize(int argc, char **argv); extern void systemShutdown(void); +extern int execExecute(char *cmd, char *name); extern int systemExecute(char *cmd); -extern int systemDisplayFile(char *file); +extern int systemDisplayHelp(char *file); extern char *systemHelpFile(char *file, char *buf); extern void systemChangeFont(const u_char font[]); extern void systemChangeLang(char *lang); -extern void systemChangeTerminal(char *color, const u_char c_termcap[], - char *mono, const u_char m_termcap[]); +extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]); extern void systemChangeScreenmap(const u_char newmap[]); +extern void systemCreateHoloshell(void); extern int vsystem(char *fmt, ...); +extern int docBrowser(char *junk); +extern int docShowDocument(char *str); /* tape.c */ +extern char *mediaTapeBlocksize(void); extern Boolean mediaInitTape(Device *dev); -extern int mediaGetTape(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetTape(Device *dev, char *file, Boolean tentative); extern void mediaShutdownTape(Device *dev); /* tcpip.c */ extern int tcpOpenDialog(Device *dev); extern int tcpMenuSelect(char *str); +extern int tcpInstallDevice(char *str); extern Boolean tcpDeviceSelect(void); /* termcap.c */ @@ -497,11 +619,14 @@ extern int set_termcap(void); /* ufs.c */ extern void mediaShutdownUFS(Device *dev); extern Boolean mediaInitUFS(Device *dev); -extern int mediaGetUFS(Device *dev, char *file, Attribs *dist_attrs); +extern int mediaGetUFS(Device *dev, char *file, Boolean tentative); -/* variables.c */ +/* variable.c */ extern void variable_set(char *var); extern void variable_set2(char *name, char *value); +extern char *variable_get(char *var); +extern void variable_unset(char *var); +extern char *variable_get_value(char *var, char *prompt); /* wizard.c */ extern void slice_wizard(Disk *d); |