Rust 앱과 작업자의 Windows 설치 파일을 구성함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
3baafa006ac611daab181e6b65ee6b2c882d3639- 부모
- 486fe9a
변경된 파일 5개
+391-0| @@ -0,0 +1,45 @@ | ||
| 1 | 추가: # Rust Windows 개발판 설치 파일 | |
| 2 | 추가: | |
| 3 | 추가: NSIS를 사용해 Linux에서 Windows x64 설치 EXE를 생성합니다. Rust 앱과 별도 작업자를 | |
| 4 | 추가: 교차 빌드하며 가짜 작업자 기능은 활성화하지 않습니다. | |
| 5 | 추가: | |
| 6 | 추가: ```sh | |
| 7 | 추가: python3 packaging/windows/rust/build.py \ | |
| 8 | 추가: --app-manifest /path/to/app/experiments/rust-ui-memory-app/Cargo.toml \ | |
| 9 | 추가: --worker-manifest /path/to/worker/experiments/rust-archive-worker/Cargo.toml \ | |
| 10 | 추가: --target-dir /path/to/cargo-target \ | |
| 11 | 추가: --output /path/to/new-installer-output | |
| 12 | 추가: ``` | |
| 13 | 추가: | |
| 14 | 추가: Cargo 1.99.1, Windows GNU Rust target, MinGW-w64와 makensis가 필요합니다. | |
| 15 | 추가: 도구는 자동 설치하지 않습니다. 기본 profile은 release이고 개발 검증에는 --profile dev를 사용할 수 있습니다. | |
| 16 | 추가: 출력 폴더는 새 경로여야 하며 기존 파일을 덮어쓰지 않습니다. 입력 저장소는 커밋된 상태여야 합니다. | |
| 17 | 추가: 앱과 작업자 PR이 병합되기 전에는 각 PR의 별도 소스 경로를 인자로 지정합니다. | |
| 18 | 추가: 빌드 정보에는 소스 커밋, 실행 파일 SHA-256, target, profile, 기능 목록을 기록합니다. | |
| 19 | 추가: | |
| 20 | 추가: 설치 파일을 더블클릭하면 현재 사용자의 LocalAppData/Programs/Zipelo-Dev에 | |
| 21 | 추가: Zipelo.exe, zipelo-archive-worker.exe, MIT LICENSE, BUILD-INFO.json과 제거 프로그램을 설치합니다. | |
| 22 | 추가: 기존 폴더나 등록이 있으면 중단하며 덮어쓰기 업데이트는 지원하지 않습니다. | |
| 23 | 추가: 시작 메뉴에 Zipelo 개발판 바로가기를 추가합니다. | |
| 24 | 추가: | |
| 25 | 추가: 마지막 화면의 [적용]을 누르면 HKCU의 ZipeloDev.Archive ProgID와 RegisteredApplications에 | |
| 26 | 추가: .zip, .tar, .gz, .tgz 연결 후보를 등록하고 ms-settings:defaultapps를 엽니다. | |
| 27 | 추가: .tar.gz는 마지막 확장자 .gz로 연결됩니다. 기본 앱은 사용자가 Windows 설정에서 직접 선택합니다. | |
| 28 | 추가: JAR, RAR, 7z는 등록하지 않습니다. [마침]만 누르면 연결 후보를 등록하지 않습니다. | |
| 29 | 추가: 관리자 권한, HKLM, UserChoice 변경을 사용하지 않습니다. | |
| 30 | 추가: 제거 시 알려진 앱 파일과 등록 값만 정리하며 폴더 전체를 재귀 삭제하지 않습니다. | |
| 31 | 추가: 실행 파일 삭제 실패 시 등록과 제거 프로그램을 보존하여 재시도할 수 있습니다. | |
| 32 | 추가: | |
| 33 | 추가: 현재는 개발 검증용입니다. PR62 화면의 실제 작업자 연결, Windows에서의 설치/제거와 설정 실행, | |
| 34 | 추가: 지원 형식별 실제 파일 열기, 재설치/권한 실패/잠긴 파일 검증, 포함 의존성의 배포 고지 검토는 남아 있습니다. | |
| 35 | 추가: 이번 EXE 생성만으로 해당 항목을 인증하거나 출시하지 않습니다. | |
| 36 | 추가: Windows 실행 검증 전에는 README 다운로드 버튼이나 release에 배포하지 않습니다. | |
| 37 | 추가: | |
| 38 | 추가: 검증은 저장소 루트에서 python3 tests/ci/run_rust.py local을 실행하고 위 명령으로 | |
| 39 | 추가: 실제 앱과 작업자를 교차 빌드하여 NSIS를 컴파일합니다. BUILD-INFO.json과 설치 EXE의 | |
| 40 | 추가: 해시를 함께 확인합니다. NSIS 부트스트랩은 32비트 PE일 수 있으며 설치되는 두 앱은 x64 PE입니다. | |
| 41 | 추가: | |
| 42 | 추가: 연결 등록은 [Microsoft 기본 프로그램 문서](https://learn.microsoft.com/en-us/windows/win32/shell/default-programs)의 | |
| 43 | 추가: Capabilities/RegisteredApplications 구조를 사용하며, | |
| 44 | 추가: [Windows 기본 앱 설정 열기](https://learn.microsoft.com/en-us/windows/apps/develop/launch/launch-default-apps-settings)의 | |
| 45 | 추가: ms-settings URI를 사용합니다. |
| @@ -0,0 +1,90 @@ | ||
| 1 | 추가: """Rust 앱과 작업자를 교차 빌드해 Windows 개발용 설치 파일을 생성함.""" | |
| 2 | 추가: | |
| 3 | 추가: import argparse | |
| 4 | 추가: import hashlib | |
| 5 | 추가: import json | |
| 6 | 추가: import os | |
| 7 | 추가: from pathlib import Path | |
| 8 | 추가: import shutil | |
| 9 | 추가: import struct | |
| 10 | 추가: import subprocess | |
| 11 | 추가: | |
| 12 | 추가: ROOT = Path(__file__).resolve().parents[3] | |
| 13 | 추가: TARGET = "x86_64-pc-windows-gnu" | |
| 14 | 추가: | |
| 15 | 추가: | |
| 16 | 추가: def pe_machine(path): | |
| 17 | 추가: with Path(path).open("rb") as stream: | |
| 18 | 추가: header = stream.read(64) | |
| 19 | 추가: if len(header) != 64 or header[:2] != b"MZ": | |
| 20 | 추가: raise ValueError("PE 실행 파일이 아님") | |
| 21 | 추가: stream.seek(struct.unpack_from("<I", header, 60)[0]) | |
| 22 | 추가: signature = stream.read(6) | |
| 23 | 추가: if len(signature) != 6 or signature[:4] != b"PE\0\0": | |
| 24 | 추가: raise ValueError("PE 헤더가 잘못됨") | |
| 25 | 추가: return struct.unpack_from("<H", signature, 4)[0] | |
| 26 | 추가: | |
| 27 | 추가: | |
| 28 | 추가: def build_binary(manifest, binary, target_dir, profile, features=()): | |
| 29 | 추가: manifest = Path(manifest).resolve(strict=True) | |
| 30 | 추가: command = ["cargo", "+1.99.1", "build", "--locked", "--manifest-path", str(manifest), | |
| 31 | 추가: "--target", TARGET, "--target-dir", str(target_dir), "--profile", profile, | |
| 32 | 추가: "--bin", binary] | |
| 33 | 추가: if features: | |
| 34 | 추가: command += ["--features", ",".join(features)] | |
| 35 | 추가: environment = dict(os.environ) | |
| 36 | 추가: linker = environment.get("CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER") | |
| 37 | 추가: linker = linker or shutil.which("x86_64-w64-mingw32-gcc") or shutil.which("x86_64-w64-mingw32-gcc-posix") | |
| 38 | 추가: if not linker or not shutil.which(linker): | |
| 39 | 추가: raise ValueError("MinGW-w64 교차 링커를 찾지 못함") | |
| 40 | 추가: environment["CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER"] = linker | |
| 41 | 추가: subprocess.run(command, env=environment, check=True) | |
| 42 | 추가: output = target_dir / TARGET / ("debug" if profile == "dev" else profile) / (binary + ".exe") | |
| 43 | 추가: if pe_machine(output) != 0x8664: | |
| 44 | 추가: raise ValueError("x64 Windows 실행 파일이 아님") | |
| 45 | 추가: commit = subprocess.check_output(["git", "-C", str(manifest.parent), "rev-parse", "HEAD"], text=True).strip() | |
| 46 | 추가: dirty = subprocess.check_output(["git", "-C", str(manifest.parent), "status", "--porcelain"], text=True) | |
| 47 | 추가: if dirty.strip(): | |
| 48 | 추가: raise ValueError("소스에 커밋하지 않은 변경이 있음") | |
| 49 | 추가: return output, {"commit": commit, "sha256": hashlib.sha256(output.read_bytes()).hexdigest(), | |
| 50 | 추가: "binary": binary, "features": list(features)} | |
| 51 | 추가: | |
| 52 | 추가: | |
| 53 | 추가: def build(args): | |
| 54 | 추가: output = Path(args.output).resolve() | |
| 55 | 추가: output.mkdir(parents=True, exist_ok=False) | |
| 56 | 추가: target_dir = Path(args.target_dir).resolve() | |
| 57 | 추가: records = {} | |
| 58 | 추가: payload = output / "payload" | |
| 59 | 추가: payload.mkdir() | |
| 60 | 추가: for name, manifest, binary, features in ( | |
| 61 | 추가: ("Zipelo.exe", args.app_manifest, "zipelo-ui-memory-app", ("ui",)), | |
| 62 | 추가: ("zipelo-archive-worker.exe", args.worker_manifest, "zipelo-archive-worker", ()), | |
| 63 | 추가: ): | |
| 64 | 추가: source, records[name] = build_binary(manifest, binary, target_dir, args.profile, features) | |
| 65 | 추가: shutil.copyfile(source, payload / name) | |
| 66 | 추가: shutil.copyfile(ROOT / "LICENSE", payload / "LICENSE") | |
| 67 | 추가: records = {"development_only": True, "windows_execution_verified": False, | |
| 68 | 추가: "profile": args.profile, "target": TARGET, "files": records} | |
| 69 | 추가: (payload / "BUILD-INFO.json").write_text(json.dumps(records, indent=4) + "\n", encoding="utf-8") | |
| 70 | 추가: shutil.copyfile(Path(__file__).with_name("installer.nsi"), output / "installer.nsi") | |
| 71 | 추가: subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=output, check=True) | |
| 72 | 추가: installer = output / "Zipelo-0.1.0-dev-windows-x64-setup.exe" | |
| 73 | 추가: if pe_machine(installer) not in (0x14C, 0x8664): | |
| 74 | 추가: raise ValueError("NSIS 설치 실행 파일이 아님") | |
| 75 | 추가: print(installer) | |
| 76 | 추가: print("SHA-256 " + hashlib.sha256(installer.read_bytes()).hexdigest()) | |
| 77 | 추가: | |
| 78 | 추가: | |
| 79 | 추가: def main(): | |
| 80 | 추가: parser = argparse.ArgumentParser(description=__doc__) | |
| 81 | 추가: parser.add_argument("--app-manifest", required=True) | |
| 82 | 추가: parser.add_argument("--worker-manifest", required=True) | |
| 83 | 추가: parser.add_argument("--output", required=True) | |
| 84 | 추가: parser.add_argument("--target-dir", required=True) | |
| 85 | 추가: parser.add_argument("--profile", choices=("dev", "release"), default="release") | |
| 86 | 추가: build(parser.parse_args()) | |
| 87 | 추가: | |
| 88 | 추가: | |
| 89 | 추가: if __name__ == "__main__": | |
| 90 | 추가: main() |
| @@ -0,0 +1,204 @@ | ||
| 1 | 추가: Unicode true | |
| 2 | 추가: !include "MUI2.nsh" | |
| 3 | 추가: !include "nsDialogs.nsh" | |
| 4 | 추가: !include "LogicLib.nsh" | |
| 5 | 추가: !include "x64.nsh" | |
| 6 | 추가: !include "FileFunc.nsh" | |
| 7 | 추가: Name "Zipelo 개발판" | |
| 8 | 추가: OutFile "Zipelo-0.1.0-dev-windows-x64-setup.exe" | |
| 9 | 추가: InstallDir "$LOCALAPPDATA\Programs\Zipelo-Dev" | |
| 10 | 추가: RequestExecutionLevel user | |
| 11 | 추가: SetCompressor /SOLID lzma | |
| 12 | 추가: SetOverwrite off | |
| 13 | 추가: AllowSkipFiles off | |
| 14 | 추가: ShowInstDetails show | |
| 15 | 추가: !define MUI_ABORTWARNING | |
| 16 | 추가: !insertmacro MUI_PAGE_WELCOME | |
| 17 | 추가: !insertmacro MUI_PAGE_INSTFILES | |
| 18 | 추가: Page custom FinishCreate | |
| 19 | 추가: !insertmacro MUI_UNPAGE_CONFIRM | |
| 20 | 추가: !insertmacro MUI_UNPAGE_INSTFILES | |
| 21 | 추가: !insertmacro MUI_LANGUAGE "Korean" | |
| 22 | 추가: Var Dialog | |
| 23 | 추가: Var ApplyButton | |
| 24 | 추가: Var Mutex | |
| 25 | 추가: !define APPKEY "Software\Zipelo-Dev" | |
| 26 | 추가: !define PROGKEY "Software\Classes\ZipeloDev.Archive" | |
| 27 | 추가: !define UNKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Zipelo-Dev" | |
| 28 | 추가: | |
| 29 | 추가: Function .onInit | |
| 30 | 추가: ${IfNot} ${RunningX64} | |
| 31 | 추가: MessageBox MB_OK|MB_ICONSTOP "64비트 Windows가 필요합니다." | |
| 32 | 추가: Abort | |
| 33 | 추가: ${EndIf} | |
| 34 | 추가: SetShellVarContext current | |
| 35 | 추가: SetRegView 64 | |
| 36 | 추가: System::Call 'kernel32::CreateMutexW(p 0, i 0, w "Local\ZipeloDevSetup") p.r0 ?e' | |
| 37 | 추가: Pop $1 | |
| 38 | 추가: StrCpy $Mutex $0 | |
| 39 | 추가: ${If} $0 == 0 | |
| 40 | 추가: ${OrIf} $1 != 0 | |
| 41 | 추가: MessageBox MB_OK "다른 설치나 제거를 마친 뒤 다시 실행하세요." | |
| 42 | 추가: Abort | |
| 43 | 추가: ${EndIf} | |
| 44 | 추가: FunctionEnd | |
| 45 | 추가: | |
| 46 | 추가: Section "Zipelo" | |
| 47 | 추가: ; 기존 설치와 등록을 덮어쓰지 않음. | |
| 48 | 추가: IfFileExists "$INSTDIR" failed | |
| 49 | 추가: System::Call 'advapi32::RegOpenKeyExW(p 0x80000001, w "${APPKEY}", i 0, i 0x20119, *p.r1) i.r0' | |
| 50 | 추가: ${If} $0 == 0 | |
| 51 | 추가: System::Call 'advapi32::RegCloseKey(p r1)' | |
| 52 | 추가: Goto failed | |
| 53 | 추가: ${ElseIf} $0 != 2 | |
| 54 | 추가: Goto failed | |
| 55 | 추가: ${EndIf} | |
| 56 | 추가: System::Call 'advapi32::RegOpenKeyExW(p 0x80000001, w "${PROGKEY}", i 0, i 0x20119, *p.r1) i.r0' | |
| 57 | 추가: ${If} $0 == 0 | |
| 58 | 추가: System::Call 'advapi32::RegCloseKey(p r1)' | |
| 59 | 추가: Goto failed | |
| 60 | 추가: ${ElseIf} $0 != 2 | |
| 61 | 추가: Goto failed | |
| 62 | 추가: ${EndIf} | |
| 63 | 추가: System::Call 'advapi32::RegOpenKeyExW(p 0x80000001, w "${UNKEY}", i 0, i 0x20119, *p.r1) i.r0' | |
| 64 | 추가: ${If} $0 == 0 | |
| 65 | 추가: System::Call 'advapi32::RegCloseKey(p r1)' | |
| 66 | 추가: Goto failed | |
| 67 | 추가: ${ElseIf} $0 != 2 | |
| 68 | 추가: Goto failed | |
| 69 | 추가: ${EndIf} | |
| 70 | 추가: IfFileExists "$SMPROGRAMS\Zipelo 개발판.lnk" failed | |
| 71 | 추가: ClearErrors | |
| 72 | 추가: CreateDirectory "$LOCALAPPDATA\Programs" | |
| 73 | 추가: IfErrors failed | |
| 74 | 추가: System::Call 'kernel32::CreateDirectoryW(w "$INSTDIR", p 0) i.r0' | |
| 75 | 추가: IntCmp $0 0 failed | |
| 76 | 추가: SetOutPath "$INSTDIR" | |
| 77 | 추가: ClearErrors | |
| 78 | 추가: File "payload\Zipelo.exe" | |
| 79 | 추가: File "payload\zipelo-archive-worker.exe" | |
| 80 | 추가: File "payload\LICENSE" | |
| 81 | 추가: File "payload\BUILD-INFO.json" | |
| 82 | 추가: IfErrors failed | |
| 83 | 추가: WriteUninstaller "$INSTDIR\Uninstall.exe" | |
| 84 | 추가: IfErrors failed | |
| 85 | 추가: WriteINIStr "$INSTDIR\install.ini" "Zipelo" "Location" "$INSTDIR" | |
| 86 | 추가: IfErrors failed | |
| 87 | 추가: CreateShortcut "$SMPROGRAMS\Zipelo 개발판.lnk" "$INSTDIR\Zipelo.exe" | |
| 88 | 추가: IfErrors failed | |
| 89 | 추가: WriteRegStr HKCU "${UNKEY}" "DisplayName" "Zipelo 개발판" | |
| 90 | 추가: WriteRegStr HKCU "${UNKEY}" "DisplayVersion" "0.1.0-dev" | |
| 91 | 추가: WriteRegStr HKCU "${UNKEY}" "UninstallString" '$\"$INSTDIR\Uninstall.exe$\"' | |
| 92 | 추가: IfErrors failed | |
| 93 | 추가: Goto done | |
| 94 | 추가: failed: | |
| 95 | 추가: SetErrorLevel 1 | |
| 96 | 추가: MessageBox MB_OK|MB_ICONSTOP "설치를 완료하지 못했습니다. 기존 Zipelo 개발판이 있으면 먼저 제거하고, 여유 공간과 쓰기 권한을 확인하세요. 새로 복사한 파일이 남았다면 해당 폴더의 제거 프로그램을 사용하세요." | |
| 97 | 추가: Abort | |
| 98 | 추가: done: | |
| 99 | 추가: SectionEnd | |
| 100 | 추가: | |
| 101 | 추가: Function FinishCreate | |
| 102 | 추가: GetDlgItem $0 $HWNDPARENT 1 | |
| 103 | 추가: SendMessage $0 ${WM_SETTEXT} 0 "STR:마침" | |
| 104 | 추가: GetDlgItem $0 $HWNDPARENT 3 | |
| 105 | 추가: EnableWindow $0 0 | |
| 106 | 추가: nsDialogs::Create 1018 | |
| 107 | 추가: Pop $Dialog | |
| 108 | 추가: ${If} $Dialog == error | |
| 109 | 추가: Abort | |
| 110 | 추가: ${EndIf} | |
| 111 | 추가: ${NSD_CreateLabel} 0 0 100% 28u "Zipelo 설치가 끝났습니다." | |
| 112 | 추가: Pop $0 | |
| 113 | 추가: ${NSD_CreateLabel} 0 32u 100% 40u "[적용]을 누르면 Zipelo를 연결 프로그램으로 등록하고 Windows 기본 앱 설정을 엽니다. 기본 앱은 설정에서 직접 선택하세요." | |
| 114 | 추가: Pop $0 | |
| 115 | 추가: ${NSD_CreateButton} 0 84u 100% 26u "적용" | |
| 116 | 추가: Pop $ApplyButton | |
| 117 | 추가: ${NSD_OnClick} $ApplyButton ApplyAssociations | |
| 118 | 추가: nsDialogs::Show | |
| 119 | 추가: FunctionEnd | |
| 120 | 추가: | |
| 121 | 추가: Function ApplyAssociations | |
| 122 | 추가: Pop $0 | |
| 123 | 추가: ClearErrors | |
| 124 | 추가: WriteRegStr HKCU "${PROGKEY}" "" "Zipelo 압축파일" | |
| 125 | 추가: WriteRegStr HKCU "${PROGKEY}\shell\open\command" "" '$\"$INSTDIR\Zipelo.exe$\" $\"%1$\"' | |
| 126 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationName" "Zipelo 개발판" | |
| 127 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationDescription" "압축파일 열기와 풀기" | |
| 128 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".zip" "ZipeloDev.Archive" | |
| 129 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".tar" "ZipeloDev.Archive" | |
| 130 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".gz" "ZipeloDev.Archive" | |
| 131 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".tgz" "ZipeloDev.Archive" | |
| 132 | 추가: WriteRegStr HKCU "Software\RegisteredApplications" "Zipelo 개발판" "${APPKEY}\Capabilities" | |
| 133 | 추가: IfErrors register_failed | |
| 134 | 추가: System::Call 'shell32::SHChangeNotify(i 0x8000000, i 0, p 0, p 0)' | |
| 135 | 추가: ExecShell "open" "ms-settings:defaultapps" | |
| 136 | 추가: IfErrors settings_failed | |
| 137 | 추가: Return | |
| 138 | 추가: register_failed: | |
| 139 | 추가: MessageBox MB_OK|MB_ICONSTOP "연결 프로그램을 등록하지 못했습니다. 쓰기 권한을 확인한 뒤 다시 적용하세요." | |
| 140 | 추가: Return | |
| 141 | 추가: settings_failed: | |
| 142 | 추가: MessageBox MB_OK "Windows 설정을 열지 못했습니다. 설정에서 앱 > 기본 앱을 직접 열어주세요." | |
| 143 | 추가: FunctionEnd | |
| 144 | 추가: | |
| 145 | 추가: Function un.onInit | |
| 146 | 추가: SetShellVarContext current | |
| 147 | 추가: SetRegView 64 | |
| 148 | 추가: System::Call 'kernel32::CreateMutexW(p 0, i 0, w "Local\ZipeloDevSetup") p.r0 ?e' | |
| 149 | 추가: Pop $1 | |
| 150 | 추가: StrCpy $Mutex $0 | |
| 151 | 추가: ${If} $0 == 0 | |
| 152 | 추가: ${OrIf} $1 != 0 | |
| 153 | 추가: Abort | |
| 154 | 추가: ${EndIf} | |
| 155 | 추가: StrCmp $INSTDIR "$LOCALAPPDATA\Programs\Zipelo-Dev" 0 invalid | |
| 156 | 추가: ReadINIStr $0 "$INSTDIR\install.ini" "Zipelo" "Location" | |
| 157 | 추가: StrCmp $0 $INSTDIR 0 invalid | |
| 158 | 추가: Return | |
| 159 | 추가: invalid: | |
| 160 | 추가: MessageBox MB_OK|MB_ICONSTOP "설치 위치를 확인하지 못했습니다. 파일을 삭제하지 않습니다." | |
| 161 | 추가: Abort | |
| 162 | 추가: FunctionEnd | |
| 163 | 추가: | |
| 164 | 추가: Section "Uninstall" | |
| 165 | 추가: SetOutPath "$TEMP" | |
| 166 | 추가: ClearErrors | |
| 167 | 추가: Delete "$INSTDIR\Zipelo.exe" | |
| 168 | 추가: Delete "$INSTDIR\zipelo-archive-worker.exe" | |
| 169 | 추가: IfErrors uninstall_failed | |
| 170 | 추가: Delete "$INSTDIR\LICENSE" | |
| 171 | 추가: Delete "$INSTDIR\BUILD-INFO.json" | |
| 172 | 추가: Delete "$SMPROGRAMS\Zipelo 개발판.lnk" | |
| 173 | 추가: ; 자신이 등록한 값만 제거하고 다른 파일과 키를 보존함. | |
| 174 | 추가: DeleteRegValue HKCU "Software\RegisteredApplications" "Zipelo 개발판" | |
| 175 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".zip" | |
| 176 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".tar" | |
| 177 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".gz" | |
| 178 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".tgz" | |
| 179 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities" "ApplicationName" | |
| 180 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities" "ApplicationDescription" | |
| 181 | 추가: DeleteRegKey /ifempty HKCU "${APPKEY}\Capabilities\FileAssociations" | |
| 182 | 추가: DeleteRegKey /ifempty HKCU "${APPKEY}\Capabilities" | |
| 183 | 추가: DeleteRegKey /ifempty HKCU "${APPKEY}" | |
| 184 | 추가: DeleteRegValue HKCU "${PROGKEY}\shell\open\command" "" | |
| 185 | 추가: DeleteRegValue HKCU "${PROGKEY}" "" | |
| 186 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open\command" | |
| 187 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open" | |
| 188 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\shell" | |
| 189 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}" | |
| 190 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayName" | |
| 191 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayVersion" | |
| 192 | 추가: DeleteRegValue HKCU "${UNKEY}" "UninstallString" | |
| 193 | 추가: DeleteRegKey /ifempty HKCU "${UNKEY}" | |
| 194 | 추가: Delete "$INSTDIR\install.ini" | |
| 195 | 추가: Delete "$INSTDIR\Uninstall.exe" | |
| 196 | 추가: RMDir "$INSTDIR" | |
| 197 | 추가: System::Call 'shell32::SHChangeNotify(i 0x8000000, i 0, p 0, p 0)' | |
| 198 | 추가: Goto un_done | |
| 199 | 추가: uninstall_failed: | |
| 200 | 추가: SetErrorLevel 1 | |
| 201 | 추가: MessageBox MB_OK|MB_ICONSTOP "Zipelo와 작업자를 닫은 뒤 제거 프로그램을 다시 실행하세요." | |
| 202 | 추가: Abort | |
| 203 | 추가: un_done: | |
| 204 | 추가: SectionEnd |
| @@ -0,0 +1,49 @@ | ||
| 1 | 추가: import argparse | |
| 2 | 추가: import importlib.util | |
| 3 | 추가: from pathlib import Path | |
| 4 | 추가: import struct | |
| 5 | 추가: import tempfile | |
| 6 | 추가: import unittest | |
| 7 | 추가: | |
| 8 | 추가: ROOT = Path(__file__).resolve().parents[2] | |
| 9 | 추가: SPEC = importlib.util.spec_from_file_location("windows_installer", ROOT / "packaging/windows/rust/build.py") | |
| 10 | 추가: MODULE = importlib.util.module_from_spec(SPEC) | |
| 11 | 추가: SPEC.loader.exec_module(MODULE) | |
| 12 | 추가: | |
| 13 | 추가: | |
| 14 | 추가: class InstallerInputTests(unittest.TestCase): | |
| 15 | 추가: def setUp(self): | |
| 16 | 추가: runs = ROOT / "tests/windows-installer/runs" | |
| 17 | 추가: runs.mkdir(parents=True, exist_ok=True) | |
| 18 | 추가: self.directory = tempfile.TemporaryDirectory(dir=runs) | |
| 19 | 추가: self.addCleanup(self.directory.cleanup) | |
| 20 | 추가: self.root = Path(self.directory.name) | |
| 21 | 추가: | |
| 22 | 추가: def test_truncated_and_non_pe_payloads_are_rejected(self): | |
| 23 | 추가: for content in (b"", b"MZ", b"not an executable" * 8, | |
| 24 | 추가: b"MZ" + bytes(58) + struct.pack("<I", 65535)): | |
| 25 | 추가: payload = self.root / "invalid.exe" | |
| 26 | 추가: payload.write_bytes(content) | |
| 27 | 추가: with self.assertRaises(ValueError): | |
| 28 | 추가: MODULE.pe_machine(payload) | |
| 29 | 추가: | |
| 30 | 추가: def test_x64_coff_machine_is_read_from_pe_offset(self): | |
| 31 | 추가: payload = self.root / "header.exe" | |
| 32 | 추가: payload.write_bytes(b"MZ" + bytes(58) + struct.pack("<I", 128) | |
| 33 | 추가: + bytes(64) + b"PE\0\0" + struct.pack("<H", 0x8664)) | |
| 34 | 추가: self.assertEqual(MODULE.pe_machine(payload), 0x8664) | |
| 35 | 추가: payload.write_bytes(payload.read_bytes()[:128] + b"badPE!") | |
| 36 | 추가: with self.assertRaises(ValueError): | |
| 37 | 추가: MODULE.pe_machine(payload) | |
| 38 | 추가: | |
| 39 | 추가: def test_existing_output_is_preserved_before_any_build(self): | |
| 40 | 추가: output = self.root / "output" | |
| 41 | 추가: output.mkdir() | |
| 42 | 추가: sentinel = output / "user-data" | |
| 43 | 추가: sentinel.write_bytes(b"preserve") | |
| 44 | 추가: args = argparse.Namespace(output=output, target_dir=self.root / "target") | |
| 45 | 추가: with self.assertRaises(FileExistsError): | |
| 46 | 추가: MODULE.build(args) | |
| 47 | 추가: self.assertEqual(sentinel.read_bytes(), b"preserve") | |
| 48 | 추가: self.assertEqual(list(output.iterdir()), [sentinel]) | |
| 49 | 추가: self.assertFalse(args.target_dir.exists()) |
| @@ -0,0 +1,3 @@ | ||
| 1 | 추가: runs/ | |
| 2 | 추가: artifacts*/ | |
| 3 | 추가: *.log |