2021-04-13 19:04:24 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Authors:
|
|
|
|
# (C) 2021 Idea an concept by Christian Zengel <christian@sysops.de>
|
2021-04-16 17:26:30 +02:00
|
|
|
# (C) 2021 Script design and prototype by Markus Helmke <m.helmke@nettwarker.de>
|
2021-04-13 19:04:24 +02:00
|
|
|
# (C) 2021 Script rework and documentation by Thorsten Spille <thorsten@spille-edv.de>
|
|
|
|
|
|
|
|
source /root/zamba.conf
|
|
|
|
|
2021-04-20 21:52:43 +02:00
|
|
|
sed -i "s|# $LXC_LOCALE|$LXC_LOCALE|" /etc/locale.gen
|
|
|
|
cat << EOF > /etc/default/locale
|
|
|
|
LANG="$LXC_LOCALE"
|
|
|
|
LANGUAGE=$LXC_LOCALE
|
|
|
|
EOF
|
|
|
|
locale-gen $LXC_LOCALE
|
|
|
|
|
2021-04-13 19:04:24 +02:00
|
|
|
apt update
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade
|
|
|
|
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" $LXC_TOOLSET acl samba samba-dsdb-modules samba-vfs-modules
|
|
|
|
|
2021-04-13 19:41:55 +02:00
|
|
|
USER=$(echo "$ZMB_ADMIN_USER" | awk '{print tolower($0)}')
|
2021-04-13 19:45:21 +02:00
|
|
|
useradd --comment "Zamba fileserver admin" --create-home --shell /bin/bash $USER
|
2021-04-13 19:41:55 +02:00
|
|
|
echo "$USER:$ZMB_ADMIN_PASS" | chpasswd
|
|
|
|
smbpasswd -x $USER
|
|
|
|
(echo $ZMB_ADMIN_PASS; echo $ZMB_ADMIN_PASS) | smbpasswd -a $USER
|
2021-04-13 19:04:24 +02:00
|
|
|
|
|
|
|
cat << EOF >> /etc/samba/smb.conf
|
|
|
|
[share]
|
|
|
|
comment = Main Share
|
2021-04-13 19:54:46 +02:00
|
|
|
path = /$LXC_SHAREFS_MOUNTPOINT/$ZMB_SHARE
|
2021-04-13 19:04:24 +02:00
|
|
|
read only = No
|
|
|
|
vfs objects = shadow_copy2
|
|
|
|
shadow: snapdir = .zfs/snapshot
|
|
|
|
shadow: sort = desc
|
|
|
|
shadow: format = -%Y-%m-%d-%H%M
|
|
|
|
shadow: snapprefix = ^zfs-auto-snap_\(frequent\)\{0,1\}\(hourly\)\{0,1\}\(daily\)\{0,1\}\(monthly\)\{0,1\}
|
|
|
|
shadow: delimiter = -20
|
|
|
|
EOF
|
|
|
|
|
2021-04-13 19:54:46 +02:00
|
|
|
mkdir -p /$LXC_SHAREFS_MOUNTPOINT/$ZMB_SHARE
|
2021-04-13 19:49:46 +02:00
|
|
|
chmod -R 770 /$LXC_SHAREFS_MOUNTPOINT/$ZMB_SHARE
|
2021-04-13 19:58:14 +02:00
|
|
|
chown -R $USER:root /$LXC_SHAREFS_MOUNTPOINT/$ZMB_SHARE
|
2021-04-13 19:04:24 +02:00
|
|
|
|
2021-04-13 19:41:55 +02:00
|
|
|
systemctl restart smbd nmbd
|