From d57f25403559f8c68edab73f607616fa77cf644d Mon Sep 17 00:00:00 2001
From: Marty Kandes <mkandes@sdsc.edu>
Date: Thu, 22 Jul 2021 21:52:53 +0000
Subject: [PATCH] Create ~/.rpmmacros file on install for Ubuntu operating
 systems

This temporary (?) fix [1] allows yum-based bootstrapping of Singularity
containers on Ubuntu (and/or Debian-based) operating systems.

[1]

ubuntu@singualrity-ubuntu-builder:~/naked-singularity/definition-files/centos$ sudo singularity build centos-7.9.2009.sif Singularity.centos-7.9.2009
INFO:    Starting build...
FATAL:   While performing build: conveyor failed to get: while checking rpm path: RPM database is using a weird path: %(bash
You are probably running this bootstrap on Debian or Ubuntu.
There is a way to work around this problem:
Create a file at path /home/ubuntu/.rpmmacros.
Place the following lines into the '.rpmmacros' file:
%_var /var
%_dbpath %{_var}/lib/rpm
After creating the file, re-run the bootstrap.
More info: https://github.com/hpcng/singularity/issues/241
---
 README.md            | 2 +-
 naked-singularity.sh | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 3fbcf7f..af45118 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ University of California, San Diego
 
 ## Version
 
-1.7.4
+1.7.5
 
 ## Last Updated
 
diff --git a/naked-singularity.sh b/naked-singularity.sh
index e54dabf..e9c473d 100755
--- a/naked-singularity.sh
+++ b/naked-singularity.sh
@@ -154,6 +154,10 @@ naked::install() {
     apt-get -y install debootstrap
     apt-get -y install yum-utils
 
+    # https://github.com/hpcng/singularity/issues/241
+    echo '%_var /var' > ~/.rpmmacros
+    echo '%_dbpath %{_var}/lib/rpm' >> ~/.rpmmacros
+
   else
 
     log::error 'Operating system not recognized or not supported.'
-- 
GitLab