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
25 if [[ -s ~
/.bashrc
]];then . ~
/.bashrc
;fi
29 # based on https://wiki.debian.org/SecuringNFS
30 # but the quota stuff is either outdated or optional,
31 # i guessed that it was not needed and it worked fine.
32 s
dd of
=/etc
/sysctl.d
/nfs-static-ports.conf
<<'EOF'
33 fs.nfs.nfs_callback_tcpport = 32764
34 fs.nfs.nlm_tcpport = 32768
35 fs.nfs.nlm_udpport = 32768
38 s
$sed -ri -f - /etc
/default
/nfs-common
<<'EOF'
40 $a STATDOPTS="--port 32765 --outgoing-port 32766"
43 s
$sed -ri -f - /etc
/default
/nfs-kernel-server
<<'EOF'
45 $a RPCMOUNTDOPTS="--manage-gids --port 32767"
47 ser restart nfs-kernel-server
49 if [[ $HOSTNAME == kd
]]; then
50 # persistent one time steps for webdav:
51 # create persistent password, put it in ~/.kodi/userdata/advancedsettings.xml,
52 # per http://kodi.wiki/view/MySQL/Sync_other_parts_of_Kodi
53 # htpasswd -c /p/c/filesystem/etc/davpass dav
54 # chmod 640 /p/c/filesystem/etc/davpass
55 # in conflink, set group to www-data.
56 # In kodi, i set the music source, server address: my domain,
57 # path: k/music. Then copied the file
58 # /p/c/subdir_files/.kodi/userdata/sources.xml to save that setting.
60 web-conf
-r /a
/c
/playlists
- apache2 dav.
$HOME_DOMAIN <<'EOF'
61 <Directory /a/c/playlists>
64 AuthName "Authentication Required"
65 AuthUserFile "/etc/davpass"
68 # outside the standard /var/www, so use this:
73 s mkdir
-p /var
/www
/davlock
74 s chown www-data
:www-data
/var
/www
/davlock
75 s
sed -i "1i DavLockDB /var/www/davlock/davlock" /etc
/apache
2/sites-enabled
/dav.
$HOME_DOMAIN.conf
78 teeu
/etc
/exports
"/k/music *(ro,nohide,async,no_subtree_check,insecure)"
81 # kodi uses sqlite by default, but supports mysql.
84 # see ofswiki.org for explanation.
85 dbpass
="$(cat /p/mysql-root-pass)"
86 if ! echo exit|mysql
-uroot "-p$dbpass"; then
87 echo -e "\n\n$dbpass\n$dbpass\n\n\n\n\n" | mysql_secure_installation
89 mysql
-uroot "-p$dbpass" <<EOF
90 GRANT ALL PRIVILEGES ON *.* TO 'kodi' IDENTIFIED BY '$(</p/mysql-kodi-pass)';
92 s
sed -ri 's/^(\s*bind-address\s*=).*/\1 0.0.0.0/' /etc
/mysql
/mariadb.conf.d
/50-server.cnf