2012-06-20 15:03:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Remove pk files older than 20 days
|
|
|
|
# Remove tfm files older than 60 days
|
|
|
|
# Remove source files older than 60 days
|
|
|
|
# Remove crap
|
|
|
|
# Call texhash
|
|
|
|
#
|
|
|
|
|
2019-11-18 14:03:53 +01:00
|
|
|
type -f -p kpsewhich >& /dev/null || exit 0
|
|
|
|
type -f -p mktexlsr >& /dev/null || exit 0
|
|
|
|
type -f -p find >& /dev/null || exit 0
|
2019-12-13 15:16:39 +01:00
|
|
|
type -f -p xargs >& /dev/null || exit 0
|
2020-02-04 13:23:01 +01:00
|
|
|
type -f -p setpriv >& /dev/null || exit 0
|
|
|
|
type -f -p sort >& /dev/null || exit 0
|
2019-12-13 15:16:39 +01:00
|
|
|
type -f -p rm >& /dev/null || exit 0
|
2012-06-20 15:03:52 +02:00
|
|
|
test -r /etc/sysconfig/texlive && . /etc/sysconfig/texlive
|
|
|
|
|
|
|
|
OLDIFS=$IFS; IFS=':;'
|
|
|
|
VARTEXFONTS="$(kpsewhich --expand-var '$VARTEXFONTS' 2> /dev/null)"
|
|
|
|
IFS=$OLDIFS
|
|
|
|
|
2020-02-04 13:23:01 +01:00
|
|
|
uids=$(find $VARTEXFONTS/ \( -not -type d \) -printf '%U\n' | sort -u)
|
|
|
|
|
|
|
|
if test "$CLEAR_TEXMF_FONTS" = "yes" -a -n "$VARTEXFONTS"
|
|
|
|
then
|
|
|
|
for uid in ${uids[@]}
|
|
|
|
do
|
|
|
|
for p in $VARTEXFONTS
|
|
|
|
do
|
|
|
|
test -d $p/pk/ && find $p/pk/ \( -not -type d -and -atime +20 -and -uid $uid \) -print0
|
|
|
|
test -d $p/tfm/ && find $p/tfm/ \( -not -type d -and -atime +60 -and -uid $uid \) -print0
|
|
|
|
test -d $p/source/ && find $p/source/ \( -not -type d -and -atime +60 -and -uid $uid \) -print0
|
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid $uid --regid mktex --init-groups rm -f)
|
|
|
|
done
|
2012-06-20 15:03:52 +02:00
|
|
|
fi
|
2020-02-04 13:23:01 +01:00
|
|
|
if test -n "$VARTEXFONTS"
|
|
|
|
then
|
|
|
|
for uid in ${uids[@]}
|
|
|
|
do
|
|
|
|
for p in $VARTEXFONTS
|
|
|
|
do
|
|
|
|
test -d $p/pk/ && find $p/pk/ \( -not -type d -and -not -name '*.*pk' -uid $uid \) -print0
|
|
|
|
test -d $p/tfm/ && find $p/tfm/ \( -not -type d -and -not -name '*.tfm' -uid $uid \) -print0
|
|
|
|
test -d $p/source/ && find $p/source/ \( -not -type d -and -not -name '*.mf' -uid $uid \) -print0
|
|
|
|
test -d $p/ && find $p/ \( -not -type d -and -path '*/[^[:alnum:]]*' -uid $uid \) -print0
|
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid $uid --regid mktex --init-groups rm -vf)
|
|
|
|
for p in $VARTEXFONTS
|
|
|
|
do
|
|
|
|
test -d $p/ && find $p/ -depth \( -type d -and -path '*/[^[:alnum:]]*' -and -uid $uid \) -print0
|
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid $uid --regid mktex --init-groups rm -vfr)
|
|
|
|
done
|
2012-06-20 15:03:52 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Update the ls-R's
|
|
|
|
#
|
|
|
|
mktexlsr > /dev/null
|
|
|
|
|
|
|
|
#
|
|
|
|
exit 0
|