mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Static binary invokes dynamic binary if appropriate.
This commit is contained in:
parent
c9808c329d
commit
8e3a97baf2
@ -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.
|
||||
|
||||
|
@ -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 > $@
|
||||
|
21
tools/lvm-static.c
Normal file
21
tools/lvm-static.c
Normal file
@ -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);
|
||||
}
|
@ -17,5 +17,5 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return lvm2_main(argc, argv);
|
||||
return lvm2_main(argc, argv, 0);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user