[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] BB_FEATURE_INSTALLER_NOPROC
From: "John Lombardo" <JohnLombardo () acm ! org>
Date: 2001-11-22 1:26:52
[Download RAW message or body]
This patch allows the --install option to work without the /proc file
system. It's not as precise as with the /proc fs, but for an embedded
system it should work just as well.
John Lombardo
["install-noprocfs.patch" (application/octet-stream)]
diff --exclude=busybox.links --exclude=_install --exclude=*.o --exclude=*.a \
--exclude=busybox --exclude applet_source_list -N -u --recursive \
busybox-0.60.2-pristine/Config.h busybox-0.60.2/Config.h
--- busybox-0.60.2-pristine/Config.h Sat Oct 27 22:14:46 2001
+++ busybox-0.60.2/Config.h Wed Nov 21 01:19:10 2001
@@ -338,8 +338,14 @@
// Enable busybox --install [-s]
// to create links (or symlinks) for all the commands that are
// compiled into the binary. (needs /proc filesystem)
-//#define BB_FEATURE_INSTALLER
+#define BB_FEATURE_INSTALLER
//
+// Enable busybox --install [-s] to work without the /proc fs. Needs
+// BB_FEATURE_INSTALLER too. Looks in /, /bin, /sbin, /usr/bin, /usr/sbin
+// in that order.
+#define BB_FEATURE_INSTALLER_NOPROC
+//
+// Enable a nifty progress meter in wget (adds just under 2k)
// Enable a nifty progress meter in wget (adds just under 2k)
#define BB_FEATURE_WGET_STATUSBAR
//
diff --exclude=busybox.links --exclude=_install --exclude=*.o --exclude=*.a \
--exclude=busybox --exclude applet_source_list -N -u --recursive \
busybox-0.60.2-pristine/busybox.c busybox-0.60.2/busybox.c
--- busybox-0.60.2-pristine/busybox.c Mon Aug 27 08:02:32 2001
+++ busybox-0.60.2/busybox.c Wed Nov 21 00:36:31 2001
@@ -8,6 +8,9 @@
#ifdef BB_LOCALE_SUPPORT
#include <locale.h>
#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
int been_there_done_that = 0; /* Also used in applets.c */
const char *applet_name;
@@ -24,6 +27,7 @@
"/sbin",
"/usr/bin",
"/usr/sbin",
+ NULL
};
/* abstract link() */
@@ -37,7 +41,24 @@
*/
static char *busybox_fullpath()
{
+#ifdef BB_FEATURE_INSTALLER_NOPROC
+ char *path;
+ int dirs_index = 0;
+ while(install_dir[dirs_index]){
+ int fd;
+ path=concat_path_file(install_dir[dirs_index++],"busybox");
+ if (path){
+ if ( (fd=open(path,O_RDONLY))>=0){
+ close(fd);
+ return path;
+ } else
+ free(path);
+ }
+ }
+ return NULL; /* fail */
+#else
return xreadlink("/proc/self/exe");
+#endif
}
/* create (sym)links for each applet */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic