[configs/*] chroot to root-image for initramfs build

Avoid issues with -b BASEDIR (*).
We became independent of the mkinitcpio version of the build environment.

(*) For example of a recent issue:
http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002202.html
http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002205.html

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
This commit is contained in:
Gerardo Exequiel Pozzi 2011-11-28 10:35:05 -03:00
parent 334db092b5
commit 40965461a4
2 changed files with 23 additions and 26 deletions

View File

@ -24,6 +24,7 @@ make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks
cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install
cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
fi fi
} }
@ -32,11 +33,8 @@ make_setup_mkinitcpio() {
make_boot() { make_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
mkinitcpio \ mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${work_dir}/root-image
-c ${script_path}/mkinitcpio.conf \ cp ${work_dir}/root-image/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
-b ${work_dir}/root-image \
-k /boot/vmlinuz-linux \
-g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
cp ${work_dir}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz cp ${work_dir}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
fi fi

View File

@ -24,21 +24,6 @@ make_packages() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create
} }
# Customize installation (root-image)
make_customize_root_image() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
cp -af ${script_path}/root-image ${work_dir}
chmod 750 ${work_dir}/root-image/etc/sudoers.d
chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel
mkdir -p ${work_dir}/root-image/etc/pacman.d
wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/
sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist
chroot ${work_dir}/root-image /usr/sbin/locale-gen
chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" arch
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Copy mkinitcpio archiso hooks (root-image) # Copy mkinitcpio archiso hooks (root-image)
make_setup_mkinitcpio() { make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
@ -49,6 +34,7 @@ make_setup_mkinitcpio() {
done done
cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio
cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio
cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
fi fi
} }
@ -59,11 +45,8 @@ make_boot() {
local _src=${work_dir}/root-image local _src=${work_dir}/root-image
local _dst_boot=${work_dir}/iso/${install_dir}/boot local _dst_boot=${work_dir}/iso/${install_dir}/boot
mkdir -p ${_dst_boot}/${arch} mkdir -p ${_dst_boot}/${arch}
mkinitcpio \ mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${_src}
-c ${script_path}/mkinitcpio.conf \ mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img
-b ${_src} \
-k /boot/vmlinuz-linux \
-g ${_dst_boot}/${arch}/archiso.img
mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz
cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest
cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING
@ -103,6 +86,22 @@ make_isolinux() {
fi fi
} }
# Customize installation (root-image)
# NOTE: mkarchroot should not be executed after this function is executed, otherwise will overwrites some custom files.
make_customize_root_image() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
cp -af ${script_path}/root-image ${work_dir}
chmod 750 ${work_dir}/root-image/etc/sudoers.d
chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel
mkdir -p ${work_dir}/root-image/etc/pacman.d
wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/
sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist
chroot ${work_dir}/root-image /usr/sbin/locale-gen
chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" arch
: > ${work_dir}/build.${FUNCNAME}
fi
}
# Split out /lib/modules from root-image (makes more "dual-iso" friendly) # Split out /lib/modules from root-image (makes more "dual-iso" friendly)
make_lib_modules() { make_lib_modules() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
@ -247,11 +246,11 @@ clean_dual ()
make_common_single() { make_common_single() {
make_basefs make_basefs
make_packages make_packages
make_customize_root_image
make_setup_mkinitcpio make_setup_mkinitcpio
make_boot make_boot
make_syslinux make_syslinux
make_isolinux make_isolinux
make_customize_root_image
make_lib_modules make_lib_modules
make_usr_share make_usr_share
make_aitab $1 make_aitab $1