mds/app-admin/pulse2-core/files/pulse2-1.3.0-makefile-1.patch

370 lines
16 KiB
Diff
Raw Normal View History

diff -uNr pulse2-1.3.0.orig//services/Makefile pulse2-1.3.0/services/Makefile
--- pulse2-1.3.0.orig//services/Makefile 2011-01-29 09:09:53.000000000 +0100
+++ pulse2-1.3.0/services/Makefile 2011-01-29 12:37:18.000000000 +0100
@@ -1,38 +1,62 @@
+# (c) 2007-2008 Mandriva, http://www.mandriva.com
#
-# (c) 2009-2010 Mandriva, http://www.mandriva.com
-#
-# $Id: Makefile 7788 2010-12-02 12:31:34Z cdelfosse $
-#
-# This file is part of Pulse 2, http://pulse2.mandriva.org
-#
-# Pulse 2 is free software; you can redistribute it and/or modify
+# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Pulse 2 is distributed in the hope that it will be useful,
+# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with Pulse 2. If not, see <http://www.gnu.org/licenses/>.
-#
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
# General Makefile variables
PULSE2_OWNER := root
PULSE2_GROUP := root
-PREFIX := /usr/local
+DESTDIR =
+PREFIX = /usr/local
VARDIR := /var/lib/pulse2/imaging
VARIMAGINGDIR := $(VARDIR)/imaging-server
HOOKSDIR := $(PREFIX)/lib/pulse2/imaging-server/hooks
-SBINDIR := $(PREFIX)/sbin
-INITDIR := /etc/init.d
-ETCDIR := /etc/mmc
-INSTALL := $(shell which install)
-SED := $(shell which sed)
+DATADIR = $(PREFIX)/share/mmc
+MODULESWEBSUBDIR = /modules/
+SBINDIR = $(PREFIX)/sbin
+LIBDIR = $(PREFIX)/lib/mmc
+ETCDIR = /etc/mmc
+INITDIR = /etc/init.d
3RDPARTY_FOLDER := 3rd_party
BUILD_FOLDER := build
+INSTALL = $(shell which install)
+SED = $(shell which sed)
+CP = $(shell which cp)
+CHOWN = $(shell which chown)
+CHGRP = $(shell which chgrp)
+
+# Python specific variables
+PYTHON = $(shell which python)
+PYTHON_PREFIX = $(shell $(PYTHON) -c "import sys; print sys.prefix")
+
+# List of files to install
+SBINFILES = bin/pulse2-package-server \
+ bin/pulse2-package-server-register-imaging \
+ contrib/msc/pulse2-msc-clean-database \
+ contrib/inventory/pulse2-inventory-clean-database \
+ bin/pulse2-inventory-server \
+ bin/pulse2-scheduler \
+ bin/pulse2-scheduler-manager \
+ bin/pulse2-launcher \
+ bin/pulse2-launchers-manager \
+ bin/pulse2-output-wrapper \
+ bin/pulse2-ping \
+ bin/pulse2-wol \
+ bin/pulse2-tcp-sproxy \
+ src/pulse2-imaging-server
# WOL stuff
WOL_VERSION := 0.7.1
@@ -40,15 +64,14 @@
WOL_FOLDER := wol-$(WOL_VERSION)
WOL_TARBALL := $(WOL_FOLDER).tar.gz
-# main target
+# Extension for backuped configuration files
+BACKUP := .$(shell date +%Y-%m-%d+%H:%M:%S)
BUILD_FOLDER = build
SUBDIRS = src
.PHONY: subdirs $(SUBDIRS)
-all: subdirs wol
-
subdirs: $(SUBDIRS)
$(SUBDIRS):
@@ -62,8 +85,6 @@
wol-clean:
-$(MAKE) clean -C $(BUILD_FOLDER)/$(WOL_FOLDER)
-install: subdirs install-imaging-server
-
wol:
[ -e $(3RDPARTY_FOLDER)/$(WOL_TARBALL) ] || wget $(WOL_URI)/$(WOL_TARBALL) -P $(3RDPARTY_FOLDER)
[ -d $(BUILD_FOLDER)/$(WOL_FOLDER) ] || tar zxf $(3RDPARTY_FOLDER)/$(WOL_TARBALL) -C $(BUILD_FOLDER)
@@ -71,9 +92,93 @@
$(MAKE) -C $(BUILD_FOLDER)/$(WOL_FOLDER) CC=$(CC)
cp -a $(BUILD_FOLDER)/$(WOL_FOLDER)/src/wol bin/pulse2-wol
-install-imaging-server:
+all: subdirs wol
+
+# Install everything
+install_nopy: subdirs install_backup install_sbin install_cfg install_initd install_hooks install_dirs
+install: install_nopy install_py
+
+install_backup:
+ @# Install directories
+ @echo ""
+ @echo "Move old configuration files to $(DESTDIR)$(ETCDIR)$(BACKUP)"
+ -[ -f $(DESTDIR)$(ETCDIR)/package-server.ini ] && mv -f $(DESTDIR)$(ETCDIR)/package-server.ini $(DESTDIR)$(ETCDIR)/package-server.ini$(BACKUP)
+ @echo "Move old configuration files to $(DESTDIR)$(ETCDIR)$(BACKUP)"
+ -[ -f $(DESTDIR)$(ETCDIR)/inventory-server.ini ] && mv -f $(DESTDIR)$(ETCDIR)/inventory-server.ini $(DESTDIR)$(ETCDIR)/inventory-server.ini$(BACKUP)
+ @echo "Move old configuration files to $(DESTDIR)$(ETCDIR)$(BACKUP)"
+ -[ -f $(DESTDIR)$(ETCDIR)/scheduler.ini ] && mv -f $(DESTDIR)$(ETCDIR)/scheduler.ini $(DESTDIR)$(ETCDIR)/scheduler.ini$(BACKUP)
+ @echo "Move old configuration files to $(DESTDIR)$(ETCDIR)$(BACKUP)"
+ -[ -f $(DESTDIR)$(ETCDIR)/launchers.ini ] && mv -f $(DESTDIR)$(ETCDIR)/launchers.ini $(DESTDIR)$(ETCDIR)/launchers.ini$(BACKUP)
+
+install_py:
+ @echo ""
+ @echo "Creating python directories..."
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(PYTHON_PREFIX)
+ @echo ""
+ @echo "Install python code in $(DESTDIR)$(PYTHON_PREFIX)"
+ $(PYTHON) setup.py install --no-compile --prefix $(DESTDIR)$(PYTHON_PREFIX)
+
+install_sbin: subdirs
+ @echo ""
+ @echo "Creating sbin directories..."
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(SBINDIR)
+ @echo ""
+ @echo "Install SBINFILES in $(DESTDIR)$(SBINDIR)"
+ $(INSTALL) $(SBINFILES) -m 755 -o root -g root $(DESTDIR)$(SBINDIR)
+
+install_cfg:
+ @echo ""
+ @echo "Creating config directories..."
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)
+ @echo ""
+ @echo "Install CONFILES in $(DESTDIR)$(ETCDIR)"
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)/plugins
+ $(INSTALL) conf/plugins/* -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/plugins
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/package-server
+ $(INSTALL) conf/pulse2/package-server/package-server.ini -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/package-server
+ $(INSTALL) conf/pulse2/package-server/keys -d -m 700 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/package-server/keys
+ $(INSTALL) conf/pulse2/package-server/keys/* -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/package-server/keys/
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/inventory-server
+ $(INSTALL) conf/pulse2/inventory-server/inventory-server.ini -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/inventory-server
+ $(INSTALL) conf/pulse2/inventory-server/keys -d -m 700 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/inventory-server/keys
+ $(INSTALL) conf/pulse2/inventory-server/keys/* -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/inventory-server/keys/
+ $(INSTALL) contrib/OcsNGMap.xml -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/inventory-server/
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/scheduler
+ $(INSTALL) conf/pulse2/scheduler/scheduler.ini -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/scheduler
+ $(INSTALL) conf/pulse2/scheduler/keys -d -m 700 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/scheduler/keys
+ $(INSTALL) conf/pulse2/scheduler/keys/* -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/scheduler/keys/
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/launchers
+ $(INSTALL) conf/pulse2/launchers/launchers.ini -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/launchers
+ $(INSTALL) conf/pulse2/launchers/keys -d -m 700 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/launchers/keys
+ $(INSTALL) conf/pulse2/launchers/keys/* -m 600 -o root -g root $(DESTDIR)$(ETCDIR)/pulse2/launchers/keys/
+ $(INSTALL) -m 755 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(ETCDIR)/pulse2/imaging-server
+ $(INSTALL) -m 755 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(ETCDIR)/pulse2/atftpd
+ $(INSTALL) -m 600 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) conf/pulse2/imaging-server/imaging-server.ini $(DESTDIR)/$(ETCDIR)/pulse2/imaging-server
+ $(INSTALL) -m 600 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) conf/pulse2/atftpd/pcre.conf $(DESTDIR)/$(ETCDIR)/pulse2/atftpd
+
+install_initd:
+ @echo ""
+ @echo "Creating init.d directories..."
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(INITDIR)
+ $(INSTALL) -m 755 -o root -g root init.d/pulse2-package-server $(DESTDIR)$(INITDIR)
+ $(SED) -i 's!##SBINDIR##!$(SBINDIR)!' $(DESTDIR)$(INITDIR)/pulse2-package-server
+ $(INSTALL) -m 755 -o root -g root init.d/pulse2-inventory-server $(DESTDIR)$(INITDIR)
+ $(SED) -i 's!##SBINDIR##!$(SBINDIR)!' $(DESTDIR)$(INITDIR)/pulse2-inventory-server
+ $(INSTALL) -m 755 -o root -g root init.d/pulse2-scheduler $(DESTDIR)$(INITDIR)
+ $(SED) -i 's!##SBINDIR##!$(SBINDIR)!' $(DESTDIR)$(INITDIR)/pulse2-scheduler
+ $(INSTALL) -m 755 -o root -g root init.d/pulse2-launchers $(DESTDIR)$(INITDIR)
+ $(SED) -i 's!##SBINDIR##!$(SBINDIR)!' $(DESTDIR)$(INITDIR)/pulse2-launchers
+ $(INSTALL) -m 755 -o root -g root init.d/pulse2-imaging-server $(DESTDIR)$(INITDIR)
+ $(SED) -i 's!##SBINDIR##!$(SBINDIR)!' $(DESTDIR)$(INITDIR)/pulse2-imaging-server
+
+install_hooks:
+ @echo "Installing hooks ..."
+ $(INSTALL) -m 755 -o root -g root -d $(DESTDIR)/$(HOOKSDIR)
+ $(INSTALL) -m 755 -o root -g root contrib/imaging-server/hooks/* $(DESTDIR)/$(HOOKSDIR)/
+
+install_dirs:
@echo ""
- @echo "Creating directories ..."
+ @echo "Creating extra directories ..."
$(INSTALL) -m 750 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(VARDIR)
$(INSTALL) -m 750 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(VARDIR)/bootmenus
$(INSTALL) -m 750 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(VARDIR)/computers
@@ -83,19 +188,15 @@
$(INSTALL) -m 750 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(VARDIR)/isos
$(INSTALL) -m 750 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(VARDIR)/archives
- @echo "Installing binaries ..."
- $(INSTALL) -m 755 -o root -g root src/pulse2-imaging-server $(DESTDIR)/$(SBINDIR)/pulse2-imaging-server
+include ../common.mk
- @echo "Installing hooks ..."
- $(INSTALL) -m 755 -o root -g root -d $(DESTDIR)/$(HOOKSDIR)
- $(INSTALL) -m 755 -o root -g root contrib/imaging-server/hooks/* $(DESTDIR)/$(HOOKSDIR)/
+$(RELEASES_DIR)/$(TARBALL_GZ):
+ mkdir -p $(RELEASES_DIR)/$(TARBALL)
+ $(CPA) web services common.mk Makefile $(RELEASES_DIR)/$(TARBALL)
+ cd $(RELEASES_DIR) && tar -czf $(TARBALL_GZ) $(EXCLUDE_FILES) $(TARBALL); rm -rf $(TARBALL);
+
+
+pyflakes:
+ pyflakes bin/pulse2-scheduler* bin/pulse2-launcher* bin/pulse2-package* bin/pulse2-inventory* bin/pulse2-output-wrapper bin/build* .
- @echo "Installing init files ..."
- $(INSTALL) -m 755 -o root -g root init.d/pulse2-imaging-server $(DESTDIR)$(INITDIR)
- $(SED) -i 's!##SBINDIR##!$(SBINDIR)!g' $(DESTDIR)$(INITDIR)/pulse2-imaging-server
- @echo "Installing config files ..."
- $(INSTALL) -m 755 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(ETCDIR)/pulse2/imaging-server
- $(INSTALL) -m 755 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) -d $(DESTDIR)/$(ETCDIR)/pulse2/atftpd
- $(INSTALL) -m 600 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) conf/pulse2/imaging-server/imaging-server.ini $(DESTDIR)/$(ETCDIR)/pulse2/imaging-server
- $(INSTALL) -m 600 -o $(PULSE2_OWNER) -g $(PULSE2_GROUP) conf/pulse2/atftpd/pcre.conf $(DESTDIR)/$(ETCDIR)/pulse2/atftpd
diff -uNr pulse2-1.3.0.orig//services/src/pulse2-imaging-server.c pulse2-1.3.0/services/src/pulse2-imaging-server.c
--- pulse2-1.3.0.orig//services/src/pulse2-imaging-server.c 2011-01-29 09:09:53.000000000 +0100
+++ pulse2-1.3.0/services/src/pulse2-imaging-server.c 2011-01-29 12:32:38.000000000 +0100
@@ -400,7 +400,7 @@
*/
char *name = malloc(40);
bzero(name, 40);
- fo = open(filename, 'r');
+ fo = open(filename, 'r', S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
read(fo, name, 40);
close(fo);
sendto(s, name, strlen(name) + 1 , MSG_NOSIGNAL,
@@ -647,7 +647,7 @@
*/
char *name = malloc(256);
bzero(name, 256);
- fo = open(filename, 'r');
+ fo = open(filename, 'r', S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
read(fo, name, 256);
close(fo);
sendto(s, name, strlen(name) + 1 , MSG_NOSIGNAL,
@@ -707,7 +707,7 @@
*/
char *name = malloc(256);
bzero(name, 256);
- fo = open(filename, 'r');
+ fo = open(filename, 'r', S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
read(fo, name, 256);
close(fo);
sendto(s, name, strlen(name) + 1 , MSG_NOSIGNAL,
@@ -932,7 +932,7 @@
diep("bind TCP");
listen(stcp, 1000);
- pidFileFD = open((char *)gPIDFile, O_WRONLY | O_CREAT | O_TRUNC);
+ pidFileFD = open((char *)gPIDFile, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (pidFileFD == -1)
diep("PID file");
snprintf(pidBuff, 6, "%d", pid);
diff -uNr pulse2-1.3.0.orig//web/Makefile pulse2-1.3.0/web/Makefile
--- pulse2-1.3.0.orig//web/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ pulse2-1.3.0/web/Makefile 2011-01-29 09:25:31.000000000 +0100
@@ -0,0 +1,60 @@
+# Copyright (C) 2006, Adam Cecile for Linbox FAS
+# Copyright (C) 2006, Jerome Wax for Linbox FAS
+# Copyright (C) 2006, Cedric Delfosse for Linbox FAS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+
+# General Makefile variables
+DESTDIR =
+PREFIX = /usr/local
+DATADIR = $(PREFIX)/share/mmc
+INSTALL = $(shell which install)
+CP = $(shell which cp)
+CHOWN = $(shell which chown)
+CHGRP = $(shell which chgrp)
+SED = $(shell which sed)
+RM = $(shell which rm)
+
+FILESTOINSTALL = modules
+
+# Default target
+all:
+
+clean_mo:
+ sh scripts/clean_mo.sh
+
+build_mo:
+ sh scripts/build_mo.sh
+
+build_pot:
+ sh scripts/build_pot.sh
+
+clean: clean_mo
+
+install: build_mo
+ @echo ""
+ @echo "Installing pulse2-web in $(DESTDIR)$(DATADIR)"
+ $(INSTALL) -d -m 755 -o root -g root $(DESTDIR)$(DATADIR)
+ $(CP) -R $(FILESTOINSTALL) $(DESTDIR)$(DATADIR)
+ $(CHOWN) -R root $(DESTDIR)$(DATADIR)
+ $(CHGRP) -R root $(DESTDIR)$(DATADIR)
+ find $(DESTDIR)$(DATADIR) -type f -name *.po[t] -exec rm -f {} \;
+
+$(RELEASES_DIR)/$(TARBALL_GZ):
+ mkdir -p $(RELEASES_DIR)/$(TARBALL)
+ $(CPA) $(FILESTOINSTALL) $(RELEASES_DIR)/$(TARBALL)
+ cd $(RELEASES_DIR) && tar -czf $(TARBALL_GZ) $(EXCLUDE_FILES) $(TARBALL); rm -rf $(TARBALL);
diff -uNr pulse2-1.3.0.orig//web/scripts/build_pot.sh pulse2-1.3.0/web/scripts/build_pot.sh
--- pulse2-1.3.0.orig//web/scripts/build_pot.sh 2011-01-29 09:09:53.000000000 +0100
+++ pulse2-1.3.0/web/scripts/build_pot.sh 2011-01-29 09:46:25.000000000 +0100
@@ -16,17 +16,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-POT="pulse2/locale/pulse2.pot"
-
-rm ${POT}
-touch ${POT}
-find . -iname "*.php" -exec xgettext -C -j -o ${POT} --language=PHP --keyword=_T {} \;
-
-for name in `find ${1} -type f -name *.po`; do
- echo -n "updating ${name}..."
- msgmerge --update --add-location --sort-output ${name} ${POT}
- echo "done"
+for module in dyngroup glpi imaging inventory msc pkgs pulse2; do
+ POT="modules/$module/locale/$module.pot"
+ rm -f ${POT}
+ touch ${POT}
+ find modules/$module -iname "*.php" -exec xgettext -C -j -o ${POT} --language=PHP --keyword=_T {} \;
+ for name in `find modules/$module/locale -type f -name *.po`; do
+ echo -n "updating ${name}..."
+ msgmerge --update --add-location --sort-output ${name} ${POT}
+ echo "done"
+ done
+
done
exit 0