#!/bin/bash

. ${TOOLKIT}-functions.sh

sid=`jtconf samba.localsid 2>/dev/null` || {
	sid=`net getlocalsid | sed -e 's/.*: //'`
	out="/etc/kusa/conf.d/zz_local_sid"

	putwarning "SAMBA / SID" \
		"local SID not defined (samba.localsid), I will obtain it" \
		"using 'net getlocalsid' command, and creating an ovverride" \
		"config file '$out', please consider to include this file" \
		"in your standard machine config files"

	echo -e "[samba]\n  localsid	$sid" >$out	|| exit $?
	jtconf samba.localsid >/dev/null || {
		echo "  ERR: something goes wrong (check $out)" >&2
		exit 1
	}
}

exit 0
