Mercurial > pidgin
comparison gaim-installer.nsi @ 14377:f5f2c3948b48
[gaim-migrate @ 17083]
Installer cleanup - use NSIS built-in stuff instead of writing our own
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 30 Aug 2006 03:46:34 +0000 |
parents | b2d0b4ca2cf3 |
children | 1a01b1dae517 |
comparison
equal
deleted
inserted
replaced
14376:b2d0b4ca2cf3 | 14377:f5f2c3948b48 |
---|---|
8 ;-------------------------------- | 8 ;-------------------------------- |
9 ;Global Variables | 9 ;Global Variables |
10 Var name | 10 Var name |
11 Var GTK_FOLDER | 11 Var GTK_FOLDER |
12 Var GTK_THEME_SEL | 12 Var GTK_THEME_SEL |
13 Var LANG_IS_SET | |
14 Var ISSILENT | 13 Var ISSILENT |
15 Var STARTUP_RUN_KEY | 14 Var STARTUP_RUN_KEY |
16 Var SPELLCHECK_SEL | 15 Var SPELLCHECK_SEL |
17 | 16 |
18 ;-------------------------------- | 17 ;-------------------------------- |
38 | 37 |
39 ; $name and $INSTDIR are set in .onInit function.. | 38 ; $name and $INSTDIR are set in .onInit function.. |
40 | 39 |
41 !include "MUI.nsh" | 40 !include "MUI.nsh" |
42 !include "Sections.nsh" | 41 !include "Sections.nsh" |
42 !include "FileFunc.nsh" | |
43 | |
44 !insertmacro GetParameters | |
45 !insertmacro GetOptions | |
46 !insertmacro GetParent | |
43 | 47 |
44 ;-------------------------------- | 48 ;-------------------------------- |
45 ;Defines | 49 ;Defines |
46 | 50 |
47 !define GAIM_NSIS_INCLUDE_PATH ".\gtk\win32\nsis" | 51 !define GAIM_NSIS_INCLUDE_PATH ".\gtk\win32\nsis" |
935 Push $1 | 939 Push $1 |
936 Push $2 | 940 Push $2 |
937 Loop: | 941 Loop: |
938 IfFileExists $0 dir_exists | 942 IfFileExists $0 dir_exists |
939 StrCpy $1 $0 ; save last | 943 StrCpy $1 $0 ; save last |
940 Push $0 | 944 ${GetParent} $0 $0 |
941 Call GetParent | |
942 Pop $0 | |
943 StrLen $2 $0 | 945 StrLen $2 $0 |
944 ; IfFileExists "C:" on xp returns true and on win2k returns false | 946 ; IfFileExists "C:" on xp returns true and on win2k returns false |
945 ; So we're done in such a case.. | 947 ; So we're done in such a case.. |
946 IntCmp $2 2 loop_done | 948 IntCmp $2 2 loop_done |
947 ; GetParent of "C:" returns "" | 949 ; GetParent of "C:" returns "" |
999 Abort | 1001 Abort |
1000 | 1002 |
1001 dir_good: | 1003 dir_good: |
1002 Pop $0 | 1004 Pop $0 |
1003 FunctionEnd | 1005 FunctionEnd |
1004 | |
1005 ; GetParent | |
1006 ; input, top of stack (e.g. C:\Program Files\Poop) | |
1007 ; output, top of stack (replaces, with e.g. C:\Program Files) | |
1008 ; modifies no other variables. | |
1009 ; | |
1010 ; Usage: | |
1011 ; Push "C:\Program Files\Directory\Whatever" | |
1012 ; Call GetParent | |
1013 ; Pop $R0 | |
1014 ; ; at this point $R0 will equal "C:\Program Files\Directory" | |
1015 Function GetParent | |
1016 Exch $0 ; old $0 is on top of stack | |
1017 Push $1 | |
1018 Push $2 | |
1019 StrCpy $1 -1 | |
1020 loop: | |
1021 StrCpy $2 $0 1 $1 | |
1022 StrCmp $2 "" exit | |
1023 StrCmp $2 "\" exit | |
1024 IntOp $1 $1 - 1 | |
1025 Goto loop | |
1026 exit: | |
1027 StrCpy $0 $0 $1 | |
1028 Pop $2 | |
1029 Pop $1 | |
1030 Exch $0 ; put $0 on top of stack, restore $0 to original value | |
1031 FunctionEnd | |
1032 | |
1033 | 1006 |
1034 ; CheckGtkVersion | 1007 ; CheckGtkVersion |
1035 ; inputs: Push 2 GTK+ version strings to check. The major value needs to | 1008 ; inputs: Push 2 GTK+ version strings to check. The major value needs to |
1036 ; be equal and the minor value needs to be greater or equal. | 1009 ; be equal and the minor value needs to be greater or equal. |
1037 ; | 1010 ; |
1219 ; If gaim installer was run silently, we want to supress gtk installer msg boxes. | 1192 ; If gaim installer was run silently, we want to supress gtk installer msg boxes. |
1220 IfSilent 0 set_gtk_normal | 1193 IfSilent 0 set_gtk_normal |
1221 StrCpy $ISSILENT "/S" | 1194 StrCpy $ISSILENT "/S" |
1222 set_gtk_normal: | 1195 set_gtk_normal: |
1223 | 1196 |
1224 Call ParseParameters | 1197 ${GetParameters} $R0 |
1198 ClearErrors | |
1199 ${GetOptions} $R0 "/L=" $LANGUAGE | |
1200 IfErrors 0 skip_lang | |
1225 | 1201 |
1226 ; Select Language | 1202 ; Select Language |
1227 IntCmp $LANG_IS_SET 1 skip_lang | |
1228 ; Display Language selection dialog | 1203 ; Display Language selection dialog |
1229 !insertmacro MUI_LANGDLL_DISPLAY | 1204 !insertmacro MUI_LANGDLL_DISPLAY |
1230 skip_lang: | 1205 skip_lang: |
1231 | 1206 |
1232 ; If install path was set on the command, use it. | 1207 ; If install path was set on the command, use it. |
1248 StrCmp $R0 "HKLM" 0 user_dir | 1223 StrCmp $R0 "HKLM" 0 user_dir |
1249 StrCpy $INSTDIR "$PROGRAMFILES\Gaim" | 1224 StrCpy $INSTDIR "$PROGRAMFILES\Gaim" |
1250 Goto instdir_done | 1225 Goto instdir_done |
1251 user_dir: | 1226 user_dir: |
1252 Push $SMPROGRAMS | 1227 Push $SMPROGRAMS |
1253 Call GetParent | 1228 ${GetParent} $SMPROGRAMS $R2 |
1254 Call GetParent | 1229 ${GetParent} $R2 $R2 |
1255 Pop $R2 | |
1256 StrCpy $INSTDIR "$R2\Gaim" | 1230 StrCpy $INSTDIR "$R2\Gaim" |
1257 | 1231 |
1258 instdir_done: | 1232 instdir_done: |
1259 Pop $R0 | 1233 Pop $R0 |
1260 FunctionEnd | 1234 FunctionEnd |
1379 ; Got no install rights.. | 1353 ; Got no install rights.. |
1380 Abort | 1354 Abort |
1381 no_gtk_cont: | 1355 no_gtk_cont: |
1382 ; Suggest path.. | 1356 ; Suggest path.. |
1383 StrCmp $R1 "HKCU" 0 hklm1 | 1357 StrCmp $R1 "HKCU" 0 hklm1 |
1384 StrCpy $R0 "$SMPROGRAMS" | 1358 ${GetParent} $SMPROGRAMS $R0 |
1385 Push $R0 | 1359 ${GetParent} $R0 $R0 |
1386 Call GetParent | |
1387 Call GetParent | |
1388 Pop $R0 | |
1389 StrCpy $R0 "$R0\GTK\2.0" | 1360 StrCpy $R0 "$R0\GTK\2.0" |
1390 Goto got_path | 1361 Goto got_path |
1391 hklm1: | 1362 hklm1: |
1392 StrCpy $R0 "${GTK_DEFAULT_INSTALL_PATH}" | 1363 StrCpy $R0 "${GTK_DEFAULT_INSTALL_PATH}" |
1393 | 1364 |
1409 Abort | 1380 Abort |
1410 done: | 1381 done: |
1411 Pop $R0 | 1382 Pop $R0 |
1412 FunctionEnd | 1383 FunctionEnd |
1413 !endif | 1384 !endif |
1414 | |
1415 ; GetParameters | |
1416 ; input, none | |
1417 ; output, top of stack (replaces, with e.g. whatever) | |
1418 ; modifies no other variables. | |
1419 Function GetParameters | |
1420 | |
1421 Push $R0 | |
1422 Push $R1 | |
1423 Push $R2 | |
1424 Push $R3 | |
1425 | |
1426 StrCpy $R2 1 | |
1427 StrLen $R3 $CMDLINE | |
1428 | |
1429 ;Check for quote or space | |
1430 StrCpy $R0 $CMDLINE $R2 | |
1431 StrCmp $R0 '"' 0 +3 | |
1432 StrCpy $R1 '"' | |
1433 Goto loop | |
1434 StrCpy $R1 " " | |
1435 | |
1436 loop: | |
1437 IntOp $R2 $R2 + 1 | |
1438 StrCpy $R0 $CMDLINE 1 $R2 | |
1439 StrCmp $R0 $R1 get | |
1440 StrCmp $R2 $R3 get | |
1441 Goto loop | |
1442 | |
1443 get: | |
1444 IntOp $R2 $R2 + 1 | |
1445 StrCpy $R0 $CMDLINE 1 $R2 | |
1446 StrCmp $R0 " " get | |
1447 StrCpy $R0 $CMDLINE "" $R2 | |
1448 | |
1449 Pop $R3 | |
1450 Pop $R2 | |
1451 Pop $R1 | |
1452 Exch $R0 | |
1453 | |
1454 FunctionEnd | |
1455 | |
1456 ; StrStr | |
1457 ; input, top of stack = string to search for | |
1458 ; top of stack-1 = string to search in | |
1459 ; output, top of stack (replaces with the portion of the string remaining) | |
1460 ; modifies no other variables. | |
1461 ; | |
1462 ; Usage: | |
1463 ; Push "this is a long ass string" | |
1464 ; Push "ass" | |
1465 ; Call StrStr | |
1466 ; Pop $R0 | |
1467 ; ($R0 at this point is "ass string") | |
1468 | |
1469 Function StrStr | |
1470 Exch $R1 ; st=haystack,old$R1, $R1=needle | |
1471 Exch ; st=old$R1,haystack | |
1472 Exch $R2 ; st=old$R1,old$R2, $R2=haystack | |
1473 Push $R3 | |
1474 Push $R4 | |
1475 Push $R5 | |
1476 StrLen $R3 $R1 | |
1477 StrCpy $R4 0 | |
1478 ; $R1=needle | |
1479 ; $R2=haystack | |
1480 ; $R3=len(needle) | |
1481 ; $R4=cnt | |
1482 ; $R5=tmp | |
1483 loop: | |
1484 StrCpy $R5 $R2 $R3 $R4 | |
1485 StrCmp $R5 $R1 done | |
1486 StrCmp $R5 "" done | |
1487 IntOp $R4 $R4 + 1 | |
1488 Goto loop | |
1489 done: | |
1490 StrCpy $R1 $R2 "" $R4 | |
1491 Pop $R5 | |
1492 Pop $R4 | |
1493 Pop $R3 | |
1494 Pop $R2 | |
1495 Exch $R1 | |
1496 FunctionEnd | |
1497 | |
1498 ; | |
1499 ; Parse the Command line | |
1500 ; | |
1501 ; Unattended install command line parameters | |
1502 ; /L=Language e.g.: /L=1033 | |
1503 ; | |
1504 Function ParseParameters | |
1505 Push $R0 | |
1506 IntOp $LANG_IS_SET 0 + 0 | |
1507 Call GetParameters | |
1508 ;Pop $R0 | |
1509 ;Push $R0 | |
1510 Push "L=" | |
1511 Call StrStr | |
1512 Pop $R0 | |
1513 StrCmp $R0 "" next | |
1514 StrCpy $R0 $R0 4 2 ; Strip first 2 chars of string | |
1515 StrCpy $LANGUAGE $R0 | |
1516 IntOp $LANG_IS_SET 0 + 1 | |
1517 next: | |
1518 Pop $R0 | |
1519 FunctionEnd | |
1520 | 1385 |
1521 ; GetWindowsVersion | 1386 ; GetWindowsVersion |
1522 ; | 1387 ; |
1523 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ | 1388 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ |
1524 ; Updated by Joost Verburg | 1389 ; Updated by Joost Verburg |