Harmonize handling of pre-existing gnupg dotfiles in chroot when handling fake signing keys for local repository.

This commit is contained in:
Daniel Baumann 2013-02-19 12:01:27 +01:00 committed by Daniel Baumann
parent 11b07e9a41
commit 48939b9ac9
1 changed files with 7 additions and 7 deletions

View File

@ -366,13 +366,12 @@ EOF
if [ "${LB_APT_SECURE}" = "true" ] if [ "${LB_APT_SECURE}" = "true" ]
then then
_LB_DOTGNUPG_EXISTED=0 if [ -e chroot/root/.gnupg ]
if [ -d chroot/root/.gnupg ]
then then
_LB_DOTGNUPG_EXISTED=1 mv chroot/root/.gnupg chroot/root/.gnupg.orig
fi fi
# Ensure ~/.gnupg exists (required for gnupg >= ~1.4.9) # Ensure ~/.gnupg exists
mkdir -p chroot/root/.gnupg mkdir -p chroot/root/.gnupg
# Temporarily replace /dev/random with /dev/urandom so as not # Temporarily replace /dev/random with /dev/urandom so as not
@ -436,10 +435,11 @@ EOF
mv chroot/dev/random.orig chroot/dev/random mv chroot/dev/random.orig chroot/dev/random
fi fi
# Remove /root/.gnupg if we created it during the signing process rm -rf chroot/root/.gnupg
if [ "${_LB_DOTGNUPG_EXISTED}" -eq 0 ]
if [ -e chroot/root/.gnupg.orig ]
then then
rm -rf chroot/root/.gnupg mv chroot/root/.gnupg.orig chroot/root/.gnupg
fi fi
fi fi