4 Replies Latest reply on Mar 10, 2011 10:52 AM by Eyal NameToUpdate

    Change parameters in configuration file in a zip



      I'm using Blade Logic 8.0 to deploy a silverlight application to IIS 7.0 servers.


      The application is packed in a *.xap file (which is basically a zip file).


      Inside the XAP package there's a configuration file in *.xaml format (which is basically xml).


      Inside this XAML file there are parameters that change between the servers.


      The current process is to:

      1. run external command to rename the XAP to ZIP

      2. run external command to unzip the file

      3. modify the extracted XAML file as an xml configuration file

      4. run external command to zip back the content

      5. run external command  to rename the zip back to XAP


      There got to be a smarter way to do this, right?





        • 1. Change parameters in configuration file in a zip
          Reinhard Vielhaber

          Is there some "silent-install" configuration possible? You presumably won't be able to change data inside of a compressed archive directly.

          • 2. Re: Change parameters in configuration file in a zip

            Heh, I thought the whole point of Blade Logic was to do the "silent install".


            I managed to write an NSH Script to do this replacement.


            but I got a problem...


            When I zip back the file, the files keep the full path.

            If I unzipped the file to a temp dir C:\Temp, this directory will appear within the zip.


            Is there a command to change working dir in an NSH script?





            The script is:


            # unzip the XAP file

            unzip -o "SilverLight.xap" -d "/C/Temp/"


            # replace parameter in the file

            sed 's/ReplaceME/WithMe/g' "/C/Temp/file.xaml" > "/C/Temp/file.xaml"


            # replace the original file

            mv -f "/C/Temp/new_file.xaml" "/C/Temp/file.xaml"



            #zip the file back

            zip -r "SilverLight.xap" /C/Temp/*

            • 3. Re: Change parameters in configuration file in a zip
              Bernd Scoor



              i hope i understood correctly. ( Change working dir in NSH = CD )


              after the mv just

              cd /C/Temp

              zip -r "SilverLight.xap" *


              then it should save only the folder structure and files after c/temp

              and /c/temp will not be saved in the zip



              About the smarter way of doing this...well maybe: Grammar, Configuration Objects...i am still not an expert at this...

              But easier for a beginner would be, if you just copy the xml file separatly and use, as a job parameter, a server property where the ReplaceME is set differently for each server. And do your sed with this property in the script.

              • 4. Re: Change parameters in configuration file in a zip

                Thanks qwertzalot,


                I'm ubable to copy just the file and then zip it because the compilation process of the Silverlight application already creates the zip.


                In addition, I'd rather use the sed command instead of a configuration file since this configuration file keeps changing - so I have to recreate the BLPackage for the configuration file each time.


                using the sed command - I create a BLPackage for the new version of the application, and the NSH script job stays the same (at least untill they'll start adding new parameters to the file).