Hi.
I just modified wpkg a bit. Now packages can have an attribute notify
which prevents wpkg, if set to "true", to notify the user that it
installs software. Additionally I introduced the value of "always" to
the execute attribute. If set it just acts like execute="once", but does
not check if the package is already installed.
The whole patch can be usefull for configs like this:
<package
id="time"
name="Time Synchonization"
revision="1"
reboot="false"
priority="100"
notify="false"
execute="always">
<install cmd="net time \\timeserver /set /yes" />
</package>
The patch is attached.
K. Dohmann
--- wpkg.js 2005-10-03 16:58:35.563908750 +0200
+++ wpkg-always-and-notify.js 2005-10-05 15:55:17.255735539 +0200
@@ -593,6 +593,7 @@
var packageRev = parseInt(packageNode.getAttribute("revision"));
var executeAttr = packageNode.getAttribute("execute");
+ var notifyAttr = packageNode.getAttribute("notify");
// search for the package in the local settings
var installedPackage = settings.selectSingleNode("[EMAIL PROTECTED]'" +
@@ -603,7 +604,9 @@
if (executeAttr == "once") {
if (null == installedPackage) {
try {
- notifyUserStart();
+ if (notifyAttr != "false") {
+ notifyUserStart();
+ }
executeOnce(packageNode);
} catch (e) {
throw new Error("Installation error while synchronizing " +
@@ -611,11 +614,25 @@
"\n\n" + e.description);
}
}
+ } else if (executeAttr == "always") {
+ // do not look if package is installed
+ try {
+ if (notifyAttr != "false") {
+ notifyUserStart();
+ }
+ executeOnce(packageNode);
+ } catch (e) {
+ throw new Error("Installation error while synchronizing " +
+ "package " + packageName + ", synchronization aborting." +
+ "\n\n" + e.description);
+ }
} else {
// if the package is not installed, install it
if (installedPackage == null) {
try {
- notifyUserStart();
+ if (notifyAttr != "false") {
+ notifyUserStart();
+ }
installPackage(packageNode);
} catch (e) {
throw new Error("Installation error while synchronizing " +
@@ -625,7 +642,9 @@
} else if (parseInt(installedPackage.getAttribute("revision")) <
packageRev) {
try {
- notifyUserStart();
+ if (notifyAttr != "false") {
+ notifyUserStart();
+ }
upgradePackage(installedPackage, packageNode);
} catch (e) {
throw new Error("Upgrade error while synchronizing " +