- endmntent (f);
- } else {
- if (argc >= 3) {
- while (i < argc)
- argv--;
- while (**argv == '-')
- argv++;
- if (mount_one
- (*argv, *(argv+1), filesystemType, flags,
- string_flags) == 0) return 0;
- else
- return( FALSE);
- } else {
- fprintf (stderr, "%s\n", mount_usage);
- return( FALSE);
+ while ((m = getmntent(f)) != NULL) {
+ if (all == FALSE && directory == NULL && (
+ (strcmp(device, m->mnt_fsname) != 0) &&
+ (strcmp(device, m->mnt_dir) != 0) ) ) {
+ continue;
+ }
+
+ if (all == TRUE && ( // If we're mounting 'all'
+ (strstr(m->mnt_opts, "noauto")) || // and the file system isn't noauto,
+ (strstr(m->mnt_type, "swap")) || // and isn't swap or nfs, then mount it
+ (strstr(m->mnt_type, "nfs")) ) ) {
+ continue;
+ }
+
+ if (all == TRUE || flags == 0) { // Allow single mount to override fstab flags
+ flags = 0;
+ *string_flags = '\0';
+ parse_mount_options(m->mnt_opts, &flags, string_flags);
+ }
+
+ device = strdup(m->mnt_fsname);
+ directory = strdup(m->mnt_dir);
+ filesystemType = strdup(m->mnt_type);
+singlemount:
+ string_flags = strdup(string_flags);
+ rc = EXIT_SUCCESS;
+#ifdef BB_NFSMOUNT
+ if (strchr(device, ':') != NULL)
+ filesystemType = "nfs";
+ if (strcmp(filesystemType, "nfs") == 0) {
+ if (nfsmount (device, directory, &flags, &extra_opts,
+ &string_flags, 1)) {
+ perror_msg("nfsmount failed");
+ rc = EXIT_FAILURE;
+ }
+ }
+#endif
+ if (!mount_one(device, directory, filesystemType, flags,
+ string_flags, useMtab, fakeIt, extra_opts, TRUE))
+ rc = EXIT_FAILURE;
+
+ if (all == FALSE)
+ break;
+ }
+ if (fstabmount == TRUE)
+ endmntent(f);
+
+ if (all == FALSE && fstabmount == TRUE && directory == NULL)
+ fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
+
+ return rc;