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
|
2020-03-23 17:21:14 +01:00
|
|
|
type -f -p seq >& /dev/null || exit 0
|
|
|
|
type -f -p getent >& /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
|
|
|
|
|
2023-05-25 13:06:32 +02:00
|
|
|
if test "$(id -ur)" = 0
|
|
|
|
then
|
|
|
|
groups=--init-groups
|
|
|
|
else
|
|
|
|
groups=--keep-groups
|
|
|
|
fi
|
|
|
|
|
2020-03-23 17:21:14 +01:00
|
|
|
if test -n "$VARTEXFONTS" -a "$HAVE_MKTEX_MEMBERS" = yes
|
2020-02-04 13:23:01 +01:00
|
|
|
then
|
2020-03-23 17:21:14 +01:00
|
|
|
IFS=:
|
|
|
|
users=($(getent group mktex))
|
|
|
|
IFS=$OLDIFS
|
|
|
|
typeset -i i
|
|
|
|
typeset -i u=${#users[*]}
|
|
|
|
let u--
|
|
|
|
for p in $VARTEXFONTS
|
2020-02-04 13:23:01 +01:00
|
|
|
do
|
2020-03-23 17:21:14 +01:00
|
|
|
test -d $p || continue
|
|
|
|
for i in $(seq 3 $u)
|
2020-02-04 13:23:01 +01:00
|
|
|
do
|
2020-03-23 17:21:14 +01:00
|
|
|
find -P $p \( \( -type f -and -not -type l \) -and -user ${users[$i]} \) -print0 | \
|
2023-05-25 13:06:32 +02:00
|
|
|
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex $groups chmod g+rw
|
2020-03-23 17:21:14 +01:00
|
|
|
find -P $p \( \( -type d -and -not -type l \) -and -user ${users[$i]} \) -print0 | \
|
2023-05-25 13:06:32 +02:00
|
|
|
xargs -r -L100 -0 -- setpriv --reuid ${users[$i]} --regid mktex $groups chmod g+rwsx
|
2020-03-23 17:21:14 +01:00
|
|
|
done
|
2020-02-04 13:23:01 +01:00
|
|
|
done
|
2020-03-23 17:21:14 +01:00
|
|
|
unset i u
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$CLEAR_TEXMF_FONTS" = "yes" -a -n "$VARTEXFONTS"
|
|
|
|
then
|
|
|
|
for p in $VARTEXFONTS
|
|
|
|
do
|
|
|
|
test -d $p/pk && find -P $p/pk \( -not -type d -and -atime +20 \) -print0
|
|
|
|
test -d $p/tfm && find -P $p/tfm \( -not -type d -and -atime +60 \) -print0
|
|
|
|
test -d $p/source && find -P $p/source \( -not -type d -and -atime +60 \) -print0
|
2023-05-25 13:06:32 +02:00
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -f)
|
2012-06-20 15:03:52 +02:00
|
|
|
fi
|
2020-02-04 13:23:01 +01:00
|
|
|
if test -n "$VARTEXFONTS"
|
|
|
|
then
|
2020-03-23 17:21:14 +01:00
|
|
|
for p in $VARTEXFONTS
|
2020-02-04 13:23:01 +01:00
|
|
|
do
|
2020-03-23 17:21:14 +01:00
|
|
|
test -d $p/pk && find -P $p/pk \( -not -type d -and -not -name '*.*pk' \) -print0
|
|
|
|
test -d $p/tfm && find -P $p/tfm \( -not -type d -and -not -name '*.tfm' \) -print0
|
|
|
|
test -d $p/source && find -P $p/source \( -not -type d -and -not -name '*.mf' \) -print0
|
|
|
|
test -d $p && find -P $p \( -not -type d -and -path '*/[^[:alnum:]]*' \) -print0
|
2023-05-25 13:06:32 +02:00
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -vf)
|
2020-03-23 17:21:14 +01:00
|
|
|
for p in $VARTEXFONTS
|
|
|
|
do
|
|
|
|
test -d $p && find -P $p -depth \( -type d -and -path '*/[^[:alnum:]]*' \) -print0
|
2023-05-25 13:06:32 +02:00
|
|
|
done > >(exec -a xargs xargs -r -L100 -0 -- setpriv --reuid mktex --regid mktex $groups rm -vfr)
|
2012-06-20 15:03:52 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Update the ls-R's
|
2020-03-11 17:11:02 +01:00
|
|
|
# Note that this is done as user mktex
|
2012-06-20 15:03:52 +02:00
|
|
|
#
|
2021-12-09 14:58:02 +01:00
|
|
|
mktexlsr < /dev/null > /dev/null
|
2012-06-20 15:03:52 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
exit 0
|