| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | #replace by symlink |
|---|
| 4 | if ! [ -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 |
|---|
| 7 | fi |
|---|
| 8 | |
|---|
| 9 | if ! [ -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 |
|---|
| 12 | fi |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | # Check of de smb.conf bestaat. |
|---|
| 16 | if [ ! -f /home/system/samba/smb.conf ]; then |
|---|
| 17 | mv /home/system/samba/smb.conf-sample /home/system/samba/smb.conf |
|---|
| 18 | fi |
|---|
| 19 | if [ ! -f /home/shares/netlogon/logon.bat ]; then |
|---|
| 20 | mv /home/shares/netlogon/logon.bat.new /home/shares/netlogon/logon.bat |
|---|
| 21 | fi |
|---|
| 22 | |
|---|
| 23 | if ! 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/" |
|---|
| 26 | fi |
|---|
| 27 | |
|---|
| 28 | if ! 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/" |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 35 | if ! 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/" |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | sed -i /home/system/samba/smb.conf -e "s@\./trash@trash@" |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | #add new setting (v3.4) |
|---|
| 44 | if ! 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/' |
|---|
| 46 | fi |
|---|
| 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!) |
|---|
| 59 | sed -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 |
|---|
| 62 | sed -i /home/system/samba/smb.conf -e 's/.*max protocol.*//g' |
|---|
| 63 | |
|---|
| 64 | chmod 1777 /home/shares/profiles |
|---|
| 65 | chmod 1777 /home/shares/spool |
|---|
| 66 | |
|---|
| 67 | #private is in another place in the official slackware version: |
|---|
| 68 | mv /home/system/samba/private/* /var/lib/samba/private/ 2>/dev/null |
|---|
| 69 | rmdir /home/system/samba/private 2>/dev/null |
|---|
| 70 | |
|---|
| 71 | #nodig vanaf 4.4.4 (windows 10?) |
|---|
| 72 | chmod +x /home/shares/netlogon/logon.bat |
|---|
| 73 | |
|---|
| 74 | exit 0 |
|---|