Skip to content

Instantly share code, notes, and snippets.

@ogawa
Created March 31, 2020 03:09
Show Gist options
  • Save ogawa/7edc208b9dc547240bfd85deead371ca to your computer and use it in GitHub Desktop.
Save ogawa/7edc208b9dc547240bfd85deead371ca to your computer and use it in GitHub Desktop.
Parabricks installer patch
diff --git a/installer.py b/installer.py
index e3c723e..3ec86ff 100755
--- a/installer.py
+++ b/installer.py
@@ -167,8 +167,8 @@ def check_singularity():
run_and_return(["singularity", "--version"], "singularity --version failed. Please check installation of singularity.")
cmd_proc = subprocess.Popen(["singularity", "--version"], stdout = subprocess.PIPE, universal_newlines=True)
singularity_version = cmd_proc.stdout.readline().split('.')
- if "singularity version " in singularity_version[0]:
- if os.getuid() != 0:
+ if ("singularity version " in singularity_version[0]) or ("SingularityPRO version " in singularity_version[0]):
+ if (install_args.fakeroot == False) and (os.getuid() != 0):
print(textwrap.fill("You need root permissions to install with singularity v3.x or higher. Try with sudo, or install on a machine with sudo and copy the parabricks folder, or contact system administrator", 120))
InstallAbort()
return "singularity 3.x"
@@ -237,6 +237,7 @@ def get_install_args():
parser.add_argument("--force", help="Disable interactive installation", action='store_true', default=False)
parser.add_argument("--ngc", help="Pull image from NGC", action='store_false', default=True)
parser.add_argument("--cpu-only", help="Install CPU only accelerated tools", action='store_true', default=False)
+ parser.add_argument("--fakeroot", help="Build singularity image with fakeroot option", action='store_true', default=False)
allArgs = parser.parse_args()
if allArgs.uninstall == True:
print("Starting Uninstallation\n")
@@ -318,7 +319,11 @@ def install_singularity_image_v3():
singularity_definition_file.write("Registry: registry.gitlab.com\n\n")
singularity_definition_file.write("%post\n")
singularity_definition_file.write(" chmod 777 /parabricks\n")
- run_and_return(["singularity", "build", image_full_name, "pb.def"], "Could not download singularity image", False, True, newEnviron)
+
+ if install_args.fakeroot == False:
+ run_and_return(["singularity", "build", image_full_name, "pb.def"], "Could not download singularity image", False, True, newEnviron)
+ else:
+ run_and_return(["singularity", "build", "--fakeroot", image_full_name, "pb.def"], "Could not download singularity image", False, True, newEnviron)
os.remove("pb.def")
os.chdir(currentDir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment