Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
7d7cadfe
energy
项目概览
energye
/
energy
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
energy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d7cadfe
编写于
9月 09, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
energy command-line tools: 优化 install CEF框架可选择系统架构
上级
0d120130
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
7 deletion
+37
-7
cmd/autoupdate/autoupdate.go
cmd/autoupdate/autoupdate.go
+33
-1
cmd/internal/install/install.go
cmd/internal/install/install.go
+2
-2
cmd/internal/install/install_nsis.go
cmd/internal/install/install_nsis.go
+1
-2
cmd/internal/install/install_upx.go
cmd/internal/install/install_upx.go
+1
-2
未找到文件。
cmd/autoupdate/autoupdate.go
浏览文件 @
7d7cadfe
...
...
@@ -14,7 +14,9 @@ package autoupdate
import
(
"crypto/tls"
"encoding/json"
"fmt"
"github.com/energye/energy/v2/cmd/internal"
"github.com/energye/energy/v2/cmd/internal/consts"
"github.com/energye/liblclbinres"
"io/ioutil"
"net/http"
...
...
@@ -67,7 +69,7 @@ func check() {
client
:=
&
http
.
Client
{
Timeout
:
5
*
time
.
Second
,
Transport
:
&
http
.
Transport
{
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
true
},
}}
request
,
err
:=
http
.
NewRequest
(
"GET"
,
internal
.
CheckUpgradeURL
,
nil
)
request
,
err
:=
http
.
NewRequest
(
"GET"
,
consts
.
CheckUpgradeURL
,
nil
)
if
err
!=
nil
{
println
(
"energy check update http.NewRequest error:"
,
err
.
Error
())
return
...
...
@@ -111,6 +113,36 @@ func LibLCLName(version, buildSupportOSArch string) (string, bool) {
return
internal
.
LibLCLName
(
version
,
buildSupportOSArch
)
}
// 命名规则 OS+[ARCH]+BIT+[GTK2]
// ARCH: 非必需, ARM 时填写, AMD为空
// GTK2: 非必需, GTK2(Linux CEF 106) 时填写, 非Linux或GTK3时为空
func
liblclOS
(
version
,
buildSupportOSArch
string
)
(
string
,
bool
)
{
archs
:=
strings
.
Split
(
buildSupportOSArch
,
","
)
var
goarch
string
if
c
.
Install
.
OS
.
IsWindows
()
&&
c
.
Install
.
Arch
.
Is386
()
{
goarch
=
"32"
// windows32 = > windows386
}
else
{
goarch
=
string
(
c
.
Install
.
Arch
)
}
noSuport
:=
fmt
.
Sprintf
(
"%v %v"
,
c
.
Install
.
OS
,
goarch
)
var
isSupport
=
func
(
goarch
string
)
bool
{
for
_
,
v
:=
range
archs
{
if
goarch
==
v
{
return
true
}
}
return
false
}
if
name
,
isOld
:=
liblclName
(
c
,
version
,
cef
);
isOld
{
if
name
==
""
{
return
noSuport
,
false
}
return
name
,
true
}
else
{
return
name
,
isSupport
(
name
)
}
}
// Version comparison, returns true if the current version is smaller than the remote version
func
compare
(
current
,
origin
string
)
(
bool
,
int
)
{
cmajor
,
cminor
,
crevision
:=
versionConvert
(
current
)
...
...
cmd/internal/install/install.go
浏览文件 @
7d7cadfe
...
...
@@ -141,11 +141,11 @@ func upxInstallPathName(c *command.Config) string {
}
func
nsisIsInstall
()
bool
{
return
consts
.
IsWindows
&&
runtime
.
GOARCH
!=
"arm64"
return
consts
.
IsWindows
&&
!
consts
.
IsARM64
}
func
upxIsInstall
()
bool
{
return
(
consts
.
IsWindows
&&
runtime
.
GOARCH
!=
"arm64"
)
||
(
consts
.
IsLinux
)
return
(
consts
.
IsWindows
&&
!
consts
.
IsARM64
)
||
(
consts
.
IsLinux
)
}
// 检查当前环境
...
...
cmd/internal/install/install_nsis.go
浏览文件 @
7d7cadfe
...
...
@@ -16,14 +16,13 @@ import (
progressbar
"github.com/energye/energy/v2/cmd/internal/progress-bar"
"github.com/energye/energy/v2/cmd/internal/tools"
"path/filepath"
"runtime"
)
func
installNSIS
(
c
*
command
.
Config
)
(
string
,
func
())
{
if
!
c
.
Install
.
INSIS
{
return
""
,
nil
}
if
consts
.
IsWindows
&&
runtime
.
GOARCH
!=
"arm64"
{
if
consts
.
IsWindows
&&
!
consts
.
IsARM64
{
// 下载并安装配置NSIS
s
:=
nsisInstallPathName
(
c
)
// 安装目录
version
:=
consts
.
NSISDownloadVersion
...
...
cmd/internal/install/install_upx.go
浏览文件 @
7d7cadfe
...
...
@@ -19,14 +19,13 @@ import (
"github.com/energye/energy/v2/cmd/internal/tools"
"os"
"path/filepath"
"runtime"
)
func
installUPX
(
c
*
command
.
Config
)
(
string
,
func
())
{
if
!
c
.
Install
.
IUPX
{
return
""
,
nil
}
if
(
consts
.
IsWindows
&&
runtime
.
GOARCH
!=
"arm64"
)
||
(
consts
.
IsLinux
)
{
if
(
consts
.
IsWindows
&&
!
consts
.
IsARM64
)
||
(
consts
.
IsLinux
)
{
s
:=
upxInstallPathName
(
c
)
// 安装目录
if
!
tools
.
IsExist
(
s
)
{
os
.
MkdirAll
(
s
,
0755
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录