[wpkg-users] Best practice for Copying a folder and the WPKG Check that its correct

Dave Evans dave.evans at goodness.co.uk
Thu Aug 21 09:59:31 CEST 2014


ah I see yes, but there's something else, which I think is relevant 
here.  I too am learning how this stuff works, and this is based on my 
understanding so far, so with that caveat aside....

wpkg also keeps it's own list of what has been installed (in 
%windir%\system32\wpkg.xml) so I think that if the robocopy fails in any 
way, then the package will fail & not yet be marked as installed.
in this case wpkg will try to run it again next time, regardless of the 
check condition encountered.
and so hopefully the robocopy will work OK the second time and 
everything will be fine.

the install commands *are* processed in the order given, so Adam's 
suggestion will work robustly for you, and presumably you could make the 
check file to be
foo.%version%.finished for added flexibility, in case you need to update 
the files in the folder.

another way of course is to just make the package run as
execute="always"
like the sample "time" package in the wpkg distribution, & let robocopy 
just synch the folders every run, but that would depend on your scenario 
as to whether that was a good idea (wasteful of bandwidth?)

enjoy :-)

--------------------------------------------------------------
Dave

On 21/08/2014 02:00, Patrick CAHILL wrote:
> Thanks Dave,
> while the exit codes you provided will work fine for the post-install 
> check, my issue was how to check for completeness the next time WPKG 
> runs when a previous attempt failed part way through.
> Since the file copy wont be rolled back, the initial <Check> command 
> would have to look at either all the files or something that was 
> guaranteed to be copied after the initial install.
> If Adams suggestion works in that the install commands are always 
> processed in the given order and always one at a time, then I should 
> be able to use it to copy a check file and work off that.
> I will use your exit codes however for the install/upgrade commands as 
> I was currently only using the 1 return.
> --
> thanks
> -Pat Cahill
> M: Berserker Street SS
> T: Glenmore SS
> W: Berserker Street SS
> T: Glenmore SS
> F: Parkhurst SS
> On 21/08/14, *Dave Evans *<dave.evans at goodness.co.uk> wrote:
>> you could just rely on the exit code from Robocopy
>> http://ss64.com/nt/robocopy-exit.html
>>
>> if the exit code is 2 or less, then everything is fine
>> up to 8 some odd things happened
>> above that something went wrong
>> (it's slightly more complicated than that)
>>
>> so you could write
>>
>>  <install cmd="Source_folder Destination_folder [files_to_copy] 
>> [options]" >
>>             <exit code="0" />
>>             <exit code="1" />
>>             <exit code="2" />
>>  </install >
>>
>> and that will work
>> if it returns a code >= 3, then as Adam mentions, it will fail the 
>> script, and then it will try again the next time
>> if it returns a code <= 2, then the folders are synchronised
>>
>> --------------------------------------------------------------
>> Dave
>>
>> On 20/08/2014 10:05, Adam Thorn wrote:
>> >One option would be to have
>> >
>> ><install cmd='robocopy SOURCE DESTINATION' />
>> ><install cmd='robocopy foo.finished DESTINATION '/>
>> >
>> >and then check for the existence of (or the size of, or modification 
>> time of) foo.finished in the destination folder. If the "main" 
>> robocopy in the first <install> is interrupted, it'll resume from 
>> where it left off the next time wpkg runs. Only after that robocopy 
>> has finished will you then copy foo.finished, at which point you can 
>> be confident that everything has copied.
>> >
>> >Adam
>> >
>> >On 20/08/2014 04:48, Patrick CAHILL wrote:
>> >>Hi All,
>> >>I want to make sure I am doing this in the best possible way.
>> >>I have a few packages that are just folder copying.
>> >>They have either just documents or shortcuts, nothing thats actually
>> >>installed or must be present for the entire package to be considered
>> >>complete.
>> >>I am unsure of the best WPKG Check to make sure the entire folder
>> >>structure has come down.
>> >>Things I am unsure of:
>> >>If RoboCopy doesnt copy the entire folder, I dont think that 
>> RoboCopy or
>> >>WPKG rolls back the failed copy and deletes those files/folders which
>> >>leads me to...
>> >>I cant use Check File exists since each file is independant of the
>> >>others and the presence of a particular one doesnt mean the entire
>> >>package is there (well I could but I would have to write a check for
>> >>each file in the folder bleh)
>> >>I cant use Check Folder exists because the folder contents might not be
>> >>completely copied.
>> >>
>> >>Several options I have seen that might work in a Check Execute:
>> >>Windows command "COMP", will compare two folders but will not recurse
>> >>subdirectories which will make the command file more complex.
>> >>RoboCopy /e /l /log:, will recurse but the log file will have to be 
>> parsed
>> >>Does anyone know of the best way to do this?
>> >>--
>> >>thanks
>> >>-Pat Cahill
>> >>M: Berserker Street SS
>> >>T: Glenmore SS
>> >>W: Berserker Street SS
>> >>T: Glenmore SS
>> >>F: Parkhurst SS
>> >>
>> >>
>> >>------------------------------------------------------------------------- 
>>
>> >>SSLrack gives free SSL certificates for open source projects (and 
>> cheap for everyone else)!
>> >>http://www.sslrack.com/promo/free-ssl-certificates-open-source-projects
>> >>
>> >>------------------------------------------------------------------------- 
>>
>> >>wpkg-users mailing list archives >> 
>> http://lists.wpkg.org/pipermail/wpkg-users/
>> >>_______________________________________________
>> >>wpkg-users mailing list
>> >>wpkg-users at lists.wpkg.org
>> >>http://lists.wpkg.org/mailman/listinfo/wpkg-users
>> >>
>> >
>> >-------------------------------------------------------------------------
>> >SSLrack gives free SSL certificates for open source projects (and 
>> cheap for everyone else)!
>> >http://www.sslrack.com/promo/free-ssl-certificates-open-source-projects
>> >
>> >-------------------------------------------------------------------------
>> >wpkg-users mailing list archives >> 
>> http://lists.wpkg.org/pipermail/wpkg-users/
>> >_______________________________________________
>> >wpkg-users mailing list
>> >wpkg-users at lists.wpkg.org
>> >http://lists.wpkg.org/mailman/listinfo/wpkg-users
>>
>> -------------------------------------------------------------------------
>> SSLrack gives free SSL certificates for open source projects (and 
>> cheap for everyone else)!
>> http://www.sslrack.com/promo/free-ssl-certificates-open-source-projects
>>
>> -------------------------------------------------------------------------
>> wpkg-users mailing list archives >> 
>> http://lists.wpkg.org/pipermail/wpkg-users/
>> _______________________________________________
>> wpkg-users mailing list
>> wpkg-users at lists.wpkg.org
>> http://lists.wpkg.org/mailman/listinfo/wpkg-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20140821/2e991506/attachment-0003.html>


More information about the wpkg-users mailing list