diff -Nur e-smith-base-5.8.0.old/createlinks e-smith-base-5.8.0/createlinks --- e-smith-base-5.8.0.old/createlinks 2020-12-25 14:41:47.326000000 -0500 +++ e-smith-base-5.8.0/createlinks 2020-12-25 14:53:04.312000000 -0500 @@ -674,3 +674,7 @@ safe_symlink("sv", "root/etc/e-smith/locale/$_"); } safe_symlink("zh-tw", "root/etc/e-smith/locale/zh-hk"); + + +# sme-server.target.d links +safe_symlink("/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/05config", "root/etc/e-smith/templates/usr/lib/systemd/system/sme-server.target.d/50koozali.conf/05config"); diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/systemd-default e-smith-base-5.8.0/root/etc/e-smith/events/actions/systemd-default --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/systemd-default 2020-12-25 14:41:47.319000000 -0500 +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/systemd-default 2020-12-25 15:17:35.667000000 -0500 @@ -17,6 +17,7 @@ my @servicedirpaths = ("/usr/lib/systemd/system/","/etc/systemd/system/"); my @presetdirpaths = ("/usr/lib/systemd/system-preset/","/etc/systemd/system-preset/"); my $filename = "/etc/systemd/system-preset/49-koozali.preset"; +my $filename2 = "/usr/lib/systemd/system/sme-server.target.d/50koozali.conf"; my %services; my %files; my @WantedBy; @@ -45,12 +46,17 @@ system("/usr/bin/systemctl set-default sme-server.target"); -#warn "expanding $filename\n"; esmith::templates::processTemplate({ MORE_DATA => { }, TEMPLATE_PATH => $filename, OUTPUT_FILENAME => $filename, }); +esmith::templates::processTemplate({ + MORE_DATA => { }, + TEMPLATE_PATH => $filename2, + OUTPUT_FILENAME => $filename2, + }); + # list both preset directories # seek files to be removed from usr/lib if same basename exist diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/05config e-smith-base-5.8.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/05config --- e-smith-base-5.8.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/05config 2020-12-25 14:41:47.246000000 -0500 +++ e-smith-base-5.8.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/05config 2020-12-25 14:44:02.798000000 -0500 @@ -2,6 +2,11 @@ # auto generated list of services { use esmith::ConfigDB; -our $c = esmith::ConfigDB->open_ro || die "Couldn't opeen the configuration database\n"; +our $c = esmith::ConfigDB->open_ro || die "Couldn't open the configuration database\n"; + +#list of exception services +#those services might keep some traces in init.d +our @list = qw(bootstrap-console masq mysql.init wan lpd clamd diald ldap.init); + my $OUT =""; } diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services e-smith-base-5.8.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services --- e-smith-base-5.8.0.old/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services 2020-12-25 14:41:47.281000000 -0500 +++ e-smith-base-5.8.0/root/etc/e-smith/templates/etc/systemd/system-preset/49-koozali.preset/20services 2020-12-25 14:44:34.621000000 -0500 @@ -1,7 +1,4 @@ { -#list of exception services -#those services might keep some traces in init.d -my @list = qw(bootstrap-console masq mysql.init wan lpd clamd diald ldap.init); foreach my $service ($c->get_all_by_prop(type => 'service')){ my $status = $service->prop('status') || 'enabled'; diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/sme-server.target.d/50koozali.conf/20services e-smith-base-5.8.0/root/etc/e-smith/templates/usr/lib/systemd/system/sme-server.target.d/50koozali.conf/20services --- e-smith-base-5.8.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/sme-server.target.d/50koozali.conf/20services 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/etc/e-smith/templates/usr/lib/systemd/system/sme-server.target.d/50koozali.conf/20services 2020-12-25 15:03:40.085000000 -0500 @@ -0,0 +1,20 @@ +[Unit] +Wants={ + +foreach my $service ($c->get_all_by_prop(type => 'service')){ + my $status = $service->prop('status') || 'enabled'; + my $servicename = $service->prop('SystemdUnit') || $service->key . ".service" || ""; + next unless $servicename || $servicename eq ".service"; + $status = ($status eq "enabled") ? "enable" : "disable"; + unless ( $service->key ~~ @list ) { + $status = "disable" if -e "/etc/rc.d/init.d/".$service->key || -e "/etc/rc.d/init.d/supervise/".$service->key; + } + next unless -e "/usr/lib/systemd/system/$servicename" || -e "/etc/lib/systemd/system/$servicename"; + # we could also filter out there services that have already WantedBy=.*sme-server.target in their unit file or in a drop-in + + $OUT .= "$servicename " if ($status eq "enable"); + + } + +} + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/acpid.service.d/51koozali.conf e-smith-base-5.8.0/root/usr/lib/systemd/system/acpid.service.d/51koozali.conf --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/acpid.service.d/51koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/acpid.service.d/51koozali.conf 2020-12-25 15:11:50.785000000 -0500 @@ -0,0 +1,3 @@ +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/crond.service.d/51koozali.conf e-smith-base-5.8.0/root/usr/lib/systemd/system/crond.service.d/51koozali.conf --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/crond.service.d/51koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/crond.service.d/51koozali.conf 2020-12-25 15:12:08.535000000 -0500 @@ -0,0 +1,3 @@ +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/irqbalance.service.d/51koozali.conf e-smith-base-5.8.0/root/usr/lib/systemd/system/irqbalance.service.d/51koozali.conf --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/irqbalance.service.d/51koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/irqbalance.service.d/51koozali.conf 2020-12-25 15:12:37.139000000 -0500 @@ -0,0 +1,3 @@ +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/rsyslog.service.d/51koozali.conf e-smith-base-5.8.0/root/usr/lib/systemd/system/rsyslog.service.d/51koozali.conf --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/rsyslog.service.d/51koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/rsyslog.service.d/51koozali.conf 2020-12-25 15:13:12.581000000 -0500 @@ -0,0 +1,3 @@ +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/smartd.service.d/51koozali.conf e-smith-base-5.8.0/root/usr/lib/systemd/system/smartd.service.d/51koozali.conf --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/smartd.service.d/51koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/smartd.service.d/51koozali.conf 2020-12-25 15:13:37.764000000 -0500 @@ -0,0 +1,3 @@ +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-base-5.8.0.old/root/usr/lib/systemd/system/sme-server.target e-smith-base-5.8.0/root/usr/lib/systemd/system/sme-server.target --- e-smith-base-5.8.0.old/root/usr/lib/systemd/system/sme-server.target 2020-12-25 14:41:47.318000000 -0500 +++ e-smith-base-5.8.0/root/usr/lib/systemd/system/sme-server.target 2020-12-25 15:06:06.683000000 -0500 @@ -6,11 +6,8 @@ Documentation=man:systemd.special(7) Requires=basic.target Conflicts=rescue.service rescue.target multi-user.target -After=basic.target rescue.service rescue.target +After=basic.target rescue.service rescue.target runit.service AllowIsolate=yes -Wants=acpid.service atd.service auditd.service avahi-daemon.service brandbot.path crond.service irqbalance.service nfs-client.target remote-fs.target rhel-configure.service rsyslog.service smartd.service yum-cron.service +Wants=atd.service auditd.service avahi-daemon.service brandbot.path nfs-client.target remote-fs.target rhel-configure.service Wants=dbus.service plymouth-quit-wait.service plymouth-quit.service systemd-logind.service systemd-update-utmp-runlevel.service systemd-user-sessions.service -Wants=php-fpm.service php55-php-fpm.service php56-php-fpm.service php70-php-fpm.service php71-php-fpm.service php72-php-fpm.service php73-php-fpm.service php74-php-fpm.service -Wants=runit.service bootstrap-console.service wan.service networking.service masq.service tinydns.service qpsmtpd.service sqpsmtpd.service qmail.service ftp.service dnscache.service dnscache.forwarder.service lpd.service dhcpd.service dovecot.service mariadb.service ntpd.service nut.service clamd.service freshclam.service httpd-admin.service httpd-e-smith.service ldap.service ldap.init.service local.service mysql.init.service spamd.service -