HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //bin/ghc-doc-index
#!/bin/sh

LOCKFILE=/var/lock/ghc-doc-index.lock

# the lockfile is not meant to be perfect, it's just in case
# two cron scripts get run close to each other to keep
# them from stepping on each other's toes.
if [ -f $LOCKFILE ]; then
  echo "Locked with $LOCKFILE"
  exit 0
fi

if [ "$(id -u)" != "0" ]; then
  echo Need to be root!
  exit 1
fi

trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
touch $LOCKFILE

PKGDIRCACHE=/var/lib/ghc/pkg-dir.cache
LISTING="env LANG=C ls -dl"

# only re-index ghc docs when there are changes
cd /usr/share/doc/ghc/html/libraries
if [ -r "$PKGDIRCACHE" ]; then
  $LISTING */ > $PKGDIRCACHE.new
  DIR_DIFF=$(diff $PKGDIRCACHE $PKGDIRCACHE.new)
else
  $LISTING */ > $PKGDIRCACHE
fi
if [ -x "gen_contents_index" -a ! -r "$PKGDIRCACHE.new" -o -n "$DIR_DIFF" ]; then
  ./gen_contents_index
fi

if [ -f $PKGDIRCACHE.new ]; then
  mv -f $PKGDIRCACHE.new $PKGDIRCACHE
fi