Browse Source

just mount rootfs read-write for needed subcommands

Waldemar Brodkorb 15 years ago
parent
commit
234eaea016
2 changed files with 27 additions and 9 deletions
  1. 1 1
      package/busybox/Makefile
  2. 26 8
      package/busybox/patches/001-ipkg.patch

+ 1 - 1
package/busybox/Makefile

@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=		busybox
 PKG_VERSION:=		1.16.1
-PKG_RELEASE:=		2
+PKG_RELEASE:=		3
 PKG_MD5SUM:=		319486ec65078d07fde26eb620fecde7
 PKG_DESCR:=		Core utilities for embedded Linux systems
 PKG_SECTION:=		base

+ 26 - 8
package/busybox/patches/001-ipkg.patch

@@ -6628,8 +6628,8 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/Kbuild busybox-1.16.1/archival/li
 +CFLAGS += -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(IPKG_ARCH)\""
 diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival/libipkg/libipkg.c
 --- busybox-1.16.1.orig/archival/libipkg/libipkg.c	1970-01-01 01:00:00.000000000 +0100
-+++ busybox-1.16.1/archival/libipkg/libipkg.c	2010-06-29 17:35:49.219617937 +0200
-@@ -0,0 +1,532 @@
++++ busybox-1.16.1/archival/libipkg/libipkg.c	2010-06-29 19:58:50.069617923 +0200
+@@ -0,0 +1,550 @@
 +/* ipkglib.c - the itsy package management system
 +
 +   Florina Boor
@@ -7083,9 +7083,6 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival
 +	ipkg_conf_t ipkg_conf;
 +	const char *message = "ipkg must have one sub-command argument";
 +
-+	/* mount rootfs read-write */
-+	if (mount("","/",0,MS_REMOUNT,0)<0)
-+		fprintf (stderr, "Mounting rootfs read-write failed\n");
 +
 +	args_init (&args);
 +
@@ -7121,6 +7118,18 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival
 +           args.noreadfeedsfile = 1;
 +
 +
++        if ( !strcmp(cmd_name,"install") ||
++             !strcmp(cmd_name,"update") ||
++             !strcmp(cmd_name,"upgrade") ||
++             !strcmp(cmd_name,"flag") ||
++             !strcmp(cmd_name,"configure") ||
++             !strcmp(cmd_name,"remove") ) {
++		/* mount rootfs read-write */
++		if (mount("","/",0,MS_REMOUNT,0)<0)
++			fprintf (stderr, "Mounting rootfs read-write failed\n");
++	}
++	
++
 +	err = ipkg_conf_init (&ipkg_conf, &args);
 +	if (err)
 +	{
@@ -7156,9 +7165,18 @@ diff -Nur busybox-1.16.1.orig/archival/libipkg/libipkg.c busybox-1.16.1/archival
 +	err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind_, (const char **) (argv + optind_), NULL);
 +
 +	ipkg_conf_deinit (&ipkg_conf);
-+	/* mount rootfs read-only */
-+	if (mount("","/",0,MS_REMOUNT|MS_RDONLY,0)<0)
-+		fprintf (stderr, "Mounting rootfs read-only failed\n");
++
++        if ( !strcmp(cmd_name,"install") ||
++             !strcmp(cmd_name,"update") ||
++             !strcmp(cmd_name,"upgrade") ||
++             !strcmp(cmd_name,"flag") ||
++             !strcmp(cmd_name,"configure") ||
++             !strcmp(cmd_name,"remove") ) {
++		sync();
++		/* mount rootfs read-only */
++		if (mount("","/",0,MS_REMOUNT|MS_RDONLY,0)<0)
++			fprintf (stderr, "Mounting rootfs read-only failed\n");
++	}
 +
 +	return err;
 +}