Merge pull request #330 from escalade/sambafix

samba: move samba-defaults into the samba-config script
This commit is contained in:
Christian Hewitt 2016-05-11 07:42:03 +04:00
commit 1ed40a16d6
6 changed files with 45 additions and 72 deletions

View File

@ -189,7 +189,6 @@ makeinstall_target() {
post_install() { post_install() {
if [ "$SAMBA_SERVER" = "yes" ]; then if [ "$SAMBA_SERVER" = "yes" ]; then
enable_service samba-defaults.service
enable_service nmbd.service enable_service nmbd.service
enable_service smbd.service enable_service smbd.service
fi fi

View File

@ -21,7 +21,10 @@ SMB_USERCONF="/storage/.config/samba.conf"
SMB_DEFCONF="/etc/samba/smb.conf" SMB_DEFCONF="/etc/samba/smb.conf"
SMB_CONF="/run/samba/smb.conf" SMB_CONF="/run/samba/smb.conf"
if [ -f /storage/.cache/services/samba.conf ]; then if [ ! -f /storage/.cache/services/samba.conf ]; then
/bin/cp /usr/share/services/samba.conf /storage/.cache/services
fi
. /storage/.cache/services/samba.conf . /storage/.cache/services/samba.conf
mkdir -p /run/samba mkdir -p /run/samba
@ -61,4 +64,3 @@ if [ -f /storage/.cache/services/samba.conf ]; then
sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF sed -e 's|^.[ \t]*.username map.=.*||' -i $SMB_CONF
sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF sed -e 's|^.[ \t]*.security.=.*| security = share|' -i $SMB_CONF
fi fi
fi

View File

@ -1,10 +1,6 @@
[Unit] [Unit]
Description=Samba NMB Daemon Description=Samba NMB Daemon
After=network.target samba-config.service After=network.target smbd.service
Requires=samba-config.service
ConditionPathExists=/storage/.cache/services/samba.conf
ConditionPathExists=/run/samba/smb.conf
[Service] [Service]
Type=forking Type=forking

View File

@ -1,11 +0,0 @@
[Unit]
Description=Samba configfile writer
After=samba-defaults.service
Requires=samba-defaults.service
ConditionPathExists=/storage/.cache/services/samba.conf
[Service]
Type=oneshot
ExecStart=/usr/lib/samba/samba-config
StartLimitInterval=0

View File

@ -1,10 +0,0 @@
[Unit]
Description=Samba defaults
ConditionPathExists=!/storage/.cache/services/samba.conf
ConditionPathExists=!/storage/.cache/services/samba.disabled
[Service]
Type=oneshot
ExecStart=/bin/cp /usr/share/services/samba.conf /storage/.cache/services/
RemainAfterExit=yes

View File

@ -1,16 +1,13 @@
[Unit] [Unit]
Description=Samba SMB Daemon Description=Samba SMB Daemon
After=network.target samba-config.service nmbd.service After=network.target
Requires=samba-config.service
ConditionPathExists=/storage/.cache/services/samba.conf
ConditionPathExists=/run/samba/smb.conf
[Service] [Service]
Type=forking Type=forking
PIDFile=/var/run/smbd-smb.conf.pid PIDFile=/var/run/smbd-smb.conf.pid
LimitNOFILE=16384 LimitNOFILE=16384
ExecStart=/usr/bin/smbd --configfile=/run/samba/smb.conf ExecStart=/usr/bin/smbd --configfile=/run/samba/smb.conf
ExecStartPre=/usr/lib/samba/samba-config
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=1s TimeoutStopSec=1s
Restart=always Restart=always