Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
texlive-bin
SuSEconfig.texlive
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File SuSEconfig.texlive of Package texlive-bin
#!/bin/bash # # Copyright (c) 1997-2001 SuSE Gmbh Nuernberg, Germany. All rights reserved. # Copyright (c) 2004 SuSE LINUX AG, Germany. All rights reserved. # Copyright (c) 2007-2009 SuSE LINUX Products GmbH, Nuernberg, Germany. # # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # Author: Werner Fink, 1997-2009 # typeset -r OLDIFS="$IFS" typeset -i rc=0 : ${VERBOSE=true} test -r /etc/sysconfig/suseconfig && . /etc/sysconfig/suseconfig unset ${!LC_*} LANG=POSIX MKTEXLSR=true export LANG MKTEXLSR rotator () { local -i i=0 local -a elements=('|' '/' '-' '\') while read -s -n 1 ; do printf "\r[${elements[((i++%4))]}]" done echo } if test $VERBOSE = true ; then exec 4> >(rotator) else exec 4> /dev/null fi if ! type -p kpsewhich &> /dev/null ; then test $VERBOSE = true && echo "[ ]Enabling TeX binaries." os=$(uname -s|tr '[:upper:]' '[:lower:]') cpu=$(uname -i|tr '[:upper:]' '[:lower:]') binary=${cpu}-${os} for script in /var/lib/texmf/link/*-${os}/base ; do test -e "$script" || continue cpu=${script%-$os/*} cpu=${cpu##*/} kpsewhich=/usr/lib/texmf/bin/${cpu}-${os}/kpsewhich if test -x $kpsewhich && $kpsewhich --var-value=TEXMFVAR > /dev/null 2>&1 ; then binary=${cpu}-${os} break fi done for script in /var/lib/texmf/link/${binary}/* ; do test -e "$script" || continue done=/var/lib/texmf/link/done/${script##*/} test -s "$done" && continue bash "$script" 0 0 done if ! type -p kpsewhich &> /dev/null ; then PATH="/usr/lib/texmf/bin/${binary}:$PATH" fi unset cpu os binary bin done kpsewhich fi export PATH type -p texhash &> /dev/null || exit 0 type -p kpsewhich &> /dev/null || exit 0 type -p updmap-sys &> /dev/null || exit 0 type -p find &> /dev/null || { echo "${0##*/}: No find in PATH ... skipping"; exit 0 ; } type -p sort &> /dev/null || { echo "${0##*/}: No sort in PATH ... skipping"; exit 0 ; } type -p env &> /dev/null || { echo "${0##*/}: No env in PATH ... skipping"; exit 0 ; } type -p sed &> /dev/null || { echo "${0##*/}: No sed in PATH ... skipping"; exit 0 ; } type -p tr &> /dev/null || { echo "${0##*/}: No tr in PATH ... skipping"; exit 0 ; } type -p grep &> /dev/null || { echo "${0##*/}: No grep in PATH ... skipping"; exit 0 ; } type -p ed &> /dev/null || { echo "${0##*/}: No ed in PATH ... skipping"; exit 0 ; } # Be sure that configuring in /etc/texmf will work even if # there are files relative to /etc/texmf ... unset KPSE_DOT || true : ${TEXMFMAIN:=$(kpsewhich --expand-path='$TEXMFMAIN' 2> /dev/null)} : ${TEXMFDIST:=$(kpsewhich --expand-path='$TEXMFDIST' 2> /dev/null)} : ${TEXMFVAR:=$(kpsewhich --var-value=TEXMFVAR 2> /dev/null)} : ${TEXMFCNF:=$(kpsewhich texmf.cnf 2> /dev/null)} : ${TEXMFSYSCONFIG:=$(kpsewhich --expand-path='$TEXMFSYSCONFIG' 2> /dev/null)} : ${TEXMFLSR:=$(kpsewhich --show-path=ls-R 2> /dev/null)} : ${WEB2C:=$TEXMFVAR/web2c} HASHLSR= for lsr in ${TEXMFLSR//:/ }; do find $lsr -prune -type d -and -not -fstype nfs > /dev/null 2>&1 || continue HASHLSR=${HASHLSR:+$HASHLSR:}${lsr} size=$(find /etc/texmf/ls-R -follow -printf '%s') if test $size -lt 80 ; then mkdir -p /var/adm/SuSEconfig > /var/adm/SuSEconfig/run-texhash; fi done tcfmgr () { ${TEXMFMAIN}/texconfig/tcfmgr ${1+"$@"} 2> /dev/null } enablemaps () { updmap-sys --quiet --nohash --listmaps < /dev/null 2> /dev/null | \ sed -n -r 's@(#![[:space:]])(Mixed)?Map[[:space:]]*@@gp' | \ xargs -r kpsewhich --format=map 2> /dev/null | \ sed -r 's@.*/([^/]*)@\1@g' } # # Straightforward ... here we go # for f in /var/adm/SuSEconfig/run?texhash; do test -e $f || continue typeset -i n=0 for lsr in ${HASHLSR//:/ }; do ((n++ == 0)) && test $VERBOSE = true && echo -e "\r[ ]Enabling TeX hash data base." find $lsr -prune -type d -and -not -fstype nfs > /dev/null 2>&1 || continue if test $f -nt $lsr/ls-R ; then texhash $lsr 1>&4 2>&4 let rc+=$? fi done cfg=$(tcfmgr --cmd find --file updmap.cfg) if test -e ${cfg} ; then test $VERBOSE = true && echo -e "\r[ ]Enabling TeX font mappings." updmap-sys --nohash --nomkmap --syncwithtrees < /dev/null 1>&4 2>&4 let rc+=$? enablemaps | \ while read line ; do line='^#![[:space:]]*((Mixed)?Map)[[:space:]]*('$line')' emap=$(sed -n -r "s/$line/\1=\3/p" ${cfg}) updmap-sys --nohash --nomkmap --enable $emap < /dev/null 1>&4 2>&4 let rc+=$? done updmap-sys < /dev/null 1>&4 2>&4 let rc+=$? fi rm -f /var/adm/SuSEconfig/run?texhash break done # # If texmf.cnf has changed it may contain changed memory sizes # of various programs. # type -p readlink &> /dev/null || exit 0 type -p texconfig-sys &> /dev/null || exit 0 test -L "$TEXMFCNF" && TEXMFCNF="$(readlink -f "$TEXMFCNF" 2> /dev/null)" # # Configuration broken # if test ! -e "$TEXMFCNF" ; then echo "${0##*/}: Configuration of texlive installation not found." exit 0 fi init=false for f in $(find ${WEB2C}/ -name '*.fmt' -name '*.mem' -o -name '*.base') ; do test -e "$f" || continue test -L "$f" && continue test "$TEXMFCNF" -nt "$f" && init=true test -s "$f" && touch "$f" done if test $init = true ; then test $VERBOSE = true && echo -e "\r[ ]Initialize TeX configuration and font mappings." updmap-sys --syncwithtrees < /dev/null 1>&4 2>&4 let rc+=$? texconfig-sys init < /dev/null 1>&4 2>&4 let rc+=$? fi # # These are required. # type -p md5sum &> /dev/null || exit 0 # # We need a check for an already modified texlive configuration: # therefore we use md5 check sums. # if test -z "$MD5DIR" ; then LIBDIR=/var/adm/SuSEconfig MD5DIR=$LIBDIR/md5 fi mkdir -p $MD5DIR test $? -gt 0 && exit 0 # # The main configuration files of TeXLive. # type -p fmtutil-sys &> /dev/null || exit 0 cnf_mfont=$(tcfmgr --cmd find --file mktex.cnf) cnf_xdvi=$(tcfmgr --cmd find --file XDvi) cnf_dvips=$(tcfmgr --cmd find --file config.ps) cnf_lang=$(TEXMF=$TEXMFSYSCONFIG kpsewhich language.dat 2> /dev/null) cnf_base=$(TEXMF=$TEXMF kpsewhich language.us 2> /dev/null) test -n "${cnf_mfont}" || exit 0 test -n "${cnf_xdvi}" || exit 0 test -n "${cnf_dvips}" || exit 0 test -n "${cnf_lang}" || exit 0 md5_mfont=${MD5DIR}${cnf_mfont} md5_xdvi=${MD5DIR}${cnf_xdvi} md5_dvips=${MD5DIR}${cnf_dvips} md5_lang=${MD5DIR}${cnf_lang} md5_cups=${MD5DIR}/cups # # Is this a full TeXLive system? # test -e ${cnf_mfont} || exit 0 # Default MetaFont mode test -e ${cnf_xdvi} || exit 0 # Default xdvi resolution test -e ${cnf_dvips} || exit 0 # Default printer mode test -e ${cnf_lang} || exit 0 # Default hyphenation # # Current MD5 sums # set -- $(md5sum < ${cnf_mfont}) ; md5modes="$1" set -- $(md5sum < ${cnf_xdvi} ) ; md5xdvi="$1" set -- $(md5sum < ${cnf_dvips}) ; md5dvips="$1" set -- $(md5sum < ${cnf_lang} ) ; md5lang="$1" # # Previous md5 sums # omd5lang=0 if test -e ${md5_lang} -a -r ${md5_lang} ; then test ${md5_lang} -nt ${cnf_lang} && md5_nt_lang="yes" set -- $(cat ${md5_lang}) ; omd5lang="$1" elif test ! -d ${md5_lang%/*} ; then mkdir -p ${md5_lang%/*} fi # # Create new formats for new language.dat if needed # if test $omd5lang = 0 -o \ \( $md5lang != $omd5lang -o "$md5_nt_lang" != "yes" \) then test $VERBOSE = true && echo -e "\r[ ]Handle language setups." set -- $(md5sum < ${cnf_lang}) echo $1 > ${md5_lang} fmtutil-sys --byhyphen ${cnf_lang} < /dev/null 1>&4 2>&4 let rc+=$? fi # # The main system printer. # lp="" if type -p lpoptions &>/dev/null && lpstat -r &>/dev/null ; then dev=PS size=a4 dpi=300 color=mono IFS=$'\n' lpopt=($(lpoptions -l 2> /dev/null)) IFS="$OLDIFS" shopt -s extglob for line in "${lpopt[@]}" ; do case "$line" in PageSize*) set -- $line while test -n "$1" ; do case "$1" in \**) size="${1:1}"; break esac shift done ;; Resolution*) set -- $line reg='?(\*)@(+([0-9])|+([0-9])x+([0-9]))dpi' cur=0 while test -n "$1" ; do case "$1" in $reg) cur=${1%%+([[:alpha:]])} esac cur="${cur#\*}" case "$1" in *Color*) color=color esac shift test "${cur%x*}" -gt "${dpi%x*}" && dpi=$cur done ;; ColorCorrection*) set -- $line while test -n "$1" ; do case "$1" in \*RGB|\*CMYK) color=color; break esac shift done ;; esac done shopt -u extglob lp="lp|${dev}-$(echo ${size}-auto-${color}-${dpi}|tr '[:upper:]' '[:lower:]')" elif test -r /etc/printcap -a -d /var/lib/apsfilter/ ; then lp=$(grep -E '^lp\|' /etc/printcap) elif test -r /etc/printcap -a -x /usr/lib/lpdfilter/bin/readpc ; then lp=$(/usr/lib/lpdfilter/bin/readpc lp || true) fi test -n "$lp" || exit 0 # No (configured) filter system: nothing to do if type -p lpoptions &>/dev/null && lpstat -r &>/dev/null ; then omd5cups=0 if test -r ${md5_cups} ; then set -- $(cat ${md5_cups}) ; omd5cups=$1 elif test ! -d ${md5_cups%/*} ; then mkdir -p ${md5_cups%/*} fi set -- $(lpoptions -l 2> /dev/null | md5sum) ; md5cups=$1 if test ${omd5cups} != ${md5cups} ; then prtcap_nt_mfont="yes" prtcap_nt_xdvi="yes" prtcap_nt_dvips="yes" echo ${md5cups} > ${md5_cups} fi else test /etc/printcap -nt ${cnf_mfont} && prtcap_nt_mfont="yes" test /etc/printcap -nt ${cnf_xdvi} && prtcap_nt_xdvi="yes" test /etc/printcap -nt ${cnf_dvips} && prtcap_nt_dvips="yes" fi # # Previous md5 sums # omd5modes=0 omd5xdvi=0 omd5dvips=0 if test -e ${md5_mfont} -a -r ${md5_mfont} ; then test ${md5_mfont} -nt ${cnf_mfont} && md5_nt_mfont="yes" set -- $(cat ${md5_mfont}) ; omd5modes="$1" elif test ! -d ${md5_mfont%/*} ; then mkdir -p ${md5_mfont%/*} fi if test -e ${md5_xdvi} -a -r ${md5_xdvi} ; then test ${md5_xdvi} -nt ${cnf_xdvi} && md5_nt_xdvi="yes" set -- $(cat ${md5_xdvi}) ; omd5xdvi="$1" elif test ! -d ${md5_xdvi%/*} ; then mkdir -p ${md5_xdvi%/*} fi if test -e ${md5_dvips} -a -r ${md5_dvips} ; then test ${md5_dvips} -nt ${cnf_dvips} && md5_nt_dvips="yes" set -- $(cat ${md5_dvips}) ; omd5dvips="$1" elif test ! -d ${md5_dvips%/*} ; then mkdir -p ${md5_dvips%/*} fi # # Convert YaST2 configured printer for apsfilter or lpdfilter # case "$lp" in *\|*.upp--*) lp="" upp=${lp##*|} IFS="-$IFS" for upp in $upp ; do break; done IFS="$OLDIFS" if test -s /etc/gs.upp/$upp ; then while read line ; do case "$line" in -sDEVICE=*) dev="${line#*=}" ;; @*.upp) dev="${line#@}" ;; -r*) dpi="${line#-r}" ;; -sPAPERSIZE=*) psz="${line#*=}" ;; -sCOLOR=*) col="${line#*=}" ;; *) ;; esac done < /etc/gs.upp/$upp lp="lp|${dev}-${psz}-auto-${col}-${dpi}" fi ;; *:cm=lpdfilter*:) entry="$lp" lp="" IFS=":" for e in $entry ; do case "$e" in cm=lpdfilter*) eval "${e#cm=lpdfilter}" ;; esac done IFS="$OLDIFS" if test "$drv" = "upp" -a -s /etc/lpdfilter/lp/upp ; then while read line ; do case "$line" in -sDEVICE=*) drv="${line#*=}" ;; # Overwrite driver! -r*) dpi="${line#-r}" ;; -dDEVICEXRESOLUTION=*) xres="${line#*=}" ;; -dDEVICEYRESOLUTION=*) yres="${line#*=}" ;; -sPAPERSIZE=*) size="${line#*=}" ;; -sCOLOR=*) color="${line#*=}" ;; -sPOSTFILTER=\"*\") eval post="${line#*=}" ;; @*) upp="${line#@}" ;; esac done < /etc/lpdfilter/lp/upp fi if test -n "$upp" && type -p gs &> /dev/null ; then drv=${upp##*/} upp=$(echo "($upp) findlibfile { pop print } { pop } ifelse" | \ gs -sDEVICE=nullpage -q -dNOPAUSE - -c quit) fi if test -r "$upp" ; then while read line ; do case "$line" in -r*) dpi="${line#-r}" ;; esac done < $upp fi if test -z "$dpi" ; then test -n "$xres" && dpi=$xres test -n "$yres" && dpi=${dpi+"${dpi}x"}$yres fi lp="lp|${drv}-${size}-${method}-${color}-${dpi}" ;; esac # # Parse the configured system main printer # Ghostscript/PS <-> Metafont mode and paper size # (UNTESTED, Sorry I've *not* enough printers around) # function get_paper () { ( . /etc/sysconfig/language &> /dev/null h=($(LANG=$RC_LANG locale -k LC_PAPER)) case "${h[0]}" in height=297) echo a4 ;; *) echo letter ;; esac ) } case "$lp" in *-letter-*) XDVISIZE=us ; DVIPSSIZE=letter ;; *-legal-*) XDVISIZE=legal ; DVIPSSIZE=legal ;; *-ledger-*) XDVISIZE=a3r ; DVIPSSIZE=ledger ;; *-tabloid-*) XDVISIZE=a3 ; DVIPSSIZE=tabloid ;; *-a3-*) XDVISIZE=a3 ; DVIPSSIZE=a3 ;; *-a4-*) XDVISIZE=a4 ; DVIPSSIZE=a4 ;; *) case "$(get_paper)" in a4) XDVISIZE=a4 ; DVIPSSIZE=a4 ;; *) XDVISIZE=us ; DVIPSSIZE=letter ;; esac ;; esac case "$lp" in *\|PS*) PRINTER=ljfour ;; *\|bj10e*) PRINTER=bjtenex ;; *\|bj200*) PRINTER=bjtzzex ;; *\|bjc600*) PRINTER=canonbjc ;; *\|bjc800*) PRINTER=canonbjc ;; *\|bjc610a*) PRINTER=canonbjc ;; # *\|bjc610b*) PRINTER=canonbjc ;; *\|cdeskjet*600) PRINTER=ljfour ;; *\|deskjet*600) PRINTER=ljfour ;; *\|cdeskjet*) PRINTER=deskjet ;; *\|deskjet*) PRINTER=deskjet ;; *\|cdj6*) PRINTER=ljfour ;; *\|cdj8*) PRINTER=ljfour ;; *\|hpdj*) PRINTER=ljfour ;; *\|cdj*600) PRINTER=ljfour ;; *\|djet*600) PRINTER=ljfour ;; *\|cdj*) PRINTER=deskjet ;; *\|djet*) PRINTER=deskjet ;; *\|laserjet*) PRINTER=cx ;; *\|ljetplus*) PRINTER=cx ;; *\|ljet2*) PRINTER=cx ;; *\|ljet3*) PRINTER=jetiiisi ;; *\|ljet4l*) PRINTER=cx ;; *\|ljet4*) PRINTER=ljfour ;; *\|lj4*) PRINTER=ljfour ;; *\|lj5*) PRINTER=ljfive ;; # *\|lj5*) PRINTER=ljfivemp ;; *\|stcolor*720) PRINTER=esphi ;; *\|stcolor*) PRINTER=epstylus ;; *\|st800*720) PRINTER=esphi ;; *\|st800*) PRINTER=epstylus ;; *\|stc800*720) PRINTER=esphi ;; *\|stc800*) PRINTER=epstylus ;; *\|stc600*) PRINTER=epscszz ;; *\|stc_h*) PRINTER=esphi ;; *\|stc*) PRINTER=epstypro ;; *) PRINTER=ljfour prtcap_nt_dvips="manual" ;; esac # # Run texconfig if no one has update the TeXLive system # or parts of it. # if test $omd5modes = 0 -o \ \( $md5modes = $omd5modes -a "$prtcap_nt_mfont" = "yes" -a "$md5_nt_mfont" = "yes" \) then test $VERBOSE = true && echo -e "\r[ ]Set MetaFont mode." env -i MKTEXLSR=true PATH=$PATH LANG=$LANG texconfig-sys mode $PRINTER < /dev/null 1>&4 2>&4 let rc+=$? set -- $(md5sum < ${cnf_mfont}) echo $1 > ${md5_mfont} fi if test $omd5xdvi = 0 -o \ \( $md5xdvi = $omd5xdvi -a "$prtcap_nt_xdvi" = "yes" -a "$md5_nt_xdvi" = "yes" \) then test $VERBOSE = true && echo -e "\r[ ]Set XDvi paper size." env -i MKTEXLSR=true PATH=$PATH LANG=$LANG texconfig-sys xdvi paper $XDVISIZE < /dev/null 1>&4 2>&4 let rc+=$? set -- $(md5sum < ${cnf_xdvi}) echo $1 > ${md5_xdvi} fi if test $omd5dvips = 0 -o \ \( $md5dvips = $omd5dvips -a "$prtcap_nt_dvips" = "yes" -a "$md5_nt_dvips" = "yes" \) then test $VERBOSE = true && echo -e "\r[ ]Set dvips mode and paper size." env -i MKTEXLSR=true PATH=$PATH LANG=$LANG texconfig-sys dvips mode $PRINTER < /dev/null 1>&4 2>&4 let rc+=$? env -i MKTEXLSR=true PATH=$PATH LANG=$LANG texconfig-sys dvips paper $DVIPSSIZE < /dev/null 1>&4 2>&4 let rc+=$? set -- $(md5sum < ${cnf_dvips}) echo $1 > ${md5_dvips} fi if test "$prtcap_nt_dvips" = "manual" -a \ \( $md5dvips = $omd5dvips -o $omd5dvips = 0 \) then echo -e "\n${0##*/}: Unknown default printer, use texconfig to setup dvips manually." if test -n "$MAIL_REPORTS_TO" ; then echo "${0##*/}: Unknown default printer, use texconfig to setup dvips manually." | \ mail -s "${0##*/}" $MAIL_REPORTS_TO fi fi if test $VERBOSE = true ; then exec 4>&- fi ## exit $rc
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor