OLD | NEW |
(Empty) | |
| 1 # Copyright 2010, Google Inc. |
| 2 # All rights reserved. |
| 3 # |
| 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are |
| 6 # met: |
| 7 # |
| 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above |
| 11 # copyright notice, this list of conditions and the following disclaimer |
| 12 # in the documentation and/or other materials provided with the |
| 13 # distribution. |
| 14 # * Neither the name of Google Inc. nor the names of its |
| 15 # contributors may be used to endorse or promote products derived from |
| 16 # this software without specific prior written permission. |
| 17 # |
| 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 |
| 31 # Information from setup.ini |
| 32 declare -A sdesc ldesc category required requires prefix version install source |
| 33 # Contents of categories |
| 34 declare -A category_contents |
| 35 # Packagenames: in request order and in install order |
| 36 declare -A allinstpackages instpackages reqpackages sectionin seed |
| 37 declare -a allinstalledpackages |
| 38 # Filetype info |
| 39 declare -A filetype |
| 40 # Sanitized names cache |
| 41 declare -A sanitized_name |
| 42 |
| 43 parse_setup_ini() { |
| 44 if ((verbose)) ; then echo "Parsing setup.ini..." >&2 ; fi |
| 45 local package line acceptmode=0 sdescmode=0 ldescmode=0 |
| 46 while read -r line ; do |
| 47 if [[ "${line:0:1}" = "@" ]] ; then |
| 48 package="${line:2}" |
| 49 acceptmode=1 |
| 50 sdescmode=0 |
| 51 ldescmode=0 |
| 52 if ((verbose)) ; then echo "Package: \"$package\"..." >&2 ; fi |
| 53 elif [[ "$line" = "[prev]" ]] || [[ "$line" = "[test]" ]] ; then |
| 54 acceptmode=0 |
| 55 elif ((acceptmode)) ; then |
| 56 if ((sdescmode)) ; then |
| 57 sdesc["$package"]="${sdesc[$package]} $line" |
| 58 if [[ "$line" = *\"* ]] ; then |
| 59 sdescmode=0 |
| 60 fi |
| 61 elif ((ldescmode)) ; then |
| 62 ldesc["$package"]="${ldesc[$package]} $line" |
| 63 if [[ "$line" = *\"* ]] ; then |
| 64 ldescmode=0 |
| 65 fi |
| 66 elif [[ "${line:0:6}" = "sdesc:" ]] ; then |
| 67 sdesc["$package"]="${line:7}" |
| 68 if [[ "${line:7}" = *\"*\"* ]] ; then |
| 69 sdescmode=0 |
| 70 else |
| 71 sdescmode=1 |
| 72 fi |
| 73 ldescmode=0 |
| 74 elif [[ "${line:0:6}" = "ldesc:" ]] ; then |
| 75 ldesc["$package"]="${line:7}" |
| 76 sdescmode=0 |
| 77 if [[ "${line:7}" = *\"*\"* ]] ; then |
| 78 ldescmode=0 |
| 79 else |
| 80 ldescmode=1 |
| 81 fi |
| 82 elif [[ "${line:0:9}" = "category:" ]] ; then |
| 83 category["$package"]="${line:10}" |
| 84 for catname in ${category["$package"]} ; do |
| 85 category_contents["$catname"]="${category_contents[$catname]} $package
" |
| 86 done |
| 87 sdescmode=0 |
| 88 ldescmode=0 |
| 89 elif [[ "${line:0:9}" = "requires:" ]] ; then |
| 90 requires["$package"]="${line:10}" |
| 91 sdescmode=0 |
| 92 ldescmode=0 |
| 93 elif [[ "${line:0:8}" = "version:" ]] ; then |
| 94 version["$package"]="${line:9}" |
| 95 sdescmode=0 |
| 96 ldescmode=0 |
| 97 elif [[ "${line:0:8}" = "install:" ]] ; then |
| 98 install["$package"]="${line:9}" |
| 99 sdescmode=0 |
| 100 ldescmode=0 |
| 101 elif [[ "${line:0:7}" = "source:" ]] ; then |
| 102 source["$package"]="${line:8}" |
| 103 sdescmode=0 |
| 104 ldescmode=0 |
| 105 elif [[ "$line" != "" ]] && |
| 106 [[ "$line" != "#"* ]] ; then |
| 107 echo "Unknown tag in \"$line\"" >&2 |
| 108 exit 1 |
| 109 fi |
| 110 fi |
| 111 done < setup.ini |
| 112 } |
| 113 |
| 114 fix_setup_inf_info() { |
| 115 version["bash"]="4.1.5-0" |
| 116 requires["bash"]="cygwin libintl8 libncurses10 libreadline7 _update-info-dir" |
| 117 install["bash"]="release/bash/bash-4.1.5-0.tar.bz2 1132678 24a05f9c3e7ca0b14fe
5e55fc92a1d93" |
| 118 source["bash"]="release/bash/bash-4.1.5-0-src.tar.bz2 6653288 e59479e2ef9b14bd
f662709a2d5b0223" |
| 119 version["libreadline7"]="6.1.2-0" |
| 120 install["libreadline7"]="release/readline/libreadline7/libreadline7-6.1.2-0.ta
r.bz2 89945 afd3ec6a01c015572ff9602cb4bdc794" |
| 121 source["libreadline7"]="release/readline/readline-6.1.2-0-src.tar.bz2 2283352
509b85aa6f723fac3b453f7c84ca3361" |
| 122 version["readline"]="6.1.2-0" |
| 123 install["readline"]="release/readline/readline-6.1.2-0.tar.bz2 288160 f16eeccb
b99b41d9128d56ddc5d4ad3c" |
| 124 source["readline"]="release/readline/readline-6.1.2-0-src.tar.bz2 2283352 509b
85aa6f723fac3b453f7c84ca3361" |
| 125 requires["coreutils"]="${requires[coreutils]} dash grep patch sed" |
| 126 requires["dash"]="${requires[dash]} cygwin" |
| 127 requires["libcloog-devel"]="${requires[libcloog-devel]} ppl-devel" |
| 128 requires["zlib-devel"]="${requires[libcloog-devel]} zlib" |
| 129 } |
| 130 |
| 131 download_package_dependences() { |
| 132 # $1 = name of the package; function is recursive |
| 133 # $2 - Section No |
| 134 local pkgname |
| 135 local instname="${install[$1]/.tar.bz2*/.tar.bz2}" |
| 136 local srcname="${source[$1]/.tar.bz2*/.tar.bz2}" |
| 137 if [[ "$instname" != "" ]] ; then |
| 138 if ((verbose)) ; then ( echo ; echo -n "Package: \"$1\"..." ) >&2 ; fi |
| 139 if [ ! -e packages/"`basename \"$instname\"`" ] ; then |
| 140 if wget http://build.chromium.org/mirror/nacl/cygwin_mirror/packages/"`bas
ename \"$instname\"`" -O packages/"`basename \"$instname\"`" || |
| 141 wget "$mirror_prefix/$instname" -O packages/"`basename \"$instname\"`"
; then |
| 142 if ! [[ "${install[$1]}" = "${install[$1]/.tar.bz2*/.tar.bz2} ` |
| 143 stat -c "%s" packages/\"\`basename \\\"$instname\\\"\`\"` ` |
| 144 md5sum -b packages/\"\`basename \\\"$instname\\\"\`\" | cut -b -
32`" ]] ; then |
| 145 echo "Wrong file downloaded: expected ${install[$1]}" >&2 |
| 146 exit 1 |
| 147 fi |
| 148 else |
| 149 # Wget should have complained for us |
| 150 exit $? |
| 151 fi |
| 152 fi |
| 153 if [ ! -e packages.unpacked/"`basename \"$instname\"`" ] ; then |
| 154 mkdir -p packages.unpacked/"`basename \"$instname\"`" |
| 155 if ! tar xSvpf {packages,-Cpackages.unpacked}/"`basename \"$instname\"`" ;
then |
| 156 # Tar should have complained for us |
| 157 exit $? |
| 158 fi |
| 159 if [[ "$pkgname" = "WindowMaker" ]] ; then |
| 160 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/WindowMaker/Ic
ons/{,tmp}defaultAppIcon.tiff |
| 161 rm packages.unpacked/"`basename \"$instname\"`"/usr/share/WindowMaker/Ic
ons/DefaultAppIcon.tiff 2> /dev/null |
| 162 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/WindowMaker/Ic
ons/{tmp,}defaultAppIcon.tiff |
| 163 elif [[ "$pkgname" = "lilypond-doc" ]] ; then |
| 164 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/doc/lilypond/h
tml/Documentation/user/lilypond-learning/{,tmp}Lilypond_002dbook-templates.de.ht
ml |
| 165 rm packages.unpacked/"`basename \"$instname\"`"/usr/share/doc/lilypond/h
tml/Documentation/user/lilypond-learning/lilypond_002dbook-templates.de.html |
| 166 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/doc/lilypond/h
tml/Documentation/user/lilypond-learning/{tmp,}Lilypond_002dbook-templates.de.ht
ml |
| 167 elif [[ "$pkgname" = "ruby" ]] ; then |
| 168 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
Exception2MessageMapper/{,tmp}Fail-i.yaml |
| 169 rm packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
Exception2MessageMapper/fail-i.yaml |
| 170 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
Exception2MessageMapper/{tmp,}Fail-i.yaml |
| 171 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
REXML/Parsers/XPathParser/{,tmp}Predicate-i.yaml |
| 172 rm packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
REXML/Parsers/XPathParser/predicate-i.yaml |
| 173 mv packages.unpacked/"`basename \"$instname\"`"/usr/share/ri/1.8/system/
REXML/Parsers/XPathParser/{tmp,}tmpPredicate-i.yaml |
| 174 fi |
| 175 fi |
| 176 if [ ! -e setup/"$1".lst.gz ] ; then |
| 177 if ! rm -f setup/"$1".lst ; then |
| 178 # Rm should have complained for us |
| 179 exit $? |
| 180 fi |
| 181 if ! tar tf {packages,-Cpackages.unpacked}/"`basename \"$instname\"`" > se
tup/"$1".lst ; then |
| 182 # Tar should have complained for us |
| 183 exit $? |
| 184 fi |
| 185 if ! gzip -9 setup/"$1".lst ; then |
| 186 # Gzip should have complained for us |
| 187 exit $? |
| 188 fi |
| 189 fi |
| 190 fi |
| 191 if [[ "$srcname" != "" ]] ; then |
| 192 if [ ! -e packages.src/"`basename \"$srcname\"`" ] ; then |
| 193 if wget http://build.chromium.org/mirror/nacl/cygwin_mirror/packages.src/"
`basename \"$srcname\"`" -O packages.src/"`basename \"$srcname\"`" || |
| 194 wget "$mirror_prefix/$srcname" -O packages.src/"`basename \"$srcname\"`
" ; then |
| 195 if ! [[ "${source[$1]}" = "${source[$1]/.tar.bz2*/.tar.bz2} ` |
| 196 stat -c "%s" packages.src/\"\`basename \\\"$srcname\\\"\`\"` ` |
| 197 md5sum -b packages.src/\"\`basename \\\"$srcname\\\"\`\" | cut -
b -32`" ]] ; then |
| 198 echo "Wrong file downloaded: expected ${install[$1]}" >&2 |
| 199 exit 1 |
| 200 fi |
| 201 else |
| 202 # Wget should have complained for us |
| 203 exit $? |
| 204 fi |
| 205 fi |
| 206 fi |
| 207 reqpackages["$1"]="present" |
| 208 sectionin["$1"]="${sectionin[$1]} $2" |
| 209 for pkgname in ${requires["$1"]} ; do |
| 210 if [[ "${reqpackages[$pkgname]}" = "present" ]] ; then |
| 211 if ((verbose)) ; then echo -n "." >&2 ; fi |
| 212 else |
| 213 download_package_dependences "$pkgname" "$2" |
| 214 fi |
| 215 done |
| 216 if [[ "${allinstpackages[$1]}" != "present" ]] ; then |
| 217 allinstpackages["$1"]="present" |
| 218 allinstalledpackages=(${allinstalledpackages[@]} "$1") |
| 219 fi |
| 220 } |
| 221 |
| 222 download_package() { |
| 223 # $1 - Category name |
| 224 # $2 - Section No |
| 225 if ((verbose)) ; then echo -n "Downloading packages in \"$1\"..." >&2 ; fi |
| 226 local pkgname |
| 227 reqpackages=() |
| 228 for pkgname in ${category_contents["$1"]} ; do |
| 229 if [[ "${reqpackages[$pkgname]}" != "present" ]] ; then |
| 230 download_package_dependences "$pkgname" "$2" |
| 231 fi |
| 232 seed["$pkgname"]="${seed[$pkgname]} $2" |
| 233 done |
| 234 if ((verbose)) ; then echo >&2 ; fi |
| 235 } |
| 236 |
| 237 download_all_packages() { |
| 238 # $1 - Section No |
| 239 local secname |
| 240 for secname in "${!category_contents[@]}" ; do |
| 241 if [ "$secname" != "_obsolete" ] ; then |
| 242 download_package "$secname" "$1" |
| 243 fi |
| 244 done |
| 245 } |
| 246 |
| 247 download_addon_packages() { |
| 248 # $1 - Start SectionN |
| 249 local insttype pkgname sectionN="$1" |
| 250 if ((verbose)) ; then echo -n "Downloading addon packages..." >&2 ; fi |
| 251 if [[ "$defpackage" = "Full" ]] ; then |
| 252 definsttype="$((sectionN-1))" |
| 253 fi |
| 254 local IFS=$'\n' |
| 255 for insttype in ` |
| 256 for insttype in "${!packages[@]}" ; do |
| 257 echo $insttype |
| 258 done | sort |
| 259 ` ; do |
| 260 if [[ "$defpackage" = "$insttype" ]] ; then |
| 261 definsttype="$sectionN" |
| 262 fi |
| 263 reqpackages=() |
| 264 IFS=$' \t\n' |
| 265 for pkgname in ${packages["$insttype"]} ; do |
| 266 if [[ "${reqpackages[$pkgname]}" != "present" ]] ; then |
| 267 download_package_dependences "$pkgname" "$sectionN" |
| 268 fi |
| 269 seed["$pkgname"]="${seed[$pkgname]} $sectionN" |
| 270 done |
| 271 ((sectionN++)) |
| 272 done |
| 273 if [[ "$defpackage" = "Minimal" ]] ; then |
| 274 definsttype="$sectionN" |
| 275 fi |
| 276 if ((verbose)) ; then echo >&2 ; fi |
| 277 } |
| 278 |
| 279 fill_required_packages() { |
| 280 if ((verbose)) ; then echo "Calculating dependences..." >&2 ; fi |
| 281 local pkgname subpkgname subsubpkgname check=1 |
| 282 while ((check)) ; do |
| 283 check=0 |
| 284 for pkgname in "${allinstalledpackages[@]}" ; do |
| 285 if ((verbose)) ; then echo "Package: \"$pkgname\"..." >&2 ; fi |
| 286 for subpkgname in ${requires["$pkgname"]} ; do |
| 287 for subsubpkgname in ${requires["$subpkgname"]} ; do |
| 288 if ! [[ " ${requires[$pkgname]} " = *" $subsubpkgname "* ]] ; then |
| 289 requires["$pkgname"]="${requires[$pkgname]} $subsubpkgname" |
| 290 check=1 |
| 291 fi |
| 292 done |
| 293 done |
| 294 done |
| 295 done |
| 296 for pkgname in "${allinstalledpackages[@]}" ; do |
| 297 for subpkgname in ${requires["$pkgname"]} ; do |
| 298 required["$subpkgname"]="${required[$subpkgname]} $pkgname" |
| 299 done |
| 300 done |
| 301 } |
| 302 |
| 303 fill_filetype_info() { |
| 304 local IFS=" |
| 305 " |
| 306 # Corner cases: files created by post-install scripts, mistakes, etc |
| 307 filetype=([Cygwin.ico]="file" |
| 308 [bin]="directory" |
| 309 [usr/bin]="directory" |
| 310 [lib]="directory" |
| 311 [usr/lib]="directory" |
| 312 [bin/exim.exe]="file" |
| 313 [bin/latex.exe]="file" |
| 314 [lib/icu/current/Makefile.inc]="file" |
| 315 [lib/rpm/rpmv.exe]="file" |
| 316 [usr/sbin/sendmail]="file" |
| 317 [usr/share/man/man1/gcc.1.gz]="file" |
| 318 [usr/share/man/man1/g++.1.gz]="file" |
| 319 [usr/share/man/man1/g77.1.gz]="file" |
| 320 [usr/share/man/man1/mf.1]="file" |
| 321 [usr/share/terminfo/E/Eterm]="file" |
| 322 [usr/share/terminfo/N/NCR260VT300WPP0]="file") |
| 323 if ((verbose)) ; then echo "Scanning filetypes..." >&2 ; fi |
| 324 for name in ` |
| 325 for package in packages.unpacked/* ; do ( |
| 326 cd $package |
| 327 if ((verbose)) ; then echo "Archive: \"${package#*/}\"..." >&2 ; fi |
| 328 find -type f |
| 329 ) done |
| 330 ` ; do |
| 331 if [[ "${name:0:10}" = "./usr/bin/" ]] ; then |
| 332 filetype["bin/${name:10}"]="file" |
| 333 elif [[ "${name:0:10}" = "./usr/lib/" ]] ; then |
| 334 filetype["lib/${name:10}"]="file" |
| 335 else |
| 336 filetype["${name:2}"]="file" |
| 337 fi |
| 338 done |
| 339 for name in ` |
| 340 for package in packages.unpacked/* ; do ( |
| 341 cd $package |
| 342 if ((verbose)) ; then echo "Archive: \"${package#*/}\"..." >&2 ; fi |
| 343 find -type d |
| 344 ) done |
| 345 ` ; do |
| 346 if [[ "${name:0:10}" = "./usr/bin/" ]] ; then |
| 347 if [[ "bin/${filetype[${name:10}]}" = "file" ]] ; then |
| 348 echo "bin/${filetype[${name:10}]} - file and directory... oops?" >&2 |
| 349 exit 1 |
| 350 fi |
| 351 filetype["bin/${name:10}"]="directory" |
| 352 elif [[ "${name:0:10}" = "./usr/lib/" ]] ; then |
| 353 if [[ "lib/${filetype[${name:10}]}" = "file" ]] ; then |
| 354 echo "lib/${filetype[${name:10}]} - file and directory... oops?" >&2 |
| 355 exit 1 |
| 356 fi |
| 357 filetype["lib/${name:10}"]="directory" |
| 358 elif ((${#name}>1)) ; then |
| 359 if [[ "${filetype[${name:2}]}" = "file" ]] ; then |
| 360 echo "${filetype[${name:2}]} - file and directory... oops?" >&2 |
| 361 exit 1 |
| 362 fi |
| 363 filetype["${name:2}"]="directory" |
| 364 fi |
| 365 done |
| 366 } |
| 367 |
| 368 sanitize_var_name() { |
| 369 local varname="$1" |
| 370 varname="${varname//-/_}" |
| 371 varname="${varname//./_}" |
| 372 varname="${varname//+/X}" |
| 373 echo -n "$varname" |
| 374 } |
| 375 |
| 376 declare_nsis_variables() { |
| 377 local outlist |
| 378 local pkgname |
| 379 if ((verbose)) ; then echo "Declare NSIS variables..." >&2 ; fi |
| 380 if [[ "$defpackage" != "NONE" ]] ; then |
| 381 echo "InstType \"Full\"" |
| 382 for pkgname in "${!packages[@]}" ; do |
| 383 echo "InstType \"$pkgname\"" |
| 384 done | sort |
| 385 cat <<END |
| 386 InstType "Minimal" |
| 387 |
| 388 Var SVV_CmdLineParameters |
| 389 Var SVV_InstType |
| 390 Var SVV_SelChangeInProgress |
| 391 |
| 392 !include "FileFunc.nsh" |
| 393 |
| 394 END |
| 395 fi |
| 396 for pkgname in "${allinstalledpackages[@]}" ; do |
| 397 sanitized_name["$pkgname"]="`sanitize_var_name \"$pkgname\"`" |
| 398 outlist="$outlist |
| 399 Var PKV_${sanitized_name[$pkgname]}" |
| 400 done |
| 401 echo "$outlist" | sort |
| 402 local secname |
| 403 for secname in "${!category_contents[@]}" ; do |
| 404 echo "$secname" |
| 405 done | sort | |
| 406 while read -r secname ; do |
| 407 local pkgname |
| 408 for pkgname in ${category_contents["$secname"]} ; do |
| 409 echo "$pkgname" |
| 410 done | sort | |
| 411 while read -r pkgname ; do |
| 412 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 413 echo "Var sv_${secname}_${sanitized_name[$pkgname]}" |
| 414 fi |
| 415 done |
| 416 done | |
| 417 sort |
| 418 } |
| 419 |
| 420 generate_unpack_tarball_text() { |
| 421 # $1 - package to unpack |
| 422 echo " SetOutPath \$INSTDIR" |
| 423 local pkgname="$1" |
| 424 if [[ "$pkgname" != "" ]] ; then |
| 425 pkgname="`basename ${install[$pkgname]/.tar.bz2*/.tar.bz2}`" |
| 426 fi |
| 427 if [[ "$pkgname" != "" ]] ; then |
| 428 local pkgcontent="`tar tSvpf packages/$pkgname\"\" --numeric-owner`" |
| 429 local attrs uidgid size date time filename |
| 430 local -A createddirs |
| 431 createddirs[0]="done" |
| 432 echo "$pkgcontent" | grep "^[dhl-]" | |
| 433 while read -r attrs uidgid size date time filename ; do |
| 434 if [[ "${attrs:0:1}" = "h" ]] ; then |
| 435 filename="${filename%/* link to *}/" |
| 436 elif [[ "${attrs:0:1}" = "l" ]] ; then |
| 437 filename="${filename%/* -> *}/" |
| 438 elif [[ "${attrs:0:1}" = "-" ]] ; then |
| 439 if [[ "$filename" = */* ]] ; then |
| 440 filename="${filename%/*}/" |
| 441 else |
| 442 filename="" |
| 443 fi |
| 444 fi |
| 445 if [[ "$filename" = "usr/share/terminfo/e/" ]] ; then |
| 446 filename="usr/share/terminfo/E/" |
| 447 fi |
| 448 if [[ "${filename:0:8}" = "usr/bin/" ]] ; then |
| 449 filename="bin/${filename:8}" |
| 450 elif [[ "${filename:0:8}" = "usr/lib/" ]] ; then |
| 451 filename="lib/${filename:8}" |
| 452 fi |
| 453 if [[ "$filename" != "" ]] ; then |
| 454 filename="${filename:0:$((${#filename}-1))}" |
| 455 if [[ "${createddirs[$filename]}" != "done" ]] ; then |
| 456 echo " CreateDirectory \"\$INSTDIR\\${prefix[$1]}${filename//\//\\}\"
" |
| 457 createddirs["$filename"]="done" |
| 458 fi |
| 459 fi |
| 460 done |
| 461 if [[ "$1" = "libgcj-common" ]] ; then |
| 462 echo " CreateDirectory \"\$INSTDIR\\${prefix[$1]}lib\\security\"" |
| 463 fi |
| 464 if [[ "$1" == "cygwin" ]] ; then |
| 465 echo " File \"/oname=Cygwin.ico\" \"setup\\Cygwin.ico\"" |
| 466 fi |
| 467 echo "$pkgcontent" | grep "^-" | |
| 468 while read -r attrs uidgid size date time filename ; do |
| 469 if [[ "$filename" != "usr/share/WindowMaker/Icons/DefaultAppIcon.tiff" ]]
&& |
| 470 [[ "$filename" != "usr/share/ri/1.8/system/Exception2MessageMapper/fail
-i.yaml" ]] && |
| 471 [[ "$filename" != "usr/share/ri/1.8/system/REXML/Parsers/XPathParser/pr
edicate-i.yaml" ]] ; then |
| 472 local fname |
| 473 if [[ "${filename:0:8}" = "usr/bin/" ]] ; then |
| 474 fname="bin/${filename:8}" |
| 475 elif [[ "${filename:0:8}" = "usr/lib/" ]] ; then |
| 476 fname="lib/${filename:8}" |
| 477 elif [[ "$filename" = "usr/share/terminfo/e/Eterm" ]] ; then |
| 478 fname="usr/share/terminfo/E/Eterm" |
| 479 else |
| 480 fname="$filename" |
| 481 fi |
| 482 fname="${fname//\//\\}" |
| 483 fname="${fname//\$/\$\$}" |
| 484 filename="${filename//\//\\}" |
| 485 echo " File \"/oname=${prefix[$1]}$fname\" \"packages.unpacked\\$pkgnam
e\\$filename\"" |
| 486 fi |
| 487 done |
| 488 echo " File \"/oname=${prefix[coreutils]}etc\\setup\\$1.lst.gz\" \"setup\\$
1.lst.gz\"" |
| 489 echo "$pkgcontent" | grep "^h" | |
| 490 while read -r attrs uidgid size date time filename ; do |
| 491 local linkname="${filename/ link to */}" |
| 492 local linktargetname="${filename/* link to /}" |
| 493 if [[ "${linkname:0:8}" = "usr/bin/" ]] ; then |
| 494 linkname="bin/${linkname:8}" |
| 495 elif [[ "${linkname:0:8}" = "usr/lib/" ]] ; then |
| 496 linkname="lib/${linkname:8}" |
| 497 fi |
| 498 if [[ "${linktargetname:0:8}" = "usr/bin/" ]] ; then |
| 499 linktargetname="bin/${linktargetname:8}" |
| 500 elif [[ "${linktargetname:0:8}" = "usr/lib/" ]] ; then |
| 501 linktargetname="lib/${linktargetname:8}" |
| 502 fi |
| 503 linkname="${linkname//\//\\}" |
| 504 linkname="${linkname//\$/\$\$}" |
| 505 linktargetname="${linktargetname//\//\\}" |
| 506 linktargetname="${linktargetname//\$/\$\$}" |
| 507 echo " MkLink::Hard \"\$INSTDIR\\${prefix[$1]}$linkname\" \"\$INSTDIR\\${
prefix[$1]}$linktargetname\"" |
| 508 done |
| 509 echo "$pkgcontent" | grep "^l" | |
| 510 while read -r attrs uidgid size date time filename ; do |
| 511 local linkname="${filename/ -> */}" |
| 512 local linktargetname="${filename/* -> /}" |
| 513 if [[ "$linktargetname" = "/tmp/install/INSTALL/usr/share/doc/lynx/COPYHEA
DER" ]] ; then |
| 514 linktargetname="/usr/share/doc/lynx/COPYHEADER" |
| 515 elif [[ "$linktargetname" = "/tmp/install/INSTALL/usr/share/doc/lynx/COPYI
NG" ]] ; then |
| 516 linktargetname="/usr/share/doc/lynx/COPYING" |
| 517 elif [[ "$linktargetname" = "../Cygwin/stunnel-4.29.README" ]] ; then |
| 518 linktargetname="../Cygwin/stunnel.README" |
| 519 elif [[ "$linktargetname" = "../../CHANGELOG" ]] && |
| 520 [[ "$linkname" = "usr/X11R6/share/tcm-2.20/help/CHANGELOG" ]] ; then |
| 521 linktargetname="../../doc/tcm-2.20/CHANGELOG" |
| 522 elif [[ "$linktargetname" = "../../COPYING" ]] && |
| 523 [[ "$linkname" = "usr/X11R6/share/tcm-2.20/help/COPYING" ]] ; then |
| 524 linktargetname="../../doc/tcm-2.20/COPYING" |
| 525 elif [[ "$linktargetname" = "mf-nowin.1" ]] && |
| 526 [[ "$linkname" = "usr/share/man/mf.1" ]] ; then |
| 527 linkname="usr/share/man/man1/mf.1" |
| 528 linktargetname="../../../X11R6/share/man/man1/mf.1" |
| 529 elif [[ "$linktargetname" = "../N/NCR260VT300WPP0" ]] ; then |
| 530 linktargetname="../N/NCR260VT300WPP0" |
| 531 elif [[ "$linkname" = "usr/share/terminfo/e/Eterm-color" ]] ; then |
| 532 linkname="usr/share/terminfo/E/Eterm-color" |
| 533 elif [[ "$linktargetname" = "../../include/qt3" ]] && |
| 534 [[ "$linkname" = "usr/lib/qt3/include" ]] ; then |
| 535 linktargetname= "../../usr/include/qt4" |
| 536 elif [[ "$linktargetname" = "../../include/qt4" ]] && |
| 537 [[ "$linkname" = "usr/lib/qt4/include" ]] ; then |
| 538 linktargetname= "../../usr/include/qt4" |
| 539 elif [[ "${linktargetname:0:2}" = "./" ]] ; then |
| 540 linktargetname="${linktargetname:2}" |
| 541 elif [[ "${linkname:0:8}" = "usr/bin/" ]] ; then |
| 542 linkname="bin/${linkname:8}" |
| 543 elif [[ "${linkname:0:8}" = "usr/lib/" ]] ; then |
| 544 linkname="lib/${linkname:8}" |
| 545 fi |
| 546 if [[ "${linkname%/*}/$linktargetname" = *//* ]] ; then |
| 547 linktargetname="/${linkname%/*}/$linktargetname" |
| 548 while [[ "$linktargetname" != //* ]] ; do |
| 549 linktargetname="${linktargetname%/*//*}//../${linktargetname#*//}" |
| 550 done |
| 551 linktargetname="${linktargetname:2}" |
| 552 fi |
| 553 local linktargetfile="/${linkname%/*}/$linktargetname" |
| 554 while [[ "$linktargetfile" = */../* ]] ; do |
| 555 local linktargetprefix="${linktargetfile%%/../*}" |
| 556 local linktargetsuffix="${linktargetfile#*/../}" |
| 557 linktargetfile="${linktargetprefix%/*}/$linktargetsuffix" |
| 558 done |
| 559 if [[ "${linktargetfile:0:9}" = "/usr/bin/" ]] ; then |
| 560 linktargetfile="bin/${linktargetfile:9}" |
| 561 elif [[ "${linktargetfile:0:9}" = "/usr/lib/" ]] ; then |
| 562 linktargetfile="lib/${linktargetfile:9}" |
| 563 else |
| 564 linktargetfile="${linktargetfile:1}" |
| 565 fi |
| 566 linkname="${linkname//\//\\}" |
| 567 linkname="${linkname//\$/\$\$}" |
| 568 if [[ "${filetype[$linktargetfile]}" = "file" ]] ; then |
| 569 linktargetname="${linktargetname//\//\\}" |
| 570 linktargetname="${linktargetname//\$/\$\$}" |
| 571 if [[ "${linkname:$((${#linkname}-4))}" = ".exe" ]] || |
| 572 [[ "${linktargetfile:$((${#linktargetfile}-4))}" != ".exe" ]] ; then |
| 573 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname\" \"$linktar
getname\"" |
| 574 else |
| 575 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname.exe\" \"$lin
ktargetname\"" |
| 576 fi |
| 577 elif [[ "${filetype[$linktargetfile.exe]}" = "file" ]] ; then |
| 578 linktargetname="${linktargetname//\//\\}" |
| 579 linktargetname="${linktargetname//\$/\$\$}" |
| 580 if [[ "${linkname:$((${#linkname}-4))}" = ".exe" ]] ; then |
| 581 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname\" \"$linktar
getname.exe\"" |
| 582 else |
| 583 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname.exe\" \"$lin
ktargetname.exe\"" |
| 584 fi |
| 585 elif [[ "${filetype[$linktargetfile]}" = "directory" ]] ; then |
| 586 linktargetname="${linktargetname//\//\\}" |
| 587 linktargetname="${linktargetname//\$/\$\$}" |
| 588 echo " MkLink::SoftD \"\$INSTDIR\\${prefix[$1]}$linkname\" \"$linktarge
tname\"" |
| 589 elif [ -f packages.unpacked/*/"$linktargetfile" ] ; then |
| 590 linktargetname="${linktargetname//\//\\}" |
| 591 linktargetname="${linktargetname//\$/\$\$}" |
| 592 if [[ "${linkname:$((${#linkname}-4))}" = ".exe" ]] || |
| 593 [[ "${linktargetfile:$((${#linktargetfile}-4))}" != ".exe" ]] ; then |
| 594 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname\" \"$linktar
getname\"" |
| 595 else |
| 596 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname.exe\" \"$lin
ktargetname\"" |
| 597 fi |
| 598 elif [ -d packages.unpacked/*/"$linktargetfile" ] ; then |
| 599 linktargetname="${linktargetname//\//\\}" |
| 600 linktargetname="${linktargetname//\$/\$\$}" |
| 601 echo " MkLink::SoftD \"\$INSTDIR\\${prefix[$1]}$linkname\" \"$linktarge
tname\"" |
| 602 elif [[ "$linktargetname" = "../share/webcheck/webcheck.py" ]] ; then |
| 603 echo " MkLink::SoftF \"\$INSTDIR\\${prefix[$1]}$linkname\" \"..\\share\
\webcheck\\webcheck.py\"" |
| 604 else |
| 605 echo "Can not determine the type of link \"$linktargetname\"" >&2 |
| 606 exit 1 |
| 607 fi |
| 608 done |
| 609 echo "$pkgcontent" | |
| 610 grep "^-.............................................. etc/postinstall/.*\\.
sh" | |
| 611 while read -r attrs uidgid size date time filename ; do |
| 612 cat <<END |
| 613 FileOpen \$R0 \$INSTDIR\\postinstall.sh a |
| 614 FileSeek \$R0 0 END |
| 615 FileWrite \$R0 "/$filename\$\n" |
| 616 FileClose \$R0 |
| 617 END |
| 618 # If we have a postinstall script we need coreutils to execute it! |
| 619 if ! [[ " ${requires[$pkgname]} " = *" coreutils "* ]] ; then |
| 620 requires["$pkgname"]="${requires[$pkgname]} coreutils" |
| 621 fi |
| 622 if ! [[ " ${required[coreutils]} " = *" $pkgname "* ]] ; then |
| 623 required["coreutils"]="${requires[coreutils]} $pkgname" |
| 624 fi |
| 625 done |
| 626 cat <<END |
| 627 Push \$R0 |
| 628 FileOpen \$R0 \$INSTDIR\\etc\\setup\\installed.log a |
| 629 FileSeek \$R0 0 END |
| 630 FileWrite \$R0 "$1 $pkgname 0\$\n" |
| 631 FileClose \$R0 |
| 632 Pop \$R0 |
| 633 END |
| 634 fi |
| 635 } |
| 636 |
| 637 generate_section_list() { |
| 638 if ((verbose)) ; then echo "Declaring unpack sections..." >&2 ; fi |
| 639 local secname |
| 640 for secname in "${!category_contents[@]}" ; do |
| 641 echo "$secname" |
| 642 done | sort | |
| 643 while read -r secname ; do |
| 644 local pkgname groupprint=1 |
| 645 for pkgname in ${category_contents["$secname"]} ; do |
| 646 echo "$pkgname" |
| 647 done | sort | |
| 648 { local groupprint=1 |
| 649 while read -r pkgname ; do |
| 650 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 651 if ((groupprint)) ; then |
| 652 if [[ "$secname" != "_PostInstallLast" ]] && |
| 653 [[ "$secname" != "_obsolete" ]] ; then |
| 654 echo "SectionGroup \"$secname\" sec_$secname" |
| 655 groupprint=0 |
| 656 fi |
| 657 fi |
| 658 local insttar="${install[$pkgname]/.tar.bz2*/}" |
| 659 if [[ "$secname" = "_PostInstallLast" ]] || |
| 660 [[ "$secname" = "_obsolete" ]] ; then |
| 661 echo -n "Section \"-${insttar/*\//}\" " |
| 662 elif [[ " ${seed[$pkgname]} " == *" $definsttype "* ]] ; then |
| 663 echo -n "Section \"!${insttar/*\//}\" " |
| 664 else |
| 665 echo -n "Section \"${insttar/*\//}\" " |
| 666 fi |
| 667 echo "sec_${secname}_${sanitized_name[$pkgname]}" |
| 668 echo " SectionIn${sectionin[$pkgname]}" |
| 669 echo "SectionEnd" |
| 670 fi |
| 671 done |
| 672 if ((!groupprint)) ; then |
| 673 echo "SectionGroupEnd" |
| 674 fi |
| 675 } |
| 676 done |
| 677 for secname in "${allinstalledpackages[@]}" ; do |
| 678 if ((verbose)) ; then echo "Package "$secname"..." >&2 ; fi |
| 679 echo "Section \"\" sec_PKG_${sanitized_name[$secname]}" |
| 680 echo " SectionIn${sectionin[$secname]}" |
| 681 generate_unpack_tarball_text "$secname" |
| 682 echo "SectionEnd" |
| 683 done |
| 684 echo "!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN" |
| 685 for secname in "${!category_contents[@]}" ; do |
| 686 echo "$secname" |
| 687 done | sort | |
| 688 while read -r secname ; do |
| 689 local pkgname |
| 690 for pkgname in ${category_contents["$secname"]} ; do |
| 691 echo "$pkgname" |
| 692 done | sort | |
| 693 { local groupprint=1 |
| 694 while read -r pkgname ; do |
| 695 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 696 if ((groupprint)) ; then |
| 697 if [[ "$secname" != "_PostInstallLast" ]] && |
| 698 [[ "$secname" != "_obsolete" ]] ; then |
| 699 echo " !insertmacro MUI_DESCRIPTION_TEXT \${sec_$secname} \"\"" |
| 700 groupprint=0 |
| 701 fi |
| 702 fi |
| 703 echo -n " !insertmacro MUI_DESCRIPTION_TEXT \${" |
| 704 echo -n "sec_${secname}_${sanitized_name[$pkgname]}} " |
| 705 # Modern UI does not like long descriptions |
| 706 #if [ "${sdesc[$pkgname]}" != "" ] ; then |
| 707 #echo "${ldesc[$pkgname]}" |
| 708 #else |
| 709 echo "${sdesc[$pkgname]}" |
| 710 #fi |
| 711 fi |
| 712 done |
| 713 } |
| 714 done |
| 715 echo "!insertmacro MUI_FUNCTION_DESCRIPTION_END" |
| 716 } |
| 717 |
| 718 generate_init_function() { |
| 719 # $1 - Section number for first options (others should follow) |
| 720 if ((verbose)) ; then echo "Declaring .onInit function..." >&2 ; fi |
| 721 echo "Function .onInit" |
| 722 if [[ "$defpackage" != "NONE" ]] ; then |
| 723 echo " StrCpy \$SVV_InstType $(($definsttype-1))" |
| 724 echo " StrCpy \$SVV_SelChangeInProgress 0" |
| 725 fi |
| 726 local pkgname |
| 727 for pkgname in "${allinstalledpackages[@]}" ; do |
| 728 if [[ " ${seed[$pkgname]} " == *" $definsttype "* ]] ; then |
| 729 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 9" |
| 730 elif [[ " ${sectionin[$pkgname]} " == *" $definsttype "* ]] ; then |
| 731 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 1" |
| 732 else |
| 733 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 0" |
| 734 fi |
| 735 done |
| 736 local secname |
| 737 for secname in "${!category_contents[@]}" ; do |
| 738 echo "$secname" |
| 739 done | sort | |
| 740 while read -r secname ; do |
| 741 local pkgname |
| 742 for pkgname in ${category_contents["$secname"]} ; do |
| 743 echo "$pkgname" |
| 744 done | sort | |
| 745 while read -r pkgname ; do |
| 746 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 747 if [[ " ${sectionin[$pkgname]} " == *" $definsttype "* ]] ; then |
| 748 echo " StrCpy \$sv_${secname}_${sanitized_name[$pkgname]} 1" |
| 749 else |
| 750 echo " StrCpy \$sv_${secname}_${sanitized_name[$pkgname]} 0" |
| 751 fi |
| 752 fi |
| 753 done |
| 754 done |
| 755 if [[ "$defpackage" != "NONE" ]] ; then |
| 756 if ((definsttype!=1)) ; then |
| 757 echo " SetCurInstType $((definsttype-1))" |
| 758 fi |
| 759 fi |
| 760 cat <<END |
| 761 \${GetParameters} \$SVV_CmdLineParameters |
| 762 Push \$R0 |
| 763 ClearErrors |
| 764 \${GetOptions} \$cmdLineParams "/?" \$R0 |
| 765 IfErrors +1 HelpMessage |
| 766 \${GetOptions} \$cmdLineParams "--help" \$R0 |
| 767 IfErrors +3 +1 |
| 768 HelpMessage: |
| 769 END |
| 770 echo -n " MessageBox MB_OK \"Recognized common options:" |
| 771 echo -n "\$\\n /D=InstDir - use InstDir as target instead of usual \$INSTDIR" |
| 772 echo -n "\$\\n /NCRC - disables the CRC check" |
| 773 echo -n "\$\\n /S - Silent install" |
| 774 if [[ "$defpackage" != "NONE" ]] ; then |
| 775 local insttype line |
| 776 echo -n "\$\\nRecognized install type options:" |
| 777 echo -n "\$\\n /FULL - Install all availabile packages" |
| 778 for insttype in "${!packages[@]}" ; do |
| 779 echo "\$\\n /`echo \"$insttype\" | tr 'a-z' 'A-Z'` - ${description[$instt
ype]}" |
| 780 done | sort | |
| 781 while read -r line ; do |
| 782 echo -n "$line" |
| 783 done |
| 784 echo -n "\$\\n /MINIMAL - Install only packages from \$\\\"Base\$\\\" categ
ory" |
| 785 fi |
| 786 echo "\"" |
| 787 echo " Abort" |
| 788 if [[ "$defpackage" != "NONE" ]] ; then |
| 789 local sectionN="$(($1-1))" |
| 790 local IFS=$'\n' |
| 791 for insttype in ` |
| 792 echo "Full" |
| 793 for insttype in "${!packages[@]}" ; do |
| 794 echo $insttype |
| 795 done | sort |
| 796 echo "Minimal" |
| 797 ` ; do |
| 798 echo " \${GetOptions} \$cmdLineParams \"/`echo \"$insttype\" | tr 'a-z' '
A-Z'`\" \$R0" |
| 799 echo " IfErrors No_$insttype +1" |
| 800 echo " StrCpy \$SVV_InstType $((sectionN-1))" |
| 801 for pkgname in "${allinstalledpackages[@]}" ; do |
| 802 if [[ " ${seed[$pkgname]} " == *" $sectionN "* ]] ; then |
| 803 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 9" |
| 804 elif [[ " ${sectionin[$pkgname]} " == *" $sectionN "* ]] ; then |
| 805 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 1" |
| 806 else |
| 807 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 0" |
| 808 fi |
| 809 done |
| 810 for secname in "${!category_contents[@]}" ; do |
| 811 echo "$secname" |
| 812 done | sort | |
| 813 while read -r secname ; do |
| 814 local pkgname |
| 815 for pkgname in ${category_contents["$secname"]} ; do |
| 816 echo "$pkgname" |
| 817 done | sort | |
| 818 while read -r pkgname ; do |
| 819 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 820 if [[ " ${sectionin[$pkgname]} " == *" $sectionN "* ]] ; then |
| 821 echo " StrCpy \$sv_${secname}_${sanitized_name[$pkgname]} 1" |
| 822 else |
| 823 echo " StrCpy \$sv_${secname}_${sanitized_name[$pkgname]} 0" |
| 824 fi |
| 825 fi |
| 826 done |
| 827 done |
| 828 for pkgname in "${allinstalledpackages[@]}" ; do |
| 829 if [[ " ${seed[$pkgname]} " == *" $sectionN "* ]] ; then |
| 830 echo " SectionSetFlags \${sec_PKG_${sanitized_name[$pkgname]}} 9" |
| 831 elif [[ " ${sectionin[$pkgname]} " == *" $sectionN "* ]] ; then |
| 832 echo " SectionSetFlags \${sec_PKG_${sanitized_name[$pkgname]}} 1" |
| 833 else |
| 834 echo " SectionSetFlags \${sec_PKG_${sanitized_name[$pkgname]}} 0" |
| 835 fi |
| 836 done |
| 837 for secname in "${!category_contents[@]}" ; do |
| 838 echo "$secname" |
| 839 done | sort | |
| 840 while read -r secname ; do |
| 841 local pkgname |
| 842 for pkgname in ${category_contents["$secname"]} ; do |
| 843 echo "$pkgname" |
| 844 done | sort | |
| 845 while read -r pkgname ; do |
| 846 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 847 if [[ " ${seed[$pkgname]} " == *" $sectionN "* ]] ; then |
| 848 echo " SectionSetFlags \${sec_${secname}_${sanitized_name[$pkgnam
e]}} 9" |
| 849 elif [[ " ${sectionin[$pkgname]} " == *" $sectionN "* ]] ; then |
| 850 echo " SectionSetFlags \${sec_${secname}_${sanitized_name[$pkgnam
e]}} 1" |
| 851 else |
| 852 echo " SectionSetFlags \${sec_${secname}_${sanitized_name[$pkgnam
e]}} 0" |
| 853 fi |
| 854 fi |
| 855 done |
| 856 done |
| 857 echo " SetCurInstType $((sectionN-1))" |
| 858 echo "No_$insttype:" |
| 859 ((sectionN++)) |
| 860 done |
| 861 fi |
| 862 echo " Pop \$R0" |
| 863 echo "FunctionEnd" |
| 864 } |
| 865 |
| 866 generate_onselchange_function(){ |
| 867 if ((verbose)) ; then echo "Declaring .onSelChange function..." >&2 ; fi |
| 868 cat <<END |
| 869 Function .onSelChange |
| 870 IntCmp \$SVV_SelChangeInProgress 0 +1 L1_SelChangeInProgress L1_SelChangeInPro
gress |
| 871 StrCpy \$SVV_SelChangeInProgress 1 |
| 872 Push \$R0 |
| 873 Push \$R1 |
| 874 END |
| 875 if [[ "$defpackage" != "NONE" ]] ; then |
| 876 cat <<END |
| 877 Push \$R2 |
| 878 GetCurInstType \$R0 |
| 879 StrCpy \$R2 0 |
| 880 IntCmp \$R0 \$SVV_InstType +4 +1 +1 |
| 881 StrCpy \$SVV_InstType \$R0 |
| 882 IntCmp \$R0 \${NSIS_MAX_INST_TYPES} +2 +1 +1 |
| 883 StrCpy \$R2 1 |
| 884 END |
| 885 fi |
| 886 # sv_XXX/PKV_XXX variables contain information about previous state of affairs |
| 887 # Note: there are three states - 0 (not to be installed), 9 (to be installed) |
| 888 # and 1 (will be installed because some other package needs it). |
| 889 # First we check is some packages were deselected and remove all packages |
| 890 # which can not be installed now. |
| 891 local secname pkgname subpkgname |
| 892 for secname in "${!category_contents[@]}" ; do |
| 893 echo "$secname" |
| 894 done | sort | |
| 895 while read -r secname ; do |
| 896 local pkgname |
| 897 for pkgname in ${category_contents["$secname"]} ; do |
| 898 echo "$pkgname" |
| 899 done | sort | |
| 900 while read -r pkgname ; do |
| 901 if ((verbose)) ; then echo "Read state: \"$pkgname\"..." >&2 ; fi |
| 902 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 903 local PKV_name="PKV_${sanitized_name[$pkgname]}" |
| 904 local sc_name="${secname}_${sanitized_name[$pkgname]}" |
| 905 echo " SectionGetFlags \${sec_$sc_name} \$R0" |
| 906 echo " IntOp \$R1 \$R0 & \${SF_SELECTED}" |
| 907 echo " IntCmp \$sv_$sc_name \$R1 L3_$sc_name" |
| 908 echo " IntCmp \$sv_$sc_name 0 L1_$sc_name" |
| 909 echo " StrCpy \$$PKV_name 0" |
| 910 for subpkgname in ${required["$pkgname"]} ; do |
| 911 if [[ "${allinstpackages[$subpkgname]}" = "present" ]] ; then |
| 912 echo " StrCpy \$PKV_${sanitized_name[$subpkgname]} 0" |
| 913 fi |
| 914 done |
| 915 echo " Goto L3_$sc_name" |
| 916 echo "L1_$sc_name:" |
| 917 if [[ "$defpackage" != "NONE" ]] ; then |
| 918 echo " IntCmp \$R2 0 L2_$sc_name +1 +1" |
| 919 for subpkgname in ${seed["$pkgname"]} ; do |
| 920 echo " IntCmp \$SVV_InstType $((subpkgname-1)) L2_$sc_name +1 +1" |
| 921 done |
| 922 echo " GoTo L3_$sc_name" |
| 923 echo "L2_$sc_name:" |
| 924 fi |
| 925 echo " StrCpy \$$PKV_name 9" |
| 926 echo "L3_$sc_name:" |
| 927 fi |
| 928 done |
| 929 done |
| 930 # Now we mark all packages which can be installed or not installed as |
| 931 # not-installed |
| 932 for pkgname in "${allinstalledpackages[@]}" ; do |
| 933 echo " IntCmp \$PKV_${sanitized_name[$pkgname]} 9 +2 +1 +2" |
| 934 echo " StrCpy \$PKV_${sanitized_name[$pkgname]} 0" |
| 935 done |
| 936 # Put the dependences back |
| 937 for pkgname in "${allinstalledpackages[@]}" ; do |
| 938 if ((verbose)) ; then echo "Set state: \"$pkgname\"..." >&2 ; fi |
| 939 echo " IntCmp \$PKV_${sanitized_name[$pkgname]} 9 +1 L4_${sanitized_name[$p
kgname]} +1" |
| 940 for subpkgname in ${requires["$pkgname"]} ; do |
| 941 echo " IntCmp \$PKV_${sanitized_name[$subpkgname]} 9 +2 +1 +2" |
| 942 echo " StrCpy \$PKV_${sanitized_name[$subpkgname]} 1" |
| 943 done |
| 944 echo "L4_${sanitized_name[$pkgname]}:" |
| 945 done |
| 946 # Copy the calculated new state to the screen |
| 947 for pkgname in "${allinstalledpackages[@]}" ; do |
| 948 echo " SectionSetFlags \${sec_PKG_${sanitized_name[$pkgname]}} \$PKV_${sani
tized_name[$pkgname]}" |
| 949 done |
| 950 for secname in "${!category_contents[@]}" ; do |
| 951 echo "$secname" |
| 952 done | sort | |
| 953 while read -r secname ; do |
| 954 local pkgname |
| 955 for pkgname in ${category_contents["$secname"]} ; do |
| 956 echo "$pkgname" |
| 957 done | sort | |
| 958 while read -r pkgname ; do |
| 959 if [[ "${allinstpackages[$pkgname]}" = "present" ]] ; then |
| 960 echo " IntOp \$sv_${secname}_${sanitized_name[$pkgname]} \$PKV_${saniti
zed_name[$pkgname]} & 1" |
| 961 echo " SectionSetFlags \${sec_${secname}_${sanitized_name[$pkgname]}} \
$PKV_${sanitized_name[$pkgname]}" |
| 962 fi |
| 963 done |
| 964 done |
| 965 if [[ "$defpackage" != "NONE" ]] ; then |
| 966 echo " Pop \$R2" |
| 967 fi |
| 968 cat <<END |
| 969 Pop \$R1 |
| 970 Pop \$R0 |
| 971 StrCpy \$SVV_SelChangeInProgress 0 |
| 972 L1_SelChangeInProgress: |
| 973 FunctionEnd |
| 974 END |
| 975 } |
OLD | NEW |