FORUMS

SDConfigGen - a tool for automatically creating SDAutorun configurations

120 posts
Thanks Meter: 17
 
By AlexVallat, Senior Member on 27th July 2008, 06:25 PM
Post Reply Email Thread
First off, I'd like to thank Sleuth255 for SDAutoRun, and to mousio for his AutoRun tool which provided the inspiration for this project.

SDConfigGen is a command line tool for the PC which inspects a collection of files to be installed, then produces an SDConfig.txt and other associated scripts and provisioning files to allow SDAutoRun to automatically install them.

It differs from mousio's solution in that rather than having SDAutoRun call a MortScript to do all the work, this tool creates an SDConfig.txt to do the majority, only calling scripts for specific functionality when required. Scripts (and therefore MortScript) may not even be required, if nothing being installed needs automation.

Installation
Unzipping the contents of the archive will produce this folder structure:

\
Storage Card\
SDConfig\
Cabs\
Files\
Scripts\
Settings\
Sys\

First things first - to use any of the script-based functionality a copy of the MortScript installation cab file must be placed within the Sys folder. Download MortScript-4.11b7.zip (or newer version) from http://www.sto-helit.de, then extract \cab\MortScript-4.11b7-PPC.cab from it.

Usage
If the name of the Storage Card will be different on your target device, then rename that folder to whatever it will be. Otherwise, just leave it as it is.

Within the sub-folders of SDConfig, add the files you want to be installed.

Cabs:
Any .cab files in this folder will be installed. If the installation of a .cab file requires user interaction (to confirm a license window, for example), then create a .mscr script file of the same name containing instructions to be executed while the cab file is being installed.

For example, if you need to install a cab file: "eWallet-PocketPC-Install.cab",
create a file called "eWallet-PocketPC-Install.mscr" too. This file contains
MortScript to be run while the cab installer is being run, for example:

Code:
windowTitle = "Software License Agreement"

WaitFor(windowTitle, 60)
SendLeftSoft(windowTitle)
Note that you don't need to worry about actually installing the cab, or waiting for installation to finish - just write the automation code itself.

The SDAutoRun UI will be hidden while an interactive cab is being installed like this, and a MortScript status window shown instead. The device will be responsive to user input, so if any non-automatable interaction is required, that can be done manually.

Files:
After the cab files have been installed, all files in this folder will be copied directly to the root folder. To copy files to sub-folders, place them in sub-folders of this folder. For example, to copy files to the Windows folder, create a Windows folder here and place the files within it.

Standard (English) folder names will automatically be replaced by variables, so files in the "Files\Program Files" folder here will be copied to %CE1% folder by SDAutoRun.

The file copy operation is actually performed by generating a CopyFiles.xml provisioning file in the Sys folder, and it is this that goes in the SDConfig.txt file. This method was chosen as it avoids the path length limit of copying directly in SDConfig.txt, and allows for the %CEn% variable subsitution scheme.

Settings:
After the files have been copied, any settings in this folder will be applied. Settings may either be .xml provisioning files (which are added directly to SDConfig.txt), or registry data in .reg, .rgu or .cereg files. Registry data files will be automatically converted to xml provisioning files within the Sys folder, which are then added to SDConfig.txt.

Scripts:
After the settings have been applied, any .mscr scripts within this folder will be executed. SDConfigGen will generate instructions in SDConfig.txt to automatically handle copying them to the \Temp folder and renaming them to replace spaces by underscores before execution if required.

Note that the device will not be interactive at this point, so don't write scripts that require user interaction.

Sys:
Apart from placing a copy of MortScript-4.11b7-PPC.cab in here, you shouldn't touch the contents of this folder; they will be automatically cleaned out and generated by the SDConfigGen tool.

Notes
I've provided RegToXml as a standalone .exe file so that registry data files can be manually converted to .xml provisioning files, if required. This is not generally necessary, though, as it will occur automatically as part of the SDConfigGen process.

Due to limitations of SDAutoRun, during installation some files need to be copied to the \Temp folder on the device before execution. A TempCleanup.xml provisioning file is generated in the Sys folder by SDConfigGen which is the last thing executed by SDConfig.txt. It should remove any temporary files that were placed in the \Temp folder, but will not remove the folder itself, or any other files within it.

SDAutoRun also requires that SDConfig.txt be ASCII, which means that if any files contain characters outside that range (such as accented characters), they can not be directly referenced. SDConfigGen will automatically detect this, and generate provisioning XML files to transparently rename the files before processing them, then back again afterwards.

The last statement in the SDConfig.txt is the RST: Reset statment, to reset the device.

