@@ -62,10 +62,12 @@ appSetup () {
6262 \\ \tidmap_ldb:use rfc2307 = yes\\ n\
6363 wins support = yes\\ n\
6464 template shell = /bin/bash\\ n\
65- winbind nss info = rfc2307\\ n\
66- idmap config ${URDOMAIN} : range = 10000-20000\\ n\
67- idmap config ${URDOMAIN} : backend = ad\
65+ template homedir = /home/%U\\ n\
66+ idmap config ${URDOMAIN} : schema_mode = rfc2307\\ n\
67+ idmap config ${URDOMAIN} : unix_nss_info = yes\\ n\
68+ idmap config ${URDOMAIN} : backend = ad\
6869 " /etc/samba/smb.conf
70+ sed -i " s/LOCALDC/${URDOMAIN} DC/g" /etc/samba/smb.conf
6971 if [[ $DNSFORWARDER != " NONE" ]]; then
7072 sed -i " /\[global\]/a \
7173 \\ \tdns forwarder = ${DNSFORWARDER} \
@@ -114,11 +116,33 @@ appSetup () {
114116 echo " restrict 2.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery" >> /etc/ntpd.conf
115117 echo " tinker panic 0" >> /etc/ntpd.conf
116118
117- appStart
119+ appStart check
120+ }
121+
122+ fixDomainUsersGroup () {
123+ GIDNUMBER=$( ldbedit -H /var/lib/samba/private/sam.ldb -e cat " samaccountname=domain users" | { grep ^gidNumber: || true ; })
124+ if [ -z " ${GIDNUMBER} " ]; then
125+ echo " dn: CN=Domain Users,CN=Users,DC=corp,DC=example,DC=com
126+ changetype: modify
127+ add: gidNumber
128+ gidNumber: 3000000" | ldbmodify -H /var/lib/samba/private/sam.ldb
129+ net cache flush
130+ fi
118131}
119132
120133appStart () {
121- /usr/bin/supervisord
134+ /usr/bin/supervisord > /var/log/supervisor/supervisor.log 2>&1 &
135+ if [ " ${1} " = " check" ]; then
136+ echo " Sleeping 10 before checking on Domain Users of gid 3000000"
137+ sleep 10
138+ fixDomainUsersGroup
139+ fi
140+ while [ ! -f /var/log/supervisor/supervisor.log ]; do
141+ echo " Waiting for log files..."
142+ sleep 1
143+ done
144+ sleep 3
145+ tail -F /var/log/supervisor/* .log
122146}
123147
124148case " $1 " in
0 commit comments