Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Singularity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMGW
Singularity
Commits
f2c6d44d
Commit
f2c6d44d
authored
3 years ago
by
Marty Kandes
Browse files
Options
Downloads
Patches
Plain Diff
Add support for CentOS/EPEL rpm-based yum install/remove of Singularity
parent
20b6ee9e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
naked-singularity.sh
+98
-38
98 additions, 38 deletions
naked-singularity.sh
with
99 additions
and
39 deletions
README.md
+
1
−
1
View file @
f2c6d44d
...
@@ -60,7 +60,7 @@ University of California, San Diego
...
@@ -60,7 +60,7 @@ University of California, San Diego
## Version
## Version
1.
8.
5
1.
8.
6
## Last Updated
## Last Updated
...
...
This diff is collapsed.
Click to expand it.
naked-singularity.sh
+
98
−
38
View file @
f2c6d44d
...
@@ -48,7 +48,8 @@ naked::install() {
...
@@ -48,7 +48,8 @@ naked::install() {
local
singularity_version
=
'3.5.3'
local
singularity_version
=
'3.5.3'
local
go_version
=
'1.15.6'
local
go_version
=
'1.15.6'
local
-i
use_rpm
=
1
local
use_rpm
=
'false'
local
rpm_repo
=
'epel'
local
os_release_id
=
''
local
os_release_id
=
''
local
os_release_version_id
=
''
local
os_release_version_id
=
''
...
@@ -64,9 +65,13 @@ naked::install() {
...
@@ -64,9 +65,13 @@ naked::install() {
shift
2
shift
2
;;
;;
-r
|
--rpm
)
-r
|
--rpm
)
use_rpm
=
0
use_rpm
=
'true'
shift
1
shift
1
;;
;;
-e
|
--enable-repo
)
rpm_repo
=
"
${
2
}
"
shift
2
;;
*
)
*
)
log::error
"Command-line option
${
1
}
not recognized or not supported."
log::error
"Command-line option
${
1
}
not recognized or not supported."
return
1
return
1
...
@@ -166,6 +171,13 @@ naked::install() {
...
@@ -166,6 +171,13 @@ naked::install() {
fi
fi
if
[[
"
${
os_release_id
}
"
=
'centos'
&&
"
${
use_rpm
}
"
=
'true'
]]
;
then
log::output
'Installing Singularity ...'
yum
-y
install
--enablerepo
=
"
${
rpm_repo
}
"
singularity-
"
${
singularity_version
}
"
else
# build and install singularity from source
mkdir
-p
/tmp/go
mkdir
-p
/tmp/go
cd
/tmp/go
cd
/tmp/go
...
@@ -201,6 +213,8 @@ naked::install() {
...
@@ -201,6 +213,8 @@ naked::install() {
make
-C
./builddir
make
-C
./builddir
make
-C
./builddir
install
make
-C
./builddir
install
fi
# Prepend the path of the install directory of Singularity to PATH
# Prepend the path of the install directory of Singularity to PATH
# because not all secure_paths in /etc/sudoers may include it. If it
# because not all secure_paths in /etc/sudoers may include it. If it
# is not included as one of the secure_paths by default, then the
# is not included as one of the secure_paths by default, then the
...
@@ -246,7 +260,7 @@ naked::install() {
...
@@ -246,7 +260,7 @@ naked::install() {
naked::uninstall
()
{
naked::uninstall
()
{
local
singularity_prefix
=
'/usr/local'
local
singularity_prefix
=
'/usr/local'
local
-i
use_rpm
=
1
local
use_rpm
=
'false'
local
os_release_id
=
''
local
os_release_id
=
''
local
os_release_version_id
=
''
local
os_release_version_id
=
''
...
@@ -258,7 +272,7 @@ naked::uninstall() {
...
@@ -258,7 +272,7 @@ naked::uninstall() {
shift
2
shift
2
;;
;;
-r
|
--rpm
)
-r
|
--rpm
)
use_rpm
=
0
use_rpm
=
'true'
shift
1
shift
1
;;
;;
*
)
*
)
...
@@ -276,18 +290,64 @@ naked::uninstall() {
...
@@ -276,18 +290,64 @@ naked::uninstall() {
return
1
return
1
fi
fi
log::output
'Parsing /etc/os-release to identify operating system ...'
if
[[
-f
'/etc/os-release'
]]
;
then
grep
'^ID='
/etc/os-release
>
/dev/null 2>&1
if
[[
"
${
?
}
"
-eq
0
]]
;
then
grep
'^ID='
/etc/os-release |
grep
'"'
>
/dev/null 2>&1
if
[[
"
${
?
}
"
-eq
0
]]
;
then
os_release_id
=
"
$(
grep
'^ID='
/etc/os-release |
cut
-d
'"'
-f
2
)
"
else
os_release_id
=
"
$(
grep
'^ID='
/etc/os-release |
cut
-d
'='
-f
2
)
"
fi
log::output
"Operating system identified as
${
os_release_id
}
."
else
log::error
'/etc/os-release does not contain ID parameter.'
return
1
fi
grep
'^VERSION_ID='
/etc/os-release
>
/dev/null 2>&1
if
[[
"
${
?
}
"
-eq
0
]]
;
then
grep
'^VERSION_ID='
/etc/os-release |
grep
'"'
>
/dev/null 2>&1
if
[[
"
${
?
}
"
-eq
0
]]
;
then
os_release_version_id
=
"
$(
grep
'^VERSION_ID='
/etc/os-release |
cut
-d
'"'
-f
2
)
"
else
os_release_version_id
=
"
$(
grep
'^VERSION_ID='
/etc/os-release |
cut
-d
'='
-f
2
)
"
fi
log::output
"Operating system version identified as
${
os_release_version_id
}
."
else
log::error
'/etc/os-release does not contain VERSION_ID parameter.'
return
1
fi
else
log::error
'/etc/os-release does not exist.'
return
1
fi
log::output
'Uninstalling Singularity ...'
log::output
'Uninstalling Singularity ...'
sudo rm
-rf
"
${
singularity_prefix
}
/libexec/singularity"
if
[[
"
${
os_release_id
}
"
=
'centos'
&&
"
${
use_rpm
}
"
=
'true'
]]
;
then
sudo rm
-rf
"
${
singularity_prefix
}
/var/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/etc/singularity"
yum
-y
remove singularity
sudo rm
-rf
"
${
singularity_prefix
}
/bin/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/bin/run-singularity"
else
# remove source-based install
sudo rm
-rf
"
${
singularity_prefix
}
/etc/bash_completion.d/singularity"
rm
-rf
"
${
singularity_prefix
}
/libexec/singularity"
rm
-rf
"
${
singularity_prefix
}
/var/singularity"
rm
-rf
"
${
singularity_prefix
}
/etc/singularity"
rm
-rf
"
${
singularity_prefix
}
/bin/singularity"
rm
-rf
"
${
singularity_prefix
}
/bin/run-singularity"
rm
-rf
"
${
singularity_prefix
}
/etc/bash_completion.d/singularity"
fi
log::output
'Checking if Singularity was uninstalled successfully ...'
log::output
'Checking if Singularity was uninstalled successfully ...'
which singularity
which singularity
if
[[
"
${
?
}
"
-eq
0
]]
;
then
if
[[
"
${
?
}
"
-eq
0
]]
;
then
log:error
'Singularity was NOT uninstalled!'
log:
:
error
'Singularity was NOT uninstalled!'
return
1
return
1
fi
fi
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment