diff options
Diffstat (limited to 'debian/xsfbs/xsfbs.sh')
-rw-r--r-- | debian/xsfbs/xsfbs.sh | 229 |
1 files changed, 0 insertions, 229 deletions
diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh index 781826f..45acd59 100644 --- a/debian/xsfbs/xsfbs.sh +++ b/debian/xsfbs/xsfbs.sh @@ -93,22 +93,6 @@ reject_nondigits () { done } -reject_whitespace () { - # syntax: reject_whitespace [ operand ] - # - # scan operand (typically a shell variable whose value cannot be trusted) for - # whitespace characters and barf if any are found - if [ -n "$1" ]; then - # does the operand contain any whitespace? - if expr "$1" : "[[:space:]]" > /dev/null 2>&1; then - # can't use die(), because I want to avoid forward references - echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_whitespace() encountered" \ - "possibly malicious garbage \"$1\"" >&2 - exit $SHELL_LIB_THROWN_ERROR - fi - fi -} - reject_unlikely_path_chars () { # syntax: reject_unlikely_path_chars [ operand ... ] # @@ -199,219 +183,6 @@ usage_error () { exit $SHELL_LIB_USAGE_ERROR } - -maplink () { - # returns what symlink should point to; i.e., what the "sane" answer is - # Keep this in sync with the debian/*.links files. - # This is only needed for symlinks to directories. - # - # XXX: Most of these look wrong in the X11R7 world and need to be fixed. - # If we've stopped using this function, fixing it might enable us to re-enable - # it again and catch more errors. - case "$1" in - /etc/X11/xkb/compiled) echo /var/lib/xkb ;; - /etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;; - /usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;; - /usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;; - /usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;; - /usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;; - /usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;; - /usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;; - /usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;; - /usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;; - /usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;; - /usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;; - /usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;; - /usr/bin/X11) echo ../X11R6/bin ;; - /usr/bin/rstartd) echo ../X11R6/bin/rstartd ;; - /usr/include/X11) echo ../X11R6/include/X11 ;; - /usr/lib/X11) echo ../X11R6/lib/X11 ;; - *) internal_error "maplink() called with unknown path \"$1\"" ;; - esac -} - -analyze_path () { - # given a supplied set of pathnames, break each one up by directory and do an - # ls -dl on each component, cumulatively; i.e. - # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin - # Thanks to Randolph Chung for this clever hack. - - local f g - - while [ -n "$1" ]; do - reject_whitespace "$1" - g= - message "Analyzing $1:" - for f in $(echo "$1" | tr / \ ); do - if [ -e /$g$f ]; then - ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true - g=$g$f/ - else - message "/$g$f: nonexistent; directory contents of /$g:" - ls -l /$g - break - fi - done - shift - done -} - -find_culprits () { - local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \ - msg - - reject_whitespace "$1" - message "Searching for overlapping packages..." - dpkg_info_dir=/var/lib/dpkg/info - if [ -d $dpkg_info_dir ]; then - if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then - possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \ - "(xbase-clients|x11-common|xfs|xlibs)") - if [ -n "$possible_culprits" ]; then - smoking_guns=$(grep -l "$1" $possible_culprits || true) - if [ -n "$smoking_guns" ]; then - bad_packages=$(printf "\\n") - for f in $smoking_guns; do - # too bad you can't nest parameter expansion voodoo - p=${f%*.list} # strip off the trailing ".list" - package=${p##*/} # strip off the directories - bad_packages=$(printf "%s\n%s" "$bad_packages" "$package") - done - msg=$(cat <<EOF -The following packages appear to have file overlaps with the X.Org packages; -these packages are either very old, or in violation of Debian Policy. Try -upgrading each of these packages to the latest available version if possible: -for example, with the command "apt-get install". If no newer version of a -package is available, you will have to remove it; for example, with the command -"apt-get remove". If even the latest available version of the package has -this file overlap, please file a bug against that package with the Debian Bug -Tracking System. You may want to refer the package maintainer to section 12.8 -of the Debian Policy manual. -EOF -) - message "$msg" - message "The overlapping packages are: $bad_packages" - else - message "no overlaps found." - fi - fi - else - message "cannot search; no matches for $dpkg_info_dir/*.list." - fi - else - message "cannot search; $dpkg_info_dir does not exist." - fi -} - -check_symlink () { - # syntax: check_symlink symlink - # - # See if specified symlink points where it is supposed to. Return 0 if it - # does, and 1 if it does not. - # - # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb(). - - local symlink - - # validate arguments - if [ $# -ne 1 ]; then - usage_error "check_symlink() called with wrong number of arguments;" \ - "expected 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - symlink="$1" - - if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then - return 0 - else - return 1 - fi -} - -check_symlinks_and_warn () { - # syntax: check_symlinks_and_warn symlink ... - # - # For each argument, check for symlink sanity, and warn if it isn't sane. - # - # Call this function from a preinst script in the event $1 is "upgrade" or - # "install". - - local errmsg symlink - - # validate arguments - if [ $# -lt 1 ]; then - usage_error "check_symlinks_and_warn() called with wrong number of" \ - "arguments; expected at least 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - while [ -n "$1" ]; do - symlink="$1" - if [ -L "$symlink" ]; then - if ! check_symlink "$symlink"; then - observe "$symlink symbolic link points to wrong location" \ - "$(readlink "$symlink"); removing" - rm "$symlink" - fi - elif [ -e "$symlink" ]; then - errmsg="$symlink exists and is not a symbolic link; this package cannot" - errmsg="$errmsg be installed until this" - if [ -f "$symlink" ]; then - errmsg="$errmsg file" - elif [ -d "$symlink" ]; then - errmsg="$errmsg directory" - else - errmsg="$errmsg thing" - fi - errmsg="$errmsg is removed" - die "$errmsg" - fi - shift - done -} - -check_symlinks_and_bomb () { - # syntax: check_symlinks_and_bomb symlink ... - # - # For each argument, check for symlink sanity, and bomb if it isn't sane. - # - # Call this function from a postinst script. - - local problem symlink - - # validate arguments - if [ $# -lt 1 ]; then - usage_error "check_symlinks_and_bomb() called with wrong number of" - "arguments; expected at least 1, got $#" - exit $SHELL_LIB_USAGE_ERROR - fi - - while [ -n "$1" ]; do - problem= - symlink="$1" - if [ -L "$symlink" ]; then - if ! check_symlink "$symlink"; then - problem=yes - warn "$symlink symbolic link points to wrong location" \ - "$(readlink "$symlink")" - fi - elif [ -e "$symlink" ]; then - problem=yes - warn "$symlink is not a symbolic link" - else - problem=yes - warn "$symlink symbolic link does not exist" - fi - if [ -n "$problem" ]; then - analyze_path "$symlink" "$(readlink "$symlink")" - find_culprits "$symlink" - die "bad symbolic links on system" - fi - shift - done -} - font_update () { # run $UPDATECMDS in $FONTDIRS |