Category: wnp
Features-Core for the WNP-Software
The windows package management I am developing on, has some new core features.
In that case, I developed on the 'feature-core'. Since each package compiles or requÃres features, there is a database driven engine, which checks which packages complies which feature, and what package requires what version of what feature.
Today I finished the tagging features as installed/uninstalled by the FeaturesEngine, so it will be very easy for the InstallerEngine to access that API.
Www-Archives and File-Archives
Today I finally added Www-Archives and File-Archives and the required makeAvailable-functions.
This generally means, that you can share your packages on a webserver somewhere and they'll be downloaded on demand only as soon as you try to install them.
The whole system is using sqlite3 now as database, and runs quite fast in tests.
A Windows Package Management System
I am working on a package system, which is described in this post. It will be often updated.<!--more-->
<h2>Executables</h2>
<h3>pkg.exe</h3>
This comandline tool ist for all stuff about installing/uninstalling or upgrading. It has accesse to the database of installed software packages and can handle dependencies.
It is able to install package files and packages from web/file-archives.
<h4>Parameters</h4>
pkg action filename[|packagename]
- actions:
- install
installs the package - uninstall
removes all of this package, except the settings - remove
deletes everything of the package (also settings!) - upgrade
Upgrades a package - info
Prints general information about the package.
- install
<h2>File-format</h2>
<h3>Package Index</h3>
There is an index file, containing all installed software. Its called database.xml.
Example:
2
3
4
5
6
<wnp>
<packages>
<installed>
<package name="firefox" version="2.0.1" language="deDE" file="firefox-deDE-2.0.1.wnp" />
2
3
4
</installed>
</packages>
</wnp>
<h3>Package .wnp</h3>
A windows package is in general a zip-archive with predefined style.
It always contains the following things:
- index.xml
Contains important data about the package.Packagetypes:- application
Packages which have application type can be installed via the normal view. - library
Those packages are libraries needed for execution of applications, they are only visible in expert mode. - addon
Addons are additions to application and also not visible in normal view.
Example:
1
2
3
4
5
6
7
8
9
10<?xml version="1.0" encoding="utf-8"?>
<wnp>
<package name="azureus" version="1.5.0.6" language="enEN" type="application">
<detail name="description"><![CDATA[Free Bittorrent client made by Aeltis]]></detail>
<complies feature="DotTorrent_Handler" />
<requires feature="java" version="1.5-1.6" />
<instructions name="install" file="install.pii" />
<instructions name="remove" file="remove.pii" />
</package>
</wnp> - application
- instructions (directory)
Instructions for install, remove, uninstall & upgrade - files (directory)
Contains all files used by the installer. (Can be empty, must exist)
<h2>Lua-Functions</h2>
This part describes all functions a install/uninstall script can use. It is very useful to check if a package can be installed or to perform specific actions, needed to install the software.
<h3>Package</h3>
- pkg.export (pkgfilename,exportedfilename) : true/false
Extract a file to a specific filename - pkg.fileexists (pkgfilename) : true/false
Check if a file exists in the archive. - pkg.filecontent (pkgfilename) : string/nil
Return the package file's content
<h3>Filesystem</h3>
- fs.fileexists (filename) : true/false
Check wether a file exists in the filesystem - fs.filecontent (filename) : string/nil
Return a file's content - fs.filesetcontent (filename,content) : true/false
Return a file's content - fs.delete (name) : true/false
Deletes folders and clients, returns if it was possible. - fs.copy (source,target) : true/false
Copys a source to a target location. - fs.chdir (dirname)
Switches to this directory - fs.dir (): string
Returns current directory - fs.setAttributes (filename,attr)
Example:- fs.setAttributes('example.txt',FILE_ATTRIBUTE_READONLY+FILE_ATTRIBUTE_HIDDEN)
Attrvalues:
- FILE_ATTRIBUTE_READONLY
- FILE_ATTRIBUTE_HIDDEN
- FILE_ATTRIBUTE_SYSTEM
- FILE_ATTRIBUTE_ARCHIVE
- FILE_ATTRIBUTE_NORMAL
- FILE_ATTRIBUTE_TEMPORARY
- FILE_ATTRIBUTE_OFFLINE
- fs.fileinfo (filename,key) : string
Possible Values for Key- CompanyName
- FileDescription
- FileVersion
- InternalName
- LegalCopyRight
- LegalTradeMarks
- OriginalFileName
- ProductName
- ProductVersion
- Comments
- SpecialBuild
- PrivateBuild
- fs.fileversion (filename) : string
Returns the version of the file. (Can be different from fs.fileinfo's data) - fs.extractfilepath (filename) : string
Returns path to the file/folder.
<h3>Registry</h3>
- reg.read (rootkey,type,key,var) : string/float/int
Returns content of a registry key. - reg.write(rootkey,type,key,var,value) : true/false
Sets a value of a registry key.types: 'INT','FLOAT,'STRING'
rootkey: 'HKEY_CURRENT_USER','HKEY_LOCAL_MACHINE','HKEY_CLASSES_ROOT','HKEY_CURRENT_CONFIG','HKEY_USERS'
<h3>Operating System</h3>
- os.sleep (seconds)
Script will sleep for the amount of seconds - os.beep ()
Create an audio beep. - os.msg (message)
Show a message as HintBox - os.build () : majorversion , minversion , build
Return the versiondetails about the windows version - os.computer () : string
Returns the computer's name - os.login () : string
Return the loginname of the current user. - os.captureconsole (cmdline) : string
Returns what was returned after cmdline was executed. - pkg_dir
Var which contains path to the pkg-directory, must be used to include the pkg-library. - print_r (element)
Prints a php's print_r-alike information about an element.
<h3>Archives</h3>
- zip.list (zipname) : Table
Returns information in an table, which has following structure:
[Path\..\Folder\Filename] => Table {
{
[packed_size] => 2406
[crc] => E7141879
[size] => 4911
} - zip.extract (zipname,file,todir,overwrite,fullpath)
Exports file (optional, default:all files) from zipname and puts it into todir (optional, default:current directory). If overwrite is set (optional, default: true) all files will be replaced, if they exist. If you set fullpath (optional, default:true) the files are exported with path information saved in the zip archive. Set it to false, if you want to lose the path information. - zip.insert (zipname,filename)
Inserts filename (with path from the current directory) to the zipfile named with zipname. - zip.delete (zipname,filename)
Removes the file from the archive - zip.create (zipname)
Creates an ziparchive. - zip.remove (zipname)
Removes the ziparchive.
<h3>Features</h3>
- feature.add (featurename,version,lang) : Boolean
Adds a new feature (version and lang are optional parameters)
Hint: Only available in detect\*.lua-Scripts - feature.delete (featurename,version,lang) : Boolean
Removes a feature.
Hint: Only available in detect\*.lua-Scripts - feature.detail (featurename,key)
Returns a detail about a feature - feature.setdetail (featurename,key,value)
Sets a detail about a feature
<h2>Doc-Updates:</h2>
- Added docs for feature-functions and some of the filesystem functions 15th March 2007
- Added new functions 14th March 2007
- New functions 5th March 2007
- Update 21 Feb 2007
- Initial Version 14th Feb 2007
New functions
While packing the first packages, I expirienced issues with missing functions.
New functions are:
- sevenzip.insert(zipfile,file/folder)
- fs.dir() : string
- fs.chdir(newdir)
- fs.delete(filename)
- fs.copy(orgfile,newfile
- ps.captureconsole(cmdline) : string
- zip.extract(zipfile,tofile)
- zip.insert(zipfile,folder/file)
- zip.remove(zipfile,folder/file)
- zip.create(zipfile)
- zip.remove(zipfile)
Whole documentation can be found in the documentation.
Win Package System updates
Today I updated the docs for the windows package management system once again, because lots of new functions, which have been added to the pkg.exe.


