mirror of
https://gitcode.com/JianFeeeee/webui4frpc.git
synced 2026-10-03 23:53:59 +00:00
feat: 原生安装包 — deb/rpm/systemd + NSIS setup.exe + macOS pkg
此前交付的 tar.gz/zip 仅是解压直用包,补齐真正的平台安装包: - Linux: .deb (dpkg-deb) 与 .rpm (rpmbuild),装 systemd 单元 + 专用 系统账号 + /etc/webui4frpc 配置,非 root 运行 + 加固 - Windows: NSIS setup.exe,向导收集监听地址/凭据,注册卸载器 + 防火墙放行(amd64/arm64) - macOS: .pkg(在 Linux 上手工 xar+mkbom 组装 flat package),launchd 开机自启 + env 配置文件(amd64/arm64) - scripts/release.sh 纳入 build_installers.sh 阶段;README 增「安装」 章节逐平台说明 已知限制:rpmbuild 无法在非 RHEL 主机交叉构建 aarch64(Debian rpm 只有 x86_64 构建 arch),aarch64 rpm 需在原生 ARM 机器构建;Linux/ARM 场景已由 deb-arm64 覆盖。
This commit is contained in:
162
packaging/windows/webui4frpc.nsi
Normal file
162
packaging/windows/webui4frpc.nsi
Normal file
@ -0,0 +1,162 @@
|
||||
; webui4frpc Windows 安装程序 (NSIS)
|
||||
;
|
||||
; 由 scripts/build_installers.sh 调用,需在命令行传入:
|
||||
; -DVERSION=0.1.0 -DARCH=amd64 -DBINSRC=<webui4frpc.exe 路径> -DOUTFILE=<输出 exe>
|
||||
|
||||
!include "MUI2.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
!ifndef VERSION
|
||||
!define VERSION "0.0.0"
|
||||
!endif
|
||||
!ifndef ARCH
|
||||
!define ARCH "amd64"
|
||||
!endif
|
||||
|
||||
Name "webui4frpc ${VERSION}"
|
||||
OutFile "${OUTFILE}"
|
||||
Unicode true
|
||||
RequestExecutionLevel admin
|
||||
InstallDir "$PROGRAMFILES64\webui4frpc"
|
||||
InstallDirRegKey HKLM "Software\webui4frpc" "InstallDir"
|
||||
|
||||
VIProductVersion "${VERSION}.0"
|
||||
VIAddVersionKey "ProductName" "webui4frpc"
|
||||
VIAddVersionKey "FileDescription" "Visual frpc controller with token-ring cluster"
|
||||
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||
VIAddVersionKey "ProductVersion" "${VERSION}"
|
||||
VIAddVersionKey "LegalCopyright" "JianFeeeee"
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
Page custom ConfigPage ConfigPageLeave
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Var Dialog
|
||||
Var LblAddr
|
||||
Var TxtAddr
|
||||
Var LblUser
|
||||
Var TxtUser
|
||||
Var LblPass
|
||||
Var TxtPass
|
||||
Var CfgAddr
|
||||
Var CfgUser
|
||||
Var CfgPass
|
||||
|
||||
Function .onInit
|
||||
StrCpy $CfgAddr "0.0.0.0:7500"
|
||||
StrCpy $CfgUser "admin"
|
||||
StrCpy $CfgPass "admin"
|
||||
FunctionEnd
|
||||
|
||||
Function ConfigPage
|
||||
!insertmacro MUI_HEADER_TEXT "服务配置" "设置监听地址与登录凭据"
|
||||
nsDialogs::Create 1018
|
||||
Pop $Dialog
|
||||
${If} $Dialog == error
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 12u "监听地址 (host:port):"
|
||||
Pop $LblAddr
|
||||
${NSD_CreateText} 0 14u 100% 12u "$CfgAddr"
|
||||
Pop $TxtAddr
|
||||
|
||||
${NSD_CreateLabel} 0 34u 100% 12u "管理员用户名:"
|
||||
Pop $LblUser
|
||||
${NSD_CreateText} 0 48u 100% 12u "$CfgUser"
|
||||
Pop $TxtUser
|
||||
|
||||
${NSD_CreateLabel} 0 68u 100% 12u "管理员密码(请勿沿用默认值):"
|
||||
Pop $LblPass
|
||||
${NSD_CreatePassword} 0 82u 100% 12u "$CfgPass"
|
||||
Pop $TxtPass
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function ConfigPageLeave
|
||||
${NSD_GetText} $TxtAddr $CfgAddr
|
||||
${NSD_GetText} $TxtUser $CfgUser
|
||||
${NSD_GetText} $TxtPass $CfgPass
|
||||
FunctionEnd
|
||||
|
||||
Section "webui4frpc" SecMain
|
||||
SetOutPath "$INSTDIR"
|
||||
File "/oname=webui4frpc.exe" "${BINSRC}"
|
||||
File "README.md"
|
||||
File "LICENSE.txt"
|
||||
|
||||
CreateDirectory "$INSTDIR\data"
|
||||
|
||||
; 启动脚本,承载安装时选择的配置
|
||||
FileOpen $0 "$INSTDIR\start-webui4frpc.cmd" w
|
||||
FileWrite $0 "@echo off$\r$\n"
|
||||
FileWrite $0 "rem webui4frpc 启动脚本(由安装程序生成)$\r$\n"
|
||||
FileWrite $0 "cd /d %~dp0$\r$\n"
|
||||
FileWrite $0 'webui4frpc.exe -addr $CfgAddr -user $CfgUser -password $CfgPass -workdir "%~dp0data"$\r$\n'
|
||||
FileClose $0
|
||||
|
||||
WriteRegStr HKLM "Software\webui4frpc" "InstallDir" "$INSTDIR"
|
||||
WriteRegStr HKLM "Software\webui4frpc" "Version" "${VERSION}"
|
||||
|
||||
; 添加/删除程序
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"DisplayName" "webui4frpc ${VERSION}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"Publisher" "JianFeeeee"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"URLInfoAbout" "https://gitcode.com/JianFeeeee/webui4frpc"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc" \
|
||||
"NoRepair" 1
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
; 开始菜单
|
||||
CreateDirectory "$SMPROGRAMS\webui4frpc"
|
||||
CreateShortcut "$SMPROGRAMS\webui4frpc\webui4frpc.lnk" \
|
||||
"$INSTDIR\start-webui4frpc.cmd" "" "$INSTDIR\webui4frpc.exe" 0
|
||||
CreateShortcut "$SMPROGRAMS\webui4frpc\打开管理界面.lnk" \
|
||||
"http://127.0.0.1:7500"
|
||||
CreateShortcut "$SMPROGRAMS\webui4frpc\卸载 webui4frpc.lnk" "$INSTDIR\uninstall.exe"
|
||||
|
||||
; 防火墙放行(失败不阻断安装)
|
||||
nsExec::ExecToLog 'netsh advfirewall firewall add rule name="webui4frpc" \
|
||||
dir=in action=allow program="$INSTDIR\webui4frpc.exe" enable=yes profile=any'
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
nsExec::ExecToLog 'netsh advfirewall firewall delete rule name="webui4frpc"'
|
||||
|
||||
Delete "$INSTDIR\webui4frpc.exe"
|
||||
Delete "$INSTDIR\start-webui4frpc.cmd"
|
||||
Delete "$INSTDIR\README.md"
|
||||
Delete "$INSTDIR\LICENSE.txt"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
|
||||
; data 目录保留(含数据库与日志),由用户手动删除
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION \
|
||||
"是否同时删除数据目录 $INSTDIR\data(数据库、转发配置、日志)?" \
|
||||
IDNO KeepData
|
||||
RMDir /r "$INSTDIR\data"
|
||||
KeepData:
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
Delete "$SMPROGRAMS\webui4frpc\*.lnk"
|
||||
RMDir "$SMPROGRAMS\webui4frpc"
|
||||
|
||||
DeleteRegKey HKLM "Software\webui4frpc"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\webui4frpc"
|
||||
SectionEnd
|
||||
Reference in New Issue
Block a user