104 lines
2.7 KiB
Perl
104 lines
2.7 KiB
Perl
#! /usr/bin/perl -w
|
|
|
|
# Need some thought on when the templates should be expanded and when the action should be called.
|
|
|
|
# Need to
|
|
|
|
# On ipsec-update expand xl2tpd.conf & secrets
|
|
|
|
# Need to stop xl2tpd if disabled. Key ?
|
|
|
|
use esmith::Build::CreateLinks qw(:all);
|
|
|
|
# our event specific for updating with yum without reboot
|
|
$event = "smeserver-libreswan-xl2tpd-update";
|
|
#add here the path to your templates needed to expand
|
|
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
|
|
|
foreach my $file (qw(
|
|
/etc/systemd/system-preset/49-koozali.preset
|
|
))
|
|
{
|
|
templates2events( $file, $event );
|
|
}
|
|
|
|
#action needed in case we have a systemd unit
|
|
event_link("systemd-default", $event, "10");
|
|
event_link("systemd-reload", $event, "50");
|
|
|
|
#action specific to this package
|
|
event_link("ip-up.xl2tpd", $event, "60");
|
|
|
|
#services we need to restart
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/xl2tpd");
|
|
|
|
#--------------------------------------------------
|
|
# templates for events
|
|
#--------------------------------------------------
|
|
|
|
foreach (
|
|
qw(
|
|
/etc/pam.d/ppp
|
|
/etc/ppp/ip-up.local
|
|
/etc/ppp/options.xl2tpd
|
|
/etc/ppp/pap-secrets
|
|
/etc/xl2tpd/xl2tpd.conf
|
|
/etc/sysconfig/modules/ip_xl2tpd.modules
|
|
)
|
|
) {
|
|
templates2events(
|
|
"$_", qw(
|
|
post-upgrade
|
|
console-save
|
|
bootstrap-console-save
|
|
remoteaccess-update
|
|
ipsec-update
|
|
)
|
|
);
|
|
}
|
|
|
|
#--------------------------------------------------
|
|
# actions for ipsec-update event
|
|
#--------------------------------------------------
|
|
|
|
my $eventIpsec = "ipsec-update";
|
|
|
|
#--------------------------------------------------
|
|
# actions for ip-up.xl2tpd event
|
|
#--------------------------------------------------
|
|
|
|
my $eventXl2tpd = "ip-up.xl2tpd";
|
|
safe_symlink( "adjust", "root/etc/e-smith/events/$eventXl2tpd/services2adjust/masq" );
|
|
event_link( "xl2tpd-interface-access", $eventXl2tpd, "70" );
|
|
|
|
# Runlevel init links.
|
|
#service_link_enhanced( "xl2tpd", "S95", "7" );
|
|
#service_link_enhanced( "xl2tpd", "K21", "6" );
|
|
#service_link_enhanced( "xl2tpd", "K21", "0" );
|
|
#service_link_enhanced( "xl2tpd", "K21", "1" );
|
|
|
|
# On ip-up.xl2tpd expand and restart masq
|
|
|
|
foreach (
|
|
qw(
|
|
/etc/rc.d/init.d/masq
|
|
)
|
|
) {
|
|
templates2events(
|
|
"$_", qw(
|
|
ip-up.xl2tpd
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
#--------------------------------------------------
|
|
# actions for ip-up.xl2tpd event
|
|
# On ip-down clear the interface
|
|
# masq gets restarted anyway via existing event
|
|
#--------------------------------------------------
|
|
|
|
my $eventXl2tpd = "ip-down";
|
|
|
|
event_link( "xl2tpd-interface-access", $eventXl2tpd, "70" );
|