Index: vzctl-3.0.11/src/Makefile =================================================================== --- vzctl-3.0.11.orig/src/Makefile +++ vzctl-3.0.11/src/Makefile @@ -17,7 +17,7 @@ INSTALL = install PREFIX = /usr SBINDIR = $(PREFIX)/sbin - LIBDIR = $(PREFIX)/lib/vzctl/lib + LIBDIR = $(PREFIX)/lib CONFDIR = /etc/vz GLBCONFIG = $(CONFDIR)/vz.conf VPSCONFDIR = $(CONFDIR)/conf @@ -33,7 +33,7 @@ NETSCRIPTDIR = /etc/sysconfig/network-sc VZDUMPDIR = $(VZDIR)/dump VEIPDUMPDIR = /var/lib/vzctl/veip LOGRDIR = /etc/logrotate.d - LIB_VER = 0.0.2 + LIB_VER = 0.0.3 export LD_LIBRARY_PATH=. CC = gcc @@ -43,13 +43,14 @@ SHAREDLIB_CFLAGS = -fPIC INC = -I ../include ARCH ?= $(shell uname -m) -OBJ_libvzctl = lib/env.lo lib/ub.lo lib/net.lo lib/logger.lo lib/exec.lo \ +OBJ_libvzctl = lib/env.lo lib/ub.lo lib/net.lo lib/exec.lo \ lib/cap.lo lib/cpu.lo lib/res.lo lib/util.lo lib/dist.lo lib/list.lo \ lib/script.lo lib/dev.lo lib/config.lo lib/lock.lo lib/quota.lo \ lib/modules.lo lib/iptables.lo lib/fs.lo lib/create.lo lib/readelf.lo \ lib/cpt.lo lib/destroy.lo lib/vps_configure.lo lib/meminfo.lo \ lib/veth.lo OBJ_simfs=lib/fs_simfs.lo +OBJ_logger = lib/logger.lo OBJ_vzctl = vzctl.o vzctl-actions.o modules.o enter.o OBJ_vzlist = vzlist.o OBJ_arp = arpsend.o @@ -59,17 +60,17 @@ OBJ_cfgvalidate = vzcfgvalidate.o valida OBJ_calc = vzcalc.o OBJ = $(OBJ_vzctl) $(OBJ_vzlist) $(OBJ_arp) $(OBJ_split) $(OBJ_memcheck) \ $(OBJ_cfgvalidate) $(OBJ_calc) -LOBJ = $(OBJ_libvzctl) $(OBJ_simfs) +LOBJ = $(OBJ_libvzctl) $(OBJ_simfs) $(OBJ_logger) LIB_vzctl = libvzctl.so.$(LIB_VER) LIB_simfs = libvzctl-simfs.so.$(LIB_VER) +LIB_logger = libvzlogger.so.$(LIB_VER) LIB_fs = $(LIB_simfs) -LDFLAGS += -Wl,-rpath=$(LIBDIR) LIBSCRIPTS = vps-create vps-postcreate vps-net_add vps-net_del vps-stop \ vps-functions PROGS = vzctl vzlist arpsend vzsplit vzcfgvalidate vzmemcheck vzcalc -LIBS = $(LIB_vzctl) $(LIB_fs) +LIBS = $(LIB_vzctl) $(LIB_fs) $(LIB_logger) INITSCRIPTS = vz CRONSCRIPTS = vpsreboot vpsnetclean @@ -102,23 +103,26 @@ check-version: %.lo: %.c $(CC) -c $(CFLAGS) $(SHAREDLIB_CFLAGS) $(INC) $< -o $@ -$(LIB_fs) : $(OBJ_simfs) lib/logger.lo - $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -o $@ +$(LIB_logger) : $(OBJ_logger) + $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -Wl,-soname,$@ -o $@ -libvzctl.a: $(OBJ_libvzctl) $(LIB_fs) +$(LIB_fs) : $(OBJ_simfs) $(LIB_logger) + $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -Wl,-soname,$@ -o $@ + +$(LIB_vzctl) : $(OBJ_libvzctl) $(LIB_fs) $(LIB_logger) + $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) -shared -Wl,-soname,$@ -o $@ + +libvzctl.a: $(OBJ_libvzctl) $(OBJ_simfs) $(OBJ_logger) ar scq $@ $+ ranlib $@ -$(LIB_vzctl) : $(LIB_fs) $(OBJ_libvzctl) - $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) -shared -o $@ - vzctl-static: $(OBJ_vzctl) libvzctl.a $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -rdynamic -ldl -lutil -o $@ -vzctl: check-version $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) - $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) -ldl -lutil -o $@ +vzctl: check-version $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) $(LIB_logger) + $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) $(LIB_logger) -ldl -lutil -o $@ -vzlist: $(OBJ_vzlist) $(LIB_vzctl) $(LIB_fs) +vzlist: $(OBJ_vzlist) $(LIB_vzctl) $(LIB_logger) $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ arpsend: $(OBJ_arp) @@ -127,10 +131,10 @@ arpsend: $(OBJ_arp) vzsplit: $(OBJ_split) $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ -vzmemcheck: $(OBJ_memcheck) $(LIB_vzctl) +vzmemcheck: $(OBJ_memcheck) $(LIB_vzctl) $(LIB_logger) $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ -vzcfgvalidate: $(OBJ_cfgvalidate) $(LIB_vzctl) +vzcfgvalidate: $(OBJ_cfgvalidate) $(LIB_vzctl) $(LIB_logger) $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ vzcalc: $(OBJ_calc) $(LIB_vzctl) @@ -145,6 +149,7 @@ install-lib: $(LIB_vzctl) $(LIB_fs) $(INSTALL) -d $(DESTDIR)$(LIBSCRIPTSDIR) $(INSTALL) $(LIB_vzctl) $(DESTDIR)$(LIBDIR)/$(LIB_vzctl) $(INSTALL) $(LIB_fs) $(DESTDIR)$(LIBDIR)/$(LIB_fs) + $(INSTALL) $(LIB_logger) $(DESTDIR)$(LIBDIR)/$(LIB_logger) for file in $(LIBSCRIPTS); do \ $(INSTALL) -m 755 ../etc/$$file $(DESTDIR)$(LIBSCRIPTSDIR)/$$file; \ done @@ -208,7 +213,7 @@ inst-dirs: install: $(PROGS) inst-dirs install-lib inst-sbin inst-scripts \ inst-netscripts inst-configs inst-initd inst-cron clean: - rm -f *.o lib/*.lo $(PROGS) $(LIB_vzctl) $(LIB_fs) $(LIB_fs) .depend + rm -f *.o lib/*.lo $(PROGS) $(LIB_vzctl) $(LIB_fs) $(LIB_logger) .depend .depend:: $(OBJ:.o=.c) $(LOBJ:.lo=.c) $(CC) -M $(FLAGS) $(DEPFLAGS) $(INC) $^ >.depend Index: vzctl-3.0.11/src/lib/logger.c =================================================================== --- vzctl-3.0.11.orig/src/lib/logger.c +++ vzctl-3.0.11/src/lib/logger.c @@ -30,7 +30,7 @@ #include "types.h" #include "logger.h" -extern log_param g_log; +LOG_DATA static inline void get_date(char *buf, int len) { Index: vzctl-3.0.11/src/vzcalc.c =================================================================== --- vzctl-3.0.11.orig/src/vzcalc.c +++ vzctl-3.0.11/src/vzcalc.c @@ -27,8 +27,6 @@ #include "config.h" #include "util.h" -LOG_DATA - void usage() { printf("Usage: vzcalc [-v] \n"); Index: vzctl-3.0.11/src/vzcfgvalidate.c =================================================================== --- vzctl-3.0.11.orig/src/vzcfgvalidate.c +++ vzctl-3.0.11/src/vzcfgvalidate.c @@ -26,8 +26,6 @@ #include "validate.h" #include "logger.h" -log_param g_log; - void usage() { printf("Usage: vzcfgvalidate [-r|-i] \n"); Index: vzctl-3.0.11/src/vzctl.c =================================================================== --- vzctl-3.0.11.orig/src/vzctl.c +++ vzctl-3.0.11/src/vzctl.c @@ -32,8 +32,6 @@ #include "util.h" #include "modules.h" -LOG_DATA - struct mod_action g_action; char *_proc_title; int _proc_title_len; Index: vzctl-3.0.11/src/vzlist.c =================================================================== --- vzctl-3.0.11.orig/src/vzlist.c +++ vzctl-3.0.11/src/vzlist.c @@ -42,7 +42,6 @@ #include "util.h" #include "types.h" -LOG_DATA static struct Cveinfo *veinfo = NULL; static int n_veinfo = 0; Index: vzctl-3.0.11/src/vzmemcheck.c =================================================================== --- vzctl-3.0.11.orig/src/vzmemcheck.c +++ vzctl-3.0.11/src/vzmemcheck.c @@ -29,8 +29,6 @@ #include "util.h" #include "logger.h" -LOG_DATA - void usage() { printf("Usage: vzmemcheck [-v] [-A]\n"); Index: vzctl-3.0.11/vzctl.spec =================================================================== --- vzctl-3.0.11.orig/vzctl.spec +++ vzctl-3.0.11/vzctl.spec @@ -5,9 +5,10 @@ %define _dumpdir %{_vzdir}/dump %define _cachedir %{_vzdir}/template/cache %define _veipdir /var/lib/vzctl/veip -%define _libdir /usr/lib/vzctl +%define _libvzdir /usr/lib/vzctl +%define _libscriptdir %{_libvzdir}/scripts %define _configdir /etc/vz -%define _scriptdir /usr/share/vzctl//scripts +%define _scriptdir /usr/share/vzctl/scripts %define _vpsconfdir /etc/sysconfig/vz-scripts %define _netdir /etc/sysconfig/network-scripts %define _logrdir /etc/logrotate.d @@ -156,13 +157,17 @@ Virtual Private Servers control API libr %files lib %defattr(-,root,root) -%dir %{_libdir}/lib -%attr(755,root,root) %{_libdir}/lib/libvzctl.so.* -%attr(755,root,root) %{_libdir}/lib/libvzctl-simfs.so.* -%attr(755,root,root) %{_libdir}/scripts/vps-stop -%attr(755,root,root) %{_libdir}/scripts/vps-functions -%attr(755,root,root) %{_libdir}/scripts/vps-net_add -%attr(755,root,root) %{_libdir}/scripts/vps-net_del -%attr(755,root,root) %{_libdir}/scripts/vps-create -%attr(755,root,root) %{_libdir}/scripts/vps-postcreate +%attr(755,root,root) %{_libdir}/libvzlogger.so.* +%attr(755,root,root) %{_libdir}/libvzctl.so.* +%attr(755,root,root) %{_libdir}/libvzctl-simfs.so.* +%dir %{_libvzdir} +%dir %{_libscriptdir} +%attr(755,root,root) %{_libscriptdir}/vps-stop +%attr(755,root,root) %{_libscriptdir}/vps-functions +%attr(755,root,root) %{_libscriptdir}/vps-net_add +%attr(755,root,root) %{_libscriptdir}/vps-net_del +%attr(755,root,root) %{_libscriptdir}/vps-create +%attr(755,root,root) %{_libscriptdir}/vps-postcreate +%post lib -p /sbin/ldconfig +%postun lib -p /sbin/ldconfig