source: npl/fileserver/samba_conf/root/etc/postinst.d/post.samba @ e013060

perl-5.22
Last change on this file since e013060 was 1568e4c, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

samba upgrade 4.7.7. also support SMBv2 and higher (SMBv1 is disabled by default in windows 10). tested with windows 7, 8.1 and 10

  • Property mode set to 100755
File size: 2.7 KB
Line 
1#!/bin/sh
2
3#replace by symlink
4if ! [ -L /etc/cups ]; then
5        mv /etc/cups /etc/cups.old 2>/dev/null
6        ln -s /home/system/cups /etc/cups 2>/dev/null
7fi
8
9if ! [ -L /etc/samba ]; then
10        mv /etc/samba /etc/samba.old 2>/dev/null
11        ln -s /home/system/samba /etc/samba 2>/dev/null
12fi
13
14
15# Check of de smb.conf bestaat.
16if [ ! -f /home/system/samba/smb.conf ]; then
17        mv /home/system/samba/smb.conf-sample /home/system/samba/smb.conf
18fi
19if [ ! -f /home/shares/netlogon/logon.bat ]; then
20        mv /home/shares/netlogon/logon.bat.new /home/shares/netlogon/logon.bat
21fi
22
23if ! cat /home/system/samba/smb.conf | grep "store dos attributes" &> /dev/null; then
24        sed -i /home/system/samba/smb.conf \
25        -e "s/    unix extensions = no/    unix extensions = no\n    store dos attributes = yes/"
26fi
27
28if ! cat /home/system/samba/smb.conf | grep "recycle:repository" &> /dev/null; then
29        sed -i /home/system/samba/smb.conf \
30        -e "s/    store dos attributes = yes/    store dos attributes = yes\n    recycle:keeptree = yes\n    recycle:touch = yes\n    recycle:versions = yes\n    recycle:repository = .\/trash/"
31        sed -i /home/system/samba/smb.conf \
32        -e "s/    store dos attributes = no/    store dos attributes = no\n    recycle:keeptree = yes\n    recycle:touch = yes\n    recycle:versions = yes\n    recycle:repository = .\/trash/"
33fi
34
35if ! cat /home/system/samba/smb.conf | grep "recycle:directory_mode" &> /dev/null; then
36        sed -i /home/system/samba/smb.conf \
37        -e "s/    recycle:repository = .\/trash/    recycle:repository = .\/trash\n    recycle:directory_mode = 0777/"
38fi
39
40sed -i /home/system/samba/smb.conf -e "s@\./trash@trash@"
41
42
43#add new setting (v3.4)
44if ! grep "map untrusted to domain" /home/system/samba/smb.conf; then
45        sed -i /home/system/samba/smb.conf -e 's/^.global./[global]\nmap untrusted to domain = yes/'
46fi
47
48#add new setting (v3.5)
49#if ! grep "max protocol" /home/system/samba/smb.conf; then
50#       sed -i /home/system/samba/smb.conf -e 's/^.global./[global]\nmax protocol = SMB2/'
51#fi
52
53#change setting settings (v4.4.4)
54# https://wiki.samba.org/index.php/Required_settings_for_NT4-style_domains
55#sed -i /home/system/samba/smb.conf -e 's/max protocol = SMB2/max protocol = NT1/'
56
57
58#let kernel do auto performance tuning. (the old value of 8k is bad!)
59sed -i /home/system/samba/smb.conf -e 's/.*socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192.*//'
60
61#samba 4.7+ chooses good defaults
62sed -i  /home/system/samba/smb.conf -e 's/.*max protocol.*//g'
63 
64chmod 1777 /home/shares/profiles
65chmod 1777 /home/shares/spool
66
67#private is in another place in the official slackware version:
68mv /home/system/samba/private/* /var/lib/samba/private/ 2>/dev/null
69rmdir /home/system/samba/private 2>/dev/null
70
71#nodig vanaf 4.4.4 (windows 10?)
72chmod +x /home/shares/netlogon/logon.bat
73
74exit 0
Note: See TracBrowser for help on using the repository browser.