@ -690,25 +690,33 @@ append_ld_so_conf() {
# but we need to generate a valid ld.so.conf. So we extract the
# but we need to generate a valid ld.so.conf. So we extract the
# current CPIO archive, run ldconfig -r against it and append the
# current CPIO archive, run ldconfig -r against it and append the
# last bits.
# last bits.
local tmp_dir_ext = " ${ tmp_dir } /extracted "
#
mkdir -p " ${ tmp_dir_ext } "
# We only do this if we are "root", because "ldconfig -r" requires
mkdir -p " ${ tmp_dir } /etc "
# root privileges to chroot. If we are not root we don't generate the
cd " ${ tmp_dir_ext } " || gen_die " cannot cd into ${ tmp_dir_ext } "
# ld.so.cache here, but expect that ldconfig would regenerate it when the
cpio -id --quiet < " ${ CPIO } " || gen_die " cannot re-extract ${ CPIO } "
# machine boots.
if [ [ $( id -u) = = 0 && -z ${ FAKED_MODE :- } ] ] ; then
cd " ${ tmp_dir } " || gen_die " cannot cd into ${ tmp_dir } "
local tmp_dir_ext = " ${ tmp_dir } /extracted "
ldconfig -r " ${ tmp_dir_ext } " || \
mkdir -p " ${ tmp_dir_ext } "
gen_die " cannot run ldconfig on ${ tmp_dir_ext } "
mkdir -p " ${ tmp_dir } /etc "
cp -a " ${ tmp_dir_ext } /etc/ld.so.cache " " ${ tmp_dir } /etc/ld.so.cache " || \
cd " ${ tmp_dir_ext } " || gen_die " cannot cd into ${ tmp_dir_ext } "
gen_die "cannot copy ld.so.cache"
cpio -id --quiet < " ${ CPIO } " || gen_die " cannot re-extract ${ CPIO } "
rm -rf " ${ tmp_dir_ext } "
cd " ${ tmp_dir } " || gen_die " cannot cd into ${ tmp_dir } "
ldconfig -r " ${ tmp_dir_ext } " || \
gen_die " cannot run ldconfig on ${ tmp_dir_ext } "
cp -a " ${ tmp_dir_ext } /etc/ld.so.cache " " ${ tmp_dir } /etc/ld.so.cache " || \
gen_die "cannot copy ld.so.cache"
rm -rf " ${ tmp_dir_ext } "
cd " ${ tmp_dir } " || gen_die " cannot cd into ${ tmp_dir } "
log_future_cpio_content
find . -print | cpio ${ CPIO_ARGS } --append -F " ${ CPIO } " \
|| gen_die "compressing ld.so.cache cpio"
cd " $( dirname " ${ tmp_dir } " ) "
rm -rf " ${ tmp_dir } "
fi
cd " ${ tmp_dir } " || gen_die " cannot cd into ${ tmp_dir } "
log_future_cpio_content
find . -print | cpio ${ CPIO_ARGS } --append -F " ${ CPIO } " \
|| gen_die "compressing ld.so.cache cpio"
cd " $( dirname " ${ tmp_dir } " ) "
rm -rf " ${ tmp_dir } "
}
}
print_list( )
print_list( )
@ -1001,10 +1009,8 @@ create_initramfs() {
append_data 'overlay'
append_data 'overlay'
fi
fi
if [ [ $( id -u) = = 0 && -z ${ FAKED_MODE :- } ] ] ; then
# keep this at the very end, generates /etc/ld.so.conf* and cache
# keep this at the very end, generates /etc/ld.so.conf* and cache
append_data 'ld_so_conf'
append_data 'ld_so_conf'
fi
# Finalize cpio by removing duplicate files
# Finalize cpio by removing duplicate files
print_info 1 " >> Finalizing cpio..."
print_info 1 " >> Finalizing cpio..."