option for disabling status for less distraction
[distro-setup] / disabled / samba-setup
1 #!/bin/bash
2
3 # this is from distro-end
4
5 if [[ $HOSTNAME == kd ]]; then
6 pi samba
7 # note samba re-reads it\'s config every 1 minute
8 case $distro in
9 arch) s cp /etc/samba/smb.conf.default /etc/samba/smb.conf ;;
10 esac
11
12 # add 2 lines after workgroup option
13 s sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc/samba/smb.conf
14 s sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc/samba/smb.conf
15 s sed -i --follow-symlinks 's/\(\s*workgroup\s*=\).*/\1 WORKGROUP\n\tencrypt passwords = yes\n\tmap to guest = bad password/' /etc/samba/smb.conf
16 # remove default homes section. not sharing that.
17 s sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc/samba/smb.conf
18
19 if ! grep -xF '[public]' /etc/samba/smb.conf &>/dev/null; then
20 s tee -a /etc/samba/smb.conf <<'EOF'
21 [public]
22 guest ok = yes
23 read only = no
24 path = /kr
25 EOF
26 fi
27
28 case $distro in
29 debian|trisquel|ubuntu)
30 # systemd claims it generates units from /etc/init.d, but it
31 # clearly doesn\'t in debian. I have no idea how they are
32 # related. fuck debian right now. It\'s not documented. samba
33 # has a systemd init file linked to /dev/null. There\'s this
34 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
35 # claims samba\'s sub-services will be started automatically by
36 # systemd... it didn\'t on install, wonder if it will on
37 # boot. It clued me in how to start it manually though. Nothing
38 # in /usr/share/doc/samba, debian admin guide says nothing about
39 # any of this. (this is in debian testing as of 4/2016).
40
41 s /etc/init.d/samba start
42 ;;
43 arch)
44 sgo samba
45 ;;
46 esac
47 fi