Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 400de66351046ccb53650d12d02a84fc > scriptlet

lfc-server-postgres-1.8.1.2-2.fc14.i686.rpm

PREIN

/bin/sh
getent group lfcmgr > /dev/null || groupadd -r lfcmgr
getent passwd lfcmgr > /dev/null || useradd -r -g lfcmgr \
    -d /var/lib/lfc -s /bin/bash -c "LFC Manager" lfcmgr
exit 0

PREUN

/bin/sh
export LANG=C

if [ $1 = 0 ]; then
    /usr/sbin/update-alternatives --display lfcdaemon | \
	grep currently | grep -q lfc-postgres && \
	/sbin/service lfcdaemon stop > /dev/null 2>&1 || :
    /usr/sbin/update-alternatives --remove lfcdaemon \
	/usr/lib/lfc-postgres/lfcdaemon
    /usr/sbin/update-alternatives --display lfcdaemon > /dev/null || \
	/sbin/chkconfig --del lfcdaemon > /dev/null 2>&1 || :
fi

POSTIN

/bin/sh
updatelfc () {
    [ -r /etc/sysconfig/lfcdaemon ] && . /etc/sysconfig/lfcdaemon
    [ -z "$NSCONFIGFILE" ] && NSCONFIGFILE=/etc/NSCONFIG
    [ -r $NSCONFIGFILE ] || return 0

    nscfg=$(cat $NSCONFIGFILE)

    cfg1=$(echo $nscfg | cut -f1 -d@)
    cfg2=$(echo $nscfg | cut -f2 -d@ -s)

    user=$(echo $cfg1 | cut -f1 -d/)
    passwd=$(echo $cfg1 | cut -f2 -d/ -s)
    host=$(echo $cfg2 | cut -f1 -d/)
    db=$(echo $cfg2 | cut -f2 -d/ -s)

    [ -z "$user" ] && return 0
    [ -z "$passwd" ] && return 0
    [ -z "$host" ] && return 0
    [ -z "$db" ] && db=cns_db

    export PGPASSWORD=$passwd
    psql="psql -t -q -U $user $db"

    vmajor=$($psql -c "select major from schema_version" 2>/dev/null)
    vminor=$($psql -c "select minor from schema_version" 2>/dev/null)
    vpatch=$($psql -c "select patch from schema_version" 2>/dev/null)

    if [ -z "$vmajor" -o -z "$vminor" -o -z "$vpatch" ] ; then
	return 0
    fi

    if [ $vmajor -eq 3 -a $vminor -eq 0 -a $vpatch -eq 0 ] ; then
	$psql <<-EOF
	ALTER TABLE Cns_groupinfo ADD banned INTEGER;
	ALTER TABLE Cns_userinfo ADD user_ca VARCHAR(255);
	ALTER TABLE Cns_userinfo ADD banned INTEGER;
	CREATE INDEX linkname_idx ON Cns_symlinks(linkname);
	UPDATE schema_version SET major = 3, minor = 1, patch = 0;
	EOF
    fi

    return 0
}

updatelfc

/usr/sbin/update-alternatives --install /usr/sbin/lfcdaemon lfcdaemon \
	  /usr/lib/lfc-postgres/lfcdaemon 10 \
  --slave /usr/share/man/man8/lfcdaemon.8.gz lfcdaemon.8.gz \
	  /usr/lib/lfc-postgres/lfcdaemon.8.gz \
  --slave /usr/share/lfc/NSCONFIG.templ NSCONFIG.templ \
	  /usr/lib/lfc-postgres/NSCONFIG.templ \
  --slave /etc/rc.d/init.d/lfcdaemon lfcdaemon.init \
	  /etc/lfc-postgres/lfcdaemon.init \
  --slave /etc/sysconfig/lfcdaemon lfcdaemon.conf \
	  /etc/lfc-postgres/lfcdaemon.conf \
  --slave /etc/logrotate.d/lfcdaemon lfcdaemon.logrotate \
	  /etc/lfc-postgres/lfcdaemon.logrotate \
  --slave /usr/sbin/lfc-shutdown lfc-shutdown \
	  /usr/lib/lfc-postgres/lfc-shutdown \
  --slave /usr/share/man/man8/lfc-shutdown.8.gz lfc-shutdown.8.gz \
	  /usr/lib/lfc-postgres/lfc-shutdown.8.gz

if [ $1 = 1 ]; then
    if [ -r /etc/rc.d/init.d/lfcdaemon ]; then
	/sbin/chkconfig --add lfcdaemon
    fi
fi

POSTUN

/bin/sh
export LANG=C

if [ $1 -ge 1 ]; then
    /usr/sbin/update-alternatives --display lfcdaemon | \
	grep currently | grep -q lfc-postgres && \
	/sbin/service lfcdaemon condrestart > /dev/null 2>&1 || :
fi

Triggers

lfc-postgres < 1.8.1.2-2

/bin/sh
# Restore alternatives removed by lfc-postgres preun
/usr/sbin/update-alternatives --install /usr/sbin/lfcdaemon lfcdaemon \
	  /usr/lib/lfc-postgres/lfcdaemon 10 \
  --slave /usr/share/man/man8/lfcdaemon.8.gz lfcdaemon.8.gz \
	  /usr/lib/lfc-postgres/lfcdaemon.8.gz \
  --slave /usr/share/lfc/NSCONFIG.templ NSCONFIG.templ \
	  /usr/lib/lfc-postgres/NSCONFIG.templ \
  --slave /etc/rc.d/init.d/lfcdaemon lfcdaemon.init \
	  /etc/lfc-postgres/lfcdaemon.init \
  --slave /etc/sysconfig/lfcdaemon lfcdaemon.conf \
	  /etc/lfc-postgres/lfcdaemon.conf \
  --slave /etc/logrotate.d/lfcdaemon lfcdaemon.logrotate \
	  /etc/lfc-postgres/lfcdaemon.logrotate \
  --slave /usr/sbin/lfc-shutdown lfc-shutdown \
	  /usr/lib/lfc-postgres/lfc-shutdown \
  --slave /usr/share/man/man8/lfc-shutdown.8.gz lfc-shutdown.8.gz \
	  /usr/lib/lfc-postgres/lfc-shutdown.8.gz