overdue-scratch

Author Topic: Revisit Chameleon's package builder  (Read 54028 times)

0 Members and 1 Guest are viewing this topic.

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #240 on: December 24, 2011, 06:21:51 PM »
the "error" is gone...
I also add >/dev/null 2>&1 at the end of all "buildpackage" line for a "clean" log-output.
Great :)

But still some problem...
I try... build the package (make pkg), and the package folder is not deleted after the creation of pkg. see picture
???
It's not really a problem. Just uncomment line 501 of buildpkg.sh.
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

JrCs

  • VoodooLabs
  • Posts: 49
Re: Revisit Chameleon's package builder
« Reply #241 on: December 28, 2011, 10:54:28 AM »
I also add >/dev/null 2>&1 at the end of all "buildpackage" line for a "clean" log-output.
ex: from
Code: [Select]
buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/"to
Code: [Select]
buildpackage "$packageRefId" "${choiceId}" "${1}/${choiceId}" "/" >/dev/null 2>&1
Hi ErmaC,
don't do that because we'll don't see futur errors. It's a bad idea to mask error with redirections to /dev/null. It's much better to resolv the cause of error.

But still some problem...
I try... build the package (make pkg), and the package folder is not deleted after the creation of pkg. see picture
???

Fabio

This is the normal process now Fabio so we can inspect generated pkgs and the distribution file.
If we want to remove properly the generated files do a
Code: [Select]
make cleanor
Code: [Select]
make distclean
Best regards,
JrCs

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #242 on: December 28, 2011, 12:34:44 PM »
This is the normal process now Fabio so we can inspect generated pkgs and the distribution file.
Thanks for this confirmation JrCs. I didn't want to change anything that I wasn't sure of so I left that alone in my latest commit.
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #243 on: December 28, 2011, 02:28:50 PM »
Best regards,
JrCs

Thanks for explain!
:)

Fabio
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

JrCs

  • VoodooLabs
  • Posts: 49
Re: Revisit Chameleon's package builder
« Reply #244 on: December 28, 2011, 05:16:41 PM »
@ErmaC: i don't understand why you have some errors setting uid/gid with cpio.

Do you use the Apple cpio (Snow Leopard or Lion) and not another one like macports or fink ?
Do you build package into a Virtual Machine ?
Can you check with the command id root if it return the good name for uid and gid.
id root must return something like this:
uid=0(root) gid=0(wheel) .....

JrCs
« Last Edit: December 28, 2011, 05:22:40 PM by JrCs »

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #245 on: December 28, 2011, 05:43:32 PM »
@ErmaC: i don't understand why you have some errors setting uid/gid with cpio.

Do you use the Apple cpio (Snow Leopard or Lion) and not another one like macports or fink ?
Do you build package into a Virtual Machine ?
Can you check with the command id root if it return the good name for uid and gid.
id root must return something like this:
uid=0(root) gid=0(wheel) .....

JrCs

Xcode 4.2 on Snow Leopard 10.6.8 (Real not virtualized)

Here the output
Code: [Select]
Last login: Wed Dec 28 13:37:44 on ttys000
Fabio:~ iFabio$ id root
uid=0(root) gid=0(wheel) groups=0(wheel),401(com.apple.access_screensharing),402(com.apple.sharepoint.group.1),204(_developer),100(_lpoperator),98(_lpadmin),80(admin),61(localaccounts),29(certusers),20(staff),12(everyone),9(procmod),8(procview),5(operator),4(tty),3(sys),2(kmem),1(daemon),403(com.apple.sharepoint.group.2)
Fabio:~ iFabio$

I installed macport some mounts ago...
Fabio
« Last Edit: December 28, 2011, 05:46:41 PM by ErmaC »
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

JrCs

  • VoodooLabs
  • Posts: 49
Re: Revisit Chameleon's package builder
« Reply #246 on: January 03, 2012, 11:07:34 AM »
Hi all, and happy new year !!!

I have made a lot of improvements in the buildpkg script:

I have simplify the creation of the menu:
use addGroupChoices to add a "main menu" and addChoice to add an option to the menu.
For example for the video mode options the menu is created like this
Code: [Select]
addGroupChoices "Options"
addGroupChoices --parent="Options" --exclusive_zero_or_one_choice "Resolution"
addChoice --group "Resolution" "1024x600x32" "org.chameleon.options.resolution.1024x600x32"

I have made a lot of checks to be sure that the Distribution file is correct.

Another thing i have change is the backup. Now all the backups are store in Chameleon.Backups directory of the target volume. It contains one directory by backup. And in the backup folder there are ALL the files needs by chameleon (like Extra, stage2 file boot, the installer log, etc...). With that a user can restore completly his chameleon install from moving all the files in the backup folder to the root.

I hope that this changes will be usefull for you.

Best regards,
JrCs

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #247 on: January 03, 2012, 11:33:22 PM »
Happy New Year too JrCs.  ;D

I have seen the extra work you've put in to the package installer, especially buildpkg.sh. Well done again.
It's great to see some fresh code being turned out which I can hopefully learn from. It will take me a while to get my head around all the changes but I'll get there.

I've made a local change to the preinstall script to only create Chameleon.Backups and write to the install log if boot or /Extra exist at the target locations. I'll commit it to my branch later, but in the mean time I have been trying to add to the Javascript in the Distribution file to also look for a com.apple.Boot.plist for users upgrading from legacy installations. However, my Javascript isn't so great and the code I have so far only works as far as finding the first plist condition but never goes on to finding the second if the first is not found.

Can you please show me what I'm doing wrong or otherwise maybe implement the feature yourself? Here's what I have:

Code: [Select]
    function get_chameleon_boot_plist() {
        if (my.target) {
            if (my.target.mountpoint + '/Extra/org.chameleon.Boot.plist') {
                var chameleon_boot_plist = my.target.mountpoint + '/Extra/org.chameleon.Boot.plist'
                return system.files.plistAtPath(chameleon_boot_plist);
            }
            // Add support for legacy installations.
            if (my.target.mountpoint + '/Extra/com.apple.Boot.plist') {
                var chameleon_boot_plist = my.target.mountpoint + '/Extra/com.apple.Boot.plist'
                return system.files.plistAtPath(chameleon_boot_plist);
            }
        }
        return null;
    }

Regards
blackosx
« Last Edit: January 03, 2012, 11:43:45 PM by Blackosx »
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

JrCs

  • VoodooLabs
  • Posts: 49
Re: Revisit Chameleon's package builder
« Reply #248 on: January 04, 2012, 09:35:37 AM »
Hi Blackosx,

your problem is the:
Code: [Select]
if (my.target.mountpoint + '/Extra/org.chameleon.Boot.plist') that is always true !

The best is to have an array with the 2 files:
Code: [Select]
var boot_plist_files=new array('org.chameleon.Boot.plist', 'com.apple.Boot.plist');and you create a loop to check the file in the array. The loop must end if the plist exists.

Tell me of you want me to make the code

Regards,
JrCs

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #249 on: January 04, 2012, 11:23:29 AM »
your problem is the:
Code: [Select]
if (my.target.mountpoint + '/Extra/org.chameleon.Boot.plist') that is always true !
Even if /Extra/org.chameleon.Boot.plist doesn't exist?

The best is to have an array with the 2 files:
Code: [Select]
var boot_plist_files=new array('org.chameleon.Boot.plist', 'com.apple.Boot.plist');and you create a loop to check the file in the array. The loop must end if the plist exists.
Maybe something like this?
Note: This it's just something I've thrown together here for responding to your suggestion. It's without any tests and might not even be correct javascript syntax.
Code: [Select]
var boot_plist_files=new array('org.chameleon.Boot.plist', 'com.apple.Boot.plist');
var i=0;
var chameleon_boot_plist = "";
while (i<=boot_plist_files.length && chameleon_boot_plist = "" ) {
    if (my.target.mountpoint + '/Extra/'boot_plist_files[i])
        var chameleon_boot_plist = my.target.mountpoint + '/Extra/'boot_plist_files[i];
    i++;
}
if (chameleon_boot_plist != "")
    return system.files.plistAtPath(chameleon_boot_plist);
else
    return null;


Tell me of you want me to make the code
Yes please..  :P
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

JrCs

  • VoodooLabs
  • Posts: 49
Re: Revisit Chameleon's package builder
« Reply #250 on: January 05, 2012, 08:39:52 PM »

Tell me of you want me to make the code
Yes please..  :P


Done, commited in trunk.

Regards,
JrCs

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #251 on: January 06, 2012, 08:35:12 PM »
Thanks JrCs.
Nice job.  ;D
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #252 on: January 07, 2012, 10:30:21 AM »
Hi JrCs

Good work with the latest round of refinements to the installer. I'm enjoying seeing the changes you're making.

However, I've found an issue with a recent functionality....
When running the package installer, it's options are now populated by reading a previous org.chameleon.Boot.plist (if found). This now presents the user the choice to deselect a previously used option/kernel flag. But this doesn't work

I think a routine is needed in the postinstall script to deal with this scenario. What do you think?

Regards
blackosx
« Last Edit: January 07, 2012, 10:33:09 PM by Blackosx »
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #253 on: January 21, 2012, 08:55:15 PM »
Hi guys!!

About: commit 1808   by blackosx.
Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?

Maybe we can use the same "method" for the credits?
like a %CPRYEAR% taked from CREDITS file and replaced into all the needed Resources file.

Like this:
add at line 16, 17 and 18
Quote
...
Package:
---------
kalyway, AzimutZ, blackosx, ErmaC, scrax, JrCs

Copyright:
---------
2009-2012

then in all the Welcome and Conclusion file (yep I add copyright year also in conclusion file)
replace the copyright string with:
from
Copyright © 2009-2012
to
Copyright © %CPRYEAR%

then into buildpkg.sh script add
this line
Quote
# ====== CREDITS ======

declare -r CHAMELEON_DEVELOP=$(awk "NR==6{print;exit}"  ${PKGROOT}/../CREDITS)
declare -r CHAMELEON_CREDITS=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)
declare -r CHAMELEON_PKGDEV=$(awk "NR==14{print;exit}"  ${PKGROOT}/../CREDITS)
declare -r CHAMELEON_CPRYEAR=$(awk "NR==18{print;exit}"  ${PKGROOT}/../CREDITS)
...

...
    local chameleonSubsts="
s&%CHAMELEONVERSION%&${CHAMELEON_VERSION%%-*}&g
s&%CHAMELEONREVISION%&${CHAMELEON_REVISION}&g
s&%CHAMELEONSTAGE%&${CHAMELEON_STAGE}&g
s&%DEVELOP%&${CHAMELEON_DEVELOP}&g
s&%CREDITS%&${CHAMELEON_CREDITS}&g
s&%PKGDEV%&${CHAMELEON_PKGDEV}&g
s&%CPRYEAR%&${CHAMELEON_CPRYEAR}&g
s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g
:t
....

...
# End

    md5=$( md5 "${distributionFilePath}" | awk {'print $4'} )
    echo "MD5 (${distributionFilePath}) = ${md5}" > "${distributionFilePath}.md5"
    echo ""

    echo -e $COL_GREEN" --------------------------"$COL_RESET
    echo -e $COL_GREEN" Building process complete!"$COL_RESET
    echo -e $COL_GREEN" --------------------------"$COL_RESET
    echo ""
    echo -e $COL_GREEN" Build info."
    echo -e $COL_GREEN" ==========="
    echo -e $COL_BLUE"  Package name: "$COL_RESET"${distributionFilename}"
    echo -e $COL_BLUE"  MD5:          "$COL_RESET"$md5"
    echo -e $COL_BLUE"  Version:      "$COL_RESET"$CHAMELEON_VERSION"
    echo -e $COL_BLUE"  Stage:        "$COL_RESET"$CHAMELEON_STAGE"
    echo -e $COL_BLUE"  Date/Time:    "$COL_RESET"$CHAMELEON_BUILDDATE"
    echo -e $COL_BLUE"  Builded by:   "$COL_RESET"$CHAMELEON_WHOBUILD"
    echo -e $COL_BLUE"  Copyright $CHAMELEON_CPRYEAR ""$COL_RESET"
    echo ""

}
...

EDIT:
also I think we need to update the description.html file with the new indroduced features like the cparm's patch for the OS X versions...

Fabio
« Last Edit: January 22, 2012, 12:41:14 AM by ErmaC »
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

Blackosx

  • Forum Moderator
  • Posts: 1117
Re: Revisit Chameleon's package builder
« Reply #254 on: January 22, 2012, 11:30:12 AM »
Hi Fabio

Good thinking and how about going further and have the Conclusion and Welcome files as templates?. This way there could be a single master language file which contains all variants for the different Conclusion and Welcome files. The compilation process then transplants the correct text, similar to how the /package/Scripts.templates/* work.

Maybe this could be extended for one master text file for all variant text in /package/Resources/*. This would be a great benefit for everyone as making changes to /package/Resources/* can be a PITA  :P

Example - template for Welcome file could be something like:
Code: [Select]
Chameleon
v%CHAMELEONVERSION% r%CHAMELEONREVISION%

%wlc_installMessage%

Developers :
%DEVELOP%

Thanks to :
%CREDITS%

Package :
%PKGDEV%

%wlc_packageBuiltText%: %WHOBUILD%, %wlc_languageTranslatedText%
Copyright © %CPRYEAR%

Example - Conclusion file could be something like:
Code: [Select]

%cnc_message%

Chameleon v%CHAMELEONVERSION% r%CHAMELEONREVISION%

Copyright © %CPRYEAR%

Example master language file:
Code: [Select]
...
...
//-------------------------------------------------
language=en.lproj
wlc_installMessage=Do not install to an Apple Macintosh computer
wlc_packageBuiltText=Package built by
wlc_languageTranslatedText=language translated by: blackosx
cnc_message=The scripts have completed and a file
named @LOG_FILENAME@ has been
written to the root of your chosen partition.

Please read it to find out if the installation was
successful and keep it for a record of what was done."
//-------------------------------------------------
language=it.lproj
wlc_installMessage=Non installare su computer Apple Macintosh
wlc_packageBuiltText=Package built by
wlc_languageTranslatedText=language tradotto da: ErmaC e scrax
cnc_message="Le operazioni sono state completate ed un file
chiamato @LOG_FILENAME@ é stato
scritto nella root della partizione scelta.

Per favore leggilo per vedere se l'installazione é
avvenuta con successo e vedere le operazioni che sono state eseguite."
//-------------------------------------------------
...
...

Note: for this example I've removed the name of who built the package from the Conclusion file as do we really need it displayed twice?

also I think we need to update the description.html file with the new indroduced features like the cparm's patch for the OS X versions...
Yes, and also one the things I have on my TO DO list since some of JrCs' changes is to amend the localizable strings to better describe the revised process and even change some of the text written to the install log. But I have little time at the moment so I will make small changes as and when I can. I haven't even had time to look properly at all the wonderful changes JrCs has made - though it's great he found time to code the use of templates - brilliant.

I also want to look more in to the names in the credits file as extra names previously referenced can be seen here and here.

Regards
blackosx
« Last Edit: January 22, 2012, 11:38:41 AM by Blackosx »
10.9.4 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB