Review installation, create tarball and add first spec file draft.

refs #4926
This commit is contained in:
Michael Friedrich 2013-10-20 16:00:12 +02:00 committed by Marius Hein
parent 9284defe17
commit 6b2cb571b6
12 changed files with 1889 additions and 1365 deletions

View File

@ -1,7 +1,15 @@
SHELL=/bin/sh
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
prefix=@prefix@
exec_prefix=@exec_prefix@
WWW_CONF_PATH=@www_conf_path@
HTTPD_CONFIG_PATH=@httpd_config_path@
ICINGAWEB_CONFIG_PATH=@icingaweb_config_path@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
INSTALL_OPTS_WEB=@INSTALL_OPTS_WEB@
@ -15,9 +23,18 @@ default:
#
# Installs the whole application w\o httpd configurations
#
install: install-static-files install-runtime-dirs ensure-writable-folders
install: install-config install-basic
#
# Installs the whole application w\o configuration
#
install-basic: install-static-files install-runtime-dirs ensure-writable-folders
#
# Updates only the application
#
update: install-application
#
# Removes files created by ./configure
#
@ -33,9 +50,27 @@ clean:
#
# Installs/copies all static files (executables, scripts, html, etc)
#
install-static-files: install-application copy-web-files-public copy-web-files-config copy-web-files-modules
install-static-files: install-application copy-web-files-public copy-web-files-modules
$(INSTALL) -m 644 $(INSTALL_OPTS) "./public/.htaccess" $(DESTDIR)$(prefix)/public/.htaccess;
#
# Installs all configuration files
#
install-config:
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
@dirs=`cd ./config ; find . -mindepth 1 -type d `;\
for dir in $$dirs; do \
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$dir"; \
done;
@files=`cd ./config ; find . -mindepth 1 -type f \
-and ! -name ".*" -and ! -name "*.in"`; \
for file in $$files; do \
$(INSTALL) -m 644 $(INSTALL_OPTS) "./config/$$file" $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)/"$$file"; \
done
#
# Installs runtime directories like the application cache
#
@ -51,7 +86,8 @@ install-tests: copy-folder-tests
# Install configurations for apache2
#
install-apache-config:
$(INSTALL) -m 644 $(INSTALL_OPTS) "./etc/apache/icingaweb.conf" $(WWW_CONF_PATH)/icingaweb.conf;
$(INSTALL) -m 755 -d $(INSTALL_OPTS) $(DESTDIR)$(HTTPD_CONFIG_PATH)
$(INSTALL) -m 644 $(INSTALL_OPTS) "./etc/apache/icingaweb.conf" $(DESTDIR)$(HTTPD_CONFIG_PATH)/icingaweb.conf;
#
# Installs the php files to the prefix
@ -59,7 +95,7 @@ install-apache-config:
install-application: copy-web-files-application copy-web-files-library
#
# Rule for coying folders and containing files (arbitary types), hidden files are excluded
# Rule for copying folders and containing files (arbitary types), hidden files are excluded
#
copy-folder-%:
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(prefix)/$*
@ -79,7 +115,7 @@ copy-folder-%:
ensure-writable-folders:
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/var/
$(INSTALL) -m 775 $(INSTALL_OPTS_WEB) -d $(DESTDIR)$(prefix)/var/log
chmod -R 775 $(DESTDIR)$(prefix)/config
chmod -R 775 $(DESTDIR)$(ICINGAWEB_CONFIG_PATH)
#
@ -103,4 +139,11 @@ copy-web-files-%:
$(INSTALL) -m 644 $(INSTALL_OPTS_WEB) "$$file" $(DESTDIR)$(prefix)/"$$file"; \
done
#
# Create release or snapshot tarball
#
create-tarball:
@./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/
create-tarball-nightly:
./bin/make-tarball --prefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-`date +%Y%m%d`-`git rev-parse --short HEAD`/

198
bin/make-tarball Executable file
View File

