diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2004-02-01 17:02:40 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2004-02-01 17:02:40 +0000 |
commit | c3ab96401bd390400a2e7ecb96685c1ade50a970 (patch) | |
tree | 7485e30aa87d5035dbf1d52ac3f3b18f8294a285 | |
parent | 0ad06bd111439500f9864a48783af87b6939d7cd (diff) | |
download | ports-c3ab96401bd390400a2e7ecb96685c1ade50a970.tar.gz ports-c3ab96401bd390400a2e7ecb96685c1ade50a970.zip |
Notes
-rw-r--r-- | sysutils/eject/Makefile | 16 | ||||
-rw-r--r-- | sysutils/eject/files/patch-aa | 120 | ||||
-rw-r--r-- | sysutils/eject/files/patch-ab | 11 | ||||
-rw-r--r-- | sysutils/eject/pkg-plist | 4 |
4 files changed, 127 insertions, 24 deletions
diff --git a/sysutils/eject/Makefile b/sysutils/eject/Makefile index ebe4214ede84..3e6ffa436359 100644 --- a/sysutils/eject/Makefile +++ b/sysutils/eject/Makefile @@ -16,18 +16,18 @@ MASTER_SITES= ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \ MAINTAINER= ports@FreeBSD.org COMMENT= Utility for ejecting media from CD or optical disk drive -DOCDIR= share/doc/eject -PLIST_SUB= DOCDIR=${DOCDIR} +PLIST_FILES= sbin/eject +PORTDOCS= README README-J MAN1= eject.1 MANCOMPRESSED= yes post-install: - @if [ ! -d ${PREFIX}/${DOCDIR} ] ; then \ - ${MKDIR} ${PREFIX}/${DOCDIR} ; \ - fi - @for i in README README-J ; do \ - ${INSTALL_DATA} ${WRKSRC}/$${i} ${PREFIX}/${DOCDIR} ; \ - done +.if !defined(NOPORTDOCS) + ${MKDIR} ${DOCSDIR} +.for i in ${PORTDOCS} + ${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR} +.endfor +.endif .include <bsd.port.mk> diff --git a/sysutils/eject/files/patch-aa b/sysutils/eject/files/patch-aa index c6766dfdeab1..6ee2b607ce5d 100644 --- a/sysutils/eject/files/patch-aa +++ b/sysutils/eject/files/patch-aa @@ -1,5 +1,5 @@ ---- eject.c.orig Tue Jan 4 09:42:12 2000 -+++ eject.c Wed Dec 24 01:11:34 2003 +--- eject.c.orig Tue Jan 4 15:42:12 2000 ++++ eject.c Sun Feb 1 17:59:10 2004 @@ -43,8 +43,8 @@ extern int optind; @@ -11,7 +11,15 @@ int eject(char *, char *); char *program = "eject"; -@@ -65,8 +65,8 @@ +@@ -52,6 +52,7 @@ + int fflag; /* force unmount filesystem */ + int nflag; /* not execute operation */ + int vflag; /* verbose operation */ ++int tflag; /* tray close */ + + /* + * simple eject program +@@ -65,14 +66,14 @@ { int ch; int sts; @@ -21,8 +29,26 @@ + char *err; char *defdev; - fflag = nflag = vflag = 0; -@@ -95,18 +95,28 @@ +- fflag = nflag = vflag = 0; ++ fflag = nflag = vflag = tflag = 0; + defdev = getenv("EJECT"); + +- while ((ch = getopt(argc, argv, "fnv?")) != EOF) { ++ while ((ch = getopt(argc, argv, "fnvt?")) != EOF) { + switch (ch) { + case 'f' : + fflag = 1; +@@ -83,6 +84,9 @@ + case 'v' : + vflag = 1; + break; ++ case 't' : ++ tflag = 1; ++ break; + case '?' : + default : + usage(); +@@ -95,18 +99,51 @@ if (argc == 0) { usage(); } @@ -41,12 +67,35 @@ + } else { + int c; + char *dev_bak = malloc(MAXPATHLEN); -+ if ((c = readlink(device, dev_bak, MAXPATHLEN-1)) != -1) { ++ free(name); ++ if ((c = readlink(device, dev_bak, MAXPATHLEN))>0) { + dev_bak[c] = '\0'; -+ free(name); + name = dev_bak; + } else { + free(dev_bak); ++ name = device; ++ } ++ if (strncmp(device, "/dev/", 5) != 0) ++ { ++ int mnts; ++ struct statfs *mntbuf; ++ mnts = getmntinfo(&mntbuf, MNT_NOWAIT); ++ if (mnts == 0) { ++ perror(program); ++ exit(1); ++ } ++ for (ch = 0; ch < mnts; ch++) { ++ if (strcmp(mntbuf[ch].f_mntonname, name) == 0) { ++ device = strdup(mntbuf[ch].f_mntfromname); ++ name = strdup(mntbuf[ch].f_mntfromname); ++ break; ++ } ++ } ++ if (strncmp(device, "/dev/", 5) != 0) ++ { ++ perror(program); ++ exit(1); ++ } + } } @@ -55,7 +104,7 @@ if (sts < 0) { perror(err); exit(1); -@@ -128,16 +138,26 @@ +@@ -128,16 +165,26 @@ int check_device(name, device) char *name; @@ -69,8 +118,8 @@ - sprintf(device, "/dev/r%sc", name); - if (vflag || nflag) { - printf("%s: using device %s\n", program, device); -+ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s", NULL }; -+ for (i = 0; dev_list[i]; i++) { ++ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s" }; ++ for (i = 0; i < 3; i++) { + if ((sts = asprintf(device, dev_list[i], name)) == -1) + return sts; + if (vflag || nflag) { @@ -88,7 +137,7 @@ return sts; } -@@ -155,7 +175,7 @@ +@@ -155,7 +202,7 @@ int unmount_fs(name, err) char *name; @@ -97,7 +146,16 @@ { int mnts; struct statfs *mntbuf; -@@ -221,7 +241,7 @@ +@@ -173,7 +220,7 @@ + /* get proper mount information into the list */ + len = strlen(name); + for (n = 0; n < mnts; n++) { +- p = rindex(mntbuf[n].f_mntfromname, '/'); ++ p = mntbuf[n].f_mntfromname - 1; + if (p == NULL) { + continue; + } +@@ -221,7 +268,7 @@ sts = 0; } if (sts < 0 && fflag == 0) { @@ -106,3 +164,41 @@ return sts; } nextp = mp->next; +@@ -255,14 +302,26 @@ + } + if (!nflag) { + if (vflag) { +- printf("%s: ejecting media from %s\n", program, name); ++ if (tflag) { ++ printf("%s: tray close on %s\n", program, name); ++ } else { ++ printf("%s: ejecting media from %s\n", program, name); ++ } + } + sts = ioctl(fd, CDIOCALLOW); + if (sts >= 0) { +- sts = ioctl(fd, CDIOCEJECT); ++ if (tflag) { ++ sts = ioctl(fd, CDIOCCLOSE); ++ } else { ++ sts = ioctl(fd, CDIOCEJECT); ++ } + } + } else { +- printf("%s: ejecting media from %s\n", program, name); ++ if (tflag) { ++ printf("%s: tray close on %s\n", program, name); ++ } else { ++ printf("%s: ejecting media from %s\n", program, name); ++ } + sts = 0; + } + close(fd); +@@ -277,6 +336,6 @@ + void + usage(void) + { +- fprintf(stderr, "usage: %s [-fnv] device\n", program); ++ fprintf(stderr, "usage: %s [-fnvt] device\n", program); + exit(1); + } diff --git a/sysutils/eject/files/patch-ab b/sysutils/eject/files/patch-ab new file mode 100644 index 000000000000..3706f388e1e4 --- /dev/null +++ b/sysutils/eject/files/patch-ab @@ -0,0 +1,11 @@ +--- eject.1.orig Tue Jan 4 14:49:41 2000 ++++ eject.1 Sun Feb 1 00:49:17 2004 +@@ -53,6 +53,8 @@ + Not execute operation but print it. + .It Fl v + Verbose mode. ++.It Fl t ++Give drive tray close command. + .Sh ENVIRONMENT + If the following environment variable exists, it is used by + .Nm eject : diff --git a/sysutils/eject/pkg-plist b/sysutils/eject/pkg-plist deleted file mode 100644 index bacdf1ec2787..000000000000 --- a/sysutils/eject/pkg-plist +++ /dev/null @@ -1,4 +0,0 @@ -sbin/eject -%%DOCDIR%%/README -%%DOCDIR%%/README-J -@dirrm %%DOCDIR%% |