initial net-usershares feature

This is applicable at least to XFCE and MATE based images
(plugins for the appropriate file managers are available).

NB: basically untested with installers.
This commit is contained in:
Michael Shigorin 2013-06-24 11:38:34 +00:00
parent 8b7138546d
commit e543e6dd7b
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# requires thunar-shares-plugin or mate-user-share to make sense
use/net-usershares: use/services use/deflogin
@$(call add,GROUPS,sambashare)
@$(call add,DEFAULT_SERVICES_ENABLE,smb nmb)
@$(call add,THE_PACKAGES,libshell)

View File

@ -0,0 +1,36 @@
#!/bin/sh -efu
[ -s /etc/samba/smb.conf ] || exit 0
. shell-config
USERSHARES_DIR="/var/lib/samba/usershares"
USERSHARES_GROUP="sambashare"
DEFAULT_GROUPS='cdwriter cdrom audio proc radio camera floppy xgrp scanner uucp' ###
GROUPS_FILE="/usr/share/install3/default-groups"
mkdir -p "$USERSHARES_DIR"
groupadd -r "$USERSHARES_GROUP"
chown root:"$USERSHARES_GROUP" "$USERSHARES_DIR"
chmod 1770 "$USERSHARES_DIR"
USERSHARES_OPTIONS="# ----------------------- User Shares Options -------------------------\n\tusershare path = $USERSHARES_DIR\n\tusershare max shares = 100\n\tusershare allow guests = yes\n\tusershare owner only = yes"
sed -i -e "\|^\[global\]|a$USERSHARES_OPTIONS" \
-e "s/workgroup = MYGROUP/workgroup = WORKGROUP/" \
"/etc/samba/smb.conf"
# Create group file for alterator-users
if [ ! -s "$GROUPS_FILE" ]; then
mkdir -p "${GROUPS_FILE%/*}"
echo "$DEFAULT_GROUPS" >"$GROUPS_FILE"
fi
# Add USERSHARES_GROUP to the default groups list.
echo "$USERSHARES_GROUP" >>"$GROUPS_FILE"
# Permissions for home dir must be 0701
tab="$(printf "\t")"
shell_config_set "/etc/login.defs" UMASK 076 "$tab" "$tab"
# smb and nmb services must be enabled