Index: branches/scrax/trunk/package/Scripts/Advanced copia/ForceHPET/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/ForceHPET/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/ForceHPET/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="ForceHPET" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp -f "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=y to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/ForceHPET/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/EHCIacquire/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/EHCIacquire/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/EHCIacquire/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="EHCIacquire" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/EHCIacquire/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/VBIOS/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/VBIOS/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/VBIOS/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="VBIOS" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/VBIOS/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/GUI/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/GUI/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/GUI/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="GUI" +string="No" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/GUI/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/SMBIOSdefaults/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/SMBIOSdefaults/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/SMBIOSdefaults/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="SMBIOSdefault" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/SMBIOSdefaults/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/UseMemDetect/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/UseMemDetect/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/UseMemDetect/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="UseMemDetect" +string="No" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/UseMemDetect/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/Wait/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/Wait/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/Wait/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="Wait" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/Wait/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/LegacyLogo/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/LegacyLogo/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/LegacyLogo/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="LegacyLogo" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/LegacyLogo/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/UseNvidiaROM/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/UseNvidiaROM/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/UseNvidiaROM/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="UseNvidaROM" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/UseNvidiaROM/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/ForceWake/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/ForceWake/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/ForceWake/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="ForceWake" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp -f "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=y to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/ForceWake/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/Wake/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/Wake/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/Wake/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="Wake" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/Wake/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/UseAtiROM/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/UseAtiROM/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/UseAtiROM/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="UseAtiROM" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/UseAtiROM/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/BootBanner/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/BootBanner/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/BootBanner/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="BootBanner" +string="No" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/BootBanner/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/QuietBoot/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/QuietBoot/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/QuietBoot/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="QuietBoot" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/QuietBoot/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/Advanced copia/UHCIreset/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/Advanced copia/UHCIreset/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/Advanced copia/UHCIreset/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="UHCIreset" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=y to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/Advanced copia/UHCIreset/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="GenerateCStates" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="DropSSDT" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="EthernetBuiltIn" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp -f "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=y to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="InstantMenu" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="GraphicsEnabler" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp -f "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=y to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/RestartFix/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/RestartFix/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/RestartFix/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="RestartFix" +string="No" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/RestartFix/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/arch/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/arch/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/arch/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="arch" +string="i386" + +main () +{ + + bootplist="${3}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/arch/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/scrax/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall =================================================================== --- branches/scrax/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall (revision 0) +++ branches/scrax/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall (revision 161) @@ -0,0 +1,169 @@ +#!/bin/bash + +# set com.apple.Boot.plist options + +overide="GeneratePStates" +string="Yes" + +main () +{ + + bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist" + systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" + + bootoptionshdextra[1]="${overide}" + bootoptionshdextra[2]="${string}" + + [ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}" + + if [ ! -f "${bootplist}" ]; then + if [ -f "${systemplist}" ]; then + cp "${systemplist}" "${bootplist}" + fi + fi + + xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" ) + + case "${xmlvalue:0:1}" in + + y) echo "${overide}=y already set in ${bootplist} skipping." + ;; + + n) echo "${overide}=n is set in ${bootplist} leaving." + ;; + + *) echo "Adding ${overide}=${string} to ${bootplist}" + array=("${bootoptionshdextra[@]}") + searchfilereplaceline "${bootplist}" "Kernel Flags" "" "" "2" + ;; + esac + + chown "${USER}:20" "${bootplist}" +} + +getxmlvalue () +{ +# 1 xml key +# 2 xml file +if [ -f "${2}" ]; then + local value + while read value; do + if [ ! "${value}" = "${value/${1}/}" ]; then + read value + value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}" + echo "$value" + break + fi + done < "${2}" +fi +} + +searchfilereplaceline () +{ + +mv "${1}" "${1}.orig" + +prefunctionifs="${IFS}" + +unset fileinput +unset fileoutput +unset find +unset replace +unset deletelines +unset deletelinesskip +unset insertlinesskip + +fileinput="${1}.orig" +fileoutput="${1}" +find="${2}" +replace="${3}" +deletelines="${4%,*}" +insertlinesskip="${5}" + +matchlinefound="0" + +if [ "${#4}" = "${4#*,}" ]; then + deletelinesskip="0" + else + deletelinesskip="${4#*,}" +fi + +IFS="\n" +while read line +do + { + if [ ! "${line}" = "${line/${find}/}" ]; then + { + # Trim the longest match from the end for <* + xmlelementindent="${line%%<*}" + + # Trim the longest match from the start for *< + xmlelementtemp="${line#*<}" + # Add back in stripped < + xmlelement="<${xmlelementtemp}" + + # Trim the shortest match from the start for < + xmltagtemp="${xmlelement#<}" + # Trim the longest match from the end for >* + xmltag="${xmltagtemp%%>*}" + + # Trim the shortest match from the start for *> + xmltexttemp="${xmlelement#*>}" + # Trim the longest match from the end for <* + xmltext="${xmltexttemp%%<*}" + + if [ "${replace}" ]; then + { + echo "${xmlelementindent}<${xmltag}>${replace}" >>"${fileoutput}" + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + matchlinefound="1" + + } + else + { + + if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then + { + if [ "${matchlinefound}" = "${insertlinesskip}" ]; then + { + arraysize=0 + while [ ${arraysize} -lt ${#array[@]} ]; + do + echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}" + let arraysize="${arraysize}+1" + done + } + fi + } + fi + + if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then + { + : + } + else + { + echo "${line}" >>"${fileoutput}" + } + fi + + if [ "${matchlinefound}" -gt 0 ]; then + let matchlinefound="${matchlinefound}+1" + fi + + } + fi + } +done < "${fileinput}" + +IFS=${prefunctionifs} + +rm -f "${fileinput}" +} + +main "${1}" "${2}" "${3}" "${4}" Property changes on: branches/scrax/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall ___________________________________________________________________ Added: svn:executable + *