initial commit of file from CVS for smeserver-tw-logonscript on Sat Sep 7 16:43:57 AEST 2024
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
return "" unless $smb{LogonScript};
|
||||
$OUT.="root preexec = perl $smb{LogonScript} %u %m %a %I\r\n";
|
||||
}
|
||||
|
@@ -0,0 +1,35 @@
|
||||
{
|
||||
$OUT.="\@echo off\r\n";
|
||||
$OUT.="rem --- Do not modify this file, if for any reason you need to run extra commands use the custom batch files groupname.bat under the custom folder or modify the custom-template under /etc/e-smith/templates-custom/home/e-smith/files/samba/netlogon/netlogon.bat ---\r\n";
|
||||
$OUT.="rem --- general logon script at TechnologyWise for Linux/Samba PDC functionality ---\r\n";
|
||||
|
||||
use esmith::ConfigDB;
|
||||
my $db = esmith::ConfigDB->open_ro();
|
||||
my $smb = $db->get("smb");
|
||||
my $server_name = $smb->prop("ServerName");
|
||||
my $logon_drive = $smb->prop("LogonDrive") || H;
|
||||
my @letters = ('G'..'Y');
|
||||
|
||||
$OUT.= "set SERVER=$server_name\r\n";
|
||||
$OUT.= "set LOGONDRIVE=$logon_drive\r\n\r\n\r\n";
|
||||
|
||||
$OUT.="net time \\\\%SERVER% /set /yes\r\n\r\n\r\n";
|
||||
$OUT.="rem --- general stuff i.e. drive mappings for all users ---\r\n";
|
||||
$OUT.="rem --- %username%.bat has been generated earlier\r\n";
|
||||
$OUT.="rem --- (see smb.conf, netlogon share, preexec statement)\r\n";
|
||||
$OUT.="rem --- to be able to assign drive mappings due to group membership\r\n";
|
||||
|
||||
if(ref(@letters) eq 'ARRAY'){
|
||||
foreach my $letter (@letters){
|
||||
if(($letter ne $logon_drive) and ($letter ne "Z")){
|
||||
$OUT.="if exist $letter: net use $letter: /del /y\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$OUT.="call \\\\%SERVER%\\netlogon\\users\\%USERNAME%.bat\r\n";
|
||||
$OUT.="rem --- Vista does not map the home drive automatically ---\r\n";
|
||||
$OUT.="IF NOT EXIST %LOGONDRIVE% NET USE %LOGONDRIVE%: \\\\%SERVER%\\%USERNAME%\r\n";
|
||||
$OUT.="if exist Z: net use Z: /del /y\r\n";
|
||||
$OUT.="rem --- eof netlogon.bat ---\r\n";
|
||||
}
|
Reference in New Issue
Block a user