File: cpio_test.nsi

package info (click to toggle)
win32-loader 0.10.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,868 kB
  • sloc: ansic: 2,492; sh: 706; asm: 344; makefile: 338
file content (68 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download | duplicates (2)
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
; Licensed under the zlib/libpng license (same as NSIS)

; cpio test runner
; Run installer with the following arguments
;  /IN=<file> /OUT=<cpio archive> /RESULT=<result file>
; and for the uninstaller append the argument below:
; _?=<directory containing uninstaller>

Unicode True
Name cpio
RequestExecutionLevel user

!define UNFUNC "un."

!include FileFunc.nsh

!insertmacro GetParameters
!insertmacro GetOptions

!include include/cpio.nsh
${CPIO_Write}

Page InstFiles
UninstPage InstFiles

Var Arguments

!macro Run UN
!searchreplace INIT_FUNC "${UN}.onInit" ".." "."
Function ${INIT_FUNC}
  InitPluginsDir
  ${GetParameters} $Arguments
  ClearErrors
  SetOutPath "$EXEDIR"
FunctionEnd

${CPIO_FUNCINC} "${UN}" Write

Section ${UN}GenerateCPIO
  StrCpy $0 ${ERROR_WRITE_FAULT}
  ${GetOptions} $Arguments "/IN=" $1
  ${GetOptions} $Arguments "/OUT=" $2
  ${GetOptions} $Arguments "/RESULT=" $3
  FileOpen $4 "$3" w
  ${IfNot} ${Errors}
    FileOpen $5 "$2" w
    ${IfNot} ${Errors}
      !insertmacro ${CPIO_PREFIX}Write_Call "${UN}" $5 $1 $0
      ${If} $0 == 0
        !insertmacro ${CPIO_PREFIX}Write_Call "${UN}" $5 "" $0
      ${EndIf}
      FileClose $5
    ${EndIf}
    FileWrite $4 "$0$\n"
    FileClose $4
  ${EndIf}
SectionEnd
!macroend

!insertmacro Run ""
!insertmacro Run ${UNFUNC}

Section "Install"
  WriteUninstaller "$OUTDIR\uninstall.exe"
SectionEnd

Section "Uninstall"
SectionEnd