blob: 13a143dcac4741fda1254d2371f91daf94a3c027 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
setup_sambauser() {
echo -n "# Setting up samba user $1..."
echo -ne "$2\n$2\n" | smbpasswd -a -s -U "$1" 2>/dev/null # $1: User, $2: Password
ERR=$?
if [ "$ERR" -ne 0 ]; then
echo
echo "# WARNING: Could not enter password for samba user $1."
echo "# Please remember to set a password for user $1 by hand."
else
echo " ok."
fi
}
setup_sambaconfig() {
echo -n "# Writing samba config..."
if [ $(grep -c "\[imageshare\]" /etc/samba/smb.conf) -gt 0 ]; then
echo " config already written; doing nothing."
else
cat >>/etc/samba/smb.conf<<-EOF
[imageshare]
path = /srv/openslx/nfs
comment = VM image share
writable = yes
valid users = vmware
EOF
echo "ok."
fi
}
setup_samba() {
setup_sambauser vmware openslx-ng
setup_sambaconfig
}
|