The only part of the file structure that can be changed is the name of the "Storage Card" folder - the other folders cannot be renamed or moved. By default, when the SDConfigGen tool is run, it works with the first sub folder under the folder the .exe file is placed. To override this behaviour, pass the folder path to SDConfigGen.exe as a command line argument.

Cabs, settings and scripts are executed in alphabetical order, grouped by subfolder. Subfolders will be executed first, so for example the contents of Cabs\Prerequisites\ would be installed before the files directly in Cabs\ (but after files in Cabs\A\). All interactive cabs are executed first, followed by non-interactive ones.

All generated files (except SDConfig.txt) are in Unicode UTF-16 encoding.

To have SDConfigGen create a log file of the generation process, use the SDConfigGenWithLog.bat file included in the archive. It will create a results.log file containing the messages that would normally be output to the console.

This is still an early version, so there will probably be bugs with it. I've used it successfully for setting up my own device several times now, but I can't make any guarantees. Please do post any bug reports or suggestions here though!

Alex

Updates

0.6:
  • All output files are now in UTF-16 encoding, with the exception of SDConfig.txt, which is in ASCII.
  • If files referenced by SDConfig.txt have names containing non-ASCII characters, provisioning files to automatically rename them before they are accessed, and to restore them afterwards will be generated.
  • Subfolders are now supported in the Cabs, Settings and Scripts folders. Files within subfolders will be processed first, in alphabetical order of subfolder name.
  • File folder variable substition made case insensitive
  • Added SDConfigGenWithLog.bat file for easy logging of output to a log file
0.5.1:
  • Removed .svn files from the file structure (oops!)
0.5:
  • Made warning message on skipping registry files less confusing
  • RegToXml: Now supports empty values for String, MultiString and Binary values
  • RegToXml: Made ,ore robust to invalid data - if a value contains invalid data, only that value is skipped.
  • RegToXml: The line number is now reported with any error or warning message.
  • RegToXml: Whitespace allowed to surround the = in value lines.
0.4:
  • RegToXml: Fixed nesting bug with registry key deletion conversion
  • RegToXml: Now supports comments (lines starting with ; )
0.3:
  • RegToXml now assumes that registry files without Unicode BOM's are encoded in the system default ANSI codepage, rather than UTF-8 (this means that if your registry file is UTF-8, it must contain a Byte Order Mark to be read correctly)
0.2:
  • Files are now installed in alphabetical order by file name (within their own group). For example, first interactive cabs A-Z, then non-interactive cabs A-Z. This allows control over installing cabs that require others to be installed before or after them.

.NET Framework (required)
Attached Files
File Type: zip SDConfigGen.0.6.zip - [Click for QR Code] (17.8 KB, 1910 views)
29th July 2008, 09:51 AM |#2  
Noonski's Avatar
Inactive Recognized Developer / Moderator Emeritus
Flag Amsterdam
Thanks Meter: 148
 
Donate to Me
More
Lookin Mighty Fine Siuer.

Not in the Testing Time yet.

But does the scripts folder eventually combine the scripts into one?

(lazy Bum At Work, Not Able to test it)
29th July 2008, 10:21 AM |#3  
OP Senior Member
Thanks Meter: 17
 
More
No, the scripts in the scripts folder are not combined into a single script, they are all executed separately. Would there be some benefit to trying to combine them into a single script before execution?
29th July 2008, 04:22 PM |#4  
Noonski's Avatar
Inactive Recognized Developer / Moderator Emeritus
Flag Amsterdam
Thanks Meter: 148
 
Donate to Me
More
Quote:
Originally Posted by AlexVallat

No, the scripts in the scripts folder are not combined into a single script, they are all executed separately. Would there be some benefit to trying to combine them into a single script before execution?

No, you are absolutely right there is now good reason for it.

It's better to have them seprated, makes finding **** Ups easier.

Don't know what i was thinking or why..
30th July 2008, 10:06 PM |#5  
Senior Member
Flag Paris
Thanks Meter: 364
 
More
AlexVallat,

Thanks for your job, you soft is amazingly simple which is a great pro compared to SASHIMI for instance.

So yhis afternoon I started to put all my files in the appropriate folders and when I launch SDConfigGen with the folder path I don't get in the config.txt file \Storage Card\ before the files to execute but the path I gave as parameter. I think transforming the path given into \Storage Card\ could help.

One other point, as a poor French guy your RegToXml converter does not handle all the French extended character set such as é, à, ... Could you make it support this characters.

Anyway for now it is fully usable but requires SDConfig.txt file edition before launching the whole process. Tomorrow it will be hands-on time as I plan to upgrade my Polaris ROM so more news to come regarding SDCofingGen usage.

The_Steph
31st July 2008, 01:12 AM |#6  
Noonski's Avatar
Inactive Recognized Developer / Moderator Emeritus
Flag Amsterdam
Thanks Meter: 148
 
Donate to Me
More
Quote:
Originally Posted by The_Steph

AlexVallat,

Thanks for your job, you soft is amazingly simple which is a great pro compared to SASHIMI for instance.

So yhis afternoon I started to put all my files in the appropriate folders and when I launch SDConfigGen with the folder path I don't get in the config.txt file \Storage Card\ before the files to execute but the path I gave as parameter. I think transforming the path given into \Storage Card\ could help.

One other point, as a poor French guy your RegToXml converter does not handle all the French extended character set such as é, à, ... Could you make it support this characters.

Anyway for now it is fully usable but requires SDConfig.txt file edition before launching the whole process. Tomorrow it will be hands-on time as I plan to upgrade my Polaris ROM so more news to come regarding SDCofingGen usage.

The_Steph

Hm my pall had the same thing but changing to Unicode seemed to solve his XML issue. NOt sure if this is the same but worth the try.
31st July 2008, 07:43 AM |#7  
gtxaspec's Avatar
Senior Member
Thanks Meter: 550
 
More
Great work alex!

Question:

Anyway to verify the syntax of the provisioning XML files?

Any tools out there that can create these files or verify them? I think a tool like this would be great.

NEVERMIND! I just saw your reply in the reg2xml converter thread! THANKS!
31st July 2008, 08:00 AM |#8  
OP Senior Member
Thanks Meter: 17
 
More
The_Steph: Thanks for your comments!

The idea with the path is that the name of the folder is used to control the name of the Storage Card on the device. So if you name your folder Storage Card, that's what goes in the SDConfig.txt. If, on your device, it has a different name (due to language changes, or whatever), then you need to rename the folder appropriately.

Thanks for the bug report about accented characters in RegToXml. I will fix that and post an updated version soon.

gtxaspec: I could verify that the files were valid XML, but the more useful check that they contain valid provisioning instructions is beyond the scope of this project. Not least because the documentation describing what are valid instructions is confusing and can be inaccurate. With anything other than the file and registry providers, it usually ends up being a case of trial and error. With the file and registry providers, using the auto-generation capabilities of SDConfigGen will avoid most surprises.

Alex
31st July 2008, 07:16 PM |#9  
OP Senior Member
Thanks Meter: 17
 
More
Version 0.3 released
I've just updated the first post to release version 0.3. This should address the accented characters issue raised by The_Steph, however it does mean that if your registry file is UTF-8 encoded, it must include Byte Order Marks to indicate this. Otherwise, it will be assumed to be encoded in the system default code page.

I've also added a feature that files are now installed in alphabetical order (within each group). If you need to make sure that certain cabs are installed before others, this can now be done by renaming them, usually by including a numeric prefix.

Alex
1st August 2008, 08:53 AM |#10  
Member
Thanks Meter: 0
 
More
reg2xml bugs
Hi Alex,

Converting everything to xml and using standard provisioning is an interesting approach!

Only obviously reg2xml has got some problems still with .reg files containing certain characters:

I've attached you a sample file which is not converted correctly at three points, each with a different error cause.

- Comments (Lines beginning with ";") in the .reg files are sometimes (not in every case, could not see what the trigger is) leading to an aborted conversion.

- Some characters like the arrow character (ASCII 27/1BHex) are also a problem.

Maybe the attached file helps in finding the bug.

BTW: Do you also have a tool that is converting just the other way around: From XML to reg indstead of from reg to XML?
Sometimes I need to have a .reg file instead of an .XML. And importing the XML and then trying to find all registry entries to export it back to a .reg can be a very tedious thing when the imports are not all together in one registry branch.

Thanks!
Attached Files
File Type: zip reg2xmlbugs.zip - [Click for QR Code] (368 Bytes, 96 views)
1st August 2008, 09:28 AM |#11  
OP Senior Member
Thanks Meter: 17
 
More
Thanks for the bug report, asango. Yes, I forgot about comments, I'll fix that and release an update soon. I'm looking into what the best way to handle control characters like 0x1B is (which is 'Escape', according to the ASCII chart I'm looking at). Obviously crashing is not an acceptable behaviour, so I'll have some sort of fix for it.

I don't have a XmlToReg tool, but it sounds like a good idea - I'll probably write one over the weekend.

Alex
Post Reply Subscribe to Thread

Tags
sashimi alternative, user customization

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes