Commit 40965461 authored by Gerardo Exequiel Pozzi's avatar Gerardo Exequiel Pozzi
Browse files

[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: default avatarGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
parent 334db092
......@@ -24,6 +24,7 @@ make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
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 ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
: > ${work_dir}/build.${FUNCNAME}
fi
}
......@@ -32,11 +33,8 @@ make_setup_mkinitcpio() {
make_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch}
mkinitcpio \
-c ${script_path}/mkinitcpio.conf \
-b ${work_dir}/root-image \
-k /boot/vmlinuz-linux \
-g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img
mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${work_dir}/root-image
cp ${work_dir}/root-image/boot/archiso.img ${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
: > ${work_dir}/build.${FUNCNAME}
fi
......
......@@ -24,21 +24,6 @@ make_packages() {
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)
make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
......@@ -49,6 +34,7 @@ make_setup_mkinitcpio() {
done
cp /lib/initcpio/archiso_shutdown ${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}
fi
}
......@@ -59,11 +45,8 @@ make_boot() {
local _src=${work_dir}/root-image
local _dst_boot=${work_dir}/iso/${install_dir}/boot
mkdir -p ${_dst_boot}/${arch}
mkinitcpio \
-c ${script_path}/mkinitcpio.conf \
-b ${_src} \
-k /boot/vmlinuz-linux \
-g ${_dst_boot}/${arch}/archiso.img
mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${_src}
mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img
mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz
cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest
cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING
......@@ -103,6 +86,22 @@ make_isolinux() {
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)
make_lib_modules() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
......@@ -247,11 +246,11 @@ clean_dual ()
make_common_single() {
make_basefs
make_packages
make_customize_root_image
make_setup_mkinitcpio
make_boot
make_syslinux
make_isolinux
make_customize_root_image
make_lib_modules
make_usr_share
make_aitab $1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment