refs #1312 fix contents of postconf.cmd
							parent
							
								
									e43a126557
								
							
						
					
					
						commit
						a68556e8c9
					
				|  | @ -522,13 +522,11 @@ def ogIsLocked(disk, par): | |||
| def ogIsPartitionLocked(disk, par): | ||||
|     DISK = DiskLib.ogDiskToDev(disk) | ||||
|     PART = DiskLib.ogDiskToDev(disk, par) | ||||
|     print (f'nati: ogIsPartitionLocked: DISK ({DISK}) PART ({PART})') | ||||
|     if not PART: return | ||||
| 
 | ||||
|     LOCKDISK = f"/var/lock/lock{DISK.replace('/', '-')}" | ||||
|     LOCKPART = f"/var/lock/lock{PART.replace('/', '-')}" | ||||
|     rc = os.path.isfile(LOCKDISK) or os.path.isfile(LOCKPART) | ||||
|     print (f'nati: ogIsPartitionLocked: LOCKDISK ({LOCKDISK}) LOCKPART ({LOCKPART}) rc ({rc})') | ||||
|     return rc | ||||
| 
 | ||||
| #/** | ||||
|  |  | |||
|  | @ -63,19 +63,20 @@ def ogInstallFirstBoot (disk, par, cmdfile): | |||
|         SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_NOTFOUND, f'{mntdir}/windows/system32') | ||||
|         return | ||||
|     full_cmdfile = f'{cmddir}/{cmdfile}' | ||||
|     bn = os.path.basename (full_cmdfile) | ||||
| 
 | ||||
|     # Creamos el archivo cmd y creamos un par de comandos para que una vez acabe la | ||||
|     # postconfiguracion resetee el mini setup, sino lo haria en cada arranque. | ||||
|     with open (full_cmdfile, 'w') as fd: | ||||
|         fd.write (r'REG ADD HKLM\System\Setup /v SystemSetupInProgress /t REG_DWORD /d 0 /f\n') | ||||
|         fd.write (r'REG ADD HKLM\System\Setup /v CmdLine /t REG_SZ /d "" /f\n') | ||||
|         fd.write (r'REG ADD HKLM\System\Setup /v SystemSetupInProgress /t REG_DWORD /d 0 /f' + '\n') | ||||
|         fd.write (r'REG ADD HKLM\System\Setup /v CmdLine /t REG_SZ /d "" /f' + '\n') | ||||
| 
 | ||||
|     # Crear los valores de registro necesarios para que se haga la ejecución del .cmd al aranque. | ||||
|     RegistryLib.ogSetRegistryValue     (mntdir, 'SYSTEM', r'\Setup\SystemSetupInProgress', 1) | ||||
|     RegistryLib.ogSetRegistryValue     (mntdir, 'SYSTEM', r'\Setup\SetupType', 4) | ||||
|     #RegistryLib.ogDeleteRegistryValue (mntdir, 'SYSTEM', r'\Setup\CmdLine') | ||||
|     RegistryLib.ogAddRegistryValue     (mntdir, 'SYSTEM', r'\Setup\CmdLine') | ||||
|     RegistryLib.ogSetRegistryValue     (mntdir, 'SYSTEM', r'\Setup\CmdLine', f'cmd.exe /c $(basename {full_cmdfile})') | ||||
|     RegistryLib.ogSetRegistryValue     (mntdir, 'SYSTEM', r'\Setup\CmdLine', f'cmd.exe /c {bn}') | ||||
| 
 | ||||
| 
 | ||||
| #/** | ||||
|  | @ -106,10 +107,10 @@ def ogInstallRunonce (disk, par, cmdfile, user, pwd, autologin, userauto=None, p | |||
|     if not autologin: | ||||
|         # Si no queremos hacer autologin despues de la postconfiguracion lo indicamos en las claves de registro | ||||
|         with open (full_cmdfile, 'w') as fd: | ||||
|             fd.write (r'DEL C:\ogboot.*\n') | ||||
|             fd.write (r'REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f\n') | ||||
|             fd.write (r'REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "" /f\n') | ||||
|             fd.write (r'REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f\n') | ||||
|             fd.write (r'DEL C:\ogboot.*' + '\n') | ||||
|             fd.write (r'REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f' + '\n') | ||||
|             fd.write (r'REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "" /f' + '\n') | ||||
|             fd.write (r'REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f' + '\n') | ||||
|     else: | ||||
|         # Si queremos hacer autologin despues de la postconfiguracion introducimos la informacion en las claves de registro | ||||
|         with open (full_cmdfile, 'w') as fd: | ||||
|  | @ -119,7 +120,7 @@ def ogInstallRunonce (disk, par, cmdfile, user, pwd, autologin, userauto=None, p | |||
|             fd.write (fr'REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "{pwdauto}" /f' + '\n') | ||||
|     #Creamos las claves de registro necesarias para que meter el cmd en el runonce del usuario y este haga autologin | ||||
|     RegistryLib.ogAddRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows\CurrentVersion\RunOnce\PostConfiguracion') | ||||
|     RegistryLib.ogSetRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows\CurrentVersion\RunOnce\PostConfiguracion', rf'C:\windows\system32\{full_cmdfile}') | ||||
|     RegistryLib.ogSetRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows\CurrentVersion\RunOnce\PostConfiguracion', rf'C:\windows\system32\{cmdfile}') | ||||
|     RegistryLib.ogAddRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon') | ||||
|     RegistryLib.ogSetRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon', 1) | ||||
|     RegistryLib.ogAddRegistryValue    (mountpoint, 'software', r'\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName') | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue