Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OTAdevice
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
957dd
OTAdevice
Commits
341e6a39
Commit
341e6a39
authored
Apr 09, 2025
by
orangepi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OTA update
parent
113485ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
6 deletions
+4
-6
OTAdevice
goproject/OTAdevice
+0
-0
main.go
goproject/main.go
+4
-4
version.conf
version.conf
+0
-2
No files found.
goproject/OTAdevice
View file @
341e6a39
No preview for this file type
goproject/main.go
View file @
341e6a39
...
@@ -53,10 +53,10 @@ func main() {
...
@@ -53,10 +53,10 @@ func main() {
// 目标 URL
// 目标 URL
url
:=
"http://47.119.190.60/api/v1/ota/latestVersion"
url
:=
"http://47.119.190.60/api/v1/ota/latestVersion"
// 定义 conf 文件路径
// 定义 conf 文件路径
confPath
:=
"/home/orangepi/
OTAdevice
/version.conf"
confPath
:=
"/home/orangepi/
car/master
/version.conf"
// 定义下载和备份文件路径
// 定义下载和备份文件路径
downloadPath
:=
"/home/orangepi/
OTAdevice
/main"
downloadPath
:=
"/home/orangepi/
car/master
/main"
backupDir
:=
"/home/orangepi/
OTAdevice
/backup"
backupDir
:=
"/home/orangepi/
car/master
/backup"
var
fileData
string
var
fileData
string
// 无限循环,直到成功读取到数据
// 无限循环,直到成功读取到数据
...
@@ -300,7 +300,7 @@ func promoteTempToFinal(tempPath, finalPath string) error {
...
@@ -300,7 +300,7 @@ func promoteTempToFinal(tempPath, finalPath string) error {
}
}
func
permiss
()
error
{
func
permiss
()
error
{
cmd
:=
exec
.
Command
(
"sudo"
,
"chmod"
,
"+x"
,
"/home/orangepi/
OTAdevice
/main"
)
cmd
:=
exec
.
Command
(
"sudo"
,
"chmod"
,
"+x"
,
"/home/orangepi/
car/master
/main"
)
output
,
err
:=
cmd
.
CombinedOutput
()
output
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
if
err
!=
nil
{
// 返回一个包含错误信息的 error 类型值
// 返回一个包含错误信息的 error 类型值
...
...
version.conf
100644 → 100755
View file @
341e6a39
1
.
1
.
0
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment