#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
# our event specific for updating with yum without reboot
$event = 'smeserver-service_control-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('action', $event, '30');
#services we need to restart
#safe_symlink('restart',root/etc/e-smith/events/$event/services2adjust/service);
#and Server Manager panel link
#panel_link('somefunction', 'manager');


# This script creates the symlinks needed by this RPM
# Specific support exists to create symlinks within e-smith web "panels"
# and for links from named "events" directories into the "actions" directory

use esmith::Build::CreateLinks qw(:all);

# Links for the panel
panel_link("servicecontrol", "manager");


#--------------------------------------------------
##service2adjust
#--------------------------------------------------
foreach my $event (qw( service-access 
			smeserver-service_control-update'
                        service-one))
    {
#    safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
#    safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-admin");
    safe_symlink("adjust", "root/etc/e-smith/events/$event/services2adjust/masq");
#    safe_symlink("sigterm", "root/etc/e-smith/events/$event/services2adjust/pptpd");
#    safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/qmail");
    safe_symlink("sigterm", "root/etc/e-smith/events/$event/services2adjust/radiusd");
#    safe_symlink("sighup", "root/etc/e-smith/events/$event/services2adjust/sshd");
#    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/wan");
    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/squid");

   # Added by stephdl for testing purpose, not sure is needed
#    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/qpsmtpd");
#    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/sqpsmtpd");
#    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/pop3");
#    safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/pop3s");   
#    safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/dovecot");   
#    safe_symlink("sigterm", "root/etc/e-smith/events/$event/services2adjust/dnscache");  

#    safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/ftp");  
    
}

safe_symlink("/etc/e-smith/events/bootstrap-console-save/templates2expand", "root/etc/e-smith/events/service-expand/templates2expand");
#-------------------------------------------------
##Action2events
#-------------------------------------------------

foreach my $event (qw ( service-access
			smeserver-service_control-update'
                        service-one))
        {
            event_link("service-control", $event, "90");
        }
foreach my $event (qw (service-expand smeserver-service_control-update'))
        {
            event_link("update-ifcfg", $event, "10");
            safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
        }
#proxy-update
#remoteaccess-update