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
6ea63d9f
Unverified
Commit
6ea63d9f
authored
Nov 26, 2019
by
Erik Wilson
Committed by
GitHub
Nov 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1124 from johankok/check-for-semanage-before-download
Verify selinux status before downloading
parents
ce3a03a1
51f8a1a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
install.sh
install.sh
+15
-9
No files found.
install.sh
View file @
6ea63d9f
...
@@ -271,6 +271,15 @@ verify_downloader() {
...
@@ -271,6 +271,15 @@ verify_downloader() {
return
0
return
0
}
}
# --- verify existence of semanage when SELinux is enabled ---
verify_semanage
()
{
if
[
-x
"
$(
which getenforce
)
"
]
;
then
if
[
"Disabled"
!=
$(
getenforce
)
]
&&
[
!
-x
"
$(
which semanage
)
"
]
;
then
fatal
'SELinux is enabled but semanage is not found'
fi
fi
}
# --- create tempory directory and cleanup when done ---
# --- create tempory directory and cleanup when done ---
setup_tmp
()
{
setup_tmp
()
{
TMP_DIR
=
$(
mktemp
-d
-t
k3s-install.XXXXXXXXXX
)
TMP_DIR
=
$(
mktemp
-d
-t
k3s-install.XXXXXXXXXX
)
...
@@ -374,15 +383,11 @@ setup_binary() {
...
@@ -374,15 +383,11 @@ setup_binary() {
if
command
-v
getenforce
>
/dev/null 2>&1
;
then
if
command
-v
getenforce
>
/dev/null 2>&1
;
then
if
[
"Disabled"
!=
$(
getenforce
)
]
;
then
if
[
"Disabled"
!=
$(
getenforce
)
]
;
then
if
command
-v
semanage
>
/dev/null 2>&1
;
then
info
'SELinux is enabled, setting permissions'
info
'SELinux is enabled, setting permissions'
if
!
$SUDO
semanage fcontext
-l
|
grep
"
${
BIN_DIR
}
/k3s"
>
/dev/null 2>&1
;
then
if
!
$SUDO
semanage fcontext
-l
|
grep
"
${
BIN_DIR
}
/k3s"
>
/dev/null 2>&1
;
then
$SUDO
semanage fcontext
-a
-t
bin_t
"
${
BIN_DIR
}
/k3s"
$SUDO
semanage fcontext
-a
-t
bin_t
"
${
BIN_DIR
}
/k3s"
fi
fi
$SUDO
restorecon
-v
${
BIN_DIR
}
/k3s
>
/dev/null
$SUDO
restorecon
-v
${
BIN_DIR
}
/k3s
>
/dev/null
else
fatal
'SELinux is enabled but semanage is not found'
fi
fi
fi
fi
fi
}
}
...
@@ -397,6 +402,7 @@ download_and_verify() {
...
@@ -397,6 +402,7 @@ download_and_verify() {
setup_verify_arch
setup_verify_arch
verify_downloader curl
||
verify_downloader wget
||
fatal
'Can not find curl or wget for downloading files'
verify_downloader curl
||
verify_downloader wget
||
fatal
'Can not find curl or wget for downloading files'
verify_semanage
setup_tmp
setup_tmp
get_release_version
get_release_version
download_hash
download_hash
...
...
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