| Current Path : /var/www/iplanru/data/www/intesco.ru/d59ed/ |
| Current File : /var/www/iplanru/data/www/intesco.ru/d59ed/dhclient-exit-hooks.d.tar |
sendmail 0000666 00000002537 15077147431 0006307 0 ustar 00 #!/bin/sh
#
# This script is called when a dhcp event occurs.
#
# Here is where we'll start/stop sendmail if needed.
#
# Written By Richard Nelson <cowboy@debian.org>
#
# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc:
# include(`/etc/mail/dialup.m4')dnl
# include(`/etc/mail/provider.m4')dnl
#
# NOTE: The dhcp DNS name is used as the peer name in /etc/mail/peers.
#
# No need to continue if we're called with an unsupported option
case "$reason" in
EXPIRE|FAIL|RELEASE|STOP) #down... and TIMEOUT too ???
;;
BOUND|RENEW|REBIND|REBOOT|TIMEOUT) #up... why TIMEOUT here ???
;;
*)
return;
;;
esac;
# Bring in some script functions to handle dynamic configuration
. /usr/share/sendmail/dynamic;
# Note the interface that just changed
update_interface "$interface" "$reason";
# If the domain name has changed, update the provider information
if [ "$new_domain_name" != "$old_domain_name" ]; then
update_provider "$new_domain_name";
fi;
# If the ip address has changed, update the host information
if [ "$new_ip_address" != "$oldnew_ip_address" ]; then
update_host "$new_ip_address";
fi;
# If anything has been changed, update sendmail.cf and reload
# Actually, we'll delay the reload because we'll be hit in a moment
# to handle the change by /etc/network/if-up.d/sendmail
update_sendmail "dhcp" Delayed;
return;
ntp 0000666 00000002342 15077225301 0005277 0 ustar 00 NTP_CONF=/etc/ntp.conf
NTP_DHCP_CONF=/var/lib/ntp/ntp.conf.dhcp
ntp_server_restart() {
invoke-rc.d ntp try-restart
}
ntp_servers_setup_remove() {
if [ ! -e $NTP_DHCP_CONF ]; then
return
fi
rm -f $NTP_DHCP_CONF
ntp_server_restart
}
ntp_servers_setup_add() {
if [ -e $NTP_DHCP_CONF ] && [ "$new_ntp_servers" = "$old_ntp_servers" ]; then
return
fi
if [ -z "$new_ntp_servers" ]; then
ntp_servers_setup_remove
return
fi
tmp=$(mktemp "$NTP_DHCP_CONF.XXXXXX") || return
chmod --reference=$NTP_CONF $tmp
chown --reference=$NTP_CONF $tmp
(
echo "# This file was copied from $NTP_CONF with the server options changed"
echo "# to reflect the information sent by the DHCP server. Any changes made"
echo "# here will be lost at the next DHCP event. Edit $NTP_CONF instead."
echo
echo "# NTP server entries received from DHCP server"
for server in $new_ntp_servers; do
echo "server $server iburst"
done
echo
sed -r -e '/^ *(server|peer).*$/d' $NTP_CONF
) >>$tmp
mv $tmp $NTP_DHCP_CONF
ntp_server_restart
}
ntp_servers_setup() {
case $reason in
BOUND|RENEW|REBIND|REBOOT)
ntp_servers_setup_add
;;
EXPIRE|FAIL|RELEASE|STOP)
ntp_servers_setup_remove
;;
esac
}
ntp_servers_setup
ntpdate 0000666 00000001446 15077225301 0006141 0 ustar 00 NTPDATE_CONF=/etc/default/ntpdate
NTPDATE_DHCP_CONF=/var/lib/ntpdate/default.dhcp
ntp_servers_setup_remove() {
rm -f $NTPDATE_DHCP_CONF
}
ntp_servers_setup_add() {
if [ -e $NTPDATE_DHCP_CONF ] && [ "$new_ntp_servers" = "$old_ntp_servers" ]; then
return
fi
if [ -z "$new_ntp_servers" ]; then
ntp_servers_setup_remove
return
fi
tmp=$(mktemp "$NTPDATE_DHCP_CONF.XXXXXX") || return
chmod --reference=$NTPDATE_CONF $tmp
chown --reference=$NTPDATE_CONF $tmp
(
echo "# NTP server entries received from DHCP server"
echo "NTPSERVERS='$new_ntp_servers'"
) >>$tmp
mv $tmp $NTPDATE_DHCP_CONF
}
ntp_servers_setup() {
case $reason in
BOUND|RENEW|REBIND|REBOOT)
ntp_servers_setup_add
;;
EXPIRE|FAIL|RELEASE|STOP)
ntp_servers_setup_remove
;;
esac
}
ntp_servers_setup
debug 0000666 00000001754 15077225301 0005572 0 ustar 00 #
# The purpose of this script is just to show the variables that are
# available to all the scripts in this directory. All these scripts
# are called from /etc/dhcp3/dhclient-script, which exports all the
# variables shown before. If you want to debug a problem with your DHCP
# setup you can enable this script and take a look at
# /tmp/dhclient-script.debug.
# To enable this script set the following variable to "yes"
RUN="no"
if [ "$RUN" = "yes" ]; then
echo `date`: entering dhclient-exit-hooks.d, dumping variables. \
>> /tmp/dhclient-script.debug
for i in reason interface medium alias_ip_address new_ip_address \
new_subnet_mask new_domain_name new_domain_search \
new_domain_name_servers new_routers new_static_routes \
old_ip_address old_subnet_mask old_domain_name \
old_domain_search old_domain_name_servers old_routers \
old_static_routes; do
echo $i=\'${!i}\' >> /tmp/dhclient-script.debug
done
echo '--------------------------' >> /tmp/dhclient-script.debug
fi
rfc3442-classless-routes 0000666 00000002754 15077225301 0011105 0 ustar 00 RUN="yes"
if [ "$RUN" = "yes" ]; then
if [ "$new_rfc3442_classless_static_routes" != "" ]; then
if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
rfc_routes=($new_rfc3442_classless_static_routes)
for(( i=0; i < ${#rfc_routes[@]}; )); do
net_length=${rfc_routes[$i]}
((i++))
net_address=(0 0 0 0)
for(( j=0; j < $[$net_length / 8 + \
($net_length % 8 ? 1 : 0)]; j++, i++)); do
net_address[$j]=${rfc_routes[$i]}
done
gateway=(0 0 0 0)
for (( j=0; j < 4; j++, i++ )); do
gateway[$j]=${rfc_routes[$i]}
done
old_IFS="$IFS"
IFS='.'
if [ "$net_length" == "32" ]; then
/sbin/route add -host "${net_address[*]}" gw "${gateway[*]}"
else
/sbin/route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}"
fi
IFS="$old_IFS"
done
fi
fi
fi