[arch-releng] [RFC] Reworking some features of archiso
This is manly for make it more simple, removing features not used today, or never used. I want to do this for making transition to systemd (on initramfs) more easy.
Two purposes: * systemd filename friendly: "-" is used for "/" and must be escaped with "\x20" * ISO9660 filename friendly: "-" is replaced with "_" --- archiso/mkarchiso | 54 +++++++-------- configs/baseline/aitab | 2 +- configs/baseline/build.sh | 26 ++++---- configs/releng/airootfs/etc/fstab | 0 configs/releng/airootfs/etc/hostname | 1 + configs/releng/airootfs/etc/locale.conf | 1 + configs/releng/airootfs/etc/pam.d/su | 6 ++ configs/releng/airootfs/etc/sudoers.d/g_wheel | 1 + .../airootfs/etc/systemd/scripts/choose-mirror | 26 ++++++++ .../etc/systemd/system/choose-mirror.service | 10 +++ .../etc/systemd/system/etc-pacman.d-gnupg.mount | 8 +++ .../system/getty@tty1.service.d/autologin.conf | 3 + .../etc/systemd/system/pacman-init.service | 15 +++++ .../airootfs/etc/udev/rules.d/81-dhcpcd.rules | 1 + configs/releng/airootfs/root/.automated_script.sh | 34 ++++++++++ configs/releng/airootfs/root/.zlogin | 1 + configs/releng/airootfs/root/customize_airootfs.sh | 22 +++++++ configs/releng/airootfs/root/install.txt | 3 + configs/releng/aitab | 4 +- configs/releng/build.sh | 76 +++++++++++----------- configs/releng/root-image/etc/fstab | 0 configs/releng/root-image/etc/hostname | 1 - configs/releng/root-image/etc/locale.conf | 1 - configs/releng/root-image/etc/pam.d/su | 6 -- configs/releng/root-image/etc/sudoers.d/g_wheel | 1 - .../root-image/etc/systemd/scripts/choose-mirror | 26 -------- .../etc/systemd/system/choose-mirror.service | 10 --- .../etc/systemd/system/etc-pacman.d-gnupg.mount | 8 --- .../system/getty@tty1.service.d/autologin.conf | 3 - .../etc/systemd/system/pacman-init.service | 15 ----- .../root-image/etc/udev/rules.d/81-dhcpcd.rules | 1 - .../releng/root-image/root/.automated_script.sh | 34 ---------- configs/releng/root-image/root/.zlogin | 1 - .../releng/root-image/root/customize_root_image.sh | 22 ------- configs/releng/root-image/root/install.txt | 3 - docs/README.build | 2 +- 36 files changed, 214 insertions(+), 214 deletions(-) create mode 100644 configs/releng/airootfs/etc/fstab create mode 100644 configs/releng/airootfs/etc/hostname create mode 100644 configs/releng/airootfs/etc/locale.conf create mode 100644 configs/releng/airootfs/etc/pam.d/su create mode 100644 configs/releng/airootfs/etc/sudoers.d/g_wheel create mode 100755 configs/releng/airootfs/etc/systemd/scripts/choose-mirror create mode 100644 configs/releng/airootfs/etc/systemd/system/choose-mirror.service create mode 100644 configs/releng/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount create mode 100644 configs/releng/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf create mode 100644 configs/releng/airootfs/etc/systemd/system/pacman-init.service create mode 100644 configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules create mode 100755 configs/releng/airootfs/root/.automated_script.sh create mode 100644 configs/releng/airootfs/root/.zlogin create mode 100755 configs/releng/airootfs/root/customize_airootfs.sh create mode 100644 configs/releng/airootfs/root/install.txt delete mode 100644 configs/releng/root-image/etc/fstab delete mode 100644 configs/releng/root-image/etc/hostname delete mode 100644 configs/releng/root-image/etc/locale.conf delete mode 100644 configs/releng/root-image/etc/pam.d/su delete mode 100644 configs/releng/root-image/etc/sudoers.d/g_wheel delete mode 100755 configs/releng/root-image/etc/systemd/scripts/choose-mirror delete mode 100644 configs/releng/root-image/etc/systemd/system/choose-mirror.service delete mode 100644 configs/releng/root-image/etc/systemd/system/etc-pacman.d-gnupg.mount delete mode 100644 configs/releng/root-image/etc/systemd/system/getty@tty1.service.d/autologin.conf delete mode 100644 configs/releng/root-image/etc/systemd/system/pacman-init.service delete mode 100644 configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules delete mode 100755 configs/releng/root-image/root/.automated_script.sh delete mode 100644 configs/releng/root-image/root/.zlogin delete mode 100755 configs/releng/root-image/root/customize_root_image.sh delete mode 100644 configs/releng/root-image/root/install.txt diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 9655167..26a82ee 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -51,14 +51,14 @@ _chroot_init() { if [[ -f "${work_dir}/mkarchiso.init" ]]; then _msg_info "Initial enviroment already installed, skipping." else - mkdir -p ${work_dir}/root-image + mkdir -p ${work_dir}/airootfs _pacman "base syslinux" : > "${work_dir}/mkarchiso.init" fi } _chroot_run() { - eval arch-chroot ${work_dir}/root-image "${run_cmd}" + eval arch-chroot ${work_dir}/airootfs "${run_cmd}" } # Mount a filesystem (trap signals in case of error for unmounting it @@ -116,7 +116,7 @@ _usage () echo "usage ${app_name} [options] command <command options>" echo " general options:" echo " -p PACKAGE(S) Package(s) to install, can be used multiple times" - echo " -r <command> Run <command> inside root-image" + echo " -r <command> Run <command> inside airootfs" echo " -C <file> Config file for pacman." echo " Default: '${pacman_conf}'" echo " -L <label> Set a label for the disk" @@ -146,7 +146,7 @@ _usage () echo " checksum" echo " make a checksum.md5 for self-test" echo " pkglist" - echo " make a pkglist.txt of packages installed on root-image" + echo " make a pkglist.txt of packages installed on airootfs" echo " iso <image name>" echo " build an iso image from the working dir" exit ${1} @@ -189,51 +189,51 @@ _show_config () { echo } -# Install desired packages to root-image +# Install desired packages to airootfs _pacman () { - _msg_info "Installing packages to '${work_dir}/root-image/'..." + _msg_info "Installing packages to '${work_dir}/airootfs/'..." if [[ "${quiet}" = "y" ]]; then - pacstrap -C "${pacman_conf}" -c -d -G -M "${work_dir}/root-image" $* &> /dev/null + pacstrap -C "${pacman_conf}" -c -d -G -M "${work_dir}/airootfs" $* &> /dev/null else - pacstrap -C "${pacman_conf}" -c -d -G -M "${work_dir}/root-image" $* + pacstrap -C "${pacman_conf}" -c -d -G -M "${work_dir}/airootfs" $* fi _msg_info "Packages installed successfully!" } -# Cleanup root-image +# Cleanup airootfs _cleanup () { - _msg_info "Cleaning up what we can on root-image..." + _msg_info "Cleaning up what we can on airootfs..." # Delete initcpio image(s) - if [[ -d "${work_dir}/root-image/boot" ]]; then - find "${work_dir}/root-image/boot" -type f -name '*.img' -delete + if [[ -d "${work_dir}/airootfs/boot" ]]; then + find "${work_dir}/airootfs/boot" -type f -name '*.img' -delete fi # Delete kernel(s) - if [[ -d "${work_dir}/root-image/boot" ]]; then - find "${work_dir}/root-image/boot" -type f -name 'vmlinuz*' -delete + if [[ -d "${work_dir}/airootfs/boot" ]]; then + find "${work_dir}/airootfs/boot" -type f -name 'vmlinuz*' -delete fi # Delete pacman database sync cache files (*.tar.gz) - if [[ -d "${work_dir}/root-image/var/lib/pacman" ]]; then - find "${work_dir}/root-image/var/lib/pacman" -maxdepth 1 -type f -delete + if [[ -d "${work_dir}/airootfs/var/lib/pacman" ]]; then + find "${work_dir}/airootfs/var/lib/pacman" -maxdepth 1 -type f -delete fi # Delete pacman database sync cache - if [[ -d "${work_dir}/root-image/var/lib/pacman/sync" ]]; then - find "${work_dir}/root-image/var/lib/pacman/sync" -delete + if [[ -d "${work_dir}/airootfs/var/lib/pacman/sync" ]]; then + find "${work_dir}/airootfs/var/lib/pacman/sync" -delete fi # Delete pacman package cache - if [[ -d "${work_dir}/root-image/var/cache/pacman/pkg" ]]; then - find "${work_dir}/root-image/var/cache/pacman/pkg" -type f -delete + if [[ -d "${work_dir}/airootfs/var/cache/pacman/pkg" ]]; then + find "${work_dir}/airootfs/var/cache/pacman/pkg" -type f -delete fi # Delete all log files, keeps empty dirs. - if [[ -d "${work_dir}/root-image/var/log" ]]; then - find "${work_dir}/root-image/var/log" -type f -delete + if [[ -d "${work_dir}/airootfs/var/log" ]]; then + find "${work_dir}/airootfs/var/log" -type f -delete fi # Delete all temporary files and dirs - if [[ -d "${work_dir}/root-image/var/tmp" ]]; then - find "${work_dir}/root-image/var/tmp" -mindepth 1 -delete + if [[ -d "${work_dir}/airootfs/var/tmp" ]]; then + find "${work_dir}/airootfs/var/tmp" -mindepth 1 -delete fi # Delete package pacman related files. find "${work_dir}" \( -name "*.pacnew" -o -name "*.pacsave" -o -name "*.pacorig" \) -delete @@ -359,9 +359,9 @@ command_checksum () { command_pkglist () { _show_config pkglist - if _is_directory_changed "${work_dir}/root-image/var/lib/pacman/local" "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt"; then + if _is_directory_changed "${work_dir}/airootfs/var/lib/pacman/local" "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt"; then _msg_info "Creating a list of installed packages on live-enviroment..." - pacman -Sl -r "${work_dir}/root-image" --config "${pacman_conf}" | \ + pacman -Sl -r "${work_dir}/airootfs" --config "${pacman_conf}" | \ awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > \ "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" _msg_info "Done!" @@ -450,7 +450,7 @@ command_prepare () { done < "${work_dir}/iso/${install_dir}/aitab" } -# Install packages on root-image. +# Install packages on airootfs. # A basic check to avoid double execution/reinstallation is done via hashing package names. command_install () { if [[ ! -f "${pacman_conf}" ]]; then diff --git a/configs/baseline/aitab b/configs/baseline/aitab index 234f61c..9134d60 100644 --- a/configs/baseline/aitab +++ b/configs/baseline/aitab @@ -1,2 +1,2 @@ # <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> -root-image / %ARCH% gzip ext4 50% +airootfs / %ARCH% gzip ext4 50% diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index ed65e17..19bc0c4 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -20,24 +20,24 @@ run_once() { fi } -# Base installation (root-image) +# Base installation (airootfs) make_basefs() { mkarchiso -v -w "${work_dir}" -D "${install_dir}" init } -# Copy mkinitcpio archiso hooks and build initramfs (root-image) +# Copy mkinitcpio archiso hooks and build initramfs (airootfs) make_setup_mkinitcpio() { - cp /usr/lib/initcpio/hooks/archiso ${work_dir}/root-image/usr/lib/initcpio/hooks - cp /usr/lib/initcpio/install/archiso ${work_dir}/root-image/usr/lib/initcpio/install - cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf + cp /usr/lib/initcpio/hooks/archiso ${work_dir}/airootfs/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/archiso ${work_dir}/airootfs/usr/lib/initcpio/install + cp ${script_path}/mkinitcpio.conf ${work_dir}/airootfs/etc/mkinitcpio-archiso.conf mkarchiso -v -w "${work_dir}" -D "${install_dir}" -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run } # Prepare ${install_dir}/boot/ make_boot() { mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} - 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 + cp ${work_dir}/airootfs/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + cp ${work_dir}/airootfs/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz } # Prepare /${install_dir}/boot/syslinux @@ -46,18 +46,18 @@ make_syslinux() { sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g; s|%ARCH%|${arch}|g" ${script_path}/syslinux/syslinux.cfg > ${work_dir}/iso/${install_dir}/boot/syslinux/syslinux.cfg - cp ${work_dir}/root-image/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ - cp ${work_dir}/root-image/usr/lib/syslinux/bios/menu.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ - cp ${work_dir}/root-image/usr/lib/syslinux/bios/libutil.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/menu.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/libutil.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ } # Prepare /isolinux make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg - cp ${work_dir}/root-image/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/ - cp ${work_dir}/root-image/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/ - cp ${work_dir}/root-image/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/ } # Process aitab diff --git a/configs/releng/airootfs/etc/fstab b/configs/releng/airootfs/etc/fstab new file mode 100644 index 0000000..e69de29 diff --git a/configs/releng/airootfs/etc/hostname b/configs/releng/airootfs/etc/hostname new file mode 100644 index 0000000..2dbe21e --- /dev/null +++ b/configs/releng/airootfs/etc/hostname @@ -0,0 +1 @@ +archiso diff --git a/configs/releng/airootfs/etc/locale.conf b/configs/releng/airootfs/etc/locale.conf new file mode 100644 index 0000000..01ec548 --- /dev/null +++ b/configs/releng/airootfs/etc/locale.conf @@ -0,0 +1 @@ +LANG=en_US.UTF-8 diff --git a/configs/releng/airootfs/etc/pam.d/su b/configs/releng/airootfs/etc/pam.d/su new file mode 100644 index 0000000..a291042 --- /dev/null +++ b/configs/releng/airootfs/etc/pam.d/su @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth sufficient pam_wheel.so trust use_uid +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so diff --git a/configs/releng/airootfs/etc/sudoers.d/g_wheel b/configs/releng/airootfs/etc/sudoers.d/g_wheel new file mode 100644 index 0000000..8c45359 --- /dev/null +++ b/configs/releng/airootfs/etc/sudoers.d/g_wheel @@ -0,0 +1 @@ +%wheel ALL=(ALL) NOPASSWD: ALL diff --git a/configs/releng/airootfs/etc/systemd/scripts/choose-mirror b/configs/releng/airootfs/etc/systemd/scripts/choose-mirror new file mode 100755 index 0000000..0ae0806 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/scripts/choose-mirror @@ -0,0 +1,26 @@ +#!/bin/bash + +get_cmdline() { + local param + for param in $(< /proc/cmdline); do + case "${param}" in + $1=*) echo "${param##*=}"; + return 0 + ;; + esac + done +} + +mirror=$(get_cmdline mirror) +[[ $mirror = auto ]] && mirror=$(get_cmdline archiso_http_srv) +[[ $mirror ]] || exit 0 + +mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig +cat >/etc/pacman.d/mirrorlist << EOF +# +# Arch Linux repository mirrorlist +# Generated by archiso +# + +Server = ${mirror%%/}/\$repo/os/\$arch +EOF diff --git a/configs/releng/airootfs/etc/systemd/system/choose-mirror.service b/configs/releng/airootfs/etc/systemd/system/choose-mirror.service new file mode 100644 index 0000000..1e4d771 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/choose-mirror.service @@ -0,0 +1,10 @@ +[Unit] +Description=Choose mirror from the kernel command line +ConditionKernelCommandLine=mirror + +[Service] +Type=oneshot +ExecStart=/etc/systemd/scripts/choose-mirror + +[Install] +WantedBy=multi-user.target diff --git a/configs/releng/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount b/configs/releng/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount new file mode 100644 index 0000000..4eab551 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount @@ -0,0 +1,8 @@ +[Unit] +Description=Temporary /etc/pacman.d/gnupg directory + +[Mount] +What=tmpfs +Where=/etc/pacman.d/gnupg +Type=tmpfs +Options=mode=0755 diff --git a/configs/releng/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf b/configs/releng/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000..d1d8474 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --autologin root --noclear %I 38400 linux diff --git a/configs/releng/airootfs/etc/systemd/system/pacman-init.service b/configs/releng/airootfs/etc/systemd/system/pacman-init.service new file mode 100644 index 0000000..23b8144 --- /dev/null +++ b/configs/releng/airootfs/etc/systemd/system/pacman-init.service @@ -0,0 +1,15 @@ +[Unit] +Description=Initializes Pacman keyring +Wants=haveged.service +After=haveged.service +Requires=etc-pacman.d-gnupg.mount +After=etc-pacman.d-gnupg.mount + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate archlinux + +[Install] +WantedBy=multi-user.target diff --git a/configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules b/configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules new file mode 100644 index 0000000..1c4053c --- /dev/null +++ b/configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="en*|eth*", ENV{SYSTEMD_WANTS}="dhcpcd@$name.service" diff --git a/configs/releng/airootfs/root/.automated_script.sh b/configs/releng/airootfs/root/.automated_script.sh new file mode 100755 index 0000000..fb106da --- /dev/null +++ b/configs/releng/airootfs/root/.automated_script.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +script_cmdline () +{ + local param + for param in $(< /proc/cmdline); do + case "${param}" in + script=*) echo "${param##*=}" ; return 0 ;; + esac + done +} + +automated_script () +{ + local script rt + script="$(script_cmdline)" + if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then + if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then + wget "${script}" --retry-connrefused -q -O /tmp/startup_script >/dev/null + rt=$? + else + cp "${script}" /tmp/startup_script + rt=$? + fi + if [[ ${rt} -eq 0 ]]; then + chmod +x /tmp/startup_script + /tmp/startup_script + fi + fi +} + +if [[ $(tty) == "/dev/tty1" ]]; then + automated_script +fi diff --git a/configs/releng/airootfs/root/.zlogin b/configs/releng/airootfs/root/.zlogin new file mode 100644 index 0000000..f598e43 --- /dev/null +++ b/configs/releng/airootfs/root/.zlogin @@ -0,0 +1 @@ +~/.automated_script.sh diff --git a/configs/releng/airootfs/root/customize_airootfs.sh b/configs/releng/airootfs/root/customize_airootfs.sh new file mode 100755 index 0000000..9c85453 --- /dev/null +++ b/configs/releng/airootfs/root/customize_airootfs.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e -u + +sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen +locale-gen + +ln -sf /usr/share/zoneinfo/UTC /etc/localtime + +usermod -s /usr/bin/zsh root +cp -aT /etc/skel/ /root/ + +useradd -m -p "" -g users -G "adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel" -s /usr/bin/zsh arch + +chmod 750 /etc/sudoers.d +chmod 440 /etc/sudoers.d/g_wheel + +sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist +sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf + +systemctl enable pacman-init.service choose-mirror.service +systemctl set-default multi-user.target diff --git a/configs/releng/airootfs/root/install.txt b/configs/releng/airootfs/root/install.txt new file mode 100644 index 0000000..3c8f171 --- /dev/null +++ b/configs/releng/airootfs/root/install.txt @@ -0,0 +1,3 @@ +View this installation guide online at +https://wiki.archlinux.org/index.php/Installation_Guide + diff --git a/configs/releng/aitab b/configs/releng/aitab index b7e9a17..f9b482d 100644 --- a/configs/releng/aitab +++ b/configs/releng/aitab @@ -1,3 +1,3 @@ # <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> -root-image / i686 xz ext4 50% -root-image / x86_64 xz ext4 50% +airootfs / i686 xz ext4 50% +airootfs / x86_64 xz ext4 50% diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 63b7126..2438175 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -51,53 +51,53 @@ make_pacman_conf() { sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${_cache_dirs[@]})|g" ${script_path}/pacman.conf > ${pacman_conf} } -# Base installation, plus needed packages (root-image) +# Base installation, plus needed packages (airootfs) make_basefs() { setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" init setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd" install } -# Additional packages (root-image) +# Additional packages (airootfs) make_packages() { setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -p "$(grep -h -v ^# ${script_path}/packages.{both,${arch}})" install } -# Copy mkinitcpio archiso hooks and build initramfs (root-image) +# Copy mkinitcpio archiso hooks and build initramfs (airootfs) make_setup_mkinitcpio() { local _hook for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do - cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/${arch}/root-image/usr/lib/initcpio/hooks - cp /usr/lib/initcpio/install/${_hook} ${work_dir}/${arch}/root-image/usr/lib/initcpio/install + cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/${arch}/airootfs/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/${_hook} ${work_dir}/${arch}/airootfs/usr/lib/initcpio/install done - cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/${arch}/root-image/usr/lib/initcpio/install - cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/${arch}/root-image/usr/lib/initcpio - cp ${script_path}/mkinitcpio.conf ${work_dir}/${arch}/root-image/etc/mkinitcpio-archiso.conf + cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/${arch}/airootfs/usr/lib/initcpio/install + cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/${arch}/airootfs/usr/lib/initcpio + cp ${script_path}/mkinitcpio.conf ${work_dir}/${arch}/airootfs/etc/mkinitcpio-archiso.conf setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -r 'mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img' run } -# Customize installation (root-image) -make_customize_root_image() { - cp -af ${script_path}/root-image ${work_dir}/${arch} +# Customize installation (airootfs) +make_customize_airootfs() { + cp -af ${script_path}/airootfs ${work_dir}/${arch} - curl -o ${work_dir}/${arch}/root-image/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on' + curl -o ${work_dir}/${arch}/airootfs/etc/pacman.d/mirrorlist 'https://www.archlinux.org/mirrorlist/?country=all&protocol=http&use_mirror_status=on' - lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/${arch}/root-image/root/install.txt + lynx -dump -nolist 'https://wiki.archlinux.org/index.php/Installation_Guide?action=render' >> ${work_dir}/${arch}/airootfs/root/install.txt - setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -r '/root/customize_root_image.sh' run - rm ${work_dir}/${arch}/root-image/root/customize_root_image.sh + setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${pacman_conf}" -D "${install_dir}" -r '/root/customize_airootfs.sh' run + rm ${work_dir}/${arch}/airootfs/root/customize_airootfs.sh } # Prepare kernel/initramfs ${install_dir}/boot/ make_boot() { mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} - cp ${work_dir}/${arch}/root-image/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img - cp ${work_dir}/${arch}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz + cp ${work_dir}/${arch}/airootfs/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + cp ${work_dir}/${arch}/airootfs/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz } # Add other aditional/extra files to ${install_dir}/boot/ make_boot_extra() { - cp ${work_dir}/${arch}/root-image/boot/memtest86+/memtest.bin ${work_dir}/iso/${install_dir}/boot/memtest - cp ${work_dir}/${arch}/root-image/usr/share/licenses/common/GPL2/license.txt ${work_dir}/iso/${install_dir}/boot/memtest.COPYING + cp ${work_dir}/${arch}/airootfs/boot/memtest86+/memtest.bin ${work_dir}/iso/${install_dir}/boot/memtest + cp ${work_dir}/${arch}/airootfs/usr/share/licenses/common/GPL2/license.txt ${work_dir}/iso/${install_dir}/boot/memtest.COPYING } # Prepare /${install_dir}/boot/syslinux @@ -108,30 +108,30 @@ make_syslinux() { s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/${install_dir}/boot/syslinux/${_cfg##*/} done cp ${script_path}/syslinux/splash.png ${work_dir}/iso/${install_dir}/boot/syslinux - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/*.c32 ${work_dir}/iso/${install_dir}/boot/syslinux - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/lpxelinux.0 ${work_dir}/iso/${install_dir}/boot/syslinux - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/memdisk ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/*.c32 ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/lpxelinux.0 ${work_dir}/iso/${install_dir}/boot/syslinux + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/memdisk ${work_dir}/iso/${install_dir}/boot/syslinux mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux/hdt - gzip -c -9 ${work_dir}/${arch}/root-image/usr/share/hwdata/pci.ids > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/pciids.gz - gzip -c -9 ${work_dir}/${arch}/root-image/usr/lib/modules/*-ARCH/modules.alias > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/modalias.gz + gzip -c -9 ${work_dir}/${arch}/airootfs/usr/share/hwdata/pci.ids > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/pciids.gz + gzip -c -9 ${work_dir}/${arch}/airootfs/usr/lib/modules/*-ARCH/modules.alias > ${work_dir}/iso/${install_dir}/boot/syslinux/hdt/modalias.gz } # Prepare /isolinux make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/ - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/ - cp ${work_dir}/${arch}/root-image/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/ + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/isohdpfx.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/${arch}/airootfs/usr/lib/syslinux/bios/ldlinux.c32 ${work_dir}/iso/isolinux/ } # Prepare /EFI make_efi() { mkdir -p ${work_dir}/iso/EFI/boot - cp ${work_dir}/x86_64/root-image/usr/lib/prebootloader/PreLoader.efi ${work_dir}/iso/EFI/boot/bootx64.efi - cp ${work_dir}/x86_64/root-image/usr/lib/prebootloader/HashTool.efi ${work_dir}/iso/EFI/boot/ + cp ${work_dir}/x86_64/airootfs/usr/lib/prebootloader/PreLoader.efi ${work_dir}/iso/EFI/boot/bootx64.efi + cp ${work_dir}/x86_64/airootfs/usr/lib/prebootloader/HashTool.efi ${work_dir}/iso/EFI/boot/ - cp ${work_dir}/x86_64/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/iso/EFI/boot/loader.efi + cp ${work_dir}/x86_64/airootfs/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/iso/EFI/boot/loader.efi mkdir -p ${work_dir}/iso/loader/entries cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/iso/loader/ @@ -162,10 +162,10 @@ make_efiboot() { cp ${work_dir}/iso/${install_dir}/boot/x86_64/archiso.img ${work_dir}/efiboot/EFI/archiso/archiso.img mkdir -p ${work_dir}/efiboot/EFI/boot - cp ${work_dir}/x86_64/root-image/usr/lib/prebootloader/PreLoader.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi - cp ${work_dir}/x86_64/root-image/usr/lib/prebootloader/HashTool.efi ${work_dir}/efiboot/EFI/boot/ + cp ${work_dir}/x86_64/airootfs/usr/lib/prebootloader/PreLoader.efi ${work_dir}/efiboot/EFI/boot/bootx64.efi + cp ${work_dir}/x86_64/airootfs/usr/lib/prebootloader/HashTool.efi ${work_dir}/efiboot/EFI/boot/ - cp ${work_dir}/x86_64/root-image/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/efiboot/EFI/boot/loader.efi + cp ${work_dir}/x86_64/airootfs/usr/lib/gummiboot/gummibootx64.efi ${work_dir}/efiboot/EFI/boot/loader.efi mkdir -p ${work_dir}/efiboot/loader/entries cp ${script_path}/efiboot/loader/loader.conf ${work_dir}/efiboot/loader/ @@ -190,11 +190,11 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs.sfs .sfs) make_prepare() { - cp -a -l -f ${work_dir}/${arch}/root-image ${work_dir} + cp -a -l -f ${work_dir}/${arch}/airootfs ${work_dir} setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare - rm -rf ${work_dir}/root-image - # rm -rf ${work_dir}/${arch}/root-image (if low space, this helps) + rm -rf ${work_dir}/airootfs + # rm -rf ${work_dir}/${arch}/airootfs (if low space, this helps) } # Build ISO @@ -234,12 +234,12 @@ mkdir -p ${work_dir} run_once make_pacman_conf -# Do all stuff for each root-image +# Do all stuff for each airootfs for arch in i686 x86_64; do run_once make_basefs run_once make_packages run_once make_setup_mkinitcpio - run_once make_customize_root_image + run_once make_customize_airootfs done for arch in i686 x86_64; do diff --git a/configs/releng/root-image/etc/fstab b/configs/releng/root-image/etc/fstab deleted file mode 100644 index e69de29..0000000 diff --git a/configs/releng/root-image/etc/hostname b/configs/releng/root-image/etc/hostname deleted file mode 100644 index 2dbe21e..0000000 --- a/configs/releng/root-image/etc/hostname +++ /dev/null @@ -1 +0,0 @@ -archiso diff --git a/configs/releng/root-image/etc/locale.conf b/configs/releng/root-image/etc/locale.conf deleted file mode 100644 index 01ec548..0000000 --- a/configs/releng/root-image/etc/locale.conf +++ /dev/null @@ -1 +0,0 @@ -LANG=en_US.UTF-8 diff --git a/configs/releng/root-image/etc/pam.d/su b/configs/releng/root-image/etc/pam.d/su deleted file mode 100644 index a291042..0000000 --- a/configs/releng/root-image/etc/pam.d/su +++ /dev/null @@ -1,6 +0,0 @@ -#%PAM-1.0 -auth sufficient pam_rootok.so -auth sufficient pam_wheel.so trust use_uid -auth required pam_unix.so -account required pam_unix.so -session required pam_unix.so diff --git a/configs/releng/root-image/etc/sudoers.d/g_wheel b/configs/releng/root-image/etc/sudoers.d/g_wheel deleted file mode 100644 index 8c45359..0000000 --- a/configs/releng/root-image/etc/sudoers.d/g_wheel +++ /dev/null @@ -1 +0,0 @@ -%wheel ALL=(ALL) NOPASSWD: ALL diff --git a/configs/releng/root-image/etc/systemd/scripts/choose-mirror b/configs/releng/root-image/etc/systemd/scripts/choose-mirror deleted file mode 100755 index 0ae0806..0000000 --- a/configs/releng/root-image/etc/systemd/scripts/choose-mirror +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -get_cmdline() { - local param - for param in $(< /proc/cmdline); do - case "${param}" in - $1=*) echo "${param##*=}"; - return 0 - ;; - esac - done -} - -mirror=$(get_cmdline mirror) -[[ $mirror = auto ]] && mirror=$(get_cmdline archiso_http_srv) -[[ $mirror ]] || exit 0 - -mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig -cat >/etc/pacman.d/mirrorlist << EOF -# -# Arch Linux repository mirrorlist -# Generated by archiso -# - -Server = ${mirror%%/}/\$repo/os/\$arch -EOF diff --git a/configs/releng/root-image/etc/systemd/system/choose-mirror.service b/configs/releng/root-image/etc/systemd/system/choose-mirror.service deleted file mode 100644 index 1e4d771..0000000 --- a/configs/releng/root-image/etc/systemd/system/choose-mirror.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Choose mirror from the kernel command line -ConditionKernelCommandLine=mirror - -[Service] -Type=oneshot -ExecStart=/etc/systemd/scripts/choose-mirror - -[Install] -WantedBy=multi-user.target diff --git a/configs/releng/root-image/etc/systemd/system/etc-pacman.d-gnupg.mount b/configs/releng/root-image/etc/systemd/system/etc-pacman.d-gnupg.mount deleted file mode 100644 index 4eab551..0000000 --- a/configs/releng/root-image/etc/systemd/system/etc-pacman.d-gnupg.mount +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Temporary /etc/pacman.d/gnupg directory - -[Mount] -What=tmpfs -Where=/etc/pacman.d/gnupg -Type=tmpfs -Options=mode=0755 diff --git a/configs/releng/root-image/etc/systemd/system/getty@tty1.service.d/autologin.conf b/configs/releng/root-image/etc/systemd/system/getty@tty1.service.d/autologin.conf deleted file mode 100644 index d1d8474..0000000 --- a/configs/releng/root-image/etc/systemd/system/getty@tty1.service.d/autologin.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear %I 38400 linux diff --git a/configs/releng/root-image/etc/systemd/system/pacman-init.service b/configs/releng/root-image/etc/systemd/system/pacman-init.service deleted file mode 100644 index 23b8144..0000000 --- a/configs/releng/root-image/etc/systemd/system/pacman-init.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Initializes Pacman keyring -Wants=haveged.service -After=haveged.service -Requires=etc-pacman.d-gnupg.mount -After=etc-pacman.d-gnupg.mount - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/pacman-key --init -ExecStart=/usr/bin/pacman-key --populate archlinux - -[Install] -WantedBy=multi-user.target diff --git a/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules b/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules deleted file mode 100644 index 1c4053c..0000000 --- a/configs/releng/root-image/etc/udev/rules.d/81-dhcpcd.rules +++ /dev/null @@ -1 +0,0 @@ -ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="en*|eth*", ENV{SYSTEMD_WANTS}="dhcpcd@$name.service" diff --git a/configs/releng/root-image/root/.automated_script.sh b/configs/releng/root-image/root/.automated_script.sh deleted file mode 100755 index fb106da..0000000 --- a/configs/releng/root-image/root/.automated_script.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -script_cmdline () -{ - local param - for param in $(< /proc/cmdline); do - case "${param}" in - script=*) echo "${param##*=}" ; return 0 ;; - esac - done -} - -automated_script () -{ - local script rt - script="$(script_cmdline)" - if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then - if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then - wget "${script}" --retry-connrefused -q -O /tmp/startup_script >/dev/null - rt=$? - else - cp "${script}" /tmp/startup_script - rt=$? - fi - if [[ ${rt} -eq 0 ]]; then - chmod +x /tmp/startup_script - /tmp/startup_script - fi - fi -} - -if [[ $(tty) == "/dev/tty1" ]]; then - automated_script -fi diff --git a/configs/releng/root-image/root/.zlogin b/configs/releng/root-image/root/.zlogin deleted file mode 100644 index f598e43..0000000 --- a/configs/releng/root-image/root/.zlogin +++ /dev/null @@ -1 +0,0 @@ -~/.automated_script.sh diff --git a/configs/releng/root-image/root/customize_root_image.sh b/configs/releng/root-image/root/customize_root_image.sh deleted file mode 100755 index 9c85453..0000000 --- a/configs/releng/root-image/root/customize_root_image.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e -u - -sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen -locale-gen - -ln -sf /usr/share/zoneinfo/UTC /etc/localtime - -usermod -s /usr/bin/zsh root -cp -aT /etc/skel/ /root/ - -useradd -m -p "" -g users -G "adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel" -s /usr/bin/zsh arch - -chmod 750 /etc/sudoers.d -chmod 440 /etc/sudoers.d/g_wheel - -sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist -sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf - -systemctl enable pacman-init.service choose-mirror.service -systemctl set-default multi-user.target diff --git a/configs/releng/root-image/root/install.txt b/configs/releng/root-image/root/install.txt deleted file mode 100644 index 3c8f171..0000000 --- a/configs/releng/root-image/root/install.txt +++ /dev/null @@ -1,3 +0,0 @@ -View this installation guide online at -https://wiki.archlinux.org/index.php/Installation_Guide - diff --git a/docs/README.build b/docs/README.build index e22ec65..1f2d703 100644 --- a/docs/README.build +++ b/docs/README.build @@ -22,7 +22,7 @@ INDEX + dosfstools for mkfs.vfat + lynx for fetching the latest installation guide -** For these hooks needs these packages (on target root-image) +** For these hooks needs these packages (on target airootfs) * archiso + (none) * archiso_loop_mnt -- 1.9.1
--- archiso/mkarchiso | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 26a82ee..7e3936e 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -266,12 +266,10 @@ _mksfs () { # Makes a filesystem from a source directory. # $1: Source directory -# $2: Target filesystem type (ext4 | ext3 | ext2 | xfs | btrfs) -# $3: Size of target filesystem. Can be an absolute value in MiB, or relative value of desired free space (1% - 99%) +# $2: Size of target filesystem. Can be an absolute value in MiB, or relative value of desired free space (1% - 99%) _mkfs () { local _src="${1}" - local _fs_type="${2}" - local _fs_size="${3}" + local _fs_size="${2}" local _fs_src="${work_dir}/${_src}" local _fs_img="${work_dir}/${_src}.fs" @@ -296,36 +294,15 @@ _mkfs () { fi fi - _msg_info "Creating ${_fs_type} image of ${_fs_size} MiB..." + _msg_info "Creating ext4 image of ${_fs_size} MiB..." rm -f "${_fs_img}" truncate -s ${_fs_size}M "${_fs_img}" local _qflag="" if [[ ${quiet} == "y" ]]; then _qflag="-q" fi - case "${_fs_type}" in - ext4) - mkfs.ext4 ${_qflag} -O ^has_journal -E lazy_itable_init=0 -m 0 -F "${_fs_img}" - tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null - ;; - ext3) - mkfs.ext3 ${_qflag} -m 0 -F "${_fs_img}" - tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null - ;; - ext2) - mkfs.ext2 ${_qflag} -m 0 -F "${_fs_img}" - tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null - ;; - xfs) - mkfs.xfs ${_qflag} "${_fs_img}" - ;; - btrfs) - mkfs.btrfs -M "${_fs_img}" - ;; - *) - _msg_error "Invalid filesystem: ${_fs_type}" 1 - ;; - esac + mkfs.ext4 ${_qflag} -O ^has_journal -E lazy_itable_init=0 -m 0 -F "${_fs_img}" + tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null _msg_info "Done!" _mount_fs "${_fs_img}" "${work_dir}/mnt/${_src}" _msg_info "Copying '${_fs_src}/' to '${work_dir}/mnt/${_src}/'..." @@ -436,7 +413,7 @@ command_prepare () { mkdir -p "${_dst}" if [[ ${_aitab_fs_type} != "none" ]]; then if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then - _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} + _mkfs ${_aitab_img} ${_aitab_fs_size} _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} mv "${_src}.fs.sfs" "${_dst}" rm "${_src}.fs" -- 1.9.1
There is no big overhead. Space usage in ext4-1G is ~0.4M while in ext4-32G is ~4M. Just use a big value to make all people happy. --- archiso/mkarchiso | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 7e3936e..d17fbb0 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -266,10 +266,8 @@ _mksfs () { # Makes a filesystem from a source directory. # $1: Source directory -# $2: Size of target filesystem. Can be an absolute value in MiB, or relative value of desired free space (1% - 99%) _mkfs () { local _src="${1}" - local _fs_size="${2}" local _fs_src="${work_dir}/${_src}" local _fs_img="${work_dir}/${_src}.fs" @@ -278,25 +276,9 @@ _mkfs () { _msg_error "The path '${_fs_src}' does not exist" 1 fi - local _spc_used - _spc_used=$(du -sxm "${_fs_src}" | awk '{print $1}') - - # Caculate FS size with desired % of free space, adds 10% overhead to used space. - if [[ ${_fs_size} != ${_fs_size%\%} ]]; then - if [[ ${_fs_size%\%} -le 0 || ${_fs_size%\%} -ge 100 ]]; then - _msg_error "Invalid percentage of free space specified '${_fs_size}' on '${_src}', should be 0% < x < 100%" 1 - fi - _fs_size=$((_spc_used * 110 / (100 - ${_fs_size%\%}))) - else - local _spc_used_over=$((_spc_used * 11 / 10)) - if [[ ${_fs_size} -lt ${_spc_used_over} ]]; then - _msg_error "Filesystem size specified '${_fs_size}' MiB for '${_src}' is too small, must be at least '${_spc_used_over}' MiB" 1 - fi - fi - - _msg_info "Creating ext4 image of ${_fs_size} MiB..." + _msg_info "Creating ext4 image of 32GiB..." rm -f "${_fs_img}" - truncate -s ${_fs_size}M "${_fs_img}" + truncate -s 32G "${_fs_img}" local _qflag="" if [[ ${quiet} == "y" ]]; then _qflag="-q" @@ -413,7 +395,7 @@ command_prepare () { mkdir -p "${_dst}" if [[ ${_aitab_fs_type} != "none" ]]; then if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then - _mkfs ${_aitab_img} ${_aitab_fs_size} + _mkfs ${_aitab_img} _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} mv "${_src}.fs.sfs" "${_dst}" rm "${_src}.fs" -- 1.9.1
--- archiso/mkarchiso | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index d17fbb0..115d5e0 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -16,6 +16,7 @@ iso_application="Arch Linux Live/Rescue CD" install_dir="arch" work_dir="work" out_dir="out" +sfs_comp="xz" # Show an INFO message # $1: message string @@ -132,6 +133,8 @@ _usage () echo " Default: '${work_dir}'" echo " -o <out_dir> Set the output directory" echo " Default: '${out_dir}'" + echo " -c <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz)" + echo " Default: '${sfs_comp}'" echo " -v Enable verbose output" echo " -h This message" echo " commands:" @@ -242,10 +245,8 @@ _cleanup () { # Makes a SquashFS filesystem image of file/directory passes as argument with desired compression. # $1: Source file/directory -# $2: SquashFS compression type (gzip | lzo | xz) _mksfs () { local _src="${1}" - local _sfs_comp="${2}" if [[ ! -e "${work_dir}/${_src}" ]]; then _msg_error "The path '${work_dir}/${_src}' does not exist" 1 @@ -256,9 +257,9 @@ _mksfs () { _msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..." local _seconds=${SECONDS} if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress &> /dev/null + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null else - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress fi _seconds=$((SECONDS - _seconds)) printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60)) @@ -396,13 +397,13 @@ command_prepare () { if [[ ${_aitab_fs_type} != "none" ]]; then if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then _mkfs ${_aitab_img} - _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} + _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} ${_aitab_sfs_comp} + _mksfs ${_aitab_img} mv "${work_dir}/${_aitab_img}.sfs" "${_dst}" fi fi @@ -450,7 +451,7 @@ if [[ ${EUID} -ne 0 ]]; then _msg_error "This script must be run as root." 1 fi -while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do +while getopts 'p:r:C:L:P:A:D:w:o:c:vh' arg; do case "${arg}" in p) pkg_list="${pkg_list} ${OPTARG}" ;; r) run_cmd="${OPTARG}" ;; @@ -461,6 +462,7 @@ while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do D) install_dir="${OPTARG}" ;; w) work_dir="${OPTARG}" ;; o) out_dir="${OPTARG}" ;; + c) sfs_comp="${OPTARG}" ;; v) quiet="n" ;; h|?) _usage 0 ;; *) -- 1.9.1
Always create one filesystem of a fixed size (32G), format (ext4) and know name "airootfs". Simplify logic a lot. --- archiso/initcpio/hooks/archiso | 29 +++----------------- archiso/initcpio/hooks/archiso_pxe_http | 16 +---------- archiso/mkarchiso | 48 ++++++++++----------------------- configs/baseline/aitab | 2 -- configs/baseline/build.sh | 8 +----- configs/releng/aitab | 3 --- configs/releng/build.sh | 10 +------ docs/README.bootparams | 6 ----- docs/README.build | 47 +------------------------------- 9 files changed, 21 insertions(+), 148 deletions(-) delete mode 100644 configs/baseline/aitab delete mode 100644 configs/releng/aitab diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 66a6273..d6ca443 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -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 diff --git a/archiso/initcpio/hooks/archiso_pxe_http b/archiso/initcpio/hooks/archiso_pxe_http index 32e8ab0..001b486 100644 --- a/archiso/initcpio/hooks/archiso_pxe_http +++ b/archiso/initcpio/hooks/archiso_pxe_http @@ -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" "/" diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 115d5e0..8325608 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -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. diff --git a/configs/baseline/aitab b/configs/baseline/aitab deleted file mode 100644 index 9134d60..0000000 --- a/configs/baseline/aitab +++ /dev/null @@ -1,2 +0,0 @@ -# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> -airootfs / %ARCH% gzip ext4 50% diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 19bc0c4..46033cb 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -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 diff --git a/configs/releng/aitab b/configs/releng/aitab deleted file mode 100644 index f9b482d..0000000 --- a/configs/releng/aitab +++ /dev/null @@ -1,3 +0,0 @@ -# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> -airootfs / i686 xz ext4 50% -airootfs / x86_64 xz ext4 50% diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 2438175..f0b6f42 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -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 diff --git a/docs/README.bootparams b/docs/README.bootparams index 755cc0d..caee0c2 100644 --- a/docs/README.bootparams +++ b/docs/README.bootparams @@ -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 diff --git a/docs/README.build b/docs/README.build index 1f2d703..1c047ea 100644 --- a/docs/README.build +++ b/docs/README.build @@ -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 -- 1.9.1
* Make it ISO9660 friendly (extra dot "." is replaced by "_") * Was used when support both .fs.sfs and .sfs --- archiso/initcpio/hooks/archiso | 4 ++-- archiso/initcpio/hooks/archiso_pxe_http | 2 +- archiso/mkarchiso | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index d6ca443..c5fd062 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -174,8 +174,8 @@ archiso_mount_handler() { fi mkdir -p "/run/archiso/cowspace/${cow_directory}" - _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.fs.sfs" "/run/archiso/sfs/airootfs" - _mnt_fs "/run/archiso/sfs/airootfs/airootfs.fs" "${newroot}" "/" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs" "/run/archiso/sfs/airootfs" + _mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/" if [[ "${copytoram}" == "y" ]]; then umount /run/archiso/bootmnt diff --git a/archiso/initcpio/hooks/archiso_pxe_http b/archiso/initcpio/hooks/archiso_pxe_http index 001b486..84ce17f 100644 --- a/archiso/initcpio/hooks/archiso_pxe_http +++ b/archiso/initcpio/hooks/archiso_pxe_http @@ -34,7 +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" - _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.fs.sfs" "/${arch}" + _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}" if [[ "${checksum}" == "y" ]]; then _curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/" diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 8325608..b0e451c 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -271,7 +271,7 @@ _mkfs () { local _src="${1}" local _fs_src="${work_dir}/${_src}" - local _fs_img="${work_dir}/${_src}.fs" + local _fs_img="${work_dir}/${_src}.img" if [[ ! -e "${_fs_src}" ]]; then _msg_error "The path '${_fs_src}' does not exist" 1 @@ -371,7 +371,7 @@ command_iso () { fi } -# create airootfs.fs.sfs filesystem, and push it in "iso" directory. +# create airootfs.sfs filesystem, and push it in "iso" directory. command_prepare () { _show_config prepare @@ -382,11 +382,11 @@ command_prepare () { mkdir -p "${_dst}" - if _is_directory_changed "${_src}" "${_dst}/airootfs.fs.sfs"; then + if _is_directory_changed "${_src}" "${_dst}/airootfs.sfs"; then _mkfs airootfs - _mksfs airootfs.fs - mv "${_src}.fs.sfs" "${_dst}" - rm "${_src}.fs" + _mksfs airootfs.img + mv "${_src}.sfs" "${_dst}" + rm "${_src}.img" fi } -- 1.9.1
--- archiso/mkarchiso | 69 +++++++++++++++++-------------------------------------- 1 file changed, 21 insertions(+), 48 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index b0e451c..a0edf26 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -243,55 +243,34 @@ _cleanup () { _msg_info "Done!" } -# Makes a SquashFS filesystem image of file/directory passes as argument with desired compression. -# $1: Source file/directory -_mksfs () { - local _src="${1}" - - if [[ ! -e "${work_dir}/${_src}" ]]; then - _msg_error "The path '${work_dir}/${_src}' does not exist" 1 - fi - - local _sfs_img="${work_dir}/${_src}.sfs" - - _msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..." - local _seconds=${SECONDS} - if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null - else - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress - fi - _seconds=$((SECONDS - _seconds)) - printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60)) -} - # Makes a filesystem from a source directory. -# $1: Source directory -_mkfs () { - local _src="${1}" - - local _fs_src="${work_dir}/${_src}" - local _fs_img="${work_dir}/${_src}.img" - - if [[ ! -e "${_fs_src}" ]]; then - _msg_error "The path '${_fs_src}' does not exist" 1 +_mkairootfs () { + if [[ ! -e "${work_dir}/airootfs" ]]; then + _msg_error "The path '${work_dir}/airootfs' does not exist" 1 fi _msg_info "Creating ext4 image of 32GiB..." - rm -f "${_fs_img}" - truncate -s 32G "${_fs_img}" + truncate -s 32G "${work_dir}/airootfs.img" local _qflag="" if [[ ${quiet} == "y" ]]; then _qflag="-q" fi - mkfs.ext4 ${_qflag} -O ^has_journal -E lazy_itable_init=0 -m 0 -F "${_fs_img}" - tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null + mkfs.ext4 ${_qflag} -O ^has_journal -E lazy_itable_init=0 -m 0 -F "${work_dir}/airootfs.img" + tune2fs -c 0 -i 0 "${work_dir}/airootfs.img" &> /dev/null _msg_info "Done!" - _mount_fs "${_fs_img}" "${work_dir}/mnt/${_src}" - _msg_info "Copying '${_fs_src}/' to '${work_dir}/mnt/${_src}/'..." - cp -aT "${_fs_src}/" "${work_dir}/mnt/${_src}/" + _mount_fs "${work_dir}/airootfs.img" "${work_dir}/mnt/airootfs" + _msg_info "Copying '${work_dir}/airootfs/' to '${work_dir}/mnt/airootfs/'..." + cp -aT "${work_dir}/airootfs/" "${work_dir}/mnt/airootfs/" _msg_info "Done!" - _umount_fs "${work_dir}/mnt/${_src}" + _umount_fs "${work_dir}/mnt/airootfs" + _msg_info "Creating SquashFS image, this may take some time..." + if [[ "${quiet}" = "y" ]]; then + mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null + else + mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress + fi + _msg_info "Done!" + rm ${work_dir}/airootfs.img } command_checksum () { @@ -377,16 +356,10 @@ command_prepare () { _cleanup - local _src="${work_dir}/airootfs" - local _dst="${work_dir}/iso/${install_dir}/${arch}" - - mkdir -p "${_dst}" + mkdir -p "${work_dir}/iso/${install_dir}/${arch}" - if _is_directory_changed "${_src}" "${_dst}/airootfs.sfs"; then - _mkfs airootfs - _mksfs airootfs.img - mv "${_src}.sfs" "${_dst}" - rm "${_src}.img" + if _is_directory_changed "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs"; then + _mkairootfs fi } -- 1.9.1
Also remove _show_space_usage() irrelevant now when fs size is fixed and big --- archiso/mkarchiso | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index a0edf26..4d8496f 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -39,15 +39,6 @@ _msg_error() { fi } -# Show space usage similar to df, but better formatted. -# $1: mount-point or mounted device. -_show_space_usage () { - local _where="${1}" - local _fs _total _used _avail _pct_u=0 _mnt - read _fs _total _used _avail _pct_u _mnt < <(df -m "${_where}" | tail -1) &> /dev/null - _msg_info "Total: ${_total} MiB (100%) | Used: ${_used} MiB (${_pct_u}) | Avail: ${_avail} MiB ($((100 - ${_pct_u%\%}))%)" -} - _chroot_init() { if [[ -f "${work_dir}/mkarchiso.init" ]]; then _msg_info "Initial enviroment already installed, skipping." @@ -62,27 +53,19 @@ _chroot_run() { eval arch-chroot ${work_dir}/airootfs "${run_cmd}" } -# Mount a filesystem (trap signals in case of error for unmounting it -# $1: source image -# $2: mount-point -_mount_fs() { - local _src="${1}" - local _dst="${2}" - trap "_umount_fs ${_src}" EXIT HUP INT TERM - mkdir -p "${_dst}" - _msg_info "Mounting '${_src}' on '${_dst}'" - mount "${_src}" "${_dst}" - _show_space_usage "${_dst}" +_mount_airootfs() { + trap "_umount_airootfs" EXIT HUP INT TERM + mkdir -p "${work_dir}/mnt/airootfs" + _msg_info "Mounting '${work_dir}/airootfs.img' on '${work_dir}/mnt/airootfs'" + mount "${work_dir}/airootfs.img" "${work_dir}/mnt/airootfs" + _msg_info "Done!" } -# Unmount a filesystem (and untrap signals) -# $1: mount-point or device/image -_umount_fs() { - local _dst="${1}" - _show_space_usage "${_dst}" - _msg_info "Unmounting '${_dst}'" - umount "${_dst}" - rmdir "${_dst}" +_umount_airootfs() { + _msg_info "Unmounting '${work_dir}/mnt/airootfs'" + umount "${work_dir}/mnt/airootfs" + _msg_info "Done!" + rmdir "${work_dir}/mnt/airootfs" trap - EXIT HUP INT TERM } @@ -258,11 +241,11 @@ _mkairootfs () { mkfs.ext4 ${_qflag} -O ^has_journal -E lazy_itable_init=0 -m 0 -F "${work_dir}/airootfs.img" tune2fs -c 0 -i 0 "${work_dir}/airootfs.img" &> /dev/null _msg_info "Done!" - _mount_fs "${work_dir}/airootfs.img" "${work_dir}/mnt/airootfs" + _mount_airootfs _msg_info "Copying '${work_dir}/airootfs/' to '${work_dir}/mnt/airootfs/'..." cp -aT "${work_dir}/airootfs/" "${work_dir}/mnt/airootfs/" _msg_info "Done!" - _umount_fs "${work_dir}/mnt/airootfs" + _umount_airootfs _msg_info "Creating SquashFS image, this may take some time..." if [[ "${quiet}" = "y" ]]; then mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null -- 1.9.1
This is a task done in some way by run_once() on build.sh --- archiso/mkarchiso | 96 +++++++++++++++++++------------------------------------ 1 file changed, 32 insertions(+), 64 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 4d8496f..7a3e465 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -69,30 +69,6 @@ _umount_airootfs() { trap - EXIT HUP INT TERM } -# Compare if a file/directory (source) is newer than other file (target) -# $1: source file/directory -# $2: target file -# return: 0 if target does not exists or if target is older than source. -# 1 if target is newer than source -_is_directory_changed() { - local _src="${1}" - local _dst="${2}" - - if [ -e "${_dst}" ]; then - if [[ $(find ${_src} -newer ${_dst} | wc -l) -gt 0 ]]; then - _msg_info "Target '${_dst}' is older than '${_src}', updating." - rm -f "${_dst}" - return 0 - else - _msg_info "Target '${_dst}' is up to date with '${_src}', skipping." - return 1 - fi - else - _msg_info "Target '${_dst}' does not exist, making it from '${_src}'" - return 0 - fi -} - # Show help usage, with an exit status. # $1: exit status number. _usage () @@ -262,28 +238,24 @@ command_checksum () { local _chk_arch for _chk_arch in i686 x86_64; do - if _is_directory_changed "${work_dir}/iso/${install_dir}" "${work_dir}/iso/${install_dir}/checksum.${_chk_arch}.md5"; then - _msg_info "Creating checksum file for self-test (${_chk_arch})..." - cd "${work_dir}/iso/${install_dir}" - if [[ -d "${_chk_arch}" ]]; then - find ${_chk_arch} -type f -print0 | xargs -0 md5sum > checksum.${_chk_arch}.md5 - fi - cd ${OLDPWD} - _msg_info "Done!" + _msg_info "Creating checksum file for self-test (${_chk_arch})..." + cd "${work_dir}/iso/${install_dir}" + if [[ -d "${_chk_arch}" ]]; then + find ${_chk_arch} -type f -print0 | xargs -0 md5sum > checksum.${_chk_arch}.md5 fi + cd ${OLDPWD} + _msg_info "Done!" done } command_pkglist () { _show_config pkglist - if _is_directory_changed "${work_dir}/airootfs/var/lib/pacman/local" "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt"; then - _msg_info "Creating a list of installed packages on live-enviroment..." - pacman -Sl -r "${work_dir}/airootfs" --config "${pacman_conf}" | \ - awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > \ - "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" - _msg_info "Done!" - fi + _msg_info "Creating a list of installed packages on live-enviroment..." + pacman -Sl -r "${work_dir}/airootfs" --config "${pacman_conf}" | \ + awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > \ + "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" + _msg_info "Done!" } @@ -308,29 +280,27 @@ command_iso () { _show_config iso - if _is_directory_changed "${work_dir}/iso" "${out_dir}/${img_name}"; then - mkdir -p ${out_dir} - _msg_info "Creating ISO image..." - local _qflag="" - if [[ ${quiet} == "y" ]]; then - _qflag="-quiet" - fi - xorriso -as mkisofs ${_qflag} \ - -iso-level 3 \ - -full-iso9660-filenames \ - -volid "${iso_label}" \ - -appid "${iso_application}" \ - -publisher "${iso_publisher}" \ - -preparer "prepared by mkarchiso" \ - -eltorito-boot isolinux/isolinux.bin \ - -eltorito-catalog isolinux/boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \ - ${_iso_efi_boot_args} \ - -output "${out_dir}/${img_name}" \ - "${work_dir}/iso/" - _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" + mkdir -p ${out_dir} + _msg_info "Creating ISO image..." + local _qflag="" + if [[ ${quiet} == "y" ]]; then + _qflag="-quiet" fi + xorriso -as mkisofs ${_qflag} \ + -iso-level 3 \ + -full-iso9660-filenames \ + -volid "${iso_label}" \ + -appid "${iso_application}" \ + -publisher "${iso_publisher}" \ + -preparer "prepared by mkarchiso" \ + -eltorito-boot isolinux/isolinux.bin \ + -eltorito-catalog isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \ + ${_iso_efi_boot_args} \ + -output "${out_dir}/${img_name}" \ + "${work_dir}/iso/" + _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" } # create airootfs.sfs filesystem, and push it in "iso" directory. @@ -341,9 +311,7 @@ command_prepare () { mkdir -p "${work_dir}/iso/${install_dir}/${arch}" - if _is_directory_changed "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs"; then - _mkairootfs - fi + _mkairootfs } # Install packages on airootfs. -- 1.9.1
--- archiso/mkarchiso | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 7a3e465..3f511e9 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -222,6 +222,7 @@ _mkairootfs () { cp -aT "${work_dir}/airootfs/" "${work_dir}/mnt/airootfs/" _msg_info "Done!" _umount_airootfs + mkdir -p "${work_dir}/iso/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." if [[ "${quiet}" = "y" ]]; then mksquashfs "${work_dir}/airootfs.img" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null @@ -308,9 +309,6 @@ command_prepare () { _show_config prepare _cleanup - - mkdir -p "${work_dir}/iso/${install_dir}/${arch}" - _mkairootfs } -- 1.9.1
This is done better with run_once() in build.sh --- archiso/mkarchiso | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 3f511e9..38e0026 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -329,14 +329,7 @@ command_install () { _show_config install - local _pkg_list_hash - _pkg_list_hash=$(echo ${pkg_list} | sort -u | md5sum | cut -c1-32) - if [[ -f "${work_dir}/install.${_pkg_list_hash}" ]]; then - _msg_info "These packages are already installed, skipping." - else - _pacman "${pkg_list}" - : > "${work_dir}/install.${_pkg_list_hash}" - fi + _pacman "${pkg_list}" } command_init() { -- 1.9.1
This is done better with run_once() in build.sh --- archiso/mkarchiso | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 38e0026..cd95f0f 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -40,13 +40,8 @@ _msg_error() { } _chroot_init() { - if [[ -f "${work_dir}/mkarchiso.init" ]]; then - _msg_info "Initial enviroment already installed, skipping." - else - mkdir -p ${work_dir}/airootfs - _pacman "base syslinux" - : > "${work_dir}/mkarchiso.init" - fi + mkdir -p ${work_dir}/airootfs + _pacman "base syslinux" } _chroot_run() { -- 1.9.1
--- archiso/initcpio/hooks/archiso | 10 +++++----- archiso/initcpio/hooks/archiso_pxe_http | 2 +- archiso/mkarchiso | 30 ++++++++---------------------- configs/baseline/build.sh | 1 - configs/releng/build.sh | 1 - 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index c5fd062..26bdedc 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -93,8 +93,8 @@ _mnt_dev() { _verify_checksum() { local _status - cd "/run/archiso/bootmnt/${archisobasedir}" - md5sum -c checksum.${arch}.md5 > /tmp/checksum.${arch}.log 2>&1 + cd "/run/archiso/bootmnt/${archisobasedir}/${arch}" + md5sum -c airootfs.md5 > /tmp/checksum.log 2>&1 _status=$? cd "${OLDPWD}" return ${_status} @@ -142,17 +142,17 @@ archiso_mount_handler() { fi if [[ "${checksum}" == "y" ]]; then - if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.${arch}.md5" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.md5" ]]; then msg -n ":: Self-test requested, please wait..." if _verify_checksum; then msg "done. Checksum is OK, continue booting." else echo "ERROR: one or more files are corrupted" - echo "see /tmp/checksum.${arch}.log for details" + echo "see /tmp/checksum.log for details" launch_interactive_shell fi else - echo "ERROR: checksum=y option specified but checksum.${arch}.md5 not found" + echo "ERROR: checksum=y option specified but ${archisobasedir}/${arch}/airootfs.md5 not found" launch_interactive_shell fi fi diff --git a/archiso/initcpio/hooks/archiso_pxe_http b/archiso/initcpio/hooks/archiso_pxe_http index 84ce17f..a23e952 100644 --- a/archiso/initcpio/hooks/archiso_pxe_http +++ b/archiso/initcpio/hooks/archiso_pxe_http @@ -37,7 +37,7 @@ archiso_pxe_http_mount_handler () { _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}" if [[ "${checksum}" == "y" ]]; then - _curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/" + _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.md5" "/" fi mkdir -p "/run/archiso/bootmnt" diff --git a/archiso/mkarchiso b/archiso/mkarchiso index cd95f0f..2de026e 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -100,8 +100,6 @@ _usage () echo " run command specified by -r" echo " prepare" echo " build all images" - echo " checksum" - echo " make a checksum.md5 for self-test" echo " pkglist" echo " make a pkglist.txt of packages installed on airootfs" echo " iso <image name>" @@ -110,7 +108,7 @@ _usage () } # Shows configuration according to command mode. -# $1: init | install | run | prepare | checksum | iso +# $1: init | install | run | prepare | iso _show_config () { local _mode="$1" echo @@ -132,8 +130,6 @@ _show_config () { ;; prepare) ;; - checksum) - ;; pkglist) ;; iso) @@ -228,20 +224,12 @@ _mkairootfs () { rm ${work_dir}/airootfs.img } -command_checksum () { - _show_config checksum - - local _chk_arch - - for _chk_arch in i686 x86_64; do - _msg_info "Creating checksum file for self-test (${_chk_arch})..." - cd "${work_dir}/iso/${install_dir}" - if [[ -d "${_chk_arch}" ]]; then - find ${_chk_arch} -type f -print0 | xargs -0 md5sum > checksum.${_chk_arch}.md5 - fi - cd ${OLDPWD} - _msg_info "Done!" - done +_mkchecksum () { + _msg_info "Creating checksum file for self-test..." + cd "${work_dir}/iso/${install_dir}/${arch}" + md5sum airootfs.sfs > airootfs.md5 + cd ${OLDPWD} + _msg_info "Done!" } command_pkglist () { @@ -305,6 +293,7 @@ command_prepare () { _cleanup _mkairootfs + _mkchecksum } # Install packages on airootfs. @@ -383,9 +372,6 @@ case "${command_name}" in prepare) command_prepare ;; - checksum) - command_checksum - ;; pkglist) command_pkglist ;; diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 46033cb..e997bab 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -67,7 +67,6 @@ make_prepare() { # Build ISO make_iso() { - mkarchiso -v -w "${work_dir}" -D "${install_dir}" checksum mkarchiso -v -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" } diff --git a/configs/releng/build.sh b/configs/releng/build.sh index f0b6f42..07ff911 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -193,7 +193,6 @@ make_prepare() { # Build ISO make_iso() { - mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso" } -- 1.9.1
participants (1)
-
Gerardo Exequiel Pozzi