diff -Nur e-smith-samba-2.6.0.old/createlinks e-smith-samba-2.6.0/createlinks --- e-smith-samba-2.6.0.old/createlinks 2021-01-01 18:57:02.072000000 -0500 +++ e-smith-samba-2.6.0/createlinks 2021-01-01 23:24:12.627000000 -0500 @@ -19,6 +19,7 @@ post-install post-upgrade workgroup-update + e-smith-samba-update )); } @@ -27,11 +28,11 @@ /etc/krb5.conf )) { - templates2events($file, qw(console-save bootstrap-console-save)); + templates2events($file, qw(console-save bootstrap-console-save e-smith-samba-update)); } foreach (qw(console-save bootstrap-console-save bootstrap-ldap-save - post-install post-upgrade workgroup-update)) + post-install post-upgrade workgroup-update e-smith-samba-update)) { event_link('store-ldap-smbpasswd', $_, "06"); } @@ -111,11 +112,10 @@ $event = "pre-restore"; event_link("delete-smbpasswd", $event, "90"); -# Link smbd and nmbd to daemontools. -safe_symlink("daemontools", "root/etc/rc.d/init.d/smbd"); -safe_symlink("daemontools", "root/etc/rc.d/init.d/nmbd"); - -safe_symlink("../init.d/supervise/smb", "root/etc/rc.d/rc7.d/S91smb"); -safe_symlink("../init.d/supervise/smb", "root/etc/rc.d/rc6.d/K35smb"); -safe_symlink("../init.d/supervise/smb", "root/etc/rc.d/rc1.d/K35smb"); -safe_symlink("../init.d/supervise/smb", "root/etc/rc.d/rc0.d/K35smb"); +$event = "e-smith-samba-update"; +event_link("user-create-profiledir", $event, "20"); +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smbd"); +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/nmbd"); +# systemd-specific action mandatory for this package-update event +event_link("systemd-reload", $event, "89"); +event_link("systemd-default", $event, "88"); diff -Nur e-smith-samba-2.6.0.old/root/sbin/e-smith/systemd/nmbd-prepare e-smith-samba-2.6.0/root/sbin/e-smith/systemd/nmbd-prepare --- e-smith-samba-2.6.0.old/root/sbin/e-smith/systemd/nmbd-prepare 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/sbin/e-smith/systemd/nmbd-prepare 2021-01-01 22:52:33.288000000 -0500 @@ -0,0 +1,31 @@ +#!/bin/sh + +# Source networking configuration. +. /etc/sysconfig/network + +#if [ -f /etc/sysconfig/samba ]; then +# . /etc/sysconfig/samba +#fi +# We currently don't care about /etc/sysconfig/samba, but that may change. + +status=$(/sbin/e-smith/config getprop smb status) +if [ "$status" = "disabled" ] +then + /sbin/e-smith/config setprop nmbd status disabled + exit 1 +fi + +nmbd=/usr/sbin/nmbd + +[ -f $nmbd ] || exit 1 + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 1 + +# Check that smb.conf exists. +[ -f /etc/samba/smb.conf ] || exit 1 + +# Check that we can write to it... so non-root users stop here +[ -w /etc/samba/smb.conf ] || exit 1 + +exit 0 diff -Nur e-smith-samba-2.6.0.old/root/sbin/e-smith/systemd/smbd-prepare e-smith-samba-2.6.0/root/sbin/e-smith/systemd/smbd-prepare --- e-smith-samba-2.6.0.old/root/sbin/e-smith/systemd/smbd-prepare 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/sbin/e-smith/systemd/smbd-prepare 2021-01-01 22:52:39.807000000 -0500 @@ -0,0 +1,43 @@ +#!/bin/sh + +# Source networking configuration. +. /etc/sysconfig/network + +#if [ -f /etc/sysconfig/samba ]; then +# . /etc/sysconfig/samba +#fi +# We currently don't care about /etc/sysconfig/samba, but that may change. + +ldapauth=$(/sbin/e-smith/config getprop ldap Authentication || echo disabled) + +status=$(/sbin/e-smith/config getprop smb status) +if [ "$status" = "disabled" ] +then + /sbin/e-smith/config setprop smbd status disabled + exit 1 +fi + +smbd=/usr/sbin/smbd + +[ -f $smbd ] || exit 1 + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 1 + +# Check that smb.conf exists. +[ -f /etc/samba/smb.conf ] || exit 1 + +# Check that we can write to it... so non-root users stop here +[ -w /etc/samba/smb.conf ] || exit 1 + +# Delete the printing.tdb file if it exists to force it to rebuild. +rm -f /var/cache/samba/printing.tdb + +# Backup critical tdb files +for tdb in /etc/samba/*.tdb \ + /var/lib/samba/*.tdb +do + [ -r "$tdb" ] && tdbbackup -l "$tdb" .bak +done + +exit 0 diff -Nur e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/nmbd.service e-smith-samba-2.6.0/root/usr/lib/systemd/system/nmbd.service --- e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/nmbd.service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/usr/lib/systemd/system/nmbd.service 2021-01-01 22:59:33.744000000 -0500 @@ -0,0 +1,23 @@ +[Unit] +# When systemd stops or restarts the smb.service, the action is propagated to this unit +PartOf=smb.service +# Start this unit after the smb.service start +After=smb.service + +[Service] +Type=notify +NotifyAccess=all +PIDFile=/run/nmbd.pid +EnvironmentFile=-/etc/sysconfig/samba +ExecStartPre=/sbin/e-smith/service-status nmbd +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smb.conf +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smbusers +ExecStartPre=/sbin/e-smith/systemd/nmbd-prepare +ExecStart=/usr/sbin/nmbd --foreground --no-process-group $NMBDOPTIONS +ExecReload=/bin/kill -HUP $MAINPID +LimitCORE=infinity +Environment=KRB5CCNAME=FILE:/run/samba/krb5cc_samba +Restart=always + +[Install] +WantedBy=sme-server.target diff -Nur e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/nmb.service.d/50koozali.conf e-smith-samba-2.6.0/root/usr/lib/systemd/system/nmb.service.d/50koozali.conf --- e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/nmb.service.d/50koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/usr/lib/systemd/system/nmb.service.d/50koozali.conf 2021-01-01 23:00:56.573000000 -0500 @@ -0,0 +1,10 @@ +# disabled as conlfict with KOOZALI SME SERVER samba +[Service] +Type=oneshot +ExecStart= +ExecStart=/bin/false +ExecReload= + +[Install] +WantedBy= + diff -Nur e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/smbd.service e-smith-samba-2.6.0/root/usr/lib/systemd/system/smbd.service --- e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/smbd.service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/usr/lib/systemd/system/smbd.service 2021-01-01 22:55:00.045000000 -0500 @@ -0,0 +1,28 @@ +[Unit] +Description=Samba SMB Daemon +Documentation=man:smbd(8) man:samba(7) man:smb.conf(5) +Wants=network-online.target +After=network.target network-online.target nmb.service winbind.service +# When systemd stops or restarts the smb.service, the action is propagated to this unit +PartOf=smb.service +# Start this unit after the smb.service start +After=smb.service + +[Service] +Type=notify +NotifyAccess=all +PIDFile=/run/smbd.pid +LimitNOFILE=16384 +EnvironmentFile=-/etc/sysconfig/samba +ExecStartPre=/sbin/e-smith/service-status smbd +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smb.conf +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smbusers +ExecStartPre=/sbin/e-smith/systemd/smbd-prepare +ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS +ExecReload=/bin/kill -HUP $MAINPID +LimitCORE=infinity +Environment=KRB5CCNAME=FILE:/run/samba/krb5cc_samba +Restart=always + +[Install] +WantedBy=sme-server.target diff -Nur e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/smb.service.d/50koozali.conf e-smith-samba-2.6.0/root/usr/lib/systemd/system/smb.service.d/50koozali.conf --- e-smith-samba-2.6.0.old/root/usr/lib/systemd/system/smb.service.d/50koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-samba-2.6.0/root/usr/lib/systemd/system/smb.service.d/50koozali.conf 2021-01-01 23:04:31.977000000 -0500 @@ -0,0 +1,25 @@ +[Unit] +Description=Samba SMB Daemon global service for Koozali SME Server + +[Service] +Type=oneshot +#NotifyAccess= +#PIDFile= +#LimitNOFILE= +#EnvironmentFile= +ExecStartPre=/sbin/e-smith/service-status smb +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smb.conf +ExecStartPre=-/sbin/e-smith/expand-template /etc/samba/smbusers +ExecStart= +# Execute a dummy program +ExecStart=/bin/true + +ExecReload= +#LimitCORE= +# This service shall be considered active after start +RemainAfterExit=yes + +[Install] +WantedBy= +WantedBy=sme-server.target +