Import from github

Signed-off-by: Stefano Capitani's avatarSte74 <stefano@manjaro.org>
parents
# Maintainer: Stefano Capitani <stefanoatmanjarodotorg>
pkgname=manjaro-settings-samba
pkgver=20180509
pkgrel=2
pkgdesc="Adds a smb.conf file for Manjaro and enables samba"
arch=('any')
url="https://github.com/manjaro/packages-extra"
license=('GPL')
depends=('samba')
install=manjaro-settings-samba.install
backup=('etc/samba/smb.conf')
source=("smb.conf")
md5sums=('4ef6b075cb314caafbe99629d9da5855')
pkgver() {
date +%Y%m%d
}
package() {
install -Dm644 smb.conf $pkgdir/etc/samba/smb.conf
mkdir -p $pkgdir/var/lib/samba/usershare
chmod 1770 $pkgdir/var/lib/samba/usershare
}
msg() {
ALL_OFF="\e[1;0m"
BOLD="\e[1;1m"
GREEN="${BOLD}\e[1;32m"
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&2
}
add_users() {
_l="/etc/login.defs"
_p="/etc/passwd"
## get mini UID limit ##
l=$(grep "^UID_MIN" $_l)
## get max UID limit ##
l1=$(grep "^UID_MAX" $_l)
## use awk to print if UID >= $MIN and UID <= $MAX and shell is not /sbin/nologin ##
users=$(awk -F':' -v "min=${l##UID_MIN}" -v "max=${l1##UID_MAX}" '{ if ( $3 >= min && $3 <= max && $7 != "/sbin/nologin" ) print $0 }' "$_p" | cut -d: -f1)
for i in $users; do
msg "Adding user '$i' to user-group 'sambashare'"
usermod -a -G sambashare $i
done
}
add_group() {
getent group "sambashare" &>/dev/null || groupadd -r sambashare
add_users
chgrp sambashare var/lib/samba/usershare
}
post_upgrade() {
add_group
echo ""
msg "Please add new users to 'sambashare' group."
echo ""
}
post_install() {
msg "Attempting to enable Samba services..."
systemctl is-active smb >/dev/null || systemctl enable smb
systemctl is-active nmb >/dev/null || systemctl enable nmb
add_group
echo ""
msg "Samba services should now be enabled."
msg "Please add new users to 'sambashare' group."
msg "Reboot your system, so changes will take affect."
echo ""
}
post_remove() {
msg "Attempting to disable Samba services..."
! systemctl is-active smb >/dev/null || systemctl disable smb
! systemctl is-active nmb >/dev/null || systemctl disable nmb
! getent group sambashare || groupadd -r sambashare
echo ""
msg "Samba services should now be disabled. Reboot your system."
echo ""
}
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/%m.log
max log size = 1000
client max protocol = NT1
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
pam password change = yes
map to guest = Bad Password
usershare allow guests = yes
name resolve order = lmhosts bcast host wins
security = user
guest account = nobody
usershare path = /var/lib/samba/usershare
usershare max shares = 100
usershare owner only = yes
force create mode = 0070
force directory mode = 0070
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment