summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--WHATS_NEW5
-rw-r--r--tools/Makefile.in8
-rw-r--r--tools/lvm-static.c21
-rw-r--r--tools/lvm.c2
-rw-r--r--tools/lvm2cmdline.h2
-rw-r--r--tools/lvmcmdline.c19
7 files changed, 46 insertions, 13 deletions
diff --git a/VERSION b/VERSION
index 271a57146..c61be4e73 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.01.05-cvs (2005-02-09)
+2.01.05-cvs (2005-02-18)
diff --git a/WHATS_NEW b/WHATS_NEW
index 889237556..c917c798c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
-Version 2.01.05 -
-===================================
+Version 2.01.05 - 18th February 2005
+====================================
+ Static binary invokes dynamic binary if appropriate.
Make clvmd config check a little more tolerant.
gulm clvmd can now cope with >1 message arriving in a TCP message.
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 05eb51472..d032e7094 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -90,14 +90,16 @@ ifeq ("@DEVMAPPER@", "yes")
LVMLIBS += -ldevmapper
endif
+CFLAGS += -DLVM_SHARED_PATH=\"$(sbindir)/lvm\"
+
include $(top_srcdir)/make.tmpl
lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
$(CC) -o $@ $(OBJECTS) lvm.o $(LDFLAGS) $(LVMLIBS) $(LIBS) -rdynamic
-lvm.static: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
- $(CC) -o $@ $(OBJECTS) lvm.o -static $(LDFLAGS) $(LVMLIBS) $(LIBS) \
- -rdynamic
+lvm.static: $(OBJECTS) lvm-static.o $(top_srcdir)/lib/liblvm.a
+ $(CC) -o $@ $(OBJECTS) lvm-static.o -static $(LDFLAGS) $(LVMLIBS) \
+ $(LIBS) -rdynamic
liblvm2cmd.a: $(top_srcdir)/lib/liblvm.a $(OBJECTS)
cat $(top_srcdir)/lib/liblvm.a > $@
diff --git a/tools/lvm-static.c b/tools/lvm-static.c
new file mode 100644
index 000000000..50effa966
--- /dev/null
+++ b/tools/lvm-static.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "lvm2cmdline.h"
+
+int main(int argc, char **argv)
+{
+ return lvm2_main(argc, argv, 1);
+}
diff --git a/tools/lvm.c b/tools/lvm.c
index 603bcecf6..2e9dab7e0 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -17,5 +17,5 @@
int main(int argc, char **argv)
{
- return lvm2_main(argc, argv);
+ return lvm2_main(argc, argv, 0);
}
diff --git a/tools/lvm2cmdline.h b/tools/lvm2cmdline.h
index 042cbb871..8278ae6cb 100644
--- a/tools/lvm2cmdline.h
+++ b/tools/lvm2cmdline.h
@@ -16,6 +16,6 @@
#ifndef _LVM_CMDLINE_H
#define _LVM_CMDLINE_H
-int lvm2_main(int argc, char **argv);
+int lvm2_main(int argc, char **argv, int is_static);
#endif
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 3bbcabed9..eff842467 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1409,7 +1409,7 @@ static void _exec_lvm1_command(struct cmd_context *cmd, int argc, char **argv)
log_sys_error("execvp", path);
}
-int lvm2_main(int argc, char **argv)
+int lvm2_main(int argc, char **argv, int is_static)
{
char *namebase, *base;
int ret, alias = 0;
@@ -1417,10 +1417,6 @@ int lvm2_main(int argc, char **argv)
_close_stray_fds();
- if (!(cmd = _init_lvm()))
- return -1;
-
- cmd->argv = argv;
namebase = strdup(argv[0]);
base = basename(namebase);
while (*base == '/')
@@ -1428,8 +1424,21 @@ int lvm2_main(int argc, char **argv)
if (strcmp(base, "lvm") && strcmp(base, "lvm.static") &&
strcmp(base, "initrd-lvm"))
alias = 1;
+
+ if (is_static && strcmp(base, "lvm.static") &&
+ path_exists(LVM_SHARED_PATH) &&
+ !getenv("LVM_DID_EXEC")) {
+ setenv("LVM_DID_EXEC", base, 1);
+ execvp(LVM_SHARED_PATH, argv);
+ unsetenv("LVM_DID_EXEC");
+ }
+
free(namebase);
+ if (!(cmd = _init_lvm()))
+ return -1;
+
+ cmd->argv = argv;
_register_commands();
if (_lvm1_fallback(cmd)) {