diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-11-15 17:33:30 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-11-15 17:33:30 +0000 |
commit | a9c95ea6551eb3d894fcc56822c8aa394972b699 (patch) | |
tree | 59359f25ba4bd356c2dfce79735fb66db4bb4151 | |
parent | 80974fad03689b4344888820d89b514d4e4d166b (diff) | |
download | busybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.tar.gz busybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.tar.bz2 busybox-w32-a9c95ea6551eb3d894fcc56822c8aa394972b699.zip |
Updates
-rw-r--r-- | Changelog | 4 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | applets/install.sh | 11 | ||||
-rw-r--r-- | busybox.def.h | 3 | ||||
-rw-r--r-- | coreutils/rm.c | 13 | ||||
-rw-r--r-- | init.c | 4 | ||||
-rw-r--r-- | init/init.c | 4 | ||||
-rwxr-xr-x | install.sh | 11 | ||||
-rw-r--r-- | internal.h | 4 | ||||
-rw-r--r-- | mount.c | 35 | ||||
-rw-r--r-- | rm.c | 13 | ||||
-rw-r--r-- | util-linux/mount.c | 35 |
12 files changed, 98 insertions, 43 deletions
@@ -7,6 +7,10 @@ | |||
7 | * If BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever | 7 | * If BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever |
8 | command you define it as will be run if the init script exits. | 8 | command you define it as will be run if the init script exits. |
9 | * Made createPath be quiet (again thanks to Eric Delaunay). | 9 | * Made createPath be quiet (again thanks to Eric Delaunay). |
10 | * Updated to install.sh to make it more robust (thanks to Adam Di Carlo) | ||
11 | * NFS support added to mount by Eric Delaunay. It costs 10k when compiled | ||
12 | in, but that is still a big win for those that use NFS. | ||
13 | * Made 'rm -f' be silent for non-existant files (thanks to Eric Delaunay). | ||
10 | 14 | ||
11 | -Erik Andersen | 15 | -Erik Andersen |
12 | 16 | ||
@@ -34,11 +34,11 @@ ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` | |||
34 | 34 | ||
35 | # -D_GNU_SOURCE is needed because environ is used in init.c | 35 | # -D_GNU_SOURCE is needed because environ is used in init.c |
36 | ifeq ($(DODEBUG),true) | 36 | ifeq ($(DODEBUG),true) |
37 | CFLAGS=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT | 37 | CFLAGS+=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT |
38 | STRIP= | 38 | STRIP= |
39 | LDFLAGS= | 39 | LDFLAGS= |
40 | else | 40 | else |
41 | CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE | 41 | CFLAGS+=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE |
42 | LDFLAGS= -s | 42 | LDFLAGS= -s |
43 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) | 43 | STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) |
44 | #Only staticly link when _not_ debugging | 44 | #Only staticly link when _not_ debugging |
diff --git a/applets/install.sh b/applets/install.sh index 4a0b83254..29c9e26d9 100755 --- a/applets/install.sh +++ b/applets/install.sh | |||
@@ -1,16 +1,21 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | set -e | ||
4 | |||
3 | if [ "$1" == "" ]; then | 5 | if [ "$1" == "" ]; then |
4 | echo "No installation directory. aborting." | 6 | echo "No installation directory, aborting." |
5 | exit 1; | 7 | exit 1; |
6 | fi | 8 | fi |
7 | 9 | ||
8 | h=`cat busybox.links` | 10 | # can't just use cat, rmdir is not unique |
11 | #h=`cat busybox.links` | ||
12 | h=`sort busybox.links | uniq` | ||
9 | 13 | ||
10 | mkdir -p $1/bin | 14 | mkdir -p $1/bin |
11 | for i in $h ; do | 15 | for i in $h ; do |
16 | [ ${verbose} ] && echo " making link to $i" | ||
12 | mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` | 17 | mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` |
13 | (cd $1/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ) | 18 | ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` |
14 | done | 19 | done |
15 | rm -f $1/bin/busybox | 20 | rm -f $1/bin/busybox |
16 | install -m 755 busybox $1/bin/busybox | 21 | install -m 755 busybox $1/bin/busybox |
diff --git a/busybox.def.h b/busybox.def.h index 6e2b818d6..657ce4383 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -34,9 +34,10 @@ | |||
34 | #define BB_MKDIR | 34 | #define BB_MKDIR |
35 | #define BB_MKNOD | 35 | #define BB_MKNOD |
36 | #define BB_MKSWAP | 36 | #define BB_MKSWAP |
37 | #define BB_MNC | 37 | //#define BB_MNC |
38 | #define BB_MORE | 38 | #define BB_MORE |
39 | #define BB_MOUNT | 39 | #define BB_MOUNT |
40 | #define BB_NFSMOUNT | ||
40 | //#define BB_MT | 41 | //#define BB_MT |
41 | //#define BB_MTAB | 42 | //#define BB_MTAB |
42 | #define BB_MV | 43 | #define BB_MV |
diff --git a/coreutils/rm.c b/coreutils/rm.c index e6132ab35..ba5d30e92 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <time.h> | 26 | #include <time.h> |
27 | #include <utime.h> | 27 | #include <utime.h> |
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | #include <errno.h> | ||
29 | 30 | ||
30 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" | 31 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
31 | "Remove (unlink) the FILE(s).\n\n" | 32 | "Remove (unlink) the FILE(s).\n\n" |
@@ -59,6 +60,7 @@ static int dirAction(const char *fileName, struct stat* statbuf) | |||
59 | 60 | ||
60 | extern int rm_main(int argc, char **argv) | 61 | extern int rm_main(int argc, char **argv) |
61 | { | 62 | { |
63 | struct stat statbuf; | ||
62 | 64 | ||
63 | if (argc < 2) { | 65 | if (argc < 2) { |
64 | usage( rm_usage); | 66 | usage( rm_usage); |
@@ -85,9 +87,14 @@ extern int rm_main(int argc, char **argv) | |||
85 | 87 | ||
86 | while (argc-- > 0) { | 88 | while (argc-- > 0) { |
87 | srcName = *(argv++); | 89 | srcName = *(argv++); |
88 | if (recursiveAction( srcName, recursiveFlag, FALSE, TRUE, | 90 | if (forceFlag == TRUE && lstat(srcName, &statbuf) != 0 && errno == ENOENT) { |
89 | fileAction, dirAction) == FALSE) { | 91 | /* do not reports errors for non-existent files if -f, just skip them */ |
90 | exit( FALSE); | 92 | } |
93 | else { | ||
94 | if (recursiveAction( srcName, recursiveFlag, FALSE, | ||
95 | TRUE, fileAction, dirAction) == FALSE) { | ||
96 | exit( FALSE); | ||
97 | } | ||
91 | } | 98 | } |
92 | } | 99 | } |
93 | exit( TRUE); | 100 | exit( TRUE); |
@@ -538,3 +538,7 @@ extern int init_main(int argc, char **argv) | |||
538 | sleep(1); | 538 | sleep(1); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | |||
542 | #if defined FOO | ||
543 | #error Ack! | ||
544 | #endif | ||
diff --git a/init/init.c b/init/init.c index a3e8d6700..980150ff5 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -538,3 +538,7 @@ extern int init_main(int argc, char **argv) | |||
538 | sleep(1); | 538 | sleep(1); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | |||
542 | #if defined FOO | ||
543 | #error Ack! | ||
544 | #endif | ||
diff --git a/install.sh b/install.sh index 4a0b83254..29c9e26d9 100755 --- a/install.sh +++ b/install.sh | |||
@@ -1,16 +1,21 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | set -e | ||
4 | |||
3 | if [ "$1" == "" ]; then | 5 | if [ "$1" == "" ]; then |
4 | echo "No installation directory. aborting." | 6 | echo "No installation directory, aborting." |
5 | exit 1; | 7 | exit 1; |
6 | fi | 8 | fi |
7 | 9 | ||
8 | h=`cat busybox.links` | 10 | # can't just use cat, rmdir is not unique |
11 | #h=`cat busybox.links` | ||
12 | h=`sort busybox.links | uniq` | ||
9 | 13 | ||
10 | mkdir -p $1/bin | 14 | mkdir -p $1/bin |
11 | for i in $h ; do | 15 | for i in $h ; do |
16 | [ ${verbose} ] && echo " making link to $i" | ||
12 | mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` | 17 | mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` |
13 | (cd $1/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ) | 18 | ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` |
14 | done | 19 | done |
15 | rm -f $1/bin/busybox | 20 | rm -f $1/bin/busybox |
16 | install -m 755 busybox $1/bin/busybox | 21 | install -m 755 busybox $1/bin/busybox |
diff --git a/internal.h b/internal.h index 0e7054f14..32a21ce5b 100644 --- a/internal.h +++ b/internal.h | |||
@@ -158,6 +158,10 @@ extern void erase_mtab(const char * name); | |||
158 | extern void whine_if_fstab_is_missing(); | 158 | extern void whine_if_fstab_is_missing(); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #if defined BB_NFSMOUNT | ||
162 | int nfsmount(const char *spec, const char *node, unsigned long *flags, | ||
163 | char **extra_opts, char **mount_opts, int running_bg); | ||
164 | #endif | ||
161 | 165 | ||
162 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) | 166 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) |
163 | 167 | ||
@@ -92,12 +92,12 @@ static const struct mount_options mount_options[] = { | |||
92 | }; | 92 | }; |
93 | 93 | ||
94 | #if ! defined BB_MTAB | 94 | #if ! defined BB_MTAB |
95 | #define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt) \ | 95 | #define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt, mtab_opts) \ |
96 | mount(specialfile, dir, filesystemtype, flags, string_flags) | 96 | mount(specialfile, dir, filesystemtype, flags, string_flags) |
97 | #else | 97 | #else |
98 | static int | 98 | static int |
99 | do_mount(char* specialfile, char* dir, char* filesystemtype, | 99 | do_mount(char* specialfile, char* dir, char* filesystemtype, |
100 | long flags, void* string_flags, int useMtab, int fakeIt) | 100 | long flags, void* string_flags, int useMtab, int fakeIt, char* mtab_opts) |
101 | { | 101 | { |
102 | int status=0; | 102 | int status=0; |
103 | 103 | ||
@@ -106,7 +106,7 @@ do_mount(char* specialfile, char* dir, char* filesystemtype, | |||
106 | 106 | ||
107 | if ( status == 0 ) { | 107 | if ( status == 0 ) { |
108 | if ( useMtab==TRUE ) | 108 | if ( useMtab==TRUE ) |
109 | write_mtab(specialfile, dir, filesystemtype, flags, string_flags); | 109 | write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); |
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | else | 112 | else |
@@ -157,7 +157,7 @@ parse_mount_options ( char *options, unsigned long *flags, char *strflags) | |||
157 | 157 | ||
158 | int | 158 | int |
159 | mount_one(char *blockDevice, char *directory, char *filesystemType, | 159 | mount_one(char *blockDevice, char *directory, char *filesystemType, |
160 | unsigned long flags, char *string_flags, int useMtab, int fakeIt) | 160 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts) |
161 | { | 161 | { |
162 | int status = 0; | 162 | int status = 0; |
163 | 163 | ||
@@ -182,7 +182,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
182 | filesystemType++; // hop past tab | 182 | filesystemType++; // hop past tab |
183 | 183 | ||
184 | status = do_mount (blockDevice, directory, filesystemType, | 184 | status = do_mount (blockDevice, directory, filesystemType, |
185 | flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); | 185 | flags | MS_MGC_VAL, string_flags, useMtab, |
186 | fakeIt, mtab_opts); | ||
186 | if (status == 0) | 187 | if (status == 0) |
187 | break; | 188 | break; |
188 | } | 189 | } |
@@ -190,7 +191,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
190 | fclose (f); | 191 | fclose (f); |
191 | } else { | 192 | } else { |
192 | status = do_mount (blockDevice, directory, filesystemType, | 193 | status = do_mount (blockDevice, directory, filesystemType, |
193 | flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); | 194 | flags | MS_MGC_VAL, string_flags, useMtab, |
195 | fakeIt, mtab_opts); | ||
194 | } | 196 | } |
195 | 197 | ||
196 | if (status) { | 198 | if (status) { |
@@ -203,7 +205,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
203 | 205 | ||
204 | extern int mount_main (int argc, char **argv) | 206 | extern int mount_main (int argc, char **argv) |
205 | { | 207 | { |
206 | char string_flags[1024]=""; | 208 | char string_flags_buf[1024]=""; |
209 | char *string_flags = string_flags_buf; | ||
210 | char *extra_opts = string_flags_buf; | ||
207 | unsigned long flags = 0; | 211 | unsigned long flags = 0; |
208 | char *filesystemType = "auto"; | 212 | char *filesystemType = "auto"; |
209 | char *device = NULL; | 213 | char *device = NULL; |
@@ -245,14 +249,13 @@ extern int mount_main (int argc, char **argv) | |||
245 | argv++; | 249 | argv++; |
246 | while (i > 0 && **argv) { | 250 | while (i > 0 && **argv) { |
247 | if (**argv == '-') { | 251 | if (**argv == '-') { |
248 | while (i>0 && *++(*argv)) switch (**argv) { | 252 | char *opt = *argv; |
253 | while (i>0 && *++opt) switch (*opt) { | ||
249 | case 'o': | 254 | case 'o': |
250 | if (--i == 0) { | 255 | if (--i == 0) { |
251 | goto goodbye; | 256 | goto goodbye; |
252 | } | 257 | } |
253 | parse_mount_options (*(++argv), &flags, string_flags); | 258 | parse_mount_options (*(++argv), &flags, string_flags); |
254 | --i; | ||
255 | ++argv; | ||
256 | break; | 259 | break; |
257 | case 'r': | 260 | case 'r': |
258 | flags |= MS_RDONLY; | 261 | flags |= MS_RDONLY; |
@@ -262,8 +265,6 @@ extern int mount_main (int argc, char **argv) | |||
262 | goto goodbye; | 265 | goto goodbye; |
263 | } | 266 | } |
264 | filesystemType = *(++argv); | 267 | filesystemType = *(++argv); |
265 | --i; | ||
266 | ++argv; | ||
267 | break; | 268 | break; |
268 | case 'w': | 269 | case 'w': |
269 | flags &= ~MS_RDONLY; | 270 | flags &= ~MS_RDONLY; |
@@ -317,14 +318,20 @@ extern int mount_main (int argc, char **argv) | |||
317 | *string_flags = '\0'; | 318 | *string_flags = '\0'; |
318 | parse_mount_options(m->mnt_opts, &flags, string_flags); | 319 | parse_mount_options(m->mnt_opts, &flags, string_flags); |
319 | mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type, | 320 | mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type, |
320 | flags, string_flags, useMtab, fakeIt); | 321 | flags, string_flags, useMtab, fakeIt, extra_opts); |
321 | } | 322 | } |
322 | } | 323 | } |
323 | endmntent (f); | 324 | endmntent (f); |
324 | } else { | 325 | } else { |
325 | if (device && directory) { | 326 | if (device && directory) { |
327 | #ifdef BB_NFSMOUNT | ||
328 | if (strcmp(filesystemType, "nfs") == 0) { | ||
329 | if (nfsmount(device, directory, &flags, &extra_opts, &string_flags, 1) != 0) | ||
330 | exit(FALSE); | ||
331 | } | ||
332 | #endif | ||
326 | exit (mount_one (device, directory, filesystemType, | 333 | exit (mount_one (device, directory, filesystemType, |
327 | flags, string_flags, useMtab, fakeIt)); | 334 | flags, string_flags, useMtab, fakeIt, extra_opts)); |
328 | } else { | 335 | } else { |
329 | goto goodbye; | 336 | goto goodbye; |
330 | } | 337 | } |
@@ -26,6 +26,7 @@ | |||
26 | #include <time.h> | 26 | #include <time.h> |
27 | #include <utime.h> | 27 | #include <utime.h> |
28 | #include <dirent.h> | 28 | #include <dirent.h> |
29 | #include <errno.h> | ||
29 | 30 | ||
30 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" | 31 | static const char* rm_usage = "rm [OPTION]... FILE...\n\n" |
31 | "Remove (unlink) the FILE(s).\n\n" | 32 | "Remove (unlink) the FILE(s).\n\n" |
@@ -59,6 +60,7 @@ static int dirAction(const char *fileName, struct stat* statbuf) | |||
59 | 60 | ||
60 | extern int rm_main(int argc, char **argv) | 61 | extern int rm_main(int argc, char **argv) |
61 | { | 62 | { |
63 | struct stat statbuf; | ||
62 | 64 | ||
63 | if (argc < 2) { | 65 | if (argc < 2) { |
64 | usage( rm_usage); | 66 | usage( rm_usage); |
@@ -85,9 +87,14 @@ extern int rm_main(int argc, char **argv) | |||
85 | 87 | ||
86 | while (argc-- > 0) { | 88 | while (argc-- > 0) { |
87 | srcName = *(argv++); | 89 | srcName = *(argv++); |
88 | if (recursiveAction( srcName, recursiveFlag, FALSE, TRUE, | 90 | if (forceFlag == TRUE && lstat(srcName, &statbuf) != 0 && errno == ENOENT) { |
89 | fileAction, dirAction) == FALSE) { | 91 | /* do not reports errors for non-existent files if -f, just skip them */ |
90 | exit( FALSE); | 92 | } |
93 | else { | ||
94 | if (recursiveAction( srcName, recursiveFlag, FALSE, | ||
95 | TRUE, fileAction, dirAction) == FALSE) { | ||
96 | exit( FALSE); | ||
97 | } | ||
91 | } | 98 | } |
92 | } | 99 | } |
93 | exit( TRUE); | 100 | exit( TRUE); |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 827a56f0a..a9463afba 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -92,12 +92,12 @@ static const struct mount_options mount_options[] = { | |||
92 | }; | 92 | }; |
93 | 93 | ||
94 | #if ! defined BB_MTAB | 94 | #if ! defined BB_MTAB |
95 | #define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt) \ | 95 | #define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt, mtab_opts) \ |
96 | mount(specialfile, dir, filesystemtype, flags, string_flags) | 96 | mount(specialfile, dir, filesystemtype, flags, string_flags) |
97 | #else | 97 | #else |
98 | static int | 98 | static int |
99 | do_mount(char* specialfile, char* dir, char* filesystemtype, | 99 | do_mount(char* specialfile, char* dir, char* filesystemtype, |
100 | long flags, void* string_flags, int useMtab, int fakeIt) | 100 | long flags, void* string_flags, int useMtab, int fakeIt, char* mtab_opts) |
101 | { | 101 | { |
102 | int status=0; | 102 | int status=0; |
103 | 103 | ||
@@ -106,7 +106,7 @@ do_mount(char* specialfile, char* dir, char* filesystemtype, | |||
106 | 106 | ||
107 | if ( status == 0 ) { | 107 | if ( status == 0 ) { |
108 | if ( useMtab==TRUE ) | 108 | if ( useMtab==TRUE ) |
109 | write_mtab(specialfile, dir, filesystemtype, flags, string_flags); | 109 | write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); |
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | else | 112 | else |
@@ -157,7 +157,7 @@ parse_mount_options ( char *options, unsigned long *flags, char *strflags) | |||
157 | 157 | ||
158 | int | 158 | int |
159 | mount_one(char *blockDevice, char *directory, char *filesystemType, | 159 | mount_one(char *blockDevice, char *directory, char *filesystemType, |
160 | unsigned long flags, char *string_flags, int useMtab, int fakeIt) | 160 | unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts) |
161 | { | 161 | { |
162 | int status = 0; | 162 | int status = 0; |
163 | 163 | ||
@@ -182,7 +182,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
182 | filesystemType++; // hop past tab | 182 | filesystemType++; // hop past tab |
183 | 183 | ||
184 | status = do_mount (blockDevice, directory, filesystemType, | 184 | status = do_mount (blockDevice, directory, filesystemType, |
185 | flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); | 185 | flags | MS_MGC_VAL, string_flags, useMtab, |
186 | fakeIt, mtab_opts); | ||
186 | if (status == 0) | 187 | if (status == 0) |
187 | break; | 188 | break; |
188 | } | 189 | } |
@@ -190,7 +191,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
190 | fclose (f); | 191 | fclose (f); |
191 | } else { | 192 | } else { |
192 | status = do_mount (blockDevice, directory, filesystemType, | 193 | status = do_mount (blockDevice, directory, filesystemType, |
193 | flags | MS_MGC_VAL, string_flags, useMtab, fakeIt); | 194 | flags | MS_MGC_VAL, string_flags, useMtab, |
195 | fakeIt, mtab_opts); | ||
194 | } | 196 | } |
195 | 197 | ||
196 | if (status) { | 198 | if (status) { |
@@ -203,7 +205,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
203 | 205 | ||
204 | extern int mount_main (int argc, char **argv) | 206 | extern int mount_main (int argc, char **argv) |
205 | { | 207 | { |
206 | char string_flags[1024]=""; | 208 | char string_flags_buf[1024]=""; |
209 | char *string_flags = string_flags_buf; | ||
210 | char *extra_opts = string_flags_buf; | ||
207 | unsigned long flags = 0; | 211 | unsigned long flags = 0; |
208 | char *filesystemType = "auto"; | 212 | char *filesystemType = "auto"; |
209 | char *device = NULL; | 213 | char *device = NULL; |
@@ -245,14 +249,13 @@ extern int mount_main (int argc, char **argv) | |||
245 | argv++; | 249 | argv++; |
246 | while (i > 0 && **argv) { | 250 | while (i > 0 && **argv) { |
247 | if (**argv == '-') { | 251 | if (**argv == '-') { |
248 | while (i>0 && *++(*argv)) switch (**argv) { | 252 | char *opt = *argv; |
253 | while (i>0 && *++opt) switch (*opt) { | ||
249 | case 'o': | 254 | case 'o': |
250 | if (--i == 0) { | 255 | if (--i == 0) { |
251 | goto goodbye; | 256 | goto goodbye; |
252 | } | 257 | } |
253 | parse_mount_options (*(++argv), &flags, string_flags); | 258 | parse_mount_options (*(++argv), &flags, string_flags); |
254 | --i; | ||
255 | ++argv; | ||
256 | break; | 259 | break; |
257 | case 'r': | 260 | case 'r': |
258 | flags |= MS_RDONLY; | 261 | flags |= MS_RDONLY; |
@@ -262,8 +265,6 @@ extern int mount_main (int argc, char **argv) | |||
262 | goto goodbye; | 265 | goto goodbye; |
263 | } | 266 | } |
264 | filesystemType = *(++argv); | 267 | filesystemType = *(++argv); |
265 | --i; | ||
266 | ++argv; | ||
267 | break; | 268 | break; |
268 | case 'w': | 269 | case 'w': |
269 | flags &= ~MS_RDONLY; | 270 | flags &= ~MS_RDONLY; |
@@ -317,14 +318,20 @@ extern int mount_main (int argc, char **argv) | |||
317 | *string_flags = '\0'; | 318 | *string_flags = '\0'; |
318 | parse_mount_options(m->mnt_opts, &flags, string_flags); | 319 | parse_mount_options(m->mnt_opts, &flags, string_flags); |
319 | mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type, | 320 | mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type, |
320 | flags, string_flags, useMtab, fakeIt); | 321 | flags, string_flags, useMtab, fakeIt, extra_opts); |
321 | } | 322 | } |
322 | } | 323 | } |
323 | endmntent (f); | 324 | endmntent (f); |
324 | } else { | 325 | } else { |
325 | if (device && directory) { | 326 | if (device && directory) { |
327 | #ifdef BB_NFSMOUNT | ||
328 | if (strcmp(filesystemType, "nfs") == 0) { | ||
329 | if (nfsmount(device, directory, &flags, &extra_opts, &string_flags, 1) != 0) | ||
330 | exit(FALSE); | ||
331 | } | ||
332 | #endif | ||
326 | exit (mount_one (device, directory, filesystemType, | 333 | exit (mount_one (device, directory, filesystemType, |
327 | flags, string_flags, useMtab, fakeIt)); | 334 | flags, string_flags, useMtab, fakeIt, extra_opts)); |
328 | } else { | 335 | } else { |
329 | goto goodbye; | 336 | goto goodbye; |
330 | } | 337 | } |