yum-minimal : better cleanup of initial yum failure
If the initial yum install into the chroot fails, we can leave behind a lockfile and an incorrectly modified rpmmacros. Change this so we run the cleanup unconditionally. Change-Id: Ia9f9c4c845e5f34d33ff9a4ab7226c9175283757
This commit is contained in:
parent
1fabb01a4f
commit
e2c0d16f84
@ -124,15 +124,22 @@ function _install_pkg_manager {
|
||||
(
|
||||
flock -w 1200 9 || die "Can not lock .rpmmacros"
|
||||
echo "%_dbpath /var/lib/rpm" >> $HOME/.rpmmacros
|
||||
|
||||
sudo -E yum -y \
|
||||
--setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \
|
||||
--setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \
|
||||
--releasever=$DIB_RELEASE \
|
||||
--installroot $TARGET_ROOT \
|
||||
install $@
|
||||
sed -i '$ d' $HOME/.rpmmacros
|
||||
) 9>$HOME/.rpmmacros.dib.lock
|
||||
install $@ && rc=$? || rc=$?
|
||||
|
||||
# We modified the base system - make sure we clean up always!
|
||||
rm $HOME/.rpmmacros.dib.lock
|
||||
sed -i '$ d' $HOME/.rpmmacros
|
||||
if [ $rc != 0 ]; then
|
||||
die "Initial yum install to chroot failed! Can not continue."
|
||||
fi
|
||||
) 9>$HOME/.rpmmacros.dib.lock
|
||||
|
||||
# Set gpg path back because subsequent actions will take place in
|
||||
# the chroot
|
||||
sudo sed -i "s,$TARGET_ROOT/etc/pki/rpm-gpg,/etc/pki/rpm-gpg,g" \
|
||||
|
Loading…
Reference in New Issue
Block a user