forked from ports/contrib
fgetty: initial commit
This commit is contained in:
parent
5e9c6f2d2d
commit
b8cdd104fe
7
fgetty/.footprint
Normal file
7
fgetty/.footprint
Normal file
@ -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
|
2
fgetty/.md5sum
Normal file
2
fgetty/.md5sum
Normal file
@ -0,0 +1,2 @@
|
||||
4cf5326af47b835354c6fac97c361d2e fgetty-0.6.patch
|
||||
399dd207805b75ea99ed814943d71c60 fgetty-0.6.tar.bz2
|
19
fgetty/Pkgfile
Normal file
19
fgetty/Pkgfile
Normal file
@ -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}
|
||||
}
|
13
fgetty/README
Normal file
13
fgetty/README
Normal file
@ -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
|
104
fgetty/fgetty-0.6.patch
Normal file
104
fgetty/fgetty-0.6.patch
Normal file
@ -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 <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <termios.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#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);
|
Loading…
x
Reference in New Issue
Block a user