Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1e38b5d9
Commit
1e38b5d9
authored
Sep 26, 2023
by
Brad Davidson
Committed by
Brad Davidson
Sep 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't ignore assets in home dir if system assets exist
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
fe18b1fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
main.go
cmd/k3s/main.go
+10
-6
No files found.
cmd/k3s/main.go
View file @
1e38b5d9
...
@@ -222,16 +222,20 @@ func getAssetAndDir(dataDir string) (string, string) {
...
@@ -222,16 +222,20 @@ func getAssetAndDir(dataDir string) (string, string) {
// extract checks for and if necessary unpacks the bindata archive, returning the unique path
// extract checks for and if necessary unpacks the bindata archive, returning the unique path
// to the extracted bindata asset.
// to the extracted bindata asset.
func
extract
(
dataDir
string
)
(
string
,
error
)
{
func
extract
(
dataDir
string
)
(
string
,
error
)
{
//
first look for global asset folder so we don't create a HOME version if not needed
//
check if content already exists in requested data-dir
_
,
dir
:=
getAssetAndDir
(
datadir
.
DefaultD
ataDir
)
asset
,
dir
:=
getAssetAndDir
(
d
ataDir
)
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
dir
,
"bin"
,
"k3s"
));
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
dir
,
"bin"
,
"k3s"
));
err
==
nil
{
return
dir
,
nil
return
dir
,
nil
}
}
asset
,
dir
:=
getAssetAndDir
(
dataDir
)
// check if content exists in default path as a fallback, prior
// check if target content already exists
// to extracting. This will prevent re-extracting into the user's home
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
dir
,
"bin"
,
"k3s"
));
err
==
nil
{
// dir if the assets already exist in the default path.
return
dir
,
nil
if
dataDir
!=
datadir
.
DefaultDataDir
{
_
,
defaultDir
:=
getAssetAndDir
(
datadir
.
DefaultDataDir
)
if
_
,
err
:=
os
.
Stat
(
filepath
.
Join
(
defaultDir
,
"bin"
,
"k3s"
));
err
==
nil
{
return
defaultDir
,
nil
}
}
}
// acquire a data directory lock
// acquire a data directory lock
...
...
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