Sophie

Sophie

distrib > CentOS > 5 > i386 > by-pkgid > f5af2c1806c7128e66afae07e6a99ed6 > scriptlet

xorg-x11-xfs-1.0.2-5.el5_6.1.i386.rpm

PREIN

/bin/sh
{
  /usr/sbin/useradd -c "X Font Server" -r -s /sbin/nologin -u 43 -d /etc/X11/fs xfs || :
  # Upgrade path:
  if [ "$1" -gt "1" ] ; then
    if [ -e "/usr/X11R6/lib/X11/fs/config" ] ; then
      cat <<-EOF > "/etc/X11/fs/xfs-migrate"
	On upgrades, we now must determine if we are upgrading from monolithic
	xfs or modular xfs by checking for the existance of the old monolithic
	xfs config file.  If found, we know it is a monolith->modular upgrade,
	so we set this flag file in order for xfs.init to perform a "restart"
	instead of a "reload" in the 'condrestart'.  See bug #173271 for
	details.
EOF
    fi
  fi
} &> /dev/null || : # Silence output, and ignore errors (Bug #91822)

PREUN

/bin/sh
{
  if [ "$1" = "0" ]; then
    /sbin/service xfs stop &> /dev/null || :
# FIXME: The chkconfig call below works properly if uninstalling the package,
#        but it will cause xfs to be de-chkconfig'd if upgrading from one X11
#        implementation to another, as witnessed in the transition from
#        XFree86 to Xorg X11.  If this call is removed however, then xfs will
#        remain visible in ntsysv and similar utilities even after xfs is
#        uninstalled from the system in non-upgrade scenarios.  Not sure how
#        to fix this yet.
    /sbin/chkconfig --del xfs || :
# userdel/groupdel removed because they cause the user/group to get destroyed
# when upgrading from one X11 implementation to another, ie: XFree86 -> Xorg
#    /usr/sbin/userdel xfs 2>/dev/null || :
#    /usr/sbin/groupdel xfs 2>/dev/null || :
  fi
}

POSTIN

/bin/sh
{
  # Install section
  /sbin/chkconfig --add xfs
  #------------------------------------------------------------------------
  # Upgrade section
  if [ "$1" -gt "1" ] ; then
    XORG_CONFIG=/etc/X11/xorg.conf
    XFSCONFIG=/etc/X11/fs/config

    if [ -f $XORG_CONFIG ] ; then
      # If the X server is configured to use UNIX socket for font server
      if grep -q 'unix/:' $XORG_CONFIG &> /dev/null ; then
        # Disable legacy font path element in X server config
        if grep -q '/usr/X11R6/lib/X11/fonts/TrueType' $XORG_CONFIG &> /dev/null ; then
          perl -p -i -e 's|FontPath[ ]*"/usr/X11R6/lib/X11/fonts/TrueType"|#FontPath "/usr/X11R6/lib/X11/fonts/TrueType"|g' $XORG_CONFIG
        fi

        # Convert config to use modern unix socket
        perl -p -i -e 's#unix/:-1#unix/:7100#g' $XORG_CONFIG

        # Disable TCP listen by default for xfs
        if [ -f $XFSCONFIG ] && ! grep -q "no-listen" $XFSCONFIG &> /dev/null ; then
          echo -e "# For security, don't listen to TCP ports by default.\nno-listen = tcp\n" >> $XFSCONFIG
        fi
      fi
    fi

    # XFS config file upgrade munging
    if [ -f $XFSCONFIG ] ; then
      # Remove Speedo font directories from xfs config if present to avoid
      # bug reports about xfs complaining about empty directories in syslog.
      perl -p -i -e 's#^.*/.*/Speedo.*\n##' $XFSCONFIG

      # On upgrades, remove /usr/X11R6 font path elements from the XFS config file
      if grep -q "/usr/X11R6/lib/X11/fonts" $XFSCONFIG &> /dev/null ; then
        for fpe in misc:unscaled 75dpi:unscaled 100dpi:unscaled Type1 ; do
          perl -p -i -e "s#/usr/X11R6/lib/X11/fonts/${fpe}#/usr/share/X11/fonts/${fpe}#g" $XFSCONFIG
        done
      fi
    fi
  fi ; # End Upgrade section
}

POSTUN

/bin/sh
{
  if [ "$1" -gt "1" ]; then
    /sbin/service xfs condrestart &> /dev/null || :
  fi
}

Triggers

XFree86-xfs

/bin/sh
{
  /usr/sbin/useradd -c "X Font Server" -r -s /sbin/nologin -u 43 -d /etc/X11/fs xfs || :
  /sbin/chkconfig --add xfs
  /sbin/service xfs condrestart || :
} &> /dev/null || :