Hi,

I've added two patches (note: not against latest release) to change the way
unattended locates the scripts.
If you apply the patches, unattended tries to locate the files (scripts) in
the site directory first instead of the scripts.

This has two pleasant effects:
1) You don't have to add your own scripts to the scripts directory. All site
specific files can stay in the site directory.
2) Files in site override files in scripts with the same name. Scripts
you've changed (and placed in site) don't get overwritten with a new version
of unattended.

The PATH change in todo.pl is very simple. The change to install.pl is a
copy/paste affair, so not the best code.
Maybe someone can clean that up to avoid the duplicate code (add a
subroutine or something)
I've tested it and it seems OK to me, but to be sure it needs more than one
tester... Anybody??

Let me know if you think this should make it to the cvs.

Greetings,
Niels

BTW, when is the next version going to be released?

--- todo.pl.bak 2004-10-17 23:51:06.000000000 +0200
+++ todo.pl     2005-07-05 19:49:30.375000000 +0200
@@ -452,7 +452,7 @@
     $ENV{'_IN_TODO'} = 'yes';

     # Add "bin" and "scripts" directories to PATH.
-    $ENV{'PATH'} = "$z\\bin;$z\\scripts;$ENV{'PATH'}";
+    $ENV{'PATH'} = "$z\\bin;$z\\site;$z\\scripts;$ENV{'PATH'}";

     # Set handy "WINVER" environment variable.
     $ENV{'WINVER'} = get_windows_version ();

--- install.pl.bak      2005-03-27 11:20:38.000000000 +0200
+++ install.pl  2005-07-06 17:26:18.000000000 +0200
@@ -898,6 +898,31 @@
             close FILE
                 or die "Unable to close $full_path: $^E";
         }
+        $script_dir = "$dos_zdrv\\site";
+        opendir SCRIPTS, dos_to_host ($script_dir)
+            or die "Unable to opendir $script_dir: $^E";
+        while (my $ent = readdir SCRIPTS) {
+            # Skip special files
+            $ent eq '.' || $ent eq '..'
+                and next;
+            # Skip non-bat files
+            $ent =~ /\.bat\z/i
+                or next;
+            # Skip non-ordinary filess
+            my $full_path = $file_spec->catfile ($script_dir, $ent);
+            -f dos_to_host ($full_path)
+                or next;
+            open FILE, dos_to_host ($full_path)
+                or die "Unable to open $full_path for reading: $^E";
+            $is_linux
+                and binmode FILE, ':crlf';
+            my $line = <FILE>;
+            chomp $line;
+            $_batfile_first_lines->{$ent} = $line;
+            close FILE
+                or die "Unable to close $full_path: $^E";
+        }
+
         closedir SCRIPTS
             or die "Unable to closedir $script_dir: $^E";
     }



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
unattended-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to