diff --git a/setup/exclude.txt b/setup/exclude.txt new file mode 100644 index 000000000..6a58a296a --- /dev/null +++ b/setup/exclude.txt @@ -0,0 +1,5 @@ +# +# The following source files are not re-distributed with the "build" of the application +# since they are used solely for constructing other files during the build process +# +packaging diff --git a/setup/install/apache.conf.tpl b/setup/install/apache.conf.tpl new file mode 100644 index 000000000..5ffcc1b4e --- /dev/null +++ b/setup/install/apache.conf.tpl @@ -0,0 +1,35 @@ +# _ITOP_NAME_ default Apache configuration + +Alias /_ITOP_NAME_ _ITOP_DATADIR_/_ITOP_NAME_ + + + Options FollowSymLinks + DirectoryIndex index.php + + + AddType application/x-httpd-php .php + + php_flag magic_quotes_gpc Off + php_flag track_vars On + php_flag register_globals Off + + + + +# Disallow web access to directories that don't need it + + Order Deny,Allow + Deny from All + + + Order Deny,Allow + Deny from All + + + Order Deny,Allow + Deny from All + + + Order Deny,Allow + Deny from All + diff --git a/setup/install/cron.tpl b/setup/install/cron.tpl new file mode 100644 index 000000000..88c5a8c9a --- /dev/null +++ b/setup/install/cron.tpl @@ -0,0 +1,19 @@ +# +# Regular cron jobs for the _ITOP_NAME_ package +# + +#MAILTO=root + +# +# Main heartbeat scheduler for _ITOP_NAME_, launched every 5 minutes +# + +*/5 * * * * root php _ITOP_DATADIR_/_ITOP_NAME_/webservices/cron.php --param_file=_ITOP_SYSCONFDIR_/_ITOP_NAME_/production/cron.params >> _ITOP_LOGDIR_/_ITOP_NAME_/cron.log 2>&1 + +# # # # # # +# # # # # #-- User name +# # # # #------ Day of week (0-7) 0 == 7 == Sunday +# # # #-------- Month (1 - 12) +# # #---------- Day of month (1 - 31) +# #------------ Hour (0 - 23) +#-------------- Min (0 - 59) diff --git a/setup/install/install.sh b/setup/install/install.sh new file mode 100644 index 000000000..32c314360 --- /dev/null +++ b/setup/install/install.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# Linux installation script to be used inside packages (deb, rmp) +# or launched manually with the appropriate variables set... +# +# $Id$ +# +#set -x + +if [ "_$_ITOP_SYSCONFDIR_" = "_" ]; then + _ITOP_SYSCONFDIR_="/etc" +fi +if [ "_$_ITOP_VARDIR_" = "_" ]; then + _ITOP_VARDIR_="/var" +fi +if [ "_$_ITOP_NAME_" = "_" ]; then + _ITOP_NAME_="itop-itsm" +fi + +if [ "_$PREFIX" != "_" ]; then + local=${HEAD}$PREFIX + sublocal=$PREFIX + conf=${HEAD}$_ITOP_SYSCONFDIR_/$_ITOP_NAME_ + subconf=$_ITOP_SYSCONFDIR_/$_ITOP_NAME_ + var=${HEAD}$_ITOP_VARDIR_ + subvar=$_ITOP_VARDIR_ +else + local=/usr/local + sublocal=$local + conf=$local/$_ITOP_SYSCONFDIR_ + subconf=$conf + var=$local/$_ITOP_VARDIR_ + subvar=$var +fi + +if [ "_$_ITOP_WEBCONFDIR_" = "_" ]; then + _ITOP_WEBCONFDIR_="$conf/../httpd" + if [ ! -d $_ITOP_WEBCONFDIR_ ]; then + exit "Please define a valid _ITOP_WEBCONFDIR_ variable" + fi +fi + +# Define additional dirs +if [ _"$_ITOP_LOGDIR_" = _"" ]; then + _ITOP_LOGDIR_="$var/log/$_ITOP_NAME_" +else + _ITOP_LOGDIR_="${HEAD}$_ITOP_LOGDIR_" +fi + +if [ _"$_ITOP_VARLIBDIR_" = _"" ]; then + _ITOP_VARLIBDIR_="$var/lib/$_ITOP_NAME_" +else + _ITOP_VARLIBDIR_="${HEAD}$_ITOP_VARLIBDIR_" +fi + +if [ _"$_ITOP_DATADIR_" = _"" ]; then + _ITOP_DATADIR_="$local/share/$_ITOP_NAME_" +else + _ITOP_DATADIR_="${HEAD}$_ITOP_DATADIR_" +fi + +# From now on Variables are correctly setup, just use them +# +echo "$_ITOP_NAME_ will be installed under $_ITOP_DATADIR_" + +echo "Creating target directories ..." +for d in production test toolkit; do + install -m 755 -d $conf/$d $_ITOP_VARLIBDIR_/env-$d +done +install -m 755 -d $_ITOP_DATADIR_ $_ITOP_LOGDIR_ "$_ITOP_VARLIBDIR_/data" + +echo "Copying files ..." +cp -a ./web/* $_ITOP_DATADIR_ + +echo "Creating symlinks..." +(cd $_ITOP_DATADIR_ ; \ +ln -s $subconf conf ;\ +ln -s $subvar/log/$_ITOP_NAME_ log ;\ +ln -s $subvar/lib/$_ITOP_NAME_/env-production env-production ;\ +ln -s $subvar/lib/$_ITOP_NAME_/env-test env-test ;\ +ln -s $subvar/lib/$_ITOP_NAME_/data data ;\ +) +(cd $_ITOP_VARLIBDIR_ ; ln -s $sublocal/share/$_ITOP_NAME_/approot.inc.php approot.inc.php) + + +if [ _"$HEAD" != _"" ]; then + install -m 755 -d $_ITOP_WEBCONFDIR_/conf.d $conf/../cron.d +fi + +# Substitute variables for templates +sed -e "s~_ITOP_NAME_~$_ITOP_NAME_~g" -e "s~_ITOP_SYSCONFDIR_~$conf~g" -e "s~_ITOP_DATADIR_~$sublocal/share~g" -e "s~_ITOP_LOGDIR_~$subvar/log~g" ./web/setup/install/apache.conf.tpl > $_ITOP_WEBCONFDIR_/conf.d/$_ITOP_NAME_.conf +sed -e "s~_ITOP_NAME_~$_ITOP_NAME_~g" -e "s~_ITOP_SYSCONFDIR_~$conf~g" -e "s~_ITOP_DATADIR_~$sublocal/share~g" -e "s~_ITOP_LOGDIR_~$subvar/log~g" ./web/setup/install/cron.tpl > $conf/../cron.d/$_ITOP_NAME_ +chmod 644 $_ITOP_WEBCONFDIR_/conf.d/$_ITOP_NAME_.conf $conf/../cron.d/$_ITOP_NAME_ + +exit 0 diff --git a/setup/packaging/rpm/itop-itsm.spec b/setup/packaging/rpm/itop-itsm.spec new file mode 100644 index 000000000..ec6e4e069 --- /dev/null +++ b/setup/packaging/rpm/itop-itsm.spec @@ -0,0 +1,73 @@ +%define webconfdir %{?_webconfdir:%{_sysconfdir}/httpd} +%define logdir %{?_logdir:%{_var}/log} + +Name: itop-itsm +Version: 2.0.2 +Release: 1%{?dist} +# Use a variable below +Summary: iTop: IT Operational Portal +# Use a variable below +Group: Applications/Databases +License: AGPLv3+ +URL: http://www.combodo.com/itop +Source0: iTop-2.0.2-beta-1416.zip +#Source4: install.sh +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +# Use a variable below +Requires: php >= 5.2.0, php-mysql, php-mcrypt, php-xml, php-cli, php-soap, graphviz +#, php-pecl-apc +# Use a variable below +BuildRequires: unzip + +# Use a variable below +%description +iTop is an open source CMDB... + +%prep +%setup -c %{name} +#cp %SOURCE4 ./web/setup/install/ + +%build + +%install +rm -rf %{buildroot} + +export _ITOP_NAME_=%{name} +export _ITOP_SYSCONFDIR_=%{_sysconfdir} +export _ITOP_WEBCONFDIR_=%{buildroot}/%{webconfdir} +export _ITOP_VARDIR_=%{_var} +export PREFIX=%{_prefix} +export HEAD=%{buildroot} +chmod 755 ./web/setup/install/install.sh +./web/setup/install/install.sh + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +#%dir %{_datadir}/%{name} +%dir %{_var}/lib/%{name} +%{_datadir}/* +%{webconfdir}/conf.d/%{name}.conf +%{_sysconfdir}/cron.d/%{name} +%{_var}/lib/%{name}/approot.inc.php + +# Use a variable below +%defattr(-,apache,root,-) +%dir %{_sysconfdir}/%{name} +#%config(noreplace) %{_sysconfdir}/%{name}/production/cron.params +%dir %{_sysconfdir}/%{name}/test +%dir %{_sysconfdir}/%{name}/toolkit +%dir %{logdir}/%{name} +%dir %{_var}/lib/%{name}/env-production +%dir %{_var}/lib/%{name}/env-test +%dir %{_var}/lib/%{name}/env-toolkit +%dir %{_var}/lib/%{name}/data + + +%changelog +* Mon Aug 05 2013 Denis Flaven +- ver 1.0