diff options
Diffstat (limited to 'samples')
-rwxr-xr-x | samples/copifuncs/copi.ifman1 | 29 | ||||
-rwxr-xr-x | samples/copifuncs/copi.ifmcfg2 | 68 | ||||
-rwxr-xr-x | samples/copifuncs/copi.ifmcfg4 | 30 | ||||
-rwxr-xr-x | samples/copifuncs/copi.ifmcfg5 | 14 | ||||
-rwxr-xr-x | samples/copifuncs/copi.ifpoll1 | 9 | ||||
-rwxr-xr-x | samples/copifuncs/copi.ifreq1 | 20 | ||||
-rwxr-xr-x | samples/copifuncs/copi.rcnews | 79 | ||||
-rwxr-xr-x | samples/copifuncs/copi.sendifm2 | 15 | ||||
-rw-r--r-- | samples/copifuncs/copi.trnrc | 13 | ||||
-rw-r--r-- | samples/copifuncs/ifpatch | 101 | ||||
-rwxr-xr-x | samples/dselect | 11 | ||||
-rw-r--r-- | samples/install/FDISK.TEST | 28 | ||||
-rw-r--r-- | samples/install/makefile.in | 35 | ||||
-rw-r--r-- | samples/install/setup.c | 371 | ||||
-rw-r--r-- | samples/install/setup.help | 49 | ||||
-rwxr-xr-x | samples/menubox11 | 31 | ||||
-rwxr-xr-x | samples/programbox | 7 | ||||
-rwxr-xr-x | samples/programbox2 | 7 | ||||
-rwxr-xr-x | samples/progress | 7 | ||||
-rwxr-xr-x | samples/progress2 | 7 | ||||
-rwxr-xr-x | samples/run_test.sh | 56 | ||||
-rw-r--r-- | samples/setup-edit | 4 | ||||
-rw-r--r-- | samples/setup-tempfile | 4 |
23 files changed, 983 insertions, 12 deletions
diff --git a/samples/copifuncs/copi.ifman1 b/samples/copifuncs/copi.ifman1 new file mode 100755 index 000000000000..3e271a532e29 --- /dev/null +++ b/samples/copifuncs/copi.ifman1 @@ -0,0 +1,29 @@ +#! /usr/bin/perl +# +# This is a utility script to manipulate Fidonet-related issues +# using Eugene Crosser's ifmail package +# +# Version 0.1 +# +# (C) Michael Bravo and The Communication Tube, 1994 +# +# You can do whatever you want with this script. I take no responsibility +# whatsoever in anything related to this script. If you make some useful +# additions to this, please think of sending them to me so I could partake +# of your wisdom. +# +# This script was written to help attaching and requesting files from the +# commandline, much like you do with Squish under DOS or OS/2. It is certainly +# not perfect - I used it as an exercise in Perl. It also probably lacks +# some other useful features, like ability to specify trunc/sent or kill/sent +# attributes etc etc. If you really want this or some other features +# implemented, write me at mbravo@tctube.spb.su or mbravo@octopus.spb.su +# and I will try to do what I can. +# +# Note - files don't get copied to any spool dir, so if you move attached +# files somewhere, they won't get sent. +# +# This script is supposed to read ifmail's config to determine where outbound +# directory and logfile are. The only two parameters to modify in most cases +# are below. + diff --git a/samples/copifuncs/copi.ifmcfg2 b/samples/copifuncs/copi.ifmcfg2 new file mode 100755 index 000000000000..c8a8c03d664a --- /dev/null +++ b/samples/copifuncs/copi.ifmcfg2 @@ -0,0 +1,68 @@ +# Transport programs for mail and news, used by iftoss +sendmail /usr/lib/sendmail -f $F $T +rnews /usr/lib/news/rnews + +# Unpackers, used by ifunpack. +# $F expands to archieve file name +unzip /usr/bin/unzip -oq $F +unarj /usr/bin/unarj e $F +#unarc /usr/bin/unpack $F +unzoo /usr/bin/zoo -extract $F +unlzh /usr/bin/lharc -x $F + +# Packer program, used by ifpack +# $F expands to archieve file name, $P - to list of packet names +packer /usr/bin/zip $F $P + +# Maximum arcmail file size, will start new arcmail file if exceeds +maxfsize 65000 + +# Maximum packet size, ifmail/ifnews will start new packet if exeeds. +# .out files are NOT created if nonzero specified, you must run ifpack +# to make packets out. (unimplemented) +maxpsize 65000 + +# cnews log file and (temporary) database for seen-bys +newslog /usr/lib/news/log +msgidbm /tmp/ifmsgids + +# From this line on, values may be prefixed by a logical expression in +# round brackets. Operators are: '!', '&', '|', 'Xor'. +# Possible elements are: +# - Nodelist flags (like "CM", "MNP", "V32" etc.) +# - speed <operator> <numeric> +# where <operator> is '=', '!=', '<', '>', '<=', '>=' +# - address <wildcard> +# where <wildcard> is an (possibly incomplete) fidonet address, +# e.g. "5020/*" +# - time <interval>[,<interval>,...] +# where <interval> is a day spec. with optional time spec., e.g. +# Wk2000-0900,Sat1800-0000,Sun +# - phone <prefix> +# e.g. "phone 7-095-" + +# Dialing parameters +# of multiple "ModemPort", "ModemReset", "ModemDial", "ModemHangup" lines, +# first matching is used. +# of multiple "PhoneTrans", "ModemConnect", "ModemError" lines, all matching +# are used. +# In send and expect strings, following substitutions are made: +# \\ '\' character +# \r carriage return (0x0d) +# \n new line (0x0a) +# \t tab (0x09) +# \b backspace (0x08) +# \s space (0x20) +# \NNN (where N is an octal digit) - character with octal code NNN +# \d 1 second delay (send strings only) +# \p 1/4 second pause (send strings only) +# \T translated telephone no. (send strings only) +# \D untranslated telephone no. (send strings only) + +# ModemPort present a blank-separated list of ports with possible speed +# extention (separated by colon); if speed is prefixed with 'L', it is +# a "locked" port speed, otherwise it is a maximum speed to be set, while +# actual speed is taken from the nodelist. If speed is omitted (or set +# to zero), previous port speed is not changed. +#ModemPort (time Any0000-0900,Sat,Sun) ttyS0 +#ModemPort cua0:L38400 diff --git a/samples/copifuncs/copi.ifmcfg4 b/samples/copifuncs/copi.ifmcfg4 new file mode 100755 index 000000000000..4cb7a75b1fca --- /dev/null +++ b/samples/copifuncs/copi.ifmcfg4 @@ -0,0 +1,30 @@ +ModemHangup +++ATH\r +ModemOK OK +ModemConnect CONNECT +ModemError BUSY +ModemError NO\sCARRIER +ModemError NO\sDIAL +ModemError RING\r +ModemError ERROR + +# Call options (time, address and nodelist flag dependant) +# All matching are applied in the order they are specified. +# Possible options are "[No]Call", "[No]Hold", "[No]PUA", "[No]EMSI", +# "[No]WaZOO", "[No]Freqs", "[No]Zmodem", "[No]ZedZap", "[No]Janus", +# "[No]Hydra". Here, WaZOO stands for YooHoo/2U2 handshake, not for +# the transfer scheme. FTS-0001 handshake and DietIFNA scheme cannot +# be disallowed (because they are mandatory by standart). "Hold" +# means really hold "hold" type packets and files: do not send them +# if our system initiated the session, "NoHold" means send "hold" +# packets when our system initiated the session. "NoPUA" stands for +# "No PickUp All", i.e. PUP ("Pick Up Primary"). NoCall means do not +# perform outbound call. This flag has no effect on the nodes +# explicitly specified in the command line. +# Default options are "everything allowed". +# options ((!CM) & time Any0700-0200) Nocall +#options (time Any0900-2100 & ! address 2:5020/*) Nocall + +# EMSI data for this node +# From this line on values CANNOT be prefixed with logical expression +# For now, escaping of '}' and ']' unimplemented, try to avoid these +# characters please! diff --git a/samples/copifuncs/copi.ifmcfg5 b/samples/copifuncs/copi.ifmcfg5 new file mode 100755 index 000000000000..8221c1cf160d --- /dev/null +++ b/samples/copifuncs/copi.ifmcfg5 @@ -0,0 +1,14 @@ + +# PhoneTrans lines provide rules to change phone prefixes to make local +# or long-distance calls. In the example below, my country code is 7, +# and local dialing area is 095. From the numbers starting with "7-095-" +# the prefix is stripped and the 7-digit remainder is dialed. For +# the numbers starting with "7-" but not with "7-095-", the country prefix +# "7-" is stripped and the long-distance dialing prefix "8W" substituted. +# For the numbers not matching any of the above, international +# call is performed: international dialing prefix "8W10" is prepended +# to the unmodified 11-digit number. Generally, the syntax is: +# "PhoneTrans <what-to-strip> / <what-to-substitute-instead>" +#PhoneTrans 7-095- / +#PhoneTrans 7- / 8W +#PhoneTrans / 8W10 diff --git a/samples/copifuncs/copi.ifpoll1 b/samples/copifuncs/copi.ifpoll1 new file mode 100755 index 000000000000..812c8e9cd0da --- /dev/null +++ b/samples/copifuncs/copi.ifpoll1 @@ -0,0 +1,9 @@ +#!/bin/sh +# ver 0.7 +# ifpoll, poll my boss node or the node given as argument 1 +# +# i start this shell script every day by crond, but you can +# start it also by hand :) start it as the owner of ifcico. +# rasca, berlin 1993 (Rasca Gmelch, 2:2410/305.4) +# +# where "ifcico" and "ifpack" reside diff --git a/samples/copifuncs/copi.ifreq1 b/samples/copifuncs/copi.ifreq1 new file mode 100755 index 000000000000..637293954bd5 --- /dev/null +++ b/samples/copifuncs/copi.ifreq1 @@ -0,0 +1,20 @@ +#!/usr/bin/perl +$ver = "0.4"; +# +# this perl script is designed for the ifmail package by eugene grosser. +# +# request a file (first argument) from a fido-node (second argument), +# don't forget to quote if you use wildcards, e.g.: + +# ifreq 'files*' 2:2410/305 +# or +# ifreq 'files newfile' 2:2410/305 +# +# this perl script does only add an entry to the corresponding flo-file, +# the mailer ifcico is not started! +# +# rasca, berlin 1994 (rasca@marie.physik.tu-berlin.de, 2:2410/305.4) +# +# multi-zone support added by +# Roland Rosenfeld 15.05.1994 (roland@p13.flokiste.fido.de, 2:2450/300.13) + diff --git a/samples/copifuncs/copi.rcnews b/samples/copifuncs/copi.rcnews new file mode 100755 index 000000000000..957a272ee496 --- /dev/null +++ b/samples/copifuncs/copi.rcnews @@ -0,0 +1,79 @@ +#! /bin/sh +## $Revision: 1.1 $ +## News boot script. + +## =()<. @<_PATH_SHELLVARS>@>()= +. /usr/lib/news/innshellvars + +## Pick ${INND} or ${INNDSTART} +WHAT=${INNDSTART} +## Set to true or false +DOINNWATCH=false +MAIL="${MAILCMD} -s 'Boot-time Usenet warning on `hostname`' ${NEWSMASTER}" + +## RFLAG is set below; set FLAGS as appropriate. +RFLAG="" +FLAGS="-i0 -c0" + +## Clean shutdown? +if [ -f ${SERVERPID} ] ; then + ( echo 'INND: PID file exists -- unclean shutdown!' >/dev/console ) + RFLAG="-r" +fi + +if [ ! -f ${NEWSLIB}/.news.daily ] ; then + echo 'No .news.daily file; need to run news.daily?' | eval ${MAIL} +else + case `find ${NEWSLIB} -name .news.daily -mtime +1 -print 2>/dev/null` in + "") + ;; + *) + echo 'Old .news.daily file; need to run news.daily?' | eval ${MAIL} + ;; + esac +fi + +## Active file recovery. +if [ ! -s ${ACTIVE} ] ; then + if [ -s ${NEWACTIVE} ] ; then + mv ${NEWACTIVE} ${ACTIVE} + else + if [ -s ${OLDACTIVE} ] ; then + cp ${OLDACTIVE} ${ACTIVE} + else + ( echo 'INND: No active file!' >/dev/console ) + exit 1 + fi + fi + RFLAG="-r" + # You might want to rebuild the DBZ database, too: + #echo "cd ${NEWSLIB} \ + # && makehistory -r \ + # && mv history.n.dir history.dir \ + # && mv history.n.pag history.pag" | su ${NEWSUSER} +fi + +## Remove temporary batchfiles and lock files. +( cd ${BATCH} && rm -f bch* ) +( cd ${LOCKS} && rm -f LOCK* ) +( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} ) +rm -f ${NEWSCONTROL} ${NNTPCONNECT} ${SERVERPID} + +## Start the show. +( echo 'Starting innd.' >/dev/console ) +eval ${WHAT} ${RFLAG} ${FLAGS} + +# Gee, looks like lisp, doesn't it? +${DOINNWATCH} && { + echo "( ( sleep 60 ; ${INNWATCH} ) & )" | su ${NEWSUSER} +} + +RMFILE=${MOST_LOGS}/expire.rm +if [ -s ${MOST_LOGS}/expire.rm ] ; then + ( echo "Removing articles from pre-downtime expire run." >/dev/console ) + ( + echo 'System shut down during expire. Unlinking articles listed in' + echo ${RMFILE} + ) | eval ${MAIL} + echo "${NEWSBIN}/expirerm ${RMFILE}" | su ${NEWSUSER} & +fi diff --git a/samples/copifuncs/copi.sendifm2 b/samples/copifuncs/copi.sendifm2 new file mode 100755 index 000000000000..1a34a1fabbc0 --- /dev/null +++ b/samples/copifuncs/copi.sendifm2 @@ -0,0 +1,15 @@ + ${SITE} ${BATCHFILE} + + echo "${PROGNAME}: [$$] end ${SITE}" +done + +case ${HAVE_UUSTAT} in +DONT) + rm -f ${TEMP} + ;; +esac + +## Remove the lock file. +rm -f ${LOCK} + +echo "${PROGNAME}: [$$] end `date`" diff --git a/samples/copifuncs/copi.trnrc b/samples/copifuncs/copi.trnrc new file mode 100644 index 000000000000..7be596f74db6 --- /dev/null +++ b/samples/copifuncs/copi.trnrc @@ -0,0 +1,13 @@ +TRNINIT="-x -e -X -F\" :> \"" +HIDELINE="^X-FTN" +NEWSHEADER="Newsgroups: %(%F=^\$?%C:%F) +Subject: %(%S=^\$?%\"\n\nSubject: \":%S) +%(%R=^\$?:References: %R +)Sender: +Distribution: %(%i=^\$?%\"\nDistribution: \":%D) +Organization: %o +X-Comment-To: %f\n\n" +ATTRIBUTION="%f writes:\n" +YOUSAID="In article %i \n of newsgroup %C you write about \"%s\":\n" +MAILCALL="(New Mail)" +export NEWSHEADER HIDELINE TRNINIT ATTRIBUTION MAILCALL YOUSAID EDITOR diff --git a/samples/copifuncs/ifpatch b/samples/copifuncs/ifpatch new file mode 100644 index 000000000000..1e7c7ee510e8 --- /dev/null +++ b/samples/copifuncs/ifpatch @@ -0,0 +1,101 @@ +--- ifgate/message.c.orig Mon Jul 24 15:17:47 1995 ++++ ifgate/message.c Mon Jul 24 15:18:00 1995 +@@ -48,12 +48,26 @@ + if (!strcasecmp(msg->key,"X-UUCP-From")) return 0; + if (!strcasecmp(msg->key,"X-Body-Start")) return 0; + if (!strncasecmp(msg->key,"X-FTN-",6)) return 0; +- if (!strcasecmp(msg->key,"Path")) return isftnpath(msg->val)?0:1; ++ if (!strcasecmp(msg->key,"Path")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return isftnpath(msg->val)?0:1; ++#endif ++ + if (!strcasecmp(msg->key,"Newsgroups")) return newsmode?0:2; + if (!strcasecmp(msg->key,"Xref")) return 0; + if (!strcasecmp(msg->key,"Return-Receipt-To")) return 1; + if (!strcasecmp(msg->key,"Received")) return newsmode?0:2; +- if (!strcasecmp(msg->key,"From")) return ftnorigin?0:2; ++ if (!strcasecmp(msg->key,"From")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return ftnorigin?0:2; ++#endif ++ + if (!strcasecmp(msg->key,"To")) + { + if (newsmode) return 0; +@@ -66,7 +80,14 @@ + } + if (!strcasecmp(msg->key,"Cc")) return 2; + if (!strcasecmp(msg->key,"Bcc")) return 2; +- if (!strcasecmp(msg->key,"Reply-To")) return 2; ++ if (!strcasecmp(msg->key,"Reply-To")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ + if (!strcasecmp(msg->key,"Lines")) return 0; + if (!strcasecmp(msg->key,"Date")) return 0; + if (!strcasecmp(msg->key,"Subject")) +@@ -77,8 +98,22 @@ + if (!strcasecmp(msg->key,"Organization")) return removeorg?0:1; + if (!strcasecmp(msg->key,"Comment-To")) return 0; + if (!strcasecmp(msg->key,"X-Comment-To")) return 0; +- if (!strcasecmp(msg->key,"Keywords")) return 2; +- if (!strcasecmp(msg->key,"Summary")) return 2; ++ if (!strcasecmp(msg->key,"Keywords")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ ++ if (!strcasecmp(msg->key,"Summary")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ + if (!strcasecmp(msg->key,"MIME-Version")) return removemime?0:1; + if (!strcasecmp(msg->key,"Content-Type")) return removemime?0:1; + if (!strcasecmp(msg->key,"Content-Length")) return removemime?0:1; +@@ -86,8 +121,26 @@ + if (!strcasecmp(msg->key,"Content-Name")) return 2; + if (!strcasecmp(msg->key,"Content-Description")) return 2; + if (!strcasecmp(msg->key,"Message-ID")) return ftnorigin?0:1; +- if (!strcasecmp(msg->key,"References")) return removeref?0:1; +- if (!strcasecmp(msg->key,"Distribution")) return ftnorigin?0:1; ++ if (!strcasecmp(msg->key,"References")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return removeref?0:1; ++#endif ++ ++ if (!strcasecmp(msg->key,"Distribution")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return ftnorigin?0:1; ++#endif ++ ++#ifdef LESS_RFC_KLUDGES ++ if (!strcasecmp(msg->key,"NNTP-Posting-Host")) return 0; ++#endif ++ + /*if (!strcasecmp(msg->key,"")) return ;*/ + return 1; + } diff --git a/samples/dselect b/samples/dselect new file mode 100755 index 000000000000..9da035dab95d --- /dev/null +++ b/samples/dselect @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: dselect,v 1.7 2016/01/26 22:52:53 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a file" "$@" --dselect $HOME/ 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/samples/install/FDISK.TEST b/samples/install/FDISK.TEST new file mode 100644 index 000000000000..2ad568a62d7b --- /dev/null +++ b/samples/install/FDISK.TEST @@ -0,0 +1,28 @@ + +Disk /dev/hda: 14 heads, 62 sectors, 1018 cylinders +Units = cylinders of 868 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/hda1 1 1 3 1271 a OS/2 Boot Manager +/dev/hda2 4 4 287 123256 6 DOS 16-bit >=32M +/dev/hda3 * 288 288 649 157108 83 Linux native +/dev/hda4 650 650 1018 160146 83 Linux native + +Disk /dev/sda: 64 heads, 32 sectors, 511 cylinders +Units = cylinders of 2048 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/sda1 1 1 21 21488 82 Linux swap +/dev/sda2 22 22 511 501760 83 Linux native + +Disk /dev/sdb: 64 heads, 32 sectors, 4106 cylinders +Units = cylinders of 2048 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/sdb1 1 1 201 205808 83 Linux native +/dev/sdb2 202 202 402 205824 83 Linux native +/dev/sdb3 403 403 603 205824 83 Linux native +/dev/sdb4 604 604 4106 3587072 5 Extended +/dev/sdb5 604 604 1803 1228784 83 Linux native +/dev/sdb6 1024 1804 3003 1228784 83 Linux native +/dev/sdb7 2048 3004 4106 1129456 83 Linux native diff --git a/samples/install/makefile.in b/samples/install/makefile.in new file mode 100644 index 000000000000..3dcdc09ba2c5 --- /dev/null +++ b/samples/install/makefile.in @@ -0,0 +1,35 @@ +# $Id: makefile.in,v 1.1 2000/10/08 17:22:53 tom Exp $ +# template makefile for DIALOG sample 'install' +# +SHELL = /bin/sh + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +srcdir = @srcdir@ +top_builddir = ../.. + +DESTDIR = +bindir = $(DESTDIR)@bindir@ + +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ @DEFS@ -I$(top_builddir) -I$(srcdir)/../.. -I. -I$(srcdir) +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +CC = @CC@ +LDFLAGS = @LDFLAGS@ +LIBS = -L../.. -ldialog @LIBS@ +RANLIB = @RANLIB@ + +RM = rm -f + +all: setup + +setup: setup.o + $(CC) -o $@ setup.o $(LIBS) + +clean: + rm -f *.o setup + +test: setup + ./setup + diff --git a/samples/install/setup.c b/samples/install/setup.c new file mode 100644 index 000000000000..ae569813e865 --- /dev/null +++ b/samples/install/setup.c @@ -0,0 +1,371 @@ +/* Copyright (C) 1995 Florian La Roche */ +/* Who wants to help coding? I don't like doing this... */ + +/* You can just start setup as normal user and see how far it is coded + right now. This will do a fake installation and won't actually chnage + any data on your computer. */ + +/* TODO: write a good package selection code + change functions to return better error code + */ + +/* Show an extra text-box with the contents of all external commands, + before they are executed. So you can abort the installation, if any + wrong commands are to be executed. (So don't format wrong partition.) */ +#define VERBOSE 1 + +/* If defined, don't actually execute any comands and don't actually modify + any files. So you can test any possible installation without doing any + damage to your computer. + The file FDISK.TEST is used instead of real "fdisk -l" output, so that + it can be started as normal user. */ +#define DEBUG_THIS 1 + +#include <dialog.h> + +/* max length of a partition name like e.g. '/dev/hda1' */ +#define MAX_DEV_NAME 25 + +/* max number of possible Linux/Swap/MsDos partitions */ +#define MAX_PARTS 20 + +char *progname = NULL; + +static void +error(const char *s) +{ + fprintf(stderr, "%s: %s\n", progname, s); + exit(1); +} + +static int +my_system(const char *s,...) +{ + int ret, i; + va_list ap; + char sh[200]; + + va_start(ap, s); + vsprintf(sh, s, ap); + va_end(ap); + +#ifdef VERBOSE + i = dialog_msgbox("I will run the following command:", sh, 10, 65, 1); + dialog_clear(); +#ifdef DEBUG_THIS + return 0; +#endif +#endif + ret = system(sh); + if (!(ret >> 8)) + return 0; + i = dialog_msgbox("Error-Exit on the following command:", + sh, 12, 73, 1); + dialog_clear(); + return 1; +} + +/* We support to install from DOS/Linux-partitions. */ +enum partition_type { + MsDos, + Linux, + Swap +}; + +struct partition { + enum partition_type type; + char name[MAX_DEV_NAME]; + int blocks; + int flag; +} partitions[MAX_PARTS]; +int num_partition = 0; +int num_linux = 0; +int num_swap = 0; +int num_msdos = 0; + +static int +get_line(char *line, int size, FILE * f) +{ + char *ptr = line; + int c; + + if (feof(f)) + return -1; + while (size-- && ((c = getc(f)) != EOF) && (c != '\n')) + *ptr++ = c; + *ptr++ = '\0'; + return (int) (ptr - line); +} + +static void +read_partitions(void) +{ + FILE *f; + char line[200]; + int length; +#ifndef DEBUG_THIS + int ret = system("fdisk -l 2>/dev/null 1>/tmp/fdisk.output"); + if ((ret >> 8) != 0) { + error("fdisk didn't run"); + } + if ((f = fopen("/tmp/fdisk.output", "r")) == NULL) +#else + if ((f = fopen("FDISK.TEST", "r")) == NULL) +#endif + error("cannot read fdisk output"); + + while (num_partition <= MAX_PARTS + && (length = get_line(line, 200, f)) >= 0) { + if (strncmp(line, "/dev/", 5) == 0) { + int n = 0; + char *s = line + 5; + char *t = partitions[num_partition].name; + strcpy(t, "/dev/"); + t += 5; + while (n < MAX_DEV_NAME && *s != '\0' + && !isspace((unsigned char) *s)) { + *t++ = *s++; + n++; + } + *t = '\0'; + /* Read the size of the partition. */ + t = line + 37; + while (isspace((unsigned char) *t)) + t++; + partitions[num_partition].blocks = atoi(t); + if (strstr(line, "Linux native")) { + partitions[num_partition].type = Linux; + num_partition++; + num_linux++; + } else if (strstr(line, "Linux swap")) { + partitions[num_partition].type = Swap; + num_partition++; + num_swap++; + } else if (strstr(line, "DOS")) { + partitions[num_partition].type = MsDos; + num_partition++; + num_msdos++; + } + } + } + fclose(f); +#ifndef DEBUG_THIS + unlink("/tmp/fdisk.output"); +#endif +} + +static int +select_partition(const char *title, const char *prompt, int y, int x) +{ + int i, num, ret; + char info[MAX_PARTS][40]; + char *items[MAX_PARTS * 2]; + int num_pa[MAX_PARTS]; + + num = 0; + for (i = 0; i < num_partition; i++) { + if (partitions[i].type == Linux) { + items[num * 2] = partitions[i].name; + sprintf(info[num], "Linux partition with %d blocks", + partitions[i].blocks); + items[num * 2 + 1] = info[num]; + num_pa[num] = i; + num++; + } + } + ret = dialog_menu(title, prompt, y + num, x, num, num, items); + dialog_clear(); + if (ret >= 0) /* item selected */ + ret = num_pa[ret]; + return ret; +} + +static int +select_install_partition(void) +{ + return select_partition("Select Install Partition", + "\\nWhere do you want to install Linux?\\n", 9, 60); +} + +static int +select_source_partition(void) +{ + return select_partition("Select Source Partition", + "\\nOn which partition is the source?\\n", 9, 60); +} + +const char *null = ">/dev/null 2>/dev/null"; +const char *install_partition = NULL; + +static void +extract_packages(const char *source_path) +{ +#ifndef DEBUG_THIS + FILE *f; +#endif + + if (my_system("mkdir -p /install/var/installed/packages %s", null)) + return; + if (my_system("cd /install; for i in /source%s/*.tgz; do " + "tar xzplvvkf $i >> var/installed/packages/base " + "2>>var/installed/packages/ERROR; done", source_path)) + return; +#ifndef DEBUG_THIS + if ((f = fopen("/install/etc/fstab", "w")) == NULL) { + /* i = */ dialog_msgbox("Error", "Cannot write /etc/fstab", + 12, 40, 1); + return; + } + fprintf(f, "%s / ext2 defaults 1 1\n", install_partition); + fprintf(f, "none /proc proc defaults 0 2\n"); + /* XXX write swap-partitions */ + fclose(f); +#endif +} + +static void +install_premounted(void) +{ + extract_packages(""); +} + +static void +install_harddisk(void) +{ + const char *name; + int part, ret; + + if ((part = select_source_partition()) <= -1) + return; + name = partitions[part].name; + + if (my_system("mount -t ext2 %s /source %s", name, null)) + return; + ret = dialog_inputbox("Path in partition", + "Please enter the directory in which the " + "source files are.", 13, 50, "", FALSE); + dialog_clear(); + if (ret != 0) + return; + /* XXX strdup */ + extract_packages(strdup(dialog_input_result)); + if (my_system("umount /source %s", null)) + return; +} + +static void +install_nfs(void) +{ + if (my_system("ifconfig eth0 134.96.81.36 netmask 255.255.255.224 " + "broadcast 134.96.81.63 %s", null)) + return; + if (my_system("route add -net 134.96.81.32 %s", null)) + return; + if (my_system("mount -t nfs 134.96.81.38:" + "/local/ftp/pub/linux/ELF.binary/tar /source %s", null)) + return; + extract_packages("/base"); + if (my_system("umount /source %s", null)) + return; + if (my_system("ifconfig eth0 down %s", null)) + return; +} + +static void +main_install(void) +{ + int part, ret; + const char *name; + char *items1[] = + { + "1", "Harddisk Install", + "2", "Network Install(NFS)", + "3", "Premounted on /source" + }; + + if (num_linux == 0) { + /* XXX */ + return; + } + if ((part = select_install_partition()) <= -1) + return; + install_partition = name = partitions[part].name; + if (my_system("mke2fs %s %s", name, null)) + return; + if (my_system("mount -t ext2 %s /install %s", name, null)) + return; + ret = dialog_menu("Choose install medium", + "\\nPlease say from where you want to install.\\n", + 12, 62, 3, 3, items1); + dialog_clear(); + switch (ret) { + case 0: + install_harddisk(); + break; + case 1: + install_nfs(); + break; + case 2: + install_premounted(); + break; + case -2: /* cancel */ + case -1: + break; /* esc */ + } + if (my_system("umount /install %s", null)) + return; +} + +int +main(int argc, char **argv) +{ + int stop = 0; + int ret; + char *items1[] = + { + "1", "Display a help text", + "2", "Start an installation", + "3", "Exit to the shell" + }; + + progname = argv[0]; + + read_partitions(); + if (num_linux == 0) { + printf("\n\nPlease start \"fdisk\" or \"cfdisk\" and create a" + "\nnative Linux-partition to install Linux on.\n\n"); + exit(1); + } + + init_dialog(); + + while (!stop) { + ret = dialog_menu("Linux Install Utility", + "\\nCopyright (C) 1995 Florian La Roche\\n" + "\\nPre-Alpha version, be careful, read the doc!!!" + "\\nemail: florian@jurix.jura.uni-sb.de, " + "flla@stud.uni-sb.de\\n", + 15, 64, 3, 3, items1); + dialog_clear(); + switch (ret) { + case 0: + ret = dialog_textbox("Help Text", + "setup.help", 20, 70); + dialog_clear(); + break; + case 1: + main_install(); + break; + case 2: + stop = 1; + break; + case -2: /* cancel */ + case -1: + stop = 1; /* esc */ + } + } + end_dialog(); + printf("\nExecute \"reboot\" to restart your computer...\n"); + + exit(0); +} diff --git a/samples/install/setup.help b/samples/install/setup.help new file mode 100644 index 000000000000..7ac8369d4e6e --- /dev/null +++ b/samples/install/setup.help @@ -0,0 +1,49 @@ +At the moment, only installation from a harddisk +is supported. All commands are shown to you on +the screen before executing. This is just to make +sure that nothing bad is done to your harddisk :-) + +You can also select to install from a premounted dir. +Then the "tar/base" directory must be mounted on +"/install", so that all tar-packages from the basic +stuff are in "/install/*.tgz". (So you could be able +to install via NFS...) + +Good luck..., +anyone wants to help programming this tool?, + +Florian La Roche + +Contents: +========= +- overview about what "setup" does. +- creating a Linux-partition before starting "setup" +- about lilo +- how to use "setup", what keys are supported + +What does "setup" do on my computer? +==================================== +Setup will ask you for a partition on your harddisk, +where you would like to have Linux installed. +You can then choose to install this distribution from +your local harddisk or via network (NFS). +setup will install a very basic system. +At the end, you can install lilo, the Linux Loader. +Rebooting your computer with this little linux system +and then runing the setup-program on it, will give +the possibility to install more packages. + +Creating a Linux-partition: +=========================== +To install this Linux distribution, you need to +create an extra partition on your harddisk for +Linux. + +What is lilo and how should I install it? +========================================= +Read the lilo-documentation for this... + + + +Florian La Roche + diff --git a/samples/menubox11 b/samples/menubox11 new file mode 100755 index 000000000000..4f275226b4b4 --- /dev/null +++ b/samples/menubox11 @@ -0,0 +1,31 @@ +#!/bin/sh +# $Id: menubox11,v 1.2 2018/06/13 21:59:21 tom Exp $ +# zero-width column + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --backtitle "Debian Configuration" \ + --title "Configuring debconf" \ + --default-item Dialog "$@" \ + --menu "Packages that use debconf for configuration share a common look and feel. You can +select the type of user interface they use. +\n\n\ +The dialog frontend is a full-screen, character based interface, while the readline +frontend uses a more traditional plain text interface, and both the gnome and kde +frontends are modern X interfaces, fitting the respective desktops (but may be used +in any X environment). The editor frontend lets you configure things using your +favorite text editor. The noninteractive frontend never asks you any questions. +\n\n\ +Interface to use:" 0 0 6 \ + Dialog "" \ + Readline "" \ + Gnome "" \ + Kde "" \ + Editor "" \ + Noninteractive "" \ +2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/samples/programbox b/samples/programbox index 9fa0abc82000..afa29e1b3f9a 100755 --- a/samples/programbox +++ b/samples/programbox @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: programbox,v 1.1 2011/03/02 01:17:28 tom Exp $ +# $Id: programbox,v 1.3 2018/06/17 20:45:25 tom Exp $ . ./setup-vars @@ -11,9 +11,12 @@ while true do read text test -z "$text" && break -ls -ld "$text" +ls -ld "$text" || break sleep 0.1 done <$tempfile ) | $DIALOG --title "PROGRAMBOX" "$@" --programbox 20 70 + +retval=$? +. ./report-button diff --git a/samples/programbox2 b/samples/programbox2 index 63f87df276b2..d55c497b64c1 100755 --- a/samples/programbox2 +++ b/samples/programbox2 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: programbox2,v 1.1 2011/03/02 01:25:31 tom Exp $ +# $Id: programbox2,v 1.3 2018/06/17 20:45:25 tom Exp $ . ./setup-vars @@ -11,9 +11,12 @@ while true do read text test -z "$text" && break -ls -ld "$text" +ls -ld "$text" || break sleep 0.1 done <$tempfile ) | $DIALOG --title "PROGRAMBOX" "$@" --programbox "ProgramBox" 20 70 + +retval=$? +. ./report-button diff --git a/samples/progress b/samples/progress index 6ad45d8b04c6..a416909cce35 100755 --- a/samples/progress +++ b/samples/progress @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: progress,v 1.5 2010/01/13 10:20:03 tom Exp $ +# $Id: progress,v 1.7 2018/06/17 20:45:25 tom Exp $ . ./setup-vars @@ -11,9 +11,12 @@ while true do read text test -z "$text" && break -ls -ld "$text" +ls -ld "$text" || break sleep 1 done <$tempfile ) | $DIALOG --title "PROGRESS" "$@" --progressbox 20 70 + +retval=$? +. ./report-button diff --git a/samples/progress2 b/samples/progress2 index 564433b1c379..f4bdb3cae80b 100755 --- a/samples/progress2 +++ b/samples/progress2 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: progress2,v 1.5 2010/01/13 10:20:03 tom Exp $ +# $Id: progress2,v 1.7 2018/06/17 20:45:25 tom Exp $ . ./setup-vars @@ -11,9 +11,12 @@ while true do read text test -z "$text" && break -ls -ld "$text" +ls -ld "$text" || break sleep 1 done <$tempfile ) | $DIALOG --title "PROGRESS" "$@" --progressbox "This is a detailed description\nof the progress-box." 20 70 + +retval=$? +. ./report-button diff --git a/samples/run_test.sh b/samples/run_test.sh new file mode 100755 index 000000000000..ea9da2935293 --- /dev/null +++ b/samples/run_test.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# $Id: run_test.sh,v 1.4 2017/02/01 01:50:09 tom Exp $ +# vile:ts=4 sw=4 +THIS=`basename $0` + +if [ -z "$DIALOG" ] +then + have= + want=dialog + for p in . .. ../bin + do + prog=$p/$want + [ -f $prog ] || continue + if [ -x $prog ] + then + have=$prog + break + fi + done + + if [ -z "$have" ] + then + echo "? did not find $want" >&2 + exit + fi + + DIALOG=$have + export DIALOG +fi + +want=`basename $DIALOG` + +DIALOGOPTS="$DIALOGOPTS --trace $want.log" +export DIALOGOPTS + +mylog=run_test.log +cat >$mylog <<EOF +** `date` +EOF + +for name in "$@" +do + [ -f "$name" ] || continue + [ -x "$name" ] || continue + # skip this script and known utility-scripts + case `basename $name` in + $THIS|dft-*|killall|listing|rotated-data|shortlist|with-*) + echo "** skipping $name" >>$mylog + continue + ;; + esac + rm -f trace $want.log $name.log + echo "** running $name" >>$mylog + $name + [ -f $want.log ] && cp $want.log $name.log +done diff --git a/samples/setup-edit b/samples/setup-edit index 8f9d284220f4..d244397b1bdd 100644 --- a/samples/setup-edit +++ b/samples/setup-edit @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: setup-edit,v 1.2 2012/06/29 09:31:49 tom Exp $ +# $Id: setup-edit,v 1.3 2016/01/26 22:42:44 tom Exp $ # vile:shmode input=`tempfile 2>/dev/null` || input=/tmp/input$$ output=`tempfile 2>/dev/null` || output=/tmp/test$$ -trap "rm -f $input $output" $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM +trap "rm -f $input $output" $SIG_NONE $SIG_HUP $SIG_INT $SIG_QUIT $SIG_TERM diff --git a/samples/setup-tempfile b/samples/setup-tempfile index 3a67ea625986..b00106c29c7e 100644 --- a/samples/setup-tempfile +++ b/samples/setup-tempfile @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: setup-tempfile,v 1.3 2012/07/06 17:51:56 tom Exp $ +# $Id: setup-tempfile,v 1.4 2016/01/26 22:42:47 tom Exp $ # vile:shmode tempfile=`(tempfile) 2>/dev/null` || tempfile=/tmp/test$$ -trap "rm -f $tempfile" 0 $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM +trap "rm -f $tempfile" 0 $SIG_NONE $SIG_HUP $SIG_INT $SIG_QUIT $SIG_TERM |