@ -0,0 +1,198 @@
#!/bin/sh -
#
# File: make-tarball
#
# Description: A utility script that builds an archive file(s) of all
# git repositories and submodules in the current path.
# Useful for creating a single tarfile of a git super-
# project that contains other submodules.
# Derived from git-archive-all.sh, modified for Icinga
# DEBUGGING
set -e
set -C # noclobber
# TRAP SIGNALS
trap 'cleanup' QUIT EXIT
# For security reasons, explicitly set the internal field separator
# to newline, space, tab
OLD_IFS=$IFS
IFS='
'
cleanup () {
rm -f $TMPFILE
rm -f $TOARCHIVE
IFS="$OLD_IFS"
}
usage () {
echo "Usage is as follows:"
echo
echo "$PROGRAM <--version>"
echo " Prints the program version number on a line by itself and exits."
echo
echo "$PROGRAM <--usage|--help|-?>"
echo " Prints this usage output and exits."
echo
echo "$PROGRAM [--format <fmt>] [--prefix <path>] [--separate|-s] [output_file]"
echo " Creates an archive for the entire git superproject, and its submodules"
echo " using the passed parameters, described below."
echo
echo " If '--format' is specified, the archive is created with the named"
echo " git archiver backend. Obviously, this must be a backend that git-archive"
echo " understands. The format defaults to 'tar' if not specified."
echo
echo " If '--prefix' is specified, the archive's superproject and all submodules"
echo " are created with the <path> prefix named. The default is to not use one."
echo
echo " If '--separate' or '-s' is specified, individual archives will be created"
echo " for each of the superproject itself and its submodules. The default is to"
echo " concatenate individual archives into one larger archive."
echo
echo " If 'output_file' is specified, the resulting archive is created as the"
echo " file named. This parameter is essentially a path that must be writeable."
echo " When combined with '--separate' ('-s') this path must refer to a directory."
echo " Without this parameter or when combined with '--separate' the resulting"
echo " archive(s) are named with a dot-separated path of the archived directory and"
echo " a file extension equal to their format (e.g., 'superdir.submodule1dir.tar')."
}
version () {
echo "$PROGRAM version $VERSION"
}
# Internal variables and initializations.
readonly PROGRAM=`basename "$0"`
readonly VERSION=0.2
OLD_PWD="`pwd`"
TMPDIR=${TMPDIR:-/tmp}
TMPFILE=`mktemp "$TMPDIR/$PROGRAM.XXXXXX"` # Create a place to store our work's progress
TOARCHIVE=`mktemp "$TMPDIR/$PROGRAM.toarchive.XXXXXX"`
OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
SEPARATE=0
FORMAT=tar
PREFIX=
TREEISH=HEAD
# RETURN VALUES/EXIT STATUS CODES
readonly E_BAD_OPTION=254
readonly E_UNKNOWN=255
# Process command-line arguments.
while test $# -gt 0; do
case $1 in
--format )
shift
FORMAT="$1"
shift
;;
--prefix )
shift
PREFIX="$1"
shift
;;
--separate | -s )
shift
SEPARATE=1
;;
--version )
version
exit
;;
-? | --usage | --help )
usage
exit
;;
-* )
echo "Unrecognized option: $1" >&2
usage
exit $E_BAD_OPTION
;;
* )
break
;;
esac
done
if [ ! -z "$1" ]; then
OUT_FILE="$1"
shift
fi
# Validate parameters; error early, error often.
if [ $SEPARATE -eq 1 -a ! -d $OUT_FILE ]; then
echo "When creating multiple archives, your destination must be a directory."
echo "If it's not, you risk being surprised when your files are overwritten."
exit
elif [ `git config -l | grep -q '^core\.bare=false'; echo $?` -ne 0 ]; then
echo "$PROGRAM must be run from a git working copy (i.e., not a bare repository)."
exit
fi
# Create the superproject's git-archive
git archive --format=$FORMAT --prefix="$PREFIX" $TREEISH > $TMPDIR/$(basename $(pwd)).$FORMAT
echo $TMPDIR/$(basename $(pwd)).$FORMAT >| $TMPFILE # clobber on purpose
superfile=`head -n 1 $TMPFILE`
# DEACTIVATED: We do not have any exportable sub repositories
# find . -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' | grep -v '^$' >> $TOARCHIVE
while read path; do
TREEISH=$(git submodule | grep "^ .*${path%/}" | cut -d ' ' -f 2) # git-submodule does not list trailing slashes in $path
cd "$path"
git archive --format=$FORMAT --prefix="${PREFIX}$path" ${TREEISH:-HEAD} > "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT
if [ $FORMAT = 'zip' ]; then
# delete the empty directory entry; zipped submodules won't unzip if we don't do this
zip -d "$(tail -n 1 $TMPFILE)" "${PREFIX}${path%/}" >/dev/null # remove trailing '/'
fi
echo "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT >> $TMPFILE
cd "$OLD_PWD"
done < $TOARCHIVE
# Concatenate archives into a super-archive.
if [ $SEPARATE -eq 0 ]; then
if [ $FORMAT = 'tar' ]; then
sed -e '1d' $TMPFILE | while read file; do
tar --concatenate -f "$superfile" "$file" && rm -f "$file"
done
elif [ $FORMAT = 'zip' ]; then
sed -e '1d' $TMPFILE | while read file; do
# zip incorrectly stores the full path, so cd and then grow
cd `dirname "$file"`
zip -g "$superfile" `basename "$file"` && rm -f "$file"
done
cd "$OLD_PWD"
fi
echo "$superfile" >| $TMPFILE # clobber on purpose
fi
while read file; do
mv "$file" "$OUT_FILE"
done < $TMPFILE
CURRENTDIR=${PWD##*/}
gzip $OUT_FILE/$CURRENTDIR.tar
TAR_NAME=${PREFIX%/}
test -f $TAR_NAME.tar.gz && rm -f $TAR_NAME.tar.gz
mv $OUT_FILE/$CURRENTDIR.tar.gz ../$TAR_NAME.tar.gz
echo "../$TAR_NAME.tar.gz created for uploading..."
cd ..
test -f $TAR_NAME.tar.gz.md5 && rm $TAR_NAME.tar.gz.md5
md5sum $TAR_NAME.tar.gz > $TAR_NAME.tar.gz.md5
echo "../$TAR_NAME.tar.gz.md5 created for uploading..."

5
config/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
authentication.ini
modules/monitoring/backends.ini
modules/monitoring/instances.ini
resources.ini

View File

@ -1,32 +0,0 @@
; authentication.ini
;
; Each section listed in this configuration represents a single backend
; that can be used to authenticate users or groups. Each databse backend must refer
; to a resource defined in resources.ini,
;
; The order of entries in this configuration is used to determine the fallback
; priority in case of an error. If the resource referenced in the first
; entry is not reachable, the next lower entry will be used for authentication.
; Please be aware that this behaviour is not valid for the authentication itself.
; The authentication will only be done against the one available resource with the highest
; priority.
[users-ldap]
backend = "ldap"
target = "user"
hostname = "localhost"
root_dn = "ou=people,dc=icinga,dc=org"
bind_dn = "cn=admin,cn=config"
bind_pw = "admin"
user_class = "inetOrgPerson"
user_name_attribute = "uid"
[users-pgsql]
backend = "db"
target = "user"
resource = "icingaweb-pgsql"
[users-mysql]
backend = "db"
target = "user"
resource = "icingaweb-mysql"

View File

@ -1,2 +0,0 @@
[icinga]
path = "/usr/local/icinga-mysql/var/rw/icinga.cmd"

View File

@ -0,0 +1,2 @@
[icinga]
path = "@icinga_commandpipe@"

2665
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ AC_CHECK_PHP_MODULE([sockets json])
# Configuration files
#
AC_ARG_WITH([icingaweb_config_path],
AS_HELP_STRING([--with-icingaweb-config-path], [Configuration path for icinga web]),
AS_HELP_STRING([--with-icingaweb-config-path=PATH], [Configuration path for icinga web]),
icingaweb_config_path="'$withval'",
icingaweb_config_path="'$prefix/config/'"
)
@ -57,10 +57,10 @@ AC_ARG_WITH([web_path],
web_path=/icingaweb
)
AC_ARG_WITH([www_conf_path],
AS_HELP_STRING([--with-http-configuration-path=PATH], [Include folder apache2 (default /etc/apache2/conf.d)]),
www_conf_path=$withval,
www_conf_path=AC_PATH_GUESS([/etc/httpd/conf.d /etc/apache2/conf-available /etc/apache2/conf.d /etc/apache/conf.d], [www_conf_path], [/etc/apache2/conf.d])
AC_ARG_WITH([httpd_config_path],
AS_HELP_STRING([--with-httpd-config-path=PATH], [Include folder apache2 (default /etc/apache2/conf.d)]),
httpd_config_path=$withval,
httpd_config_path=AC_PATH_GUESS([/etc/httpd/conf.d /etc/apache2/conf-available /etc/apache2/conf.d /etc/apache/conf.d], [httpd_config_path], [/etc/apache2/conf.d])
)
#
@ -374,7 +374,7 @@ AC_SUBST(app_name)
AC_SUBST(web_user)
AC_SUBST(web_group)
AC_SUBST(web_path)
AC_SUBST(www_conf_path)
AC_SUBST(httpd_config_path)
AC_SUBST(bin_user)
AC_SUBST(bin_group)
AC_SUBST(icingaweb_config_path)
@ -439,6 +439,7 @@ AC_CONFIG_FILES([
config/authentication.ini
config/resources.ini
config/modules/monitoring/backends.ini
config/modules/monitoring/instances.ini
etc/apache/icingaweb.conf
public/.htaccess
])

1
etc/apache/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
icingaweb.conf

266
icingaweb.spec Normal file
View File

@ -0,0 +1,266 @@
# $Id$
# Authority: The icinga devel team <icinga-devel at lists.sourceforge.net>
# Upstream: The icinga devel team <icinga-devel at lists.sourceforge.net>
# ExcludeDist: el4 el3
%define revision 0
# FIXME logdir must be set to /var/log/icingaweb
#%define logdir %{_localstatedir}/log/%{name}
%define logdir %{_datadir}/icingaweb/var/log
%define sharedir %{_datadir}/icingaweb
%define prefixdir %{_datadir}/icingaweb
%define configdir %{_sysconfdir}/icingaweb
%if "%{_vendor}" == "suse"
%define phpname php5
%define phpzendname php5-ZendFramework
%endif
%if "%{_vendor}" == "redhat"
%define phpname php
%define phpzendname php-ZendFramework
%endif
# el5 requires newer php53 rather than php (5.1)
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
%define phpname php53
%endif
%if "%{_vendor}" == "suse"
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
%define apacheuser wwwrun
%define apachegroup www
%define extcmdfile-1x %{_localstatedir}/icinga/rw/icinga.cmd
%define livestatussocket-1x %{_localstatedir}/icinga/rw/live
%endif
%if "%{_vendor}" == "redhat"
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
%define apacheuser apache
%define apachegroup apache
%define extcmdfile-1x %{_localstatedir}/spool/icinga/cmd/icinga.cmd
%define livestatussocket-1x %{_localstatedir}/spool/icinga/cmd/live
%endif
Summary: Open Source host, service and network monitoring Web UI
Name: icingaweb
Version: 1.0.0
Release: %{revision}%{?dist}
License: GPLv2
Group: Applications/System
URL: http://www.icinga.org
BuildArch: noarch
%if "%{_vendor}" == "suse"
AutoReqProv: Off
%endif
Source0: https://downloads.sourceforge.net/project/icinga/%{name}/%{version}/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{phpname} >= 5.3.0
BuildRequires: %{phpname}-devel >= 5.3.0
BuildRequires: %{phpname}-ldap
BuildRequires: %{phpname}-pdo
BuildRequires: %{phpzendname}
BuildRequires: %{phpzendname}-Db-Adapter-Pdo
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Mysql
BuildRequires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
%if "%{_vendor}" == "redhat"
%endif
%if "%{_vendor}" == "suse"
Requires: %{phpname}-devel >= 5.3.0
BuildRequires: %{phpname}-json
BuildRequires: %{phpname}-sockets
BuildRequires: %{phpname}-dom
%endif
Requires: %{phpname} >= 5.3.0
Requires: %{phpzendname}
Requires: %{phpname}-ldap
Requires: %{phpname}-pdo
%if "%{_vendor}" == "redhat"
Requires: %{phpname}-common
Requires: php-pear
%endif
%if "%{_vendor}" == "suse"
Requires: %{phpname}-pear
Requires: %{phpname}-dom
Requires: %{phpname}-tokenizer
Requires: %{phpname}-gettext
Requires: %{phpname}-ctype
Requires: %{phpname}-json
Requires: apache2-mod_php5
%endif
Requires: %{name}-doc
%description
IcingaWeb for Icinga 2 or Icinga 1.x using status data,
IDOUtils or Livestatus as backend provider.
%package doc
Summary: documentation for IcingaWeb
Group: Applications/System
Requires: %{name} = %{version}-%{release}
%description doc
Documentation for IcingaWeb.
%package config-internal-mysql
Summary: config for internal mysql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo
Requires: %{phpzendname}-Db-Adapter-Pdo-Mysql
%description config-internal-mysql
Configuration for internal mysql database.
%package config-internal-pgsql
Summary: config for internal pgsql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpzendname}-Db-Adapter-Pdo
Requires: %{phpzendname}-Db-Adapter-Pdo-Pgsql
%description config-internal-pgsql
Configuration for internal pgsql database.
%package config-backend-statusdata-1x
Summary: Backend config for status data
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-statusdata
%description config-backend-statusdata-1x
Backend config for status data provided by Icinga 1.x Core.
%package config-backend-ido-mysql-1x
Summary: Backend config for icinga 1.x ido mysql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-mysql
Provides: %{name}-config-ido-mysql
%description config-backend-ido-mysql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with MySQL.
%package config-backend-ido-pgsql-1x
Summary: Backend config for icinga 1.x ido pgsql database
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Requires: %{phpname}-pgsql
Provides: %{name}-config-ido-pgsql
%description config-backend-ido-pgsql-1x
Backend config for ido mysql database provided by
Icinga 1.x IDOUtils with PostgreSQL.
%package config-backend-livestatus-1x
Summary: Backend config for icinga 1.x livestatus
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-livestatus
%description config-backend-livestatus-1x
Backend config for livestatus provided by Icinga 1.x
with mk_livestatus NEB module.
%package config-backend-commands-1x
Summary: Backend config for icinga 1.x commands
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: %{name}-config-commands
%description config-backend-commands-1x
Backend config for external command pipe provided by
Icinga 1.x
%prep
%setup -q -n %{name}-%{version}
%build
%configure \
--prefix="%{prefixdir}" \
--datadir="%{sharedir}" \
--datarootdir="%{sharedir}" \
--sysconfdir="%{configdir}" \
--with-icingaweb-config-path='%{configdir}' \
--with-web-path='/icingaweb' \
--with-httpd-config-path=%{apacheconfdir} \
--with-web-user='%{apacheuser}' \
--with-web-group='%{apachegroup}' \
--with-icinga-commandpipe='%{extcmdfile-1x}' \
--with-livestatus-socket='%{livestatussocket-1x}'
# TODO --with-log-dir='%{logdir}'
%install
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%{__mkdir} -p %{buildroot}/%{apacheconfdir}
%{__make} install \
install-apache-config \
DESTDIR="%{buildroot}" \
INSTALL_OPTS="" \
COMMAND_OPTS="" \
INSTALL_OPTS_WEB="" \
INIT_OPTS=""
# prepare configuration for sub packages
%pre
# Add apacheuser in the icingacmd group
# If the group exists, add the apacheuser in the icingacmd group.
# It is not neccessary that icinga2-web is installed on the same system as
# icinga and only on systems with icinga installed the icingacmd
# group exists. In all other cases the user used for ssh access has
# to be added to the icingacmd group on the remote icinga server.
getent group icingacmd > /dev/null
if [ $? -eq 0 ]; then
%{_sbindir}/usermod -a -G icingacmd %{apacheuser}
fi
# uncomment if building from git
# %{__rm} -rf %{buildroot}%{_datadir}/icinga2-web/.git
%preun
%post
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%files
# main dirs
%defattr(-,root,root)
%if "%{_vendor}" == "redhat"
%doc etc/schema doc
%endif
%if "%{_vendor}" == "suse"
%doc etc/schema doc
%endif
%{_datadir}/%{name}/application
%{_datadir}/%{name}/library
%{_datadir}/%{name}/public
%{_datadir}/%{name}/modules
# configs
%defattr(-,root,root)
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
%dir %{configdir}
%config(noreplace) %attr(775,%{apacheuser},%{apachegroup}) %{configdir}
# logs
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
%files doc
%defattr(-,root,root)
%doc doc
%changelog
* Sun Oct 20 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.1
- initial creation

1
public/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.htaccess

View File

@ -1,14 +0,0 @@
SetEnv APPLICATION_ENV development
RewriteEngine on
RewriteBase /icinga2-web
RewriteRule ^css/icinga.css css.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
php_flag short_open_tag on
php_value xdebug.idekey PHPSTORM