rename build to _run

This commit is contained in:
Tobias Powalowski 2023-10-12 09:44:12 +02:00
parent 7b8bc8f463
commit f16836af8b
45 changed files with 68 additions and 68 deletions

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules '/acpi/'
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
_APPS="head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
### setting up base structure
map add_dir /root /mnt /sysroot /install /var/log /home /var/tmp

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
# remove initrd-release
rm -f /tmp/etc/initrd-release

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
### adding default font and keymap
add_binary loadkeys

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
build()
_run()
{
### add block device support
# sata, scsi, nvme

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_full_dir /var/cache/pacman/pkg
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
rm -rf /var/cache/pacman/pkg
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary hwclock tzselect zic zdump
map add_full_dir /usr/share/zoneinfo /usr/share/zoneinfo-leaps

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
### add pcspkr
add_module pcspkr

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
# archboot-cpio.sh - modular tool for building an initramfs image
# archboot-cpio.sh - modular tool for _runing an initramfs image
# simplified, stripped down, optimized for size and speed
# by Tobias Powalowski <tpowa@archlinux.org>
@ -232,44 +232,44 @@ add_binary() {
return 0
}
initialize_buildroot() {
# creates a temporary directory for the buildroot and initialize it with a
initialize__runroot() {
# creates a temporary directory for the _runroot and initialize it with a
# basic set of necessary directories and symlinks
local workdir='' kernver="$1" arch buildroot
local workdir='' kernver="$1" arch _runroot
arch="$(uname -m)"
if ! workdir="$(mktemp -d --tmpdir mkinitcpio.XXXXXX)"; then
error 'Failed to create temporary working directory in %s' "${TMPDIR:-/tmp}"
return 1
fi
buildroot="${2:-$workdir/root}"
_runroot="${2:-$workdir/root}"
if [[ ! -w "${2:-$workdir}" ]]; then
error 'Unable to write to build root: %s' "$buildroot"
error 'Unable to write to _run root: %s' "$_runroot"
return 1
fi
# base directory structure
install -dm755 "$buildroot"/{new_root,proc,sys,dev,run,tmp,var,etc,usr/{local{,/bin,/sbin,/lib},lib,bin}}
ln -s "usr/lib" "$buildroot/lib"
ln -s "bin" "$buildroot/usr/sbin"
ln -s "usr/bin" "$buildroot/bin"
ln -s "usr/bin" "$buildroot/sbin"
ln -s "/run" "$buildroot/var/run"
install -dm755 "$_runroot"/{new_root,proc,sys,dev,run,tmp,var,etc,usr/{local{,/bin,/sbin,/lib},lib,bin}}
ln -s "usr/lib" "$_runroot/lib"
ln -s "bin" "$_runroot/usr/sbin"
ln -s "usr/bin" "$_runroot/bin"
ln -s "usr/bin" "$_runroot/sbin"
ln -s "/run" "$_runroot/var/run"
case "$arch" in
x86_64)
ln -s "lib" "$buildroot/usr/lib64"
ln -s "usr/lib" "$buildroot/lib64"
ln -s "lib" "$_runroot/usr/lib64"
ln -s "usr/lib" "$_runroot/lib64"
;;
esac
# kernel module dir
[[ "$kernver" != 'none' ]] && install -dm755 "$buildroot/usr/lib/modules/$kernver/kernel"
[[ "$kernver" != 'none' ]] && install -dm755 "$_runroot/usr/lib/modules/$kernver/kernel"
# mount tables
ln -s ../proc/self/mounts "$buildroot/etc/mtab"
: >"$buildroot/etc/fstab"
ln -s ../proc/self/mounts "$_runroot/etc/mtab"
: >"$_runroot/etc/fstab"
# add a blank ld.so.conf to keep ldconfig happy
: >"$buildroot/etc/ld.so.conf"
: >"$_runroot/etc/ld.so.conf"
printf '%s' "$workdir"
}
run_build_hook() {
run__run_hook() {
local hook="$1" script=''
# shellcheck disable=SC2034
local MODULES=() BINARIES=() FILES=() SCRIPT=''
@ -280,19 +280,19 @@ run_build_hook() {
return 1
fi
# source
unset -f build
unset -f _run
# shellcheck disable=SC1090
if ! . "$script"; then
error 'Failed to read %s' "$script"
return 1
fi
if ! declare -f build >"${_NO_LOG}"; then
error "Hook '%s' has no build function" "${script}"
if ! declare -f _run >"${_NO_LOG}"; then
error "Hook '%s' has no _run function" "${script}"
return 1
fi
# run
msg2 "Running build hook: [%s]" "${script##*/}"
build
msg2 "Running _run hook: [%s]" "${script##*/}"
_run
# if we made it this far, return successfully. Hooks can
# do their own error catching if it's severe enough, and
# we already capture errors from the add_* functions.

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules 'arch/x86/kernel/cpu/cpufreq|drivers/cpufreq'
map add_binary cpupower cpufreq-bench_plot.sh

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules 'md/dm-*'
map add_binary dmsetup dmeventd blkdeactivate dmstats cryptsetup \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules '/firmware/dmi-sysfs'
map add_binary dmidecode biosdecode

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_binary efibootmgr
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary efivar efisecdb
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules '/fs/(btrfs|cifs|exfat|ext4|f2fs|fat|hfs|hfsplus|isofs|jfs|nfs|nfsd|nilfs2|nls|ntfs3|udf|xfs|vboxsf)'
add_all_modules '/(lib/|kernel|arch/*)/crypto'

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
_APPS="mkswap badblocks blkid debugfs dumpe2fs e2fsck e2image e2undo findfs fsck \
logsave mkfs.ext2 resize2fs chattr lsattr e2freefrag filefrag \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
# add firmware files and licenses
map add_full_dir "/lib/firmware" "/usr/share/licenses/linux-firmware"

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
rm -r /lib/firmware
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules '/hv/hv_*'
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
build() {
_run() {
### init modules
map add_module vfat? iso9660? nls_cp437? nls_ascii? cdrom? exfat?
map add_binary bash sh blkid mount mountpoint switch_root bsdcpio mkfs.btrfs setfont \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary genfstab arch-chroot pacstrap \
archboot-binary-check.sh archboot-not-installed.sh hwdetect

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
# save RAM with deleting already copied content
rm -rf /var/cache/pacman/pkg

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_file /etc/archboot/defaults /usr/lib/archboot/common.sh \
/usr/lib/archboot/container.sh /usr/bin/archboot-"$(uname -m)"-create-container.sh \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary kexec vmcore-dmesg
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
# add firmware files and licenses
map add_full_dir "/lib/firmware/amdgpu" "/lib/firmware/i915" "/lib/firmware/nvidia" \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_full_dir /usr/share/licenses/common
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_binary lshw
for i in manuf oui pnpid; do

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
local symlink
### from thin-provisioning-tools

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules -f 'dm-' 'drivers/md/*'
map add_binary mdmon mdadm

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
### generate motd
MOTD=$(mktemp /var/tmp/motd.XXXX)

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_binary nvim
map add_full_dir /usr/share/nvim

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary arping clockdiff tracepath ssh genl \
ifstat ctstat rtstat lnstat nstat rtacct rtmon ss tc bridge \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
_APPS="arping clockdiff tracepath ssh arpd \
genl ifstat ctstat rtstat lnstat nstat rtacct rtmon ss tc \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules -f '_cs|b44|broadcom/bnx2x|brocade|cavium|chelsio|cisco|netronome|mellanox|myricom|qlogic|qualcomm' '/drivers/net/ethernet|/net/ipv4|/net/ipv6|/drivers/net/usb'
map add_binary ip getent ping

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary lspci setpci update-pciids
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules -f 'media' '/platform/'
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary findssl.sh scp sftp ssh-add ssh-agent ssh-copy-id ssh-keygen ssh-keyscan sshd \
exportfs nfsstat rpc.idmapd rpc.mountd rpc.nfsd rpc.statd rpcdebug showmount \

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
# https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot
_RUNNING_ARCH="$(uname -m)"

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
map add_binary smartctl smartd update-smart-drivedb
map add_file /etc/conf.d/smartd /etc/smartd.conf

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_binary lsusb
}

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_full_dir /usr/share/kbd
#add kbd binaries

View file

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
_run ()
{
add_all_modules -f '_cs|b43' '/net/wireless/|/net/ieee80211/|/net/mac80211/'
if [[ "$(uname -m)" == "x86_64" ]]; then