version 1.74.2.4, 2004/08/30 19:37:12 |
version 1.75, 2004/04/18 04:02:27 |
|
|
return ${failed} |
return ${failed} |
} |
} |
|
|
# |
|
# hosts |
|
# |
|
additem hosts "/etc/hosts being up to date" |
|
do_hosts() |
|
{ |
|
[ -n "$1" ] || err 2 "USAGE: do_hosts fix|check" |
|
op=$1 |
|
|
|
failed=0 |
|
h=${DEST_DIR}/etc/hosts |
|
if ! grep ^127 $h | sed 's/^[^ ]*//' | grep '\.' > /dev/null; then |
|
msg "/etc/hosts entry for localhost (ipv4) missing dotted alias" |
|
|
|
if [ "${op}" = "fix" ]; then |
|
if ! sed 's/^\(127.*\)$/\1 localhost./' < $h \ |
|
> ${SCRATCHDIR}/hosts || |
|
! mv ${SCRATCHDIR}/hosts $h; then |
|
msg "Can't update /etc/hosts" |
|
failed=1 |
|
fi |
|
else |
|
failed=1 |
|
fi |
|
fi |
|
if ! grep ^::1 $h | sed 's/^[^ ]*//' | grep '\.' > /dev/null; then |
|
msg "/etc/hosts entry for localhost (ipv6) missing dotted alias" |
|
|
|
if [ "${op}" = "fix" ]; then |
|
if ! sed 's/^\(::1.*\)$/\1 localhost./' < $h \ |
|
> ${SCRATCHDIR}/hosts || |
|
! mv ${SCRATCHDIR}/hosts $h; then |
|
msg "Can't update /etc/hosts" |
|
failed=1 |
|
fi |
|
else |
|
failed=1 |
|
fi |
|
fi |
|
|
|
return ${failed} |
|
} |
|
|
|
|
|
# |
# |
# end of items |
# end of items |
|
|
|
|
main() |
main() |
{ |
{ |
while getopts s:d:m:a: ch; do |
while getopts s:d:m: ch; do |
case ${ch} in |
case ${ch} in |
s) |
s) |
SRC_DIR=${OPTARG} |
SRC_DIR=${OPTARG} |