Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > e915afe6db6799ef4d0534fb5d9ae04a > scriptlet

Zope-2.7.7-4.amd64.rpm

PREIN

/bin/sh

 
 
if [ -n "`/usr/bin/getgid zope`" ]; then 
	if [ "`/usr/bin/getgid zope`" != "112" ]; then 
		echo "Error: group zope doesn't have gid=112. Correct this before installing Zope." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding group zope GID=112." 
	/usr/sbin/groupadd -g 112 -r zope 1>&2 || exit $? 
	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : 
fi;
 
 
 
if [ -n "`/bin/id -u zope 2>/dev/null`" ]; then 
	if [ "`/bin/id -u zope`" != "112" ]; then 
		echo "Error: user zope doesn't have uid=112. Correct this before installing Zope." 1>&2 
		exit 1 
	fi 
else 
	echo "Adding user zope UID=112." 
	/usr/sbin/useradd \
		 \
		-u 112 \
		-r \
		-d /var/lib/zope/main \
		-s /bin/false \
		-c "Zope User"\
		-g zope \
		 \
		 \
		zope 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/zope ]; then
/sbin/service zope stop 1>&2 || :;
fi };	/sbin/chkconfig --del zope
fi

POSTIN

/bin/sh
/sbin/chkconfig --add zope
# TODO: move this migration to trigger
if [ ! -f /etc/zope/main/zope.conf ] ; then
	echo "Creating initial 'main' instance..."
	/usr/sbin/mkzopeinstance main zope:zope
	echo "Instance created. Listening on 127.0.0.1:8080, initial user: 'zope' with password: 'zope'"
else
	echo "Old /etc/zope/zope.conf detected - look at changes about upgrade!" >&2
fi
was_stopped=0
for dir in /var/lib/zope/main /var/lib/zope ; do
	if [ -f $dir/Data.fs ]; then
		echo "Found the database in old location. Migrating..."
		if [ -f /var/lock/subsys/zope ]; then
			/sbin/service zope stop >&2
			was_stopped=1
		fi
		umask 022
		[ -d /var/lib/zope/main ] && cd $dir && mv -f Data* /var/lib/zope/main/var 2>/dev/null
		if [ "x$was_stopped" = "x1" ]; then
			/sbin/service zope start >&2
		fi
		echo "Migration completed (new db location is /var/lib/zope/main/var)"
		break
	fi
done
if [ -f /var/lock/subsys/zope ]; then
	if [ "x$was_stopped" != "x1" ]; then
		/sbin/service zope restart >&2
	fi
else
	echo "look at /etc/zope/main/zope.conf" >&2
	echo "Run then \"/sbin/service zope start\" to start Zope." >&2
	echo "You may create new Zope instances with mkzopeinstance" >&2
fi

POSTUN

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