Some cleanup done.

Include bteasy, bootsd, sdboot and termcap entries using file2.c

Remove all traces of "termcap.small".

The policy in this program regarding termcap is:

| If $TERM is set
| 	do nothing special, rely on usual termcap.
| else
| 	use compiled in (via file2c) termcap entries
This commit is contained in:
phk 1995-01-29 02:31:38 +00:00
parent b4abec3d5e
commit 7199f4d8dc
6 changed files with 59 additions and 127 deletions

View File

@ -12,12 +12,33 @@ CFLAGS += -Wall -g -static
LDADD = -ldialog -lncurses -lmytinfo
DPADD = ${LIBDIALOG} ${LIBNCURSES} ${LIBMYTINFO}
makedevs.c: dev2c.sh
makedevs.c: dev2c.sh Makefile
mkdir -p dev
cp ${.CURDIR}/../../etc/etc.i386/MAKEDEV dev
( cd dev; sh ./MAKEDEV all )
sh ${.CURDIR}/dev2c.sh dev > makedevs.c
sh ${.CURDIR}/dev2c.sh dev > makedevs.tmp
rm -rf dev
uudecode < ${.CURDIR}/bteasy17.uu
file2c 'const char boot0[] = {' '};' < \
bteasy17 \
>> makedevs.tmp
rm -rf bteasy17
file2c 'const char boot1[] = {' '};' < \
../../sys/i386/boot/biosboot/boot1 \
>> makedevs.tmp
file2c 'const char boot2[] = {' '};' < \
../../sys/i386/boot/biosboot/boot2 \
>> makedevs.tmp
tset -Q -S cons25 | sed 's/^.* //' | \
file2c 'const char termcap_cons25[] = {' ',0};' \
>> makedevs.tmp
tset -Q -S cons25-m | sed 's/^.* //' | \
file2c 'const char termcap_cons25_m[] = {' ',0};' \
>> makedevs.tmp
tset -Q -S vt100 | sed 's/^.* //' | \
file2c 'const char termcap_vt100[] = {' ',0};' \
>> makedevs.tmp
mv makedevs.tmp makedevs.c
.include <bsd.prog.mk>

View File

@ -0,0 +1,15 @@
begin 664 bteasy17
M,\".P([8CM"\`'S\B_2_``:Y``'RI>I@!@``B]58HD@'/#5T'+00]N0%K@26
M]D0$_W0^Q@2`Z-H`BG0!BTP"ZPCHSP"Y`0`RT;L`?+@!`LT3<AZ!O_X!5:IU
M%NH`?```@/J!=`*R@(OJ0H#RLX@6.@>_O@>Y!`#&!BT',3+VB"V*100\`'0C
M/`5T'_[&OBH'Z'$`OD@'1D:+'`K_=`4R?01U\XVW<@?H6@"#QQ#^!BT'XLN`
M/G4$`G0+OCL'"O9U"LT8ZZR^*@?H.0#H-@`RY,T:B]J#PV"T`<T6M`!U"\T:
M.]-R\J!(!^L*S1:*Q#P<=/,$]CPQ<M8\-7?24+XH![L;!E/\K%`D?[0.S1!8
MJ(!T\L-6N`$#NP`&N0$`,O;-$U[&!D@'/\,-B@T*1C`@+B`N("Z@9&ES:R`Q
M#0H*1&5F875L=#H@1C^@``$`!``&`P<'"@IC#F0.912`%($9@AZ3)*4GGRMU
M+U(OVS)`-_(]`&1O\TA01M-/<[)5;FGX3F]V96SL36EN:?A,:6YU^$%M;V5B
MX4)3Q$)31.E00TG80U#-5F5N:?A$;W-S9>,_OP``````````````````````
M````````````````````````````````````````````````````````````
1````````````````````5:H`
`
end

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: main.c,v 1.17.2.1 1994/11/21 03:12:06 phk Exp $
* $Id: main.c,v 1.18 1994/12/27 23:26:51 jkh Exp $
*
*/
@ -61,6 +61,9 @@ main(int argc, char **argv)
ioctl(0,TIOCSCTTY,(char *)NULL);
setlogin("root");
debug_fd = open("/dev/ttyv1",O_WRONLY);
setbuf(stdin,0);
setbuf(stdout,0);
setbuf(stderr,0);
} else {
debug_fd = open("sysinstall.debug",
O_WRONLY|O_CREAT|O_TRUNC,0644);

View File

@ -17,11 +17,6 @@
#include <dialog.h>
#include <fcntl.h>
#ifdef __i386__ /* temp measure delete nov 15 1994 */
#define i386 1
#else
#warning FOO
#endif
#include <sys/types.h>
#include <sys/disklabel.h>
#include <sys/uio.h>
@ -33,36 +28,6 @@ extern struct mbr *mbr;
extern int inst_part;
extern int whole_disk;
/*
* Guess what ? This is bteasy-1.7... didn't used to look this way, did it ?
* Written by Serge Vakulenko, <vak@kiae.su>
*/
static unsigned char bootcode[] = {
51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,4,
150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,232,
207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,85,170,
117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,179,136,
22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,60,0,116,
35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,10,255,
116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,7,226,
203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,42,
7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,0,
117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,243,
4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,36,
127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,50,
246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,160,
100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,160,
0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,36,
165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,211,
79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,76,
105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,85,170 };
struct part_type part_types[] = PARTITION_TYPES
char *
@ -118,13 +83,14 @@ void
write_bootcode(int fd)
{
u_char buf[512];
extern const char boot0[];
if (lseek(fd, 0, SEEK_SET) == -1)
AskAbort("Couldn't seek for master boot record read\n");
if (read(fd, buf, 512) != 512) {
AskAbort("Failed to read master boot record\n");
}
memcpy(buf, bootcode, DOSPARTOFF);
memcpy(buf, boot0, DOSPARTOFF);
buf[510] = 0x55;
buf[511] = 0xaa;
if (lseek(fd, 0, SEEK_SET) == -1)
@ -138,33 +104,14 @@ write_bootcode(int fd)
int
WriteBootblock(int dfd,struct disklabel *label,struct dos_partition *dospart)
{
int fd;
off_t of = label->d_partitions[OURPART].p_offset;
u_char bootblocks[BBSIZE];
extern const char boot1[];
extern const char boot2[];
Debug("Loading boot code from %s", BOOT1);
memcpy(bootblocks, boot1, MBRSIZE);
fd = open(BOOT1, O_RDONLY);
if (fd < 0)
Fatal("Couldn't open boot file %s\n", BOOT1);
if (read(fd, bootblocks, MBRSIZE) < 0)
Fatal("Couldn't read from boot file %s\n", BOOT1);
if (close(fd) == -1)
Fatal("Couldn't close boot file %s\n", BOOT1);
Debug("Loading boot code from %s", BOOT2);
fd = open(BOOT2, O_RDONLY);
if (fd < 0)
Fatal("Couldn't open boot file %s", BOOT2);
if (read(fd, &bootblocks[MBRSIZE], (int)(label->d_bbsize - MBRSIZE)) < 0)
Fatal("Couldn't read from boot file %s\n", BOOT2);
if (close(fd) == -1)
Fatal("Couldn't close boot file %s", BOOT2);
memcpy(&bootblocks[MBRSIZE], boot2, (int)(label->d_bbsize - MBRSIZE));
bcopy(dospart, &bootblocks[DOSPARTOFF],
sizeof(struct dos_partition) * NDOSPART);

View File

@ -14,9 +14,6 @@
#define TITLE "FreeBSD 2.0-950128-SNAP Install"
#define BOOT1 "/stand/sdboot"
#define BOOT2 "/stand/bootsd"
#define MAX_NO_DISKS 10
#define MAX_NO_FS 30
#define MAXFS MAX_NO_FS

View File

@ -21,87 +21,36 @@
#include "sysinstall.h"
static char color_termcap[] = "\
:pa#64:Co#8:Sf=\\E[3%dm:Sb=\\E[4%dm:op=\\E[37;40m:md=\\E[1m:mh=\\E[30;1m:";
static char color_entry[] = "\
cons25|ansis|ansi80x25:";
static char mono_termcap[] = "\
:us=\E[4m:ue=\E[m:";
static char mono_entry[] = "\
cons25-m|ansis-mono|ansi80x25-mono:";
static char common_termcap[] = "\
:ac=l\\332m\\300k\\277j\\331u\\264t\\303v\\301w\\302q\\304x\\263n\\305`^Da\\260f\\370g\\361~\\371.^Y-^Xh\\261I^U0\\333y\\363z\\362:\
:al=\\E[L:am:bs:NP:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:co#80:\
:dc=\\E[P:dl=\\E[M:do=\\E[B:bt=\\E[Z:ho=\\E[H:ic=\\E[@:li#25:cb=\\E[1K:\
:ms:nd=\\E[C:pt:rs=\\E[x\\E[m\\Ec:so=\\E[7m:se=\\E[m:up=\\E[A:\
:k1=\\E[M:k2=\\E[N:k3=\\E[O:k4=\\E[P:k5=\\E[Q:k6=\\E[R:k7=\\E[S:k8=\\E[T:\
:k9=\\E[U:k;=\\E[V:F1=\\E[W:F2=\\E[X:K2=\\E[E:nw=\\E[E:ec=\\E[%dX:\
:kb=^H:kh=\\E[H:ku=\\E[A:kd=\\E[B:kl=\\E[D:kr=\\E[C:\
:le=^H:eo:sf=\\E[S:sr=\\E[T:\
:kN=\\E[G:kP=\\E[I:@7=\\E[F:kI=\\E[L:kD=\\E[K:kB=\\E[Z:\
:IC=\\E[%d@:DC=\\E[%dP:SF=\\E[%dS:SR=\\E[%dT:AL=\\E[%dL:DL=\\E[%dM:\
:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:cv=\\E[%i%dd:ch=\\E[%i%d`:bw:\
:mb=\\E[5m:mr=\\E[7m:me=\\E[m:bl=^G:ut:it#8:";
static int
emergency(int color)
{
char tempbuf[sizeof(common_termcap)+sizeof(color_termcap)+sizeof(mono_entry)];
strcpy(tempbuf, color ? color_entry : mono_entry);
strcat(tempbuf, common_termcap);
strcat(tempbuf, color ? color_termcap : mono_termcap);
if (setenv("TERMCAP", tempbuf, 1) < 0)
return -1;
return 0;
}
int
set_termcap()
{
char *term;
extern const char termcap_vt100[];
extern const char termcap_cons25[];
extern const char termcap_cons25_m[];
term = getenv("TERM");
if (term == NULL) {
int color_display, no_termcap = 0;
if (access("/etc/termcap.small",R_OK)) {
no_termcap = 1;
} else if (setenv("TERMCAP", "/etc/termcap.small", 1) < 0)
no_termcap = 1;
int color_display;
if (ioctl(STDERR_FILENO, GIO_COLOR, &color_display) < 0) {
char buf[64];
int len;
/* serial console */
if (no_termcap)
if (setenv("TERM", "vt100", 1) < 0)
return -1;
fprintf(stderr, "Enter your terminal type (must be present in /etc/termcap.small): ");
if (fgets(buf, sizeof(buf), stdin) == NULL)
return -1;
len = strlen(buf);
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = '\0';
if (setenv("TERM", buf, 1) < 0)
if (setenv("TERMCAP", termcap_vt100, 1) < 0)
return -1;
} else if (color_display) {
/* color console */
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
} else {
/* mono console */
if (setenv("TERM", "cons25-m", 1) < 0)
return -1;
}
if (no_termcap) {
if (emergency(color_display) < 0)
if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
return -1;
}
}
printf("TERM=%s\n",getenv("TERM"));
printf("TERMCAP=%s\n",getenv("TERMCAP"));
return 0;
}