2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
24 # this is from distro-end
26 if [[ $HOSTNAME == kd
]]; then
28 # note samba re-reads it\'s config every 1 minute
30 arch
) s
cp /etc
/samba
/smb.conf.default
/etc
/samba
/smb.conf
;;
33 # add 2 lines after workgroup option
34 s
sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc
/samba
/smb.conf
35 s
sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc
/samba
/smb.conf
36 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
37 # remove default homes section. not sharing that.
38 s
sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc
/samba
/smb.conf
40 if ! grep -xF '[public]' /etc
/samba
/smb.conf
&>/dev
/null
; then
41 s
tee -a /etc
/samba
/smb.conf
<<'EOF'
50 debian|trisquel|ubuntu
)
51 # systemd claims it generates units from /etc/init.d, but it
52 # clearly doesn\'t in debian. I have no idea how they are
53 # related. fuck debian right now. It\'s not documented. samba
54 # has a systemd init file linked to /dev/null. There\'s this
55 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
56 # claims samba\'s sub-services will be started automatically by
57 # systemd... it didn\'t on install, wonder if it will on
58 # boot. It clued me in how to start it manually though. Nothing
59 # in /usr/share/doc/samba, debian admin guide says nothing about
60 # any of this. (this is in debian testing as of 4/2016).
62 s
/etc
/init.d
/samba start