Updates
This commit is contained in:
parent
80974fad03
commit
a9c95ea655
@ -7,6 +7,10 @@
|
||||
* If BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever
|
||||
command you define it as will be run if the init script exits.
|
||||
* Made createPath be quiet (again thanks to Eric Delaunay).
|
||||
* Updated to install.sh to make it more robust (thanks to Adam Di Carlo)
|
||||
* NFS support added to mount by Eric Delaunay. It costs 10k when compiled
|
||||
in, but that is still a big win for those that use NFS.
|
||||
* Made 'rm -f' be silent for non-existant files (thanks to Eric Delaunay).
|
||||
|
||||
-Erik Andersen
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -34,11 +34,11 @@ ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
|
||||
|
||||
# -D_GNU_SOURCE is needed because environ is used in init.c
|
||||
ifeq ($(DODEBUG),true)
|
||||
CFLAGS=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT
|
||||
CFLAGS+=-Wall -g -D_GNU_SOURCE -DDEBUG_INIT
|
||||
STRIP=
|
||||
LDFLAGS=
|
||||
else
|
||||
CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
|
||||
CFLAGS+=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
|
||||
LDFLAGS= -s
|
||||
STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
|
||||
#Only staticly link when _not_ debugging
|
||||
|
@ -1,16 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo "No installation directory. aborting."
|
||||
echo "No installation directory, aborting."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
h=`cat busybox.links`
|
||||
# can't just use cat, rmdir is not unique
|
||||
#h=`cat busybox.links`
|
||||
h=`sort busybox.links | uniq`
|
||||
|
||||
mkdir -p $1/bin
|
||||
for i in $h ; do
|
||||
[ ${verbose} ] && echo " making link to $i"
|
||||
mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `
|
||||
(cd $1/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` )
|
||||
ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `
|
||||
done
|
||||
rm -f $1/bin/busybox
|
||||
install -m 755 busybox $1/bin/busybox
|
||||
|
@ -34,9 +34,10 @@
|
||||
#define BB_MKDIR
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
#define BB_MNC
|
||||
//#define BB_MNC
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
#define BB_NFSMOUNT
|
||||
//#define BB_MT
|
||||
//#define BB_MTAB
|
||||
#define BB_MV
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <time.h>
|
||||
#include <utime.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
static const char* rm_usage = "rm [OPTION]... FILE...\n\n"
|
||||
"Remove (unlink) the FILE(s).\n\n"
|
||||
@ -59,6 +60,7 @@ static int dirAction(const char *fileName, struct stat* statbuf)
|
||||
|
||||
extern int rm_main(int argc, char **argv)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (argc < 2) {
|
||||
usage( rm_usage);
|
||||
@ -85,9 +87,14 @@ extern int rm_main(int argc, char **argv)
|
||||
|
||||
while (argc-- > 0) {
|
||||
srcName = *(argv++);
|
||||
if (recursiveAction( srcName, recursiveFlag, FALSE, TRUE,
|
||||
fileAction, dirAction) == FALSE) {
|
||||
exit( FALSE);
|
||||
if (forceFlag == TRUE && lstat(srcName, &statbuf) != 0 && errno == ENOENT) {
|
||||
/* do not reports errors for non-existent files if -f, just skip them */
|
||||
}
|
||||
else {
|
||||
if (recursiveAction( srcName, recursiveFlag, FALSE,
|
||||
TRUE, fileAction, dirAction) == FALSE) {
|
||||
exit( FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
exit( TRUE);
|
||||
|
4
init.c
4
init.c
@ -538,3 +538,7 @@ extern int init_main(int argc, char **argv)
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined FOO
|
||||
#error Ack!
|
||||
#endif
|
||||
|
@ -538,3 +538,7 @@ extern int init_main(int argc, char **argv)
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined FOO
|
||||
#error Ack!
|
||||
#endif
|
||||
|
11
install.sh
11
install.sh
@ -1,16 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo "No installation directory. aborting."
|
||||
echo "No installation directory, aborting."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
h=`cat busybox.links`
|
||||
# can't just use cat, rmdir is not unique
|
||||
#h=`cat busybox.links`
|
||||
h=`sort busybox.links | uniq`
|
||||
|
||||
mkdir -p $1/bin
|
||||
for i in $h ; do
|
||||
[ ${verbose} ] && echo " making link to $i"
|
||||
mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `
|
||||
(cd $1/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` )
|
||||
ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `
|
||||
done
|
||||
rm -f $1/bin/busybox
|
||||
install -m 755 busybox $1/bin/busybox
|
||||
|
@ -158,6 +158,10 @@ extern void erase_mtab(const char * name);
|
||||
extern void whine_if_fstab_is_missing();
|
||||
#endif
|
||||
|
||||
#if defined BB_NFSMOUNT
|
||||
int nfsmount(const char *spec, const char *node, unsigned long *flags,
|
||||
char **extra_opts, char **mount_opts, int running_bg);
|
||||
#endif
|
||||
|
||||
#if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX)
|
||||
|
||||
|
35
mount.c
35
mount.c
@ -92,12 +92,12 @@ static const struct mount_options mount_options[] = {
|
||||
};
|
||||
|
||||
#if ! defined BB_MTAB
|
||||
#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt) \
|
||||
#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt, mtab_opts) \
|
||||
mount(specialfile, dir, filesystemtype, flags, string_flags)
|
||||
#else
|
||||
static int
|
||||
do_mount(char* specialfile, char* dir, char* filesystemtype,
|
||||
long flags, void* string_flags, int useMtab, int fakeIt)
|
||||
long flags, void* string_flags, int useMtab, int fakeIt, char* mtab_opts)
|
||||
{
|
||||
int status=0;
|
||||
|
||||
@ -106,7 +106,7 @@ do_mount(char* specialfile, char* dir, char* filesystemtype,
|
||||
|
||||
if ( status == 0 ) {
|
||||
if ( useMtab==TRUE )
|
||||
write_mtab(specialfile, dir, filesystemtype, flags, string_flags);
|
||||
write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -157,7 +157,7 @@ parse_mount_options ( char *options, unsigned long *flags, char *strflags)
|
||||
|
||||
int
|
||||
mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
unsigned long flags, char *string_flags, int useMtab, int fakeIt)
|
||||
unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
@ -182,7 +182,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
filesystemType++; // hop past tab
|
||||
|
||||
status = do_mount (blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt);
|
||||
flags | MS_MGC_VAL, string_flags, useMtab,
|
||||
fakeIt, mtab_opts);
|
||||
if (status == 0)
|
||||
break;
|
||||
}
|
||||
@ -190,7 +191,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
fclose (f);
|
||||
} else {
|
||||
status = do_mount (blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt);
|
||||
flags | MS_MGC_VAL, string_flags, useMtab,
|
||||
fakeIt, mtab_opts);
|
||||
}
|
||||
|
||||
if (status) {
|
||||
@ -203,7 +205,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
|
||||
extern int mount_main (int argc, char **argv)
|
||||
{
|
||||
char string_flags[1024]="";
|
||||
char string_flags_buf[1024]="";
|
||||
char *string_flags = string_flags_buf;
|
||||
char *extra_opts = string_flags_buf;
|
||||
unsigned long flags = 0;
|
||||
char *filesystemType = "auto";
|
||||
char *device = NULL;
|
||||
@ -245,14 +249,13 @@ extern int mount_main (int argc, char **argv)
|
||||
argv++;
|
||||
while (i > 0 && **argv) {
|
||||
if (**argv == '-') {
|
||||
while (i>0 && *++(*argv)) switch (**argv) {
|
||||
char *opt = *argv;
|
||||
while (i>0 && *++opt) switch (*opt) {
|
||||
case 'o':
|
||||
if (--i == 0) {
|
||||
goto goodbye;
|
||||
}
|
||||
parse_mount_options (*(++argv), &flags, string_flags);
|
||||
--i;
|
||||
++argv;
|
||||
break;
|
||||
case 'r':
|
||||
flags |= MS_RDONLY;
|
||||
@ -262,8 +265,6 @@ extern int mount_main (int argc, char **argv)
|
||||
goto goodbye;
|
||||
}
|
||||
filesystemType = *(++argv);
|
||||
--i;
|
||||
++argv;
|
||||
break;
|
||||
case 'w':
|
||||
flags &= ~MS_RDONLY;
|
||||
@ -317,14 +318,20 @@ extern int mount_main (int argc, char **argv)
|
||||
*string_flags = '\0';
|
||||
parse_mount_options(m->mnt_opts, &flags, string_flags);
|
||||
mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type,
|
||||
flags, string_flags, useMtab, fakeIt);
|
||||
flags, string_flags, useMtab, fakeIt, extra_opts);
|
||||
}
|
||||
}
|
||||
endmntent (f);
|
||||
} else {
|
||||
if (device && directory) {
|
||||
#ifdef BB_NFSMOUNT
|
||||
if (strcmp(filesystemType, "nfs") == 0) {
|
||||
if (nfsmount(device, directory, &flags, &extra_opts, &string_flags, 1) != 0)
|
||||
exit(FALSE);
|
||||
}
|
||||
#endif
|
||||
exit (mount_one (device, directory, filesystemType,
|
||||
flags, string_flags, useMtab, fakeIt));
|
||||
flags, string_flags, useMtab, fakeIt, extra_opts));
|
||||
} else {
|
||||
goto goodbye;
|
||||
}
|
||||
|
13
rm.c
13
rm.c
@ -26,6 +26,7 @@
|
||||
#include <time.h>
|
||||
#include <utime.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
static const char* rm_usage = "rm [OPTION]... FILE...\n\n"
|
||||
"Remove (unlink) the FILE(s).\n\n"
|
||||
@ -59,6 +60,7 @@ static int dirAction(const char *fileName, struct stat* statbuf)
|
||||
|
||||
extern int rm_main(int argc, char **argv)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (argc < 2) {
|
||||
usage( rm_usage);
|
||||
@ -85,9 +87,14 @@ extern int rm_main(int argc, char **argv)
|
||||
|
||||
while (argc-- > 0) {
|
||||
srcName = *(argv++);
|
||||
if (recursiveAction( srcName, recursiveFlag, FALSE, TRUE,
|
||||
fileAction, dirAction) == FALSE) {
|
||||
exit( FALSE);
|
||||
if (forceFlag == TRUE && lstat(srcName, &statbuf) != 0 && errno == ENOENT) {
|
||||
/* do not reports errors for non-existent files if -f, just skip them */
|
||||
}
|
||||
else {
|
||||
if (recursiveAction( srcName, recursiveFlag, FALSE,
|
||||
TRUE, fileAction, dirAction) == FALSE) {
|
||||
exit( FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
exit( TRUE);
|
||||
|
@ -92,12 +92,12 @@ static const struct mount_options mount_options[] = {
|
||||
};
|
||||
|
||||
#if ! defined BB_MTAB
|
||||
#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt) \
|
||||
#define do_mount(specialfile, dir, filesystemtype, flags, string_flags, useMtab, fakeIt, mtab_opts) \
|
||||
mount(specialfile, dir, filesystemtype, flags, string_flags)
|
||||
#else
|
||||
static int
|
||||
do_mount(char* specialfile, char* dir, char* filesystemtype,
|
||||
long flags, void* string_flags, int useMtab, int fakeIt)
|
||||
long flags, void* string_flags, int useMtab, int fakeIt, char* mtab_opts)
|
||||
{
|
||||
int status=0;
|
||||
|
||||
@ -106,7 +106,7 @@ do_mount(char* specialfile, char* dir, char* filesystemtype,
|
||||
|
||||
if ( status == 0 ) {
|
||||
if ( useMtab==TRUE )
|
||||
write_mtab(specialfile, dir, filesystemtype, flags, string_flags);
|
||||
write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -157,7 +157,7 @@ parse_mount_options ( char *options, unsigned long *flags, char *strflags)
|
||||
|
||||
int
|
||||
mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
unsigned long flags, char *string_flags, int useMtab, int fakeIt)
|
||||
unsigned long flags, char *string_flags, int useMtab, int fakeIt, char *mtab_opts)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
@ -182,7 +182,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
filesystemType++; // hop past tab
|
||||
|
||||
status = do_mount (blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt);
|
||||
flags | MS_MGC_VAL, string_flags, useMtab,
|
||||
fakeIt, mtab_opts);
|
||||
if (status == 0)
|
||||
break;
|
||||
}
|
||||
@ -190,7 +191,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
fclose (f);
|
||||
} else {
|
||||
status = do_mount (blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt);
|
||||
flags | MS_MGC_VAL, string_flags, useMtab,
|
||||
fakeIt, mtab_opts);
|
||||
}
|
||||
|
||||
if (status) {
|
||||
@ -203,7 +205,9 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
|
||||
extern int mount_main (int argc, char **argv)
|
||||
{
|
||||
char string_flags[1024]="";
|
||||
char string_flags_buf[1024]="";
|
||||
char *string_flags = string_flags_buf;
|
||||
char *extra_opts = string_flags_buf;
|
||||
unsigned long flags = 0;
|
||||
char *filesystemType = "auto";
|
||||
char *device = NULL;
|
||||
@ -245,14 +249,13 @@ extern int mount_main (int argc, char **argv)
|
||||
argv++;
|
||||
while (i > 0 && **argv) {
|
||||
if (**argv == '-') {
|
||||
while (i>0 && *++(*argv)) switch (**argv) {
|
||||
char *opt = *argv;
|
||||
while (i>0 && *++opt) switch (*opt) {
|
||||
case 'o':
|
||||
if (--i == 0) {
|
||||
goto goodbye;
|
||||
}
|
||||
parse_mount_options (*(++argv), &flags, string_flags);
|
||||
--i;
|
||||
++argv;
|
||||
break;
|
||||
case 'r':
|
||||
flags |= MS_RDONLY;
|
||||
@ -262,8 +265,6 @@ extern int mount_main (int argc, char **argv)
|
||||
goto goodbye;
|
||||
}
|
||||
filesystemType = *(++argv);
|
||||
--i;
|
||||
++argv;
|
||||
break;
|
||||
case 'w':
|
||||
flags &= ~MS_RDONLY;
|
||||
@ -317,14 +318,20 @@ extern int mount_main (int argc, char **argv)
|
||||
*string_flags = '\0';
|
||||
parse_mount_options(m->mnt_opts, &flags, string_flags);
|
||||
mount_one (m->mnt_fsname, m->mnt_dir, m->mnt_type,
|
||||
flags, string_flags, useMtab, fakeIt);
|
||||
flags, string_flags, useMtab, fakeIt, extra_opts);
|
||||
}
|
||||
}
|
||||
endmntent (f);
|
||||
} else {
|
||||
if (device && directory) {
|
||||
#ifdef BB_NFSMOUNT
|
||||
if (strcmp(filesystemType, "nfs") == 0) {
|
||||
if (nfsmount(device, directory, &flags, &extra_opts, &string_flags, 1) != 0)
|
||||
exit(FALSE);
|
||||
}
|
||||
#endif
|
||||
exit (mount_one (device, directory, filesystemType,
|
||||
flags, string_flags, useMtab, fakeIt));
|
||||
flags, string_flags, useMtab, fakeIt, extra_opts));
|
||||
} else {
|
||||
goto goodbye;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user