[archiso] Drop aitab support

Always create one filesystem of a fixed size (32G), format (ext4) and
know name "airootfs".

Simplify logic a lot.
This commit is contained in:
Gerardo Exequiel Pozzi 2014-06-28 00:35:50 -03:00
parent 9131f83404
commit 36459f3acc
9 changed files with 21 additions and 148 deletions

View file

@ -101,7 +101,7 @@ _verify_checksum() {
}
run_hook() {
[[ -z "${arch}" ]] && arch="$(uname -m)"
arch="$(uname -m)"
[[ -z "${cowspace_size}" ]] && cowspace_size="75%"
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
[[ -z "${archisobasedir}" ]] && archisobasedir="arch"
@ -113,12 +113,6 @@ run_hook() {
cowfile_size=${cowfile_size/%}
fi
if [[ -z "${aitab}" ]]; then
aitab="/run/archiso/bootmnt/${archisobasedir}/aitab"
else
aitab="/run/archiso/bootmnt/${archisobasedir}/${aitab}"
fi
if [[ -n "${cow_label}" ]]; then
cow_device="/dev/disk/by-label/${cow_label}"
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
@ -147,14 +141,6 @@ archiso_mount_handler() {
fi
fi
if [[ ! -f "${aitab}" ]]; then
echo "ERROR: '${aitab}' file does not exist."
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
fi
if [[ "${checksum}" == "y" ]]; then
if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.${arch}.md5" ]]; then
msg -n ":: Self-test requested, please wait..."
@ -188,17 +174,8 @@ archiso_mount_handler() {
fi
mkdir -p "/run/archiso/cowspace/${cow_directory}"
local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size
while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do
[[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue
[[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue
if [[ "${aitab_fs_type}" != "none" ]]; then
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}"
_mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}" "${aitab_mnt}"
else
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}"
fi
done < "${aitab}"
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.fs.sfs" "/run/archiso/sfs/airootfs"
_mnt_fs "/run/archiso/sfs/airootfs/airootfs.fs" "${newroot}" "/"
if [[ "${copytoram}" == "y" ]]; then
umount /run/archiso/bootmnt

View file

@ -34,21 +34,7 @@ archiso_pxe_http_mount_handler () {
mkdir -p "/run/archiso/httpspace"
mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace"
local _aitab_url="${archiso_http_srv}${aitab#/run/archiso/bootmnt/}"
local _aitab_file="/run/archiso/httpspace/${aitab#/run/archiso/bootmnt/}"
_curl_get "${_aitab_url}" "/"
local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size
while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do
[[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue
[[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue
if [[ "${aitab_fs_type}" != "none" ]]; then
_curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}"
else
_curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}"
fi
done < "${_aitab_file}"
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.fs.sfs" "/${arch}"
if [[ "${checksum}" == "y" ]]; then
_curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/"

View file

@ -304,11 +304,7 @@ command_checksum () {
_msg_info "Creating checksum file for self-test (${_chk_arch})..."
cd "${work_dir}/iso/${install_dir}"
if [[ -d "${_chk_arch}" ]]; then
md5sum aitab > checksum.${_chk_arch}.md5
find ${_chk_arch} -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5
if [[ -d "any" ]]; then
find any -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5
fi
find ${_chk_arch} -type f -print0 | xargs -0 md5sum > checksum.${_chk_arch}.md5
fi
cd ${OLDPWD}
_msg_info "Done!"
@ -375,39 +371,23 @@ command_iso () {
fi
}
# Parse aitab and create each filesystem specified on that, and push it in "iso" directory.
# create airootfs.fs.sfs filesystem, and push it in "iso" directory.
command_prepare () {
if [[ ! -f "${work_dir}/iso/${install_dir}/aitab" ]]; then
_msg_error "The file '${work_dir}/iso/${install_dir}/aitab' does not exist." 1
fi
_show_config prepare
_cleanup
local _aitab_img _aitab_mnt _aitab_arch _aitab_sfs_comp _aitab_fs_type _aitab_fs_size
while read _aitab_img _aitab_mnt _aitab_arch _aitab_sfs_comp _aitab_fs_type _aitab_fs_size ; do
if [[ ${_aitab_img} =~ ^# ]]; then
continue
fi
if [[ "${_aitab_arch}" != "any" && "${_aitab_arch}" != "${arch}" ]]; then
continue
fi
local _src="${work_dir}/${_aitab_img}"
local _dst="${work_dir}/iso/${install_dir}/${_aitab_arch}"
mkdir -p "${_dst}"
if [[ ${_aitab_fs_type} != "none" ]]; then
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then
_mkfs ${_aitab_img}
_mksfs ${_aitab_img}.fs
mv "${_src}.fs.sfs" "${_dst}"
rm "${_src}.fs"
fi
else
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then
_mksfs ${_aitab_img}
mv "${work_dir}/${_aitab_img}.sfs" "${_dst}"
fi
fi
done < "${work_dir}/iso/${install_dir}/aitab"
local _src="${work_dir}/airootfs"
local _dst="${work_dir}/iso/${install_dir}/${arch}"
mkdir -p "${_dst}"
if _is_directory_changed "${_src}" "${_dst}/airootfs.fs.sfs"; then
_mkfs airootfs
_mksfs airootfs.fs
mv "${_src}.fs.sfs" "${_dst}"
rm "${_src}.fs"
fi
}
# Install packages on airootfs.

View file

@ -1,2 +0,0 @@
# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size>
airootfs / %ARCH% gzip ext4 50%

View file

@ -60,12 +60,7 @@ make_isolinux() {
cp ${work_dir}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/
}
# Process aitab
make_aitab() {
sed "s|%ARCH%|${arch}|g" ${script_path}/aitab > ${work_dir}/iso/${install_dir}/aitab
}
# Build all filesystem images specified in aitab (.fs.sfs .sfs)
# Build airootfs filesystem image
make_prepare() {
mkarchiso -v -w "${work_dir}" -D "${install_dir}" prepare
}
@ -81,6 +76,5 @@ run_once make_setup_mkinitcpio
run_once make_boot
run_once make_syslinux
run_once make_isolinux
run_once make_aitab
run_once make_prepare
run_once make_iso

View file

@ -1,3 +0,0 @@
# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size>
airootfs / i686 xz ext4 50%
airootfs / x86_64 xz ext4 50%

View file

@ -182,13 +182,7 @@ make_efiboot() {
umount ${work_dir}/efiboot
}
# Copy aitab
make_aitab() {
mkdir -p ${work_dir}/iso/${install_dir}
cp ${script_path}/aitab ${work_dir}/iso/${install_dir}/aitab
}
# Build all filesystem images specified in aitab (.fs.sfs .sfs)
# Build airootfs filesystem image
make_prepare() {
cp -a -l -f ${work_dir}/${arch}/airootfs ${work_dir}
setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist
@ -253,8 +247,6 @@ run_once make_isolinux
run_once make_efi
run_once make_efiboot
run_once make_aitab
for arch in i686 x86_64; do
run_once make_prepare
done

View file

@ -23,8 +23,6 @@ INDEX
Default: "/dev/disk/by-label/${archisolabel}"
* archisobasedir= Set the base directory where all files reside.
Default: "arch"
* aitab= Set the path for "aitab" file.
Default: ${archisobasedir}/aitab
* copytoram= If set to "y" or just "copytoram" without arguments,
all SquashFS are copied to "RAM".
Default: (unset)
@ -59,10 +57,6 @@ INDEX
Default: "75%"
* dm_snap_prefix= Set a prefix for device-mapper snapshot node names.
Default: "arch"
* arch= Force an architecture type (i686 | x86_64).
Do not set it for normal operations.
Useful for running a 64 bit kernel / 32 bit userspace.
Default: (architecture of running kernel)
** hooks/archiso_pxe_common

View file

@ -2,9 +2,6 @@ INDEX
-----
* Build requirements
* Image types generated by mkarchiso.
* File format for aitab.
* Why the /isolinux and /arch/boot/syslinux directories?
* Building the most basic Arch Linux live media. (configs/baseline)
* Building official Arch Linux live media. (configs/releng)
@ -39,52 +36,10 @@ INDEX
+ (none)
*** Image types generated by mkarchiso.
* image-name.sfs SquashFS image with all files directly on it.
[read-only, no dm-snapshot is used]
* image-name.fs.sfs SquashFS with only one file inside (image-name.fs),
which is an image of some type of filesystem
(ext4, ext3, ext2, xfs, btrfs), all files reside on it.
[read-write, via COW image with dm-snapshot]
*** File format for aitab.
The aitab file holds information about the filesystems images that must be
created by mkarchiso and mounted at initramfs stage from the archiso hook.
It consists of some fields which define the behaviour of images.
# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size>
<img> Image name without extension (.fs .fs.sfs .sfs).
<mnt> Mount point.
<arch> Architecture { i686 | x86_64 | any }.
<sfs_comp> SquashFS compression type { gzip | lzo | xz }.
<fs_type> Set the filesystem type of the image
{ ext4 | ext3 | ext2 | xfs | btrfs }.
A special value of "none" denotes no usage of a filesystem.
In that case all files are pushed directly to SquashFS filesystem.
<fs_size> An absolute value of file system image size in MiB.
(example: 100, 1000, 4096, etc)
A relative value of file system free space [in percent].
{1%..99%} (example 50%, 10%, 7%).
This is an estimation, and calculated in a simple way.
Space used + 10% (estimated for metadata overhead) + desired %
*** Why the /isolinux and /arch/boot/syslinux directories?
The /isolinux directory holds files needed for the ISOLINUX boot loader
module of SYSLINUX. ISOLINUX can not find config files on
/arch/boot/syslinux, like other boot loaders modules (SYSLINUX, PXELINUX).
*** Building the most basic Arch Linux live media. (configs/baseline)
* Install needed packages.
# pacman -S git make arch-install-scripts squashfs-tools libisoburn rsync --needed
# pacman -S git make arch-install-scripts squashfs-tools libisoburn --needed
* Install archiso.
# git clone git://projects.archlinux.org/archiso.git