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
20b6ee9e
Commit
20b6ee9e
authored
3 years ago
by
Marty Kandes
Browse files
Options
Downloads
Patches
Plain Diff
Recreate uninstall command to remove a source-based install of Singularity
parent
9b2bfa67
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
+2
-2
2 additions, 2 deletions
README.md
naked-singularity.sh
+95
-12
95 additions, 12 deletions
naked-singularity.sh
with
97 additions
and
14 deletions
README.md
+
2
−
2
View file @
20b6ee9e
...
@@ -60,8 +60,8 @@ University of California, San Diego
...
@@ -60,8 +60,8 @@ University of California, San Diego
## Version
## Version
1.
8.
4
1.
8.
5
## Last Updated
## Last Updated
Thur
sday, August 1
2
th, 2021
Wedne
sday, August 1
8
th, 2021
This diff is collapsed.
Click to expand it.
naked-singularity.sh
+
95
−
12
View file @
20b6ee9e
...
@@ -6,8 +6,9 @@
...
@@ -6,8 +6,9 @@
#
#
# DESCRIPTION
# DESCRIPTION
#
#
# A bash script to help users work with Singularity on their Linux
# A bash shell utility to help you work with Singularity (and the
# desktop, laptop, or virtual machine.
# definition files within the naked-singularity repository) on your
# Linux desktop, laptop, or virtual machine.
#
#
# USAGE
# USAGE
#
#
...
@@ -17,7 +18,7 @@
...
@@ -17,7 +18,7 @@
#
#
# LAST UPDATED
# LAST UPDATED
#
#
#
Friday, July 23rd
, 2021
#
Wednesday, Auguest 18th
, 2021
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -26,7 +27,7 @@ source log.sh
...
@@ -26,7 +27,7 @@ source log.sh
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# naked::install
# naked::install
#
#
# Install Singularity
(
from source
)
.
# Install
s
Singularity from source
[or via rpm]
.
#
#
# Globals:
# Globals:
#
#
...
@@ -38,8 +39,8 @@ source log.sh
...
@@ -38,8 +39,8 @@ source log.sh
#
#
# Returns:
# Returns:
#
#
# True (0) if Singularity is installed sucessfully.
False (1)
# True (0) if Singularity is installed sucessfully.
# if the installation fails.
#
False (1)
if the installation
of Singularity
fails.
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -54,6 +55,10 @@ naked::install() {
...
@@ -54,6 +55,10 @@ naked::install() {
while
((
"
${#}
"
>
0
))
;
do
while
((
"
${#}
"
>
0
))
;
do
case
"
${
1
}
"
in
case
"
${
1
}
"
in
-s
|
--singularity
)
singularity_version
=
"
${
2
}
"
shift
2
;;
-g
|
--go
)
-g
|
--go
)
go_version
=
"
${
2
}
"
go_version
=
"
${
2
}
"
shift
2
shift
2
...
@@ -62,10 +67,6 @@ naked::install() {
...
@@ -62,10 +67,6 @@ naked::install() {
use_rpm
=
0
use_rpm
=
0
shift
1
shift
1
;;
;;
-s
|
--singularity
)
singularity_version
=
"
${
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
...
@@ -222,6 +223,80 @@ naked::install() {
...
@@ -222,6 +223,80 @@ naked::install() {
}
}
# ----------------------------------------------------------------------
# naked::uninstall
#
# Removes an existing source [or rpm-based] installation of Singularity.
#
# Globals:
#
# N/A
#
# Arguments:
#
# @
#
# Returns:
#
# True (0) if Singularity is uninstalled and removed sucessfully.
# False (1) if the removal of Singularity fails.
#
# ----------------------------------------------------------------------
naked::uninstall
()
{
local
singularity_prefix
=
'/usr/local'
local
-i
use_rpm
=
1
local
os_release_id
=
''
local
os_release_version_id
=
''
while
((
"
${#}
"
>
0
))
;
do
case
"
${
1
}
"
in
-p
|
--prefix
)
singularity_prefix
=
"
${
2
}
"
shift
2
;;
-r
|
--rpm
)
use_rpm
=
0
shift
1
;;
*
)
log::error
"Command-line option
${
1
}
not recognized or not supported."
return
1
esac
done
log::output
'Checking if Singularity is already installed ...'
singularity
--version
>
/dev/null 2>&1
if
[[
"
${
?
}
"
-eq
0
]]
;
then
log::output
"Singularity is installed:
$(
singularity
--version
)
"
else
log::error
'Singularity is not installed.'
return
1
fi
log::output
'Uninstalling Singularity ...'
sudo rm
-rf
"
${
singularity_prefix
}
/libexec/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/var/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/etc/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/bin/singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/bin/run-singularity"
sudo rm
-rf
"
${
singularity_prefix
}
/etc/bash_completion.d/singularity"
log::output
'Checking if Singularity was uninstalled successfully ...'
which singularity
if
[[
"
${
?
}
"
-eq
0
]]
;
then
log:error
'Singularity was NOT uninstalled!'
return
1
fi
log::output
'Singularity was uninstalled successfully!'
return
0
}
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# naked::help
# naked::help
#
#
...
@@ -265,8 +340,8 @@ naked::help() {
...
@@ -265,8 +340,8 @@ naked::help() {
#
#
# Returns:
# Returns:
#
#
# True (0) if the script executes without issue.
False (1) if the
# True (0) if the script executes without issue.
# script fails to executre properly.
#
False (1) if the
script fails to executre properly.
#
#
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -290,6 +365,14 @@ naked::main() {
...
@@ -290,6 +365,14 @@ naked::main() {
exit
1
exit
1
fi
fi
elif
[[
"
${
naked_command
}
"
=
'uninstall'
]]
;
then
naked::uninstall
"
${
@
}
"
if
[[
"
${
?
}
"
-ne
0
]]
;
then
log::error
'Failed to run uninstall command.'
exit
1
fi
elif
[[
"
${
naked_command
}
"
=
'help'
||
\
elif
[[
"
${
naked_command
}
"
=
'help'
||
\
"
${
naked_command
}
"
=
'-h'
||
\
"
${
naked_command
}
"
=
'-h'
||
\
"
${
naked_command
}
"
=
'--help'
]]
;
then
"
${
naked_command
}
"
=
'--help'
]]
;
then
...
...
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