Chameleon

Chameleon Commit Details

Date:2011-12-31 18:53:44 (12 years 3 months ago)
Author:JrCs
Commit:1766
Parents: 1765
Message:Improved chameleon installer - Automaticaly select previous options
Changes:
M/trunk/package/Scripts/Main/postinstall
M/trunk/package/buildpkg.sh
M/trunk/package/Distribution

File differences

trunk/package/Distribution
3939
4040
4141
42
43
44
45
46
47
48
49
4250
43
51
52
53
4454
4555
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
4689
return false;
}
function get_chameleon_boot_plist() {
if (my.target) {
var chameleon_boot_plist = my.target.mountpoint + '/Extra/org.chameleon.Boot.plist'
return system.files.plistAtPath(chameleon_boot_plist);
}
return null;
}
function chameleon_boot_plist_exists() {
return system.files.fileExistsAtPath(my.target.mountpoint + '/Extra/org.chameleon.Boot.plist');
if (get_chameleon_boot_plist() != null)
return true;
return false;
}
function check_chameleon_kernel_option(kernelFlags, value) {
var flags = kernelFlags.split(" ");
for ( var i = 0; i < flags.length; i++ ) {
if (flags[i] == value)
return true;
}
return false;
}
function check_chameleon_option(key, value) {
var bootPlist = get_chameleon_boot_plist();
if (bootPlist) {
if (key == "KFflag")
key = "Kernel Flags";
if (bootPlist[ key ]) {
if ( key == "Kernel Flags" )
return check_chameleon_kernel_option( bootPlist[ key ], value );
// Check if value is a boolean
var pattern=/^(Y(es)?|No?)$/i;
var result = value.match(pattern); // Check if the value is a boolean
if ( result && bootPlist[ key ].charAt(0).toLowerCase() == value.charAt(0).toLowerCase() )
return true;
else
return bootPlist[ key ] == value; // check if the strings are equal
}
else
return false;
}
return false;
}
</script>
trunk/package/Scripts/Main/postinstall
11
22
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
322
423
524
......
180199
181200
182201
183
202
184203
185204
186205
#!/bin/bash
mergeString () {
local src="${1}"
local new="${2}"
local result="$src"
for newItem in $new ;do
local found=0
for srcItem in $src ;do
if [[ $newItem == $srcItem ]];then
found=1
break
fi
done
[[ $found -eq 0 ]] && result="$result $newItem"
done
echo "$result"
}
echo "==============================================="
echo "Post Post-Install Script"
echo "*********************************"
if [[ -n "$currentFlags" ]];then
# Combine new kernel flags with old ones.
kernelFlagString="${kernelFlagString} $currentFlags"
kernelFlagString=$( mergeString "$currentFlags" "${kernelFlagString}" )
fi
elif [ -e "$chamTemp/install_type_new" ]; then
trunk/package/buildpkg.sh
531531
532532
533533
534
534
535
536
535537
536538
537539
......
548550
549551
550552
553
551554
552555
553556
......
556559
557560
558561
559
560562
561563
562564
563565
564566
565
567
566568
567569
568570
569571
570
572
573
574
571575
572576
573577
packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}")
buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options"
addChoice --group="${builtOptionsList}" --start-selected="false" --pkg-refs="$packageRefId" "${optionName}"
addChoice --group="${builtOptionsList}" \
--start-selected="check_chameleon_option('$key','$value')" \
--pkg-refs="$packageRefId" "${optionName}"
done
done
keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout")
fi
chameleon_keylayout_key="KeyLayout"
# ------------------------------------------------------
# Available Keylayout boot options are discovered by
# reading contents of /Keymaps folder after compilation
# Adjust array contents to match expected format
# for boot options which is: name:key=value
for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )); do
# availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]}
# Start build of a keymap package module
choiceId="${availableOptions[i]}"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
# create dummy file with name of key/value
echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/KeyLayout=${availableOptions[i]}"
echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/${chameleon_keylayout_key}=${availableOptions[i]}"
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options"
# Add the Keylayout package because the Keylayout module is needed
addChoice --group="KeyLayout" --start-selected="false" --pkg-refs="$packageRefId $keylayoutPackageRefId" "${choiceId}"
addChoice --group="KeyLayout" \
--start-selected="check_chameleon_option('${chameleon_keylayout_key}','${choiceId}')" \
--pkg-refs="$packageRefId $keylayoutPackageRefId" "${choiceId}"
done
# End build KeyLayout options packages

Archive Download the corresponding diff file

Revision: 1766