~skss/live-usb-install/live-usb-install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;SetCompressor ZLIB
SetCompressor /SOLID lzma
;SetCompress 	off

VIProductVersion "2.1.7.0"
VIAddVersionKey "FileVersion" "2.1.7.0"
VIAddVersionKey "CompanyName" "SKSS"
VIAddVersionKey "LegalCopyright" "©2010 lokster"
VIAddVersionKey "FileDescription" "live-usb-install"
OutFile ..\dist\live-usb-install-2.2.1.exe


SilentInstall silent
Icon .\live-usb-install.ico


; GetParameters
; input, none
; output, top of stack (replaces, with e.g. whatever)
; modifies no other variables.
Function GetParameters
 
	Push $R0
	Push $R1
	Push $R2
	Push $R3

	StrCpy $R2 1
	StrLen $R3 $CMDLINE

	;Check for quote or space
	StrCpy $R0 $CMDLINE $R2
	StrCmp $R0 '"' 0 +3
		StrCpy $R1 '"'
		Goto loop
	StrCpy $R1 " "
 
	loop:
		IntOp $R2 $R2 + 1
		StrCpy $R0 $CMDLINE 1 $R2
		StrCmp $R0 $R1 get
		StrCmp $R2 $R3 get
		Goto loop
	 
	get:
		IntOp $R2 $R2 + 1
		StrCpy $R0 $CMDLINE 1 $R2
		StrCmp $R0 " " get
		StrCpy $R0 $CMDLINE "" $R2

	Pop $R3
	Pop $R2
	Pop $R1
	Exch $R0
 
FunctionEnd

Section Main 

	InitPluginsDir
	SetOutPath "$PLUGINSDIR"
	File "splash.jpg"
	newadvsplash::show /NOUNLOAD 10000 1000 500 -1 /BANNER "$PLUGINSDIR\splash.jpg"
	
	SetOutPath "$TEMP\live-usb-install"
	SetOverwrite on
	File /r "..\build\windows\live-usb-install\*.*"
	
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("GTK_BASEPATH", ".\GTK").r0'
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("GTK2R_PREFIX", ".\GTK\bin").r0'
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("LIB", ".\GTK\lib").r0'
	ReadEnvStr $R0 "PATH"
	StrCpy $R0 "$R0;.\GTK\bin;.\lib;.\"
	System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r0'

	Call GetParameters
	Pop $R0
	ExecWait "$OUTDIR\live-usb-install.exe"
	RMDir /r $OUTDIR
SectionEnd