initial import of sash-3.4:

--
SASH - Stand-alone shell with built-in commands.

The sash program is a stand-alone shell which is useful for recovering
from certain types of system failures. In particular, it was created
in order to cope with the problem of missing shared libraries or
important executable.

WWW: http://www.canb.auug.org.au/~dbell/

Submitted by Albert Chang <vedge@vedge.com.ar>
This commit is contained in:
lebel 2001-07-06 13:33:47 +00:00
parent cc29e81ba3
commit ff5323bd8f
9 changed files with 275 additions and 0 deletions

28
shells/sash/Makefile Normal file
View File

@ -0,0 +1,28 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/07/06 13:33:47 lebel Exp $
COMMENT= "stand-alone shell with built-in commands"
VER= 3.4
DISTNAME= sash-${VER}
CATEGORIES= shells
NEED_VERSION= 1.402
HOMEPAGE= http://www.canb.auug.org.au/~dbell/
MAINTAINER= Albert Chang <vedge@vedge.com.ar>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= http://www.canb.auug.org.au/~dbell/programs/
DOCS= README
do-install:
cd ${WRKSRC} && ${INSTALL_PROGRAM} sash ${PREFIX}/bin
cd ${WRKSRC} && ${INSTALL_MAN} sash.1 ${PREFIX}/man/man1
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/sash
cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${PREFIX}/share/doc/sash
.include <bsd.port.mk>

3
shells/sash/files/md5 Normal file
View File

@ -0,0 +1,3 @@
MD5 (sash-3.4.tar.gz) = 9c631eb171371b69276ff6692100beb6
RMD160 (sash-3.4.tar.gz) = dc879f76f20d36096922725a21da9f1659691799
SHA1 (sash-3.4.tar.gz) = 19150eaa7a18cf37def3398ae7a6e55bf37f42c9

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2001/07/06 13:33:48 lebel Exp $
--- Makefile.orig Sat Sep 25 01:21:34 1999
+++ Makefile Fri Jul 6 09:21:42 2001
@@ -5,11 +5,11 @@
# The HAVE_EXT2 definition adds the -chattr and -lsattr comamnds.
#
-CFLAGS = -O3 -Wall -Wmissing-prototypes -DHAVE_GZIP -DHAVE_EXT2
+CFLAGS += -DHAVE_GZIP
+# CFLAGS += -DHAVE_EXT2
LDFLAGS = -static -s
LIBS = -lz
-
BINDIR = /bin
MANDIR = /usr/man/man1
@@ -17,6 +17,7 @@ MANDIR = /usr/man/man1
OBJS = sash.o cmds.o cmd_dd.o cmd_ed.o cmd_grep.o cmd_ls.o cmd_tar.o \
cmd_gzip.o cmd_find.o cmd_file.o cmd_chattr.o cmd_ar.o utils.o
+all: sash
sash: $(OBJS)
$(CC) $(LDFLAGS) -o sash $(OBJS) $(LIBS)

View File

@ -0,0 +1,157 @@
$OpenBSD: patch-cmds_c,v 1.1.1.1 2001/07/06 13:33:48 lebel Exp $
--- cmds.c.orig Thu Jun 3 17:42:17 1999
+++ cmds.c Fri Jul 6 09:21:42 2001
@@ -10,14 +10,20 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/mount.h>
#include <signal.h>
#include <pwd.h>
#include <grp.h>
#include <utime.h>
#include <errno.h>
+
+#ifdef __Linux__
#include <linux/fs.h>
+#endif
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#endif
+#include <sys/mount.h>
void
do_echo(int argc, const char ** argv)
@@ -511,8 +517,15 @@ do_mount(int argc, const char ** argv)
argc--;
argv++;
+
+#ifdef __OpenBSD__
+ type = "ffs";
+#endif
+
+#ifdef __Linux__
type = "ext2";
flags = MS_MGC_VAL;
+#endif
while ((argc > 0) && (**argv == '-'))
{
@@ -533,6 +546,21 @@ do_mount(int argc, const char ** argv)
argc--;
break;
+#ifdef __OpenBSD__
+ case 'r':
+ flags |= MNT_RDONLY;
+ break;
+
+ case 's':
+ flags |= MNT_NOSUID;
+ break;
+
+ case 'e':
+ flags |= MNT_NOEXEC;
+ break;
+#endif
+
+#ifdef __Linux__
case 'r':
flags |= MS_RDONLY;
break;
@@ -540,6 +568,7 @@ do_mount(int argc, const char ** argv)
case 'm':
flags |= MS_REMOUNT;
break;
+#endif
default:
fprintf(stderr, "Unknown option\n");
@@ -555,16 +584,85 @@ do_mount(int argc, const char ** argv)
return;
}
+#ifdef __OpenBSD__
+
+ {
+ struct ufs_args ufs;
+ struct adosfs_args adosfs;
+ struct iso_args iso;
+ struct mfs_args mfs;
+ struct msdosfs_args msdosfs;
+ void * args;
+
+ if(!strcmp(type, "ffs") || !strcmp(type, "ufs")) {
+ ufs.fspec = (char*) argv[0];
+ args = &ufs;
+ } else if(!strcmp(type, "adosfs")) {
+ adosfs.fspec = (char*) argv[0];
+ adosfs.uid = 0;
+ adosfs.gid = 0;
+ args = &adosfs;
+ } else if(!strcmp(type, "cd9660")) {
+ iso.fspec = (char*) argv[0];
+ args = &iso;
+ } else if(!strcmp(type, "mfs")) {
+ mfs.fspec = (char*) argv[0];
+ args = &mfs;
+ } else if(!strcmp(type, "msdos")) {
+ msdosfs.fspec = (char*) argv[0];
+ msdosfs.uid = 0;
+ msdosfs.gid = 0;
+ args = &msdosfs;
+ } else {
+ fprintf(stderr, "Unknown filesystem type: %s", type);
+ }
+
+ fprintf(stderr, "type=%s, dev=%s, point=%s\n", type,
+ argv[0], argv[1]);
+ if (mount(type, argv[1], flags, args) < 0)
+ perror(argv[0]);
+ }
+#endif
+
+#ifdef __Linux__
if (mount(argv[0], argv[1], type, flags, 0) < 0)
perror("mount failed");
+#endif
+
}
void
do_umount(int argc, const char ** argv)
{
+ const char * str;
+ int flags = 0;
+
+#ifdef __OpenBSD__
+ argc--;
+ argv++;
+
+ while ((argc > 0) && (**argv == '-'))
+ {
+ argc--;
+ str = *argv++;
+
+ while (*++str) switch (*str)
+ {
+ case 'r':
+ flags = MNT_FORCE;
+ break;
+ }
+ }
+
+ if (unmount(argv[0], flags) < 0)
+ perror(argv[0]);
+#endif
+
+#ifdef __Linux__
if (umount(argv[1]) < 0)
perror(argv[1]);
+#endif
}

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-sash_1,v 1.1.1.1 2001/07/06 13:33:48 lebel Exp $
--- sash.1.orig Sat Oct 2 06:16:45 1999
+++ sash.1 Fri Jul 6 09:21:42 2001
@@ -359,9 +359,10 @@ LINES and COLS can be used to set the pa
.TP
.B -mount [-t type] [-r] [-m] devName dirName
Mount a filesystem on a directory name. The -t option specifies the
-type of filesystem being mounted, and defaults to "ext2".
+type of filesystem being mounted, and defaults to "ffs".
The -r option indicates to mount the filesystem read-only.
-The -m option indicates to remount an already mounted filesystem.
+The -s option indicates to mount the filesystem with nosuid.
+The -e option indicates to mount the filesystem with noexec.
.TP
.B -mv srcName ... destName
Moves one or more files from the
@@ -443,7 +444,8 @@ current umask value is printed. The mas
.B -umount fileName
Unmounts a file system. The file name can either be the device name
which is mounted, or else the directory name which the file system
-is mounted onto.
+is mounted onto. The -f option unmounts the filesystem even if it is
+being used.
.TP
.B unalias name
Remove the definition for the specified alias.

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-sash_c,v 1.1.1.1 2001/07/06 13:33:48 lebel Exp $
--- sash.c.orig Sat Sep 25 00:03:29 1999
+++ sash.c Fri Jul 6 09:21:42 2001
@@ -312,7 +312,7 @@ static const CommandEntry commandEntryTa
{
"-umount", do_umount, 2, 2,
"Unmount a filesystem",
- "fileName"
+ "[-f] fileName"
},
{

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-sash_h,v 1.1.1.1 2001/07/06 13:33:48 lebel Exp $
--- sash.h.orig Sat Sep 25 00:03:29 1999
+++ sash.h Fri Jul 6 09:21:42 2001
@@ -16,7 +16,6 @@
#include <fcntl.h>
#include <string.h>
#include <memory.h>
-#include <malloc.h>
#include <time.h>
#include <ctype.h>

8
shells/sash/pkg/DESCR Normal file
View File

@ -0,0 +1,8 @@
SASH - Stand-alone shell with built-in commands.
The sash program is a stand-alone shell which is useful for recovering
from certain types of system failures. In particular, it was created
in order to cope with the problem of missing shared libraries or
important executable.
WWW: ${HOMEPAGE}

5
shells/sash/pkg/PLIST Normal file
View File

@ -0,0 +1,5 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/07/06 13:33:47 lebel Exp $
share/doc/sash/README
bin/sash
man/man1/sash.1
@dirrm share/doc/sash