Sophie

Sophie

distrib > PLD > ac > amd64 > by-pkgid > 58e72e3bf833acefd61a925e86206253 > scriptlet

apache-base-2.2.4-1.amd64.rpm

PRETRANS

/bin/sh
# change httpd.conf from dir to symlink
if [ ! -L /etc/httpd/httpd.conf ]; then
	if [ -d /etc/httpd/httpd.conf ]; then
		if [ -d /etc/httpd/conf.d ]; then
			mv /etc/httpd/httpd.conf/* /etc/httpd/conf.d
			rmdir /etc/httpd/httpd.conf 2>/dev/null || mv -v /etc/httpd/httpd.conf{,.rpmsave}
		else
			mv /etc/httpd/httpd.conf /etc/httpd/conf.d
		fi

		# new module packages issue error as first installed over 2.0 installation
		mv -f /var/lock/subsys/httpd{,.disabled} 2>/dev/null
	fi

	# always have httpd.conf symlink (until all packages from Ac use new dir)
	install -d /etc/httpd
	ln -s conf.d /etc/httpd/httpd.conf
fi
exit 0

PREIN

/bin/sh

 
 
if [ -n "`/usr/bin/getgid http`" ]; then 
	if [ "`/usr/bin/getgid http`" != "51" ]; then 
		echo "Error: group http doesn't have gid=51. Correct this before installing apache." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding group http GID=51." 
	/usr/sbin/groupadd -g 51 -r http 1>&2 || exit $? 
	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : 
fi;
 
 
 
if [ -n "`/bin/id -u http 2>/dev/null`" ]; then 
	if [ "`/bin/id -u http`" != "51" ]; then 
		echo "Error: user http doesn't have uid=51. Correct this before installing apache." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding user http UID=51." 
	/usr/sbin/useradd \
		 \
		-u 51 \
		-r \
		-d /home/services/httpd \
		-s /bin/false \
		-c "HTTP User"\
		-g http \
		 \
		 \
		http 1>&2 || exit $? 
	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : 
fi;

PREUN

/bin/sh
if [ "$1" = "0" ]; then
	{
if [ -f /var/lock/subsys/httpd ]; then
/sbin/service httpd stop 1>&2 || :;
fi };	/sbin/chkconfig --del httpd
fi

POSTIN

/bin/sh
/sbin/chkconfig --add httpd
umask 137
touch /var/log/httpd/{access,error,agent,referer}_log

POSTUN

/bin/sh
if [ "$1" = "0" ]; then
	/usr/lib/rpm/user_group.sh user del http
	/usr/lib/rpm/user_group.sh group del http
fi

POSTTRANS

/bin/sh
# restore lock which we disabled in pretrans
mv -f /var/lock/subsys/httpd{.disabled,} 2>/dev/null

# minimizing apache restarts logics. we restart webserver:
#
# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
# 2. first install of module (post: $1 = 1)
# 2. uninstall of module (postun: $1 == 0)
#
# the strict internal deps between apache modules and
# main package are very important for all this to work.

# restart webserver at the end of transaction
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/httpd ]; then
/sbin/service httpd restart 1>&2 || :;
else
echo 'Run "/sbin/service httpd start" to start httpd service.'
fi
fi };
# macro called at module post scriptlet

# macro called at module postun scriptlet

# it's sooo annoying to write them

Triggers

apache <= 2.0.50-6

/bin/sh
RPM_SCRIPTVERBOSITY=5 
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm 
if [ -x /usr/bin/banner.sh ]; then 
	CMD="/usr/bin/banner.sh  $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m apache-2.0.50-6" 
else 
	CMD="cat" 
fi 
eval $CMD << EOF 
WARNING!!!
Since apache-2.0.50-6 autoindex module has been separated to package
apache-mod_autoindex If you want to have the same functionality do:
poldek -Uv apache-mod_autoindex
EOF

apache < 2.0.54-4

/bin/sh
RPM_SCRIPTVERBOSITY=5 
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm 
if [ -x /usr/bin/banner.sh ]; then 
	CMD="/usr/bin/banner.sh  $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m apache-2.0.54-2" 
else 
	CMD="cat" 
fi 
eval $CMD << EOF 
WARNING!!!
CGI demo/test programs - printenv and test-cgi, have been released
from package apache into separate subpackage apache-cgi_test. If you
need printenv and/or test-cgi, please install apache-cgi_test package,
e.g. by running poldek -Uv apache-cgi_test
EOF

# update /etc/sysconfig/apache -> httpd rename
if [ -f /etc/sysconfig/apache.rpmsave ]; then
	cp -f /etc/sysconfig/httpd{,.rpmnew}
	mv -f /etc/sysconfig/{apache.rpmsave,httpd}
fi

apache < 2.0.55-3.1

/bin/sh
# check for config first as in 2.2 it's .rpmsave
if [ -f /etc/httpd/httpd.conf/10_httpd.conf ]; then
	if ! grep -q 'Include webapps.d/' /etc/httpd/httpd.conf/10_httpd.conf; then
		# make sure webapps.d is included
		cp -f /etc/httpd/httpd.conf/10_httpd.conf{,.rpmsave}
		# this file is ugly, so just append new lines
		cat <<-EOF >> /etc/httpd/httpd.conf/10_httpd.conf
		# Include webapps config
		Include webapps.d/*.conf
EOF
	fi
fi

apache < 2.2.0

/bin/sh
# change HTTPD_CONF to point to new location. *only* if it's the
# default config setting
cp -f /etc/sysconfig/httpd{,.rpmorig}
sed -i -e '/^HTTPD_CONF="\/etc\/httpd\/httpd.conf"/s,.*,HTTPD_CONF="/etc/httpd/apache.conf",' /etc/sysconfig/httpd

if [ -f /etc/httpd/conf.d/10_httpd.conf.rpmsave ]; then
	sed -e '
	# as separate modules
	/^LoadModule access_module/s,^,#,
	/^LoadModule alias_module/s,^,#,
	/^LoadModule asis_module/s,^,#,
	/^LoadModule cern_meta_module/s,^,#,
	/^LoadModule cgi_module/s,^,#,
	/^LoadModule env_module/s,^,#,
	/^LoadModule include_module/s,^,#,
	/^LoadModule log_config_module/s,^,#,
	/^LoadModule mime_magic_module/s,^,#,
	/^LoadModule mime_module/s,^,#,
	/^LoadModule negotiation_module/s,^,#,
	/^LoadModule setenvif_module/s,^,#,
	/^LoadModule speling_module/s,^,#,
	/^LoadModule userdir_module/s,^,#,

	# in 30_errordocs.conf
	//,/<\/IfModule>/s,^,#,

	# in 57_mod_autoindex.conf
	/^Alias \/icons\//s,^,#,

	# in apache.conf
	/^ScriptAlias \/cgi-bin\//s,^,#,
	/^Listen 80/s,^,#,

	# avoid loops
	/Include conf.d\/\*.conf/s,^,#,
	/Include webapps.d\/\*.conf/s,^,#,

	' < /etc/httpd/conf.d/10_httpd.conf.rpmsave > /etc/httpd/conf.d/10_httpd.conf
fi


RPM_SCRIPTVERBOSITY=5 
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm 
if [ -x /usr/bin/banner.sh ]; then 
	CMD="/usr/bin/banner.sh --stderr $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m apache" 
else 
	CMD="cat >&2" 
fi 
eval $CMD <<'EOF' 
NB! Apache main config has been changed to /etc/httpd/apache.conf

There has been changed a lot, so many things could be broken.
Please report bugs to http://bugs.pld-linux.org/.

EOF