xsfbs.sh: remove unused check_symlinks_and_{bomb,warn}
This commit is contained in:
parent
8f72294ada
commit
1d0081bdf6
|
@ -303,115 +303,6 @@ EOF
|
||||||
fi
|
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 () {
|
font_update () {
|
||||||
# run $UPDATECMDS in $FONTDIRS
|
# run $UPDATECMDS in $FONTDIRS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue