To create an user and set their avatar, we need to create 2 new files, that will be used in older Windows. (http://bugzilla-attachments.gnome.org/attachment.cgi?id=214681) Was discussed in the ML about don't create this files and put all information in only one script, separating each file in one template, as suggested in: https://www.redhat.com/archives/virt-tools-list/2012-June/msg00078.html In the implementation time, a limitation occurred, and I realized that I was doing the things in the wrong way. (if there is 1 script for all the files and _generate*() gives you 1 file as output, how we could generate different files from the unique file?) So, I would like to go back with the first implementation, creating different files for each file used by windows xp (e. g.) --- data/install-scripts/Makefile.am | 2 + data/install-scripts/windows-cmd.xml | 28 ++++++++++++ data/install-scripts/windows-reg.xml | 27 ++++++++++++ data/install-scripts/windows-sif.xml | 82 +++++++++++++++++++++++++++++++++++- data/oses/windows.xml | 20 +++++++-- tools/osinfo-install-script.c | 46 +++++++++----------- 6 files changed, 175 insertions(+), 30 deletions(-) create mode 100644 data/install-scripts/windows-cmd.xml create mode 100644 data/install-scripts/windows-reg.xml diff --git a/data/install-scripts/Makefile.am b/data/install-scripts/Makefile.am index 002a884..cb24e09 100644 --- a/data/install-scripts/Makefile.am +++ b/data/install-scripts/Makefile.am @@ -3,6 +3,8 @@ databasedir = $(pkgdatadir)/db/install-scripts/ database_DATA = \ fedora.xml \ windows-sif.xml \ + windows-cmd.xml \ + windows-reg.xml \ windows-unattend.xml \ $(NULL) diff --git a/data/install-scripts/windows-cmd.xml b/data/install-scripts/windows-cmd.xml new file mode 100644 index 0000000..28a9c0d --- /dev/null +++ b/data/install-scripts/windows-cmd.xml @@ -0,0 +1,28 @@ +<libosinfo version="0.0.1"> + <!-- DESKTOP PROFILE --> + <install-script id='http://microsoft.com/windows/cmd/desktop'> + <profile>desktop</profile> + <config> + <param name="admin-password" policy="optional"/> + <param name="user-realname" policy="required"/> + </config> + <template filename="windows.cmd"> + <xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output method="text"/> + + <xsl:template match="/install-script-config"> +sc config TlntSvr start= auto +net user <xsl:value-of select="config/user-realname"/> <xsl:value-of select="config/admin-password"/> /add /passwordreq:no +net localgroup administrators <xsl:value-of select="config/user-realname"/> /add +net accounts /maxpwage:unlimited +copy a:\<xsl:value-of select="config/user-realname"/>.bmp "c:\Documents and Settings\All Users\Application Data\Microsoft\User Account Pictures" +REGEDIT /S a:\windows.reg +EXIT + </xsl:template> + </xsl:stylesheet> + </template> + </install-script> +</libosinfo> diff --git a/data/install-scripts/windows-reg.xml b/data/install-scripts/windows-reg.xml new file mode 100644 index 0000000..afc285d --- /dev/null +++ b/data/install-scripts/windows-reg.xml @@ -0,0 +1,27 @@ +<libosinfo version="0.0.1"> + <!-- DESKTOP PROFILE --> + <install-script id='http://microsoft.com/windows/reg/desktop'> + <profile>desktop</profile> + <config> + <param name="admin-password" policy="optional"/> + <param name="user-realname" policy="required"/> + </config> + <template filename="windows.reg"> + <xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output method="text"/> + + <xsl:template match="/install-script-config"> +Windows Registry Editor Version 5.00. + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] +"DefaultUserName"="<xsl:value-of select="config/user-realname"/>" +"DefaultPassword"="<xsl:value-of select="config/admin-password"/>" +"AutoAdminLogon"="1" + </xsl:template> + </xsl:stylesheet> + </template> + </install-script> +</libosinfo> diff --git a/data/install-scripts/windows-sif.xml b/data/install-scripts/windows-sif.xml index 77fc2c5..234bb8c 100644 --- a/data/install-scripts/windows-sif.xml +++ b/data/install-scripts/windows-sif.xml @@ -1,5 +1,6 @@ <libosinfo version="0.0.1"> - <install-script id='http://microsoft.com/windows/sif'> + <!-- JEOS PROFILE --> + <install-script id='http://microsoft.com/windows/sif/jeos'> <profile>jeos</profile> <config> <param name="admin-password" policy="optional"/> @@ -61,4 +62,83 @@ </xsl:stylesheet> </template> </install-script> + + <!-- DESKTOP PROFILE --> + <install-script id='http://microsoft.com/windows/sif/desktop'> + <profile>desktop</profile> + <config> + <param name="admin-password" policy="optional"/> + <param name="reg-product-key" policy="required"/> + <param name="user-realname" policy="required"/> + </config> + <template filename="windows.sif"> + <xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output method="text"/> + + <xsl:template match="/install-script-config"> +;SetupMgrTag +[Data] + AutoPartition=1 + MsDosInitiated="0" + UnattendedInstall="Yes" + +[Unattended] + UnattendMode=FullUnattended + OemSkipEula=Yes + OemPreinstall=No + TargetPath=\WINDOWS + Repartition=Yes + WaitForReboot="No" + UnattendSwitch="Yes" + +[GuiUnattended] + AdminPassword=<xsl:value-of select="config/admin-password"/> + EncryptedAdminPassword=NO + AutoLogon=Yes + AutoLogonCount=1 + OEMSkipRegional=1 + TimeZone=35 + OemSkipWelcome=1 + +[UserData] + ProductKey=<xsl:value-of select="config/reg-productkey"/> + FullName="<xsl:value-of select="config/user-realname"/>" + OrgName="" + ComputerName="<xsl:value-of select="config/hostname"/>" + +[Display] + BitsPerPel=16 + Xresolution=640 + YResolution=480 + Vrefresh=60 + +[LicenseFilePrintData] + AutoMode=PerServer + AutoUsers=5 + +[RegionalSettings] + LanguageGroup=1 + +[Identification] + JoinWorkgroup=WORKGROUP + +[Networking] + InstallDefaultComponents=Yes + +[SetupParams] + UserExecute = "a:\windows.cmd" + +[WindowsFirewall] + Profiles = WindowsFirewall.TurnOffFirewall + +[WindowsFirewall.TurnOffFirewall] + Mode = 0 + </xsl:template> + </xsl:stylesheet> + </template> + </install-script> + </libosinfo> diff --git a/data/oses/windows.xml b/data/oses/windows.xml index c06f8a2..f86d1c4 100644 --- a/data/oses/windows.xml +++ b/data/oses/windows.xml @@ -308,7 +308,10 @@ </resources> <installer> - <script id='http://microsoft.com/windows/sif'/> + <script id='http://microsoft.com/windows/sif/jeos'/> + <script id='http://microsoft.com/windows/sif/desktop'/> + <script id='http://microsoft.com/windows/reg/desktop'/> + <script id='http://microsoft.com/windows/cmd/desktop'/> </installer> </os> @@ -365,7 +368,10 @@ </resources> <installer> - <script id='http://microsoft.com/windows/sif'/> + <script id='http://microsoft.com/windows/sif/jeos'/> + <script id='http://microsoft.com/windows/sif/desktop'/> + <script id='http://microsoft.com/windows/reg/desktop'/> + <script id='http://microsoft.com/windows/cmd/desktop'/> </installer> </os> @@ -430,7 +436,10 @@ </resources> <installer> - <script id='http://microsoft.com/windows/sif'/> + <script id='http://microsoft.com/windows/sif/jeos'/> + <script id='http://microsoft.com/windows/sif/desktop'/> + <script id='http://microsoft.com/windows/reg/desktop'/> + <script id='http://microsoft.com/windows/cmd/desktop'/> </installer> </os> @@ -489,7 +498,10 @@ </resources> <installer> - <script id='http://microsoft.com/windows/sif'/> + <script id='http://microsoft.com/windows/sif/jeos'/> + <script id='http://microsoft.com/windows/sif/desktop'/> + <script id='http://microsoft.com/windows/reg/desktop'/> + <script id='http://microsoft.com/windows/cmd/desktop'/> </installer> </os> diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c index b536153..a1316c5 100644 --- a/tools/osinfo-install-script.c +++ b/tools/osinfo-install-script.c @@ -111,10 +111,9 @@ static gboolean generate_script(OsinfoOs *os) OsinfoInstallScriptList *scripts = osinfo_os_get_install_script_list(os); OsinfoInstallScriptList *profile_scripts; OsinfoFilter *filter; - OsinfoInstallScript *script; + GList *l, *tmp; gboolean ret = FALSE; GError *error = NULL; - GFile *dir = g_file_new_for_commandline_arg(output_dir ? output_dir : "."); filter = osinfo_filter_new(); osinfo_filter_add_constraint(filter, @@ -123,33 +122,30 @@ static gboolean generate_script(OsinfoOs *os) OSINFO_INSTALL_SCRIPT_PROFILE_JEOS); profile_scripts = osinfo_install_scriptlist_new_filtered(scripts, filter); - - if (osinfo_list_get_length(OSINFO_LIST(profile_scripts)) != 1) { - g_printerr("Cannot find any install script for profile '%s'\n", - profile ? profile : - OSINFO_INSTALL_SCRIPT_PROFILE_JEOS); - goto cleanup; - } - - script = OSINFO_INSTALL_SCRIPT(osinfo_list_get_nth(OSINFO_LIST(profile_scripts), 0)); - - if (prefix) - osinfo_install_script_set_output_prefix(script, prefix); - - if (osinfo_install_script_generate_output(script, - os, - config, - dir, - NULL, - &error) == NULL) { - g_printerr("Unable to generate install script: %s\n", - error ? error->message : "unknown"); - goto cleanup; + l = osinfo_list_get_elements(OSINFO_LIST(profile_scripts)); + for (tmp = l; tmp != NULL; tmp = tmp->next) { + OsinfoInstallScript *script = tmp->data; + GFile *dir = g_file_new_for_commandline_arg(output_dir ? + output_dir : "."); + + if (prefix) + osinfo_install_script_set_output_prefix(script, prefix); + + if (osinfo_install_script_generate_output(script, + os, + config, + dir, + NULL, + &error) == NULL) { + g_printerr("Unable to generate install script: %s\n", + error ? error->message : "unknown"); + goto cleanup; + } } - ret = TRUE; cleanup: + g_list_free(l); g_object_unref(scripts); g_object_unref(filter); g_object_unref(profile_scripts); -- 1.7.11.2