From b8cdd104fecd5ae0a20bd703ad2a781e288b6255 Mon Sep 17 00:00:00 2001 From: Alan Mizrahi Date: Mon, 6 Nov 2006 11:17:47 -0400 Subject: [PATCH] fgetty: initial commit --- fgetty/.footprint | 7 +++ fgetty/.md5sum | 2 + fgetty/Pkgfile | 19 ++++++++ fgetty/README | 13 +++++ fgetty/fgetty-0.6.patch | 104 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 fgetty/.footprint create mode 100644 fgetty/.md5sum create mode 100644 fgetty/Pkgfile create mode 100644 fgetty/README create mode 100644 fgetty/fgetty-0.6.patch diff --git a/fgetty/.footprint b/fgetty/.footprint new file mode 100644 index 000000000..80f8ec433 --- /dev/null +++ b/fgetty/.footprint @@ -0,0 +1,7 @@ +drwxr-xr-x root/root bin/ +drwxr-xr-x root/root sbin/ +-rwxr-xr-x root/root sbin/fgetty +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/man/ +drwxr-xr-x root/root usr/man/man8/ +-rw-r--r-- root/root usr/man/man8/fgetty.8.gz diff --git a/fgetty/.md5sum b/fgetty/.md5sum new file mode 100644 index 000000000..83245ce53 --- /dev/null +++ b/fgetty/.md5sum @@ -0,0 +1,2 @@ +4cf5326af47b835354c6fac97c361d2e fgetty-0.6.patch +399dd207805b75ea99ed814943d71c60 fgetty-0.6.tar.bz2 diff --git a/fgetty/Pkgfile b/fgetty/Pkgfile new file mode 100644 index 000000000..fe7b8be81 --- /dev/null +++ b/fgetty/Pkgfile @@ -0,0 +1,19 @@ +# $Id: $ +# Description: Small getty for Linux +# URL: http://www.fefe.de/fgetty/ +# Maintainer: Alan Mizrahi, alan at mizrahi dot com dot ve +# Depends on: dietlibc + +name=fgetty +version=0.6 +release=1 +source=(http://www.fefe.de/$name/$name-$version.tar.bz2 $name-$version.patch) + +build() { + cd $name-$version + patch -p1 < ../$name-$version.patch + make DIET="/usr/dietlibc/bin/diet" + mkdir -p $PKG/usr/man/man8 + make DESTDIR=$PKG install + rm -f $PKG/bin/{login1,login2,checkpassword.login} +} diff --git a/fgetty/README b/fgetty/README new file mode 100644 index 000000000..41a128922 --- /dev/null +++ b/fgetty/README @@ -0,0 +1,13 @@ +REQUIREMENTS + +PRE-INSTALL + +POST-INSTALL + + * Add fgetty to your /etc/inittab, I use this: +c1:123:respawn:/sbin/fgetty tty1 +c2:23:respawn:/sbin/fgetty tty2 +c3:23:respawn:/sbin/fgetty tty3 +c4:23:respawn:/sbin/fgetty tty4 + +PRECAUTION diff --git a/fgetty/fgetty-0.6.patch b/fgetty/fgetty-0.6.patch new file mode 100644 index 000000000..7d64d0d18 --- /dev/null +++ b/fgetty/fgetty-0.6.patch @@ -0,0 +1,104 @@ +--- fgetty-0.6/fgetty.c.orig 2005-11-25 12:35:04.000000000 -0400 ++++ fgetty-0.6/fgetty.c 2005-11-25 12:35:47.000000000 -0400 +@@ -10,9 +10,13 @@ + #include + #include + #include ++#include + + #include "fmt.h" + ++#undef TEST ++#undef DEBUG ++ + static struct utsname uts; + static char hn[MAXHOSTNAMELEN + 6]="HOST="; + static int hn_len=5; +@@ -21,8 +25,12 @@ + + static int noclear=0; + +-void error(char *message,int exitcode) { ++void whine(const char* message) { + write(2,message,strlen(message)); ++} ++ ++void error(char *message,int exitcode) { ++ whine(message); + exit(exitcode); + } + +@@ -77,22 +85,26 @@ + struct sigaction sa; + int fd; + if (chown(tty,0,0) || chmod(tty,0600)) +- error("could not chown/chmod tty device\n",1); ++ error("fgetty: could not chown/chmod tty device\n",1); + sa.sa_handler=SIG_IGN; + sa.sa_flags=0; + sigemptyset(&sa.sa_mask); + sigaction(SIGHUP,&sa,NULL); + sa.sa_handler=sigquit_handler; + sigaction(SIGQUIT,&sa,NULL); +- if ((fd=open(tty, O_RDWR, 0))<0 || ioctl (fd, TIOCSCTTY, (void *)1)==-1) +- error("could not open tty device\n",3); ++ setsid(); ++ if ((fd=open(tty, O_RDWR, 0))<0) ++ error("fgetty: could not open tty device\n",3); + if (!isatty(fd)) +- error("\"not a typewriter\" ;-)\n",4); +- if (vhangup()) /* linux specific */ +- error("vhangup failed\n",5); ++ error("fgetty: \"not a typewriter\" ;-)\n",4); ++ if (ioctl (fd, TIOCSCTTY, (void *)1)==0) { ++ if (vhangup()) /* linux specific */ ++ error("fgetty: vhangup failed\n",5); ++ } else ++ whine("fgetty: warning: could not set controlling tty!\n"); + close(2); close(1); close(0); close(fd); + if (open(tty,O_RDWR,0) != 0) +- error("could not open tty\n",6); ++ error("fgetty: could not open tty\n",6); + if (dup(0) != 1 || dup(0) != 2) + error("could not dup stdout and stderr\n",7); + if (!noclear) +@@ -211,7 +223,7 @@ + write(1," login: ",8); + } + +-static inline int isprint(char c) { ++static inline int _isprint(char c) { + return ((c>='A' && c<='Z') || + (c>='a' && c<='z') || + (c>='0' && c<='9') || +@@ -233,7 +245,7 @@ + if (*c == '\n' || *c == '\r') { + *c=0; + break; +- } else if (!isprint(*c)) ++ } else if (!_isprint(*c)) + error("unprintable character in login name\n",10); + else if (c-logname >= sizeof(logname)-1) + error("login name too long\n",11); +@@ -260,9 +272,20 @@ + int i; + char hostname_end='.'; + tty=argv[1]; ++ if (!tty) ++ error("usage: fgetty 1\n" ++ " fgetty vc/1\n" ++ " fgetty /dev/tty1\n",111); + if (tty[0]=='/') + strncpy(ttybuf,tty,15); +- else ++ else if (isdigit(tty[0])) { ++ struct stat ss; ++ /* try prepending /dev/vc/1 and /dev/tty1 */ ++ strcpy(ttybuf,"/dev/vc/"); strncpy(ttybuf+8,tty,3); ++ if (stat(ttybuf,&ss) && errno==ENOENT) { ++ ttybuf[5]=ttybuf[6]='t'; ttybuf[7]='y'; ++ } ++ } else + strncpy(ttybuf+5,tty,10); + tty=ttybuf; + strcpy(ttybuf2+4,ttybuf);