Skip to content

Commit

Permalink
installer.py: get rpm db path using "rpm -E %_dbpath"
Browse files Browse the repository at this point in the history
Change-Id: I4e93e2aa0d66e6a069069613e0eb95613855712f
  • Loading branch information
gpiyush-dev committed Jan 25, 2023
1 parent 475ecf6 commit 1795c0f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions photon_installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,14 @@ def _initialize_system(self):
self._bind_installer()
self._bind_repo_dir()

rpm_db_path = subprocess.check_output(['rpm', '-E', '%_dbpath'], universal_newlines=True).rstrip('\n')
if not rpm_db_path:
self.logger.error("Rpm db path empty...")
self.exit_gracefully()
# Initialize rpm DB
self.cmd.run(['mkdir', '-p', os.path.join(self.photon_root, "var/lib/rpm")])
self.cmd.run(['mkdir', '-p', os.path.join(self.photon_root, rpm_db_path[1:])])

rpm_db_init_cmd = f"rpm --root {self.photon_root} --initdb --dbpath /var/lib/rpm"
rpm_db_init_cmd = f"rpm --root {self.photon_root} --initdb --dbpath {rpm_db_path}"
if self.cmd.checkIfHostRpmNotUsable():
rpm_db_init_cmd = f"tdnf install -y rpm && {rpm_db_init_cmd}"
retval = self.cmd.run(['docker', 'run', '--rm',
Expand Down

0 comments on commit 1795c0f

Please sign in to comment.