add _file_rename

This commit is contained in:
Tobias Powalowski 2023-10-14 22:38:52 +02:00
parent 6a87cbfd29
commit 9903a24a3e
14 changed files with 86 additions and 114 deletions

View file

@ -30,7 +30,6 @@ while [ $# -gt 0 ]; do
fi fi
;; ;;
-h) _usage -h) _usage
exit 0
;; ;;
esac esac
shift shift
@ -67,7 +66,7 @@ echo "Using kernel: ${_KERNEL}"
echo "Detected kernel version: ${_KERNELVERSION}" echo "Detected kernel version: ${_KERNELVERSION}"
_builtin_modules _builtin_modules
_HOOK_COUNT=1 _HOOK_COUNT=1
_HOOKS_END_COUNT="$(echo ${_HOOKS[@]} | wc -w)" _HOOKS_END_COUNT="$(echo "${_HOOKS[@]}" | wc -w)"
if [[ "${_HOOKS_END_COUNT}" -lt 10 ]]; then if [[ "${_HOOKS_END_COUNT}" -lt 10 ]]; then
_ADD_ZERO="" _ADD_ZERO=""
else else

View file

@ -5,7 +5,7 @@
# by Tobias Powalowski <tpowa@archlinux.org> # by Tobias Powalowski <tpowa@archlinux.org>
_CONFIG="" _CONFIG=""
_CPIO=/usr/lib/archboot/cpio/hooks/ _CPIO=/usr/lib/archboot/cpio/hooks
_GENERATE_IMAGE="" _GENERATE_IMAGE=""
_TARGET_DIR="" _TARGET_DIR=""
declare -A _INCLUDED_MODS _MOD_PATH declare -A _INCLUDED_MODS _MOD_PATH
@ -30,7 +30,7 @@ EOF
} }
_abort() { _abort() {
echo "Error:" "$@" echo "ERROR:" "$@"
if [[ -n "${_BUILD_DIR}" ]]; then if [[ -n "${_BUILD_DIR}" ]]; then
rm -rf -- "${_BUILD_DIR}" rm -rf -- "${_BUILD_DIR}"
fi fi
@ -38,8 +38,6 @@ _abort() {
} }
_builtin_modules() { _builtin_modules() {
# Prime the _INCLUDED_MODS list with the builtins for this kernel.
# kmod>=27 and kernel >=5.2 required!
while IFS=.= read -rd '' _MODULE _FIELD _VALUE; do while IFS=.= read -rd '' _MODULE _FIELD _VALUE; do
_INCLUDED_MODS[${_MODULE//-/_}]=2 _INCLUDED_MODS[${_MODULE//-/_}]=2
case "$_FIELD" in case "$_FIELD" in
@ -59,11 +57,11 @@ _map() {
} }
_filter_modules() { _filter_modules() {
# Add modules to the initcpio, filtered by grep. # Add modules to the rootfs, filtered by grep.
# $@: filter arguments to grep # $@: filter arguments to grep
# -f FILTER: ERE to filter found modules # -f FILTER: ERE to filter found modules
local -i _COUNT=0 local -i _COUNT=0
local _MOD_INPUT="" OPTIND="" OPTARG="" _MOD_FILTER=() _MOD_INPUT="" OPTIND="" OPTARG="" _MOD_FILTER=()
while getopts ':f:' _FLAG; do while getopts ':f:' _FLAG; do
[[ "${_FLAG}" = "f" ]] && _MOD_FILTER+=("$OPTARG") [[ "${_FLAG}" = "f" ]] && _MOD_FILTER+=("$OPTARG")
done done
@ -83,7 +81,6 @@ _filter_modules() {
_all_modules() { _all_modules() {
# Add modules to the initcpio. # Add modules to the initcpio.
# $@: arguments to all_modules # $@: arguments to all_modules
local _MOD_INPUT
local -a _MODS local -a _MODS
mapfile -t _MODS < <(_filter_modules "$@") mapfile -t _MODS < <(_filter_modules "$@")
_map _module "${_MODS[@]}" _map _module "${_MODS[@]}"
@ -94,7 +91,7 @@ _module() {
# Add a kernel module to the rootfs. Dependencies will be # Add a kernel module to the rootfs. Dependencies will be
# discovered and added. # discovered and added.
# $1: module name # $1: module name
local _CHECK="" _MOD="" _SOFT=() _DEPS=() _FIELD="" _VALUE="" _FW=() _CHECK="" _MOD="" _SOFT=() _DEPS=() _FIELD="" _VALUE="" _FW=()
if [[ "${1}" == *\? ]]; then if [[ "${1}" == *\? ]]; then
set -- "${1%?}" set -- "${1%?}"
fi fi
@ -127,23 +124,12 @@ _module() {
} }
_full_dir() { _full_dir() {
# Add a directory and all its contents, recursively, to the rootfs.
# No parsing is performed and the contents of the directory is added as is.
# $1: path to directory
tar -C / --hard-dereference -cpf - ."${1}" | tar -C "${_ROOTFS}" -xpf - || return 1 tar -C / --hard-dereference -cpf - ."${1}" | tar -C "${_ROOTFS}" -xpf - || return 1
} }
_dir() { _dir() {
# add a directory (with parents) to $BUILDROOT [[ -d "${_ROOTFS}${1}" ]] && return 0
# $1: pathname on initcpio mkdir -p "${_ROOTFS}${1}" || return 1
# $2: mode (optional)
local _MODE="${2:-755}"
# shellcheck disable=SC2153
if [[ -d "${_ROOTFS}${1}" ]]; then
# ignore dir already exists
return 0
fi
mkdir -p -m "${_MODE}" "${_ROOTFS}${1}" || return 1
} }
_symlink() { _symlink() {
@ -151,7 +137,7 @@ _symlink() {
# to ensure that the target of the symlink exists. # to ensure that the target of the symlink exists.
# $1: pathname of symlink on image # $1: pathname of symlink on image
# $2: absolute path to target of symlink (optional, can be read from $1) # $2: absolute path to target of symlink (optional, can be read from $1)
local _LINK_NAME="${1}" _LINK_SOURCE="${2:-$1}" _LINK_DEST _LINK_NAME="${1}" _LINK_SOURCE="${2:-$1}"
# find out the link target # find out the link target
if [[ "${_LINK_NAME}" == "${_LINK_SOURCE}" ]]; then if [[ "${_LINK_NAME}" == "${_LINK_SOURCE}" ]]; then
_LINK_DEST="$(find "${_LINK_SOURCE}" -prune -printf '%l')" _LINK_DEST="$(find "${_LINK_SOURCE}" -prune -printf '%l')"
@ -170,25 +156,20 @@ _symlink() {
} }
_file() { _file() {
# Add a plain file to the rootfs. No parsing is performed and only if [[ ! -e "${_ROOTFS}${1}" ]]; then
# the singular file is added. tar --hard-dereference -C / -cpf - ."${1}" | tar -C "${_ROOTFS}" -xpf - || return 1
# $1: path to file if [[ -L "${1}" ]]; then
# $2: destination on rootfs (optional, defaults to same as source) _LINK_SOURCE="$(realpath -- "${1}")"
# determine source and destination _file "${_LINK_SOURCE}"
local _SRC="${1}" _DEST="${2:-$1}" _MODE="${3}"
if [[ ! -e "${_ROOTFS}${_DEST}" ]]; then
if [[ "${_SRC}" != "${_DEST}" ]]; then
tar --hard-dereference --transform="s|${_SRC}|${_DEST}|" -C / -cpf - ."${_SRC}" | tar -C "${_ROOTFS}" -xpf - || return 1
else
tar --hard-dereference -C / -cpf - ."${_SRC}" | tar -C "${_ROOTFS}" -xpf - || return 1
fi
if [[ -L "${_SRC}" ]]; then
_LINK_SOURCE="$(realpath -- "${_SRC}")"
_file "${_LINK_SOURCE}" "${_LINK_SOURCE}" "${_MODE}"
fi fi
fi fi
} }
_file_rename() {
_SRC="${1}" _DEST="${2:-$1}"
tar --hard-dereference --transform="s|${1}|${2}|" -C / -cpf - ."${1}" | tar -C "${_ROOTFS}" -xpf - || return 1
}
_binary() { _binary() {
# Add a binary file to the rootfs. library dependencies will # Add a binary file to the rootfs. library dependencies will
# be discovered and added. # be discovered and added.
@ -200,7 +181,7 @@ _binary() {
_BIN="${1}" _BIN="${1}"
fi fi
_ROOTFS_BIN="${2:-${_BIN}}" _ROOTFS_BIN="${2:-${_BIN}}"
_file "${_BIN}" "${_ROOTFS_BIN}" _file_rename "${_BIN}" "${_ROOTFS_BIN}"
# non-binaries # non-binaries
if ! _LDD="$(ldd "${_BIN}" 2>"${_NO_LOG}")"; then if ! _LDD="$(ldd "${_BIN}" 2>"${_NO_LOG}")"; then
return 0 return 0
@ -212,7 +193,7 @@ _binary() {
_LIB="${BASH_REMATCH[2]}" _LIB="${BASH_REMATCH[2]}"
fi fi
if [[ -f "${_LIB}" && ! -e "${_ROOTFS}${_LIB}" ]]; then if [[ -f "${_LIB}" && ! -e "${_ROOTFS}${_LIB}" ]]; then
_file "${_LIB}" "${_LIB}" _file "${_LIB}"
fi fi
done <<< "${_LDD}" done <<< "${_LDD}"
return 0 return 0
@ -224,7 +205,7 @@ _init_rootfs() {
_TMPDIR="$(mktemp -d --tmpdir mkinitcpio.XXXX)" _TMPDIR="$(mktemp -d --tmpdir mkinitcpio.XXXX)"
_ROOTFS="${2:-${_TMPDIR}/root}" _ROOTFS="${2:-${_TMPDIR}/root}"
# base directory structure # base directory structure
install -dm755 "${_ROOTFS}"/{new_root,proc,sys,dev,run,tmp,var,etc,usr/{local{,/bin,/sbin,/lib},lib,bin}} mkdir -p "${_ROOTFS}"/{new_root,proc,sys,dev,run,tmp,var,etc,usr/{local{,/bin,/sbin,/lib},lib,bin}}
ln -s "usr/lib" "${_ROOTFS}/lib" ln -s "usr/lib" "${_ROOTFS}/lib"
ln -s "bin" "${_ROOTFS}/usr/sbin" ln -s "bin" "${_ROOTFS}/usr/sbin"
ln -s "usr/bin" "${_ROOTFS}/bin" ln -s "usr/bin" "${_ROOTFS}/bin"
@ -235,7 +216,7 @@ _init_rootfs() {
ln -s "usr/lib" "${_ROOTFS}/lib64" ln -s "usr/lib" "${_ROOTFS}/lib64"
fi fi
# kernel module dir # kernel module dir
[[ "${_KERNELVERSION}" != 'none' ]] && install -dm755 "${_ROOTFS}/usr/lib/modules/${_KERNELVERSION}/kernel" [[ "${_KERNELVERSION}" != 'none' ]] && mkdir -p "${_ROOTFS}/usr/lib/modules/${_KERNELVERSION}/kernel"
# mount tables # mount tables
ln -s ../proc/self/mounts "${_ROOTFS}/etc/mtab" ln -s ../proc/self/mounts "${_ROOTFS}/etc/mtab"
: >"${_ROOTFS}/etc/fstab" : >"${_ROOTFS}/etc/fstab"
@ -245,16 +226,13 @@ _init_rootfs() {
} }
_run_hook() { _run_hook() {
# find script in install dirs if [[ ! -f ${_CPIO}/"${1}" ]]; then
# shellcheck disable=SC2154
if ! _HOOK_FILE="$(PATH="${_CPIO}" type -P "${1}")"; then
_abort "Hook ${1} cannot be found!" _abort "Hook ${1} cannot be found!"
return 1
fi fi
# source # source
unset -f _run unset -f _run
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. "${_HOOK_FILE}" . "${_CPIO}/${1}"
_run _run
} }

View file

@ -30,9 +30,9 @@ _run ()
setfattr pzstd unzstd zstdcat zstdgrep zstdless zstdmt lz4 lz4c lz4cat unlz4 gunzip zcat wipe \ setfattr pzstd unzstd zstdcat zstdgrep zstdless zstdmt lz4 lz4c lz4cat unlz4 gunzip zcat wipe \
capsh getcap getpcaps setcap file blkpr fadvise isosize pg pipesz tunelp capsh getcap getpcaps setcap file blkpr fadvise isosize pg pipesz tunelp
[[ "$(uname -m)" == "x86_64" ]] && _map _binary i386 x86_64 peekfd waitpid [[ "${_RUNNING_ARCH}" == "x86_64" ]] && _map _binary i386 x86_64 peekfd waitpid
[[ "$(uname -m)" == "aarch64" ]] && _binary peekfd [[ "${_RUNNING_ARCH}" == "aarch64" ]] && _binary peekfd
[[ "$(uname -m)" == "riscv64" ]] && _map _binary waitpid [[ "${_RUNNING_ARCH}" == "riscv64" ]] && _map _binary waitpid
### add C.UTF-8 locale ### add C.UTF-8 locale
_dir /usr/lib/locale _dir /usr/lib/locale
_full_dir /usr/lib/locale/C.utf8 _full_dir /usr/lib/locale/C.utf8

View file

@ -47,7 +47,7 @@ _run ()
_map _file /etc/profile /etc/shells _map _file /etc/profile /etc/shells
_BASIC_CONFIG="dialogrc hostname issue modprobe.d/modprobe.conf os-release tmpfiles.d/var.conf" _BASIC_CONFIG="dialogrc hostname issue modprobe.d/modprobe.conf os-release tmpfiles.d/var.conf"
for i in ${_BASIC_CONFIG}; do for i in ${_BASIC_CONFIG}; do
_file "/usr/share/archboot/base/etc/${i}" "/etc/${i}" _file_rename "/usr/share/archboot/base/etc/${i}" "/etc/${i}"
done done
### add coreutils,cryptsetup,terminfo libs and charmaps ### add coreutils,cryptsetup,terminfo libs and charmaps
@ -79,11 +79,11 @@ _run ()
# unlock and delete root password, if not set by user! # unlock and delete root password, if not set by user!
# use color grep and ls output # use color grep and ls output
for i in custom-bash-options.sh archboot-reset-root-password.sh; do for i in custom-bash-options.sh archboot-reset-root-password.sh; do
_file "/usr/share/archboot/base/etc/profile.d/${i}" "/etc/profile.d/${i}" _file_rename "/usr/share/archboot/base/etc/profile.d/${i}" "/etc/profile.d/${i}"
done done
# add default bash setup # add default bash setup
for i in .bashrc .bash_profile .bash_logout; do for i in .bashrc .bash_profile .bash_logout; do
_file "/etc/skel/${i}" "/root/${i}" _file_rename "/etc/skel/${i}" "/root/${i}"
done done
# add custom bash options # add custom bash options
echo ". /etc/profile.d/custom-bash-options.sh" >> "${_ROOTFS}/root/.bashrc" echo ". /etc/profile.d/custom-bash-options.sh" >> "${_ROOTFS}/root/.bashrc"
@ -133,12 +133,12 @@ _run ()
_map _dir /etc/tmpfiles.d /etc/modules-load.d /etc/binfmt.d/ /var/lib/systemd _map _dir /etc/tmpfiles.d /etc/modules-load.d /etc/binfmt.d/ /var/lib/systemd
_map _full_dir /etc/sysctl.d /etc/systemd /etc/xdg /usr/lib/systemd /usr/share/systemd /usr/share/factory \ _map _full_dir /etc/sysctl.d /etc/systemd /etc/xdg /usr/lib/systemd /usr/share/systemd /usr/share/factory \
/usr/share/polkit-1 /usr/lib/tmpfiles.d /usr/lib/modules-load.d /usr/lib/sysusers.d /usr/lib/sysctl.d /usr/share/polkit-1 /usr/lib/tmpfiles.d /usr/lib/modules-load.d /usr/lib/sysusers.d /usr/lib/sysctl.d
_file /usr/share/archboot/base/etc/locale.conf /etc/locale.conf _file_rename /usr/share/archboot/base/etc/locale.conf /etc/locale.conf
_file /usr/share/archboot/base/etc/vconsole.conf /etc/vconsole.conf _file_rename /usr/share/archboot/base/etc/vconsole.conf /etc/vconsole.conf
_file /usr/share/archboot/base/etc/systemd/system/getty@.service /etc/systemd/system/getty@.service _file_rename /usr/share/archboot/base/etc/systemd/system/getty@.service /etc/systemd/system/getty@.service
_file /usr/share/archboot/base/etc/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@.service _file_rename /usr/share/archboot/base/etc/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@.service
_file /usr/share/archboot/base/etc/systemd/system/windowkeys.service /etc/systemd/system/windowkeys.service _file_rename /usr/share/archboot/base/etc/systemd/system/windowkeys.service /etc/systemd/system/windowkeys.service
_file /usr/share/archboot/base/etc/systemd/journald.conf.d/fw-tty12.conf /etc/systemd/journald.conf.d/fw-tty12.conf _file_rename /usr/share/archboot/base/etc/systemd/journald.conf.d/fw-tty12.conf /etc/systemd/journald.conf.d/fw-tty12.conf
_symlink /etc/systemd/system/multi-user.target.wants/windowkeys.service /etc/systemd/system/windowkeys.service _symlink /etc/systemd/system/multi-user.target.wants/windowkeys.service /etc/systemd/system/windowkeys.service
### disable systemd mounts: ### disable systemd mounts:
# disable configfs, debugfs, fuse, hugepages, mqueue and tracefs # disable configfs, debugfs, fuse, hugepages, mqueue and tracefs
@ -163,7 +163,7 @@ _run ()
rm -f "${_ROOTFS}"/etc/systemd/system/multi-user.target.wants/remote-fs.target rm -f "${_ROOTFS}"/etc/systemd/system/multi-user.target.wants/remote-fs.target
# disable lastlog # disable lastlog
_symlink /var/log/lastlog /dev/null _symlink /var/log/lastlog /dev/null
_file /usr/share/archboot/base/etc/tmpfiles.d/var.conf /etc/tmpfiles.d/var.conf _file_rename /usr/share/archboot/base/etc/tmpfiles.d/var.conf /etc/tmpfiles.d/var.conf
### add missing libsystemd files ### add missing libsystemd files
_map _file /usr/lib/libnss_myhostname.so.2 /usr/lib/libnss_mymachines.so.2 \ _map _file /usr/lib/libnss_myhostname.so.2 /usr/lib/libnss_mymachines.so.2 \
/usr/lib/libnss_resolve.so.2 /usr/lib/libnss_systemd.so.2 /usr/lib/libnss_resolve.so.2 /usr/lib/libnss_systemd.so.2
@ -179,10 +179,10 @@ _run ()
# add rule files # add rule files
_full_dir /usr/lib/udev _full_dir /usr/lib/udev
# add schedule rules file # add schedule rules file
_file /usr/share/archboot/base/etc/udev/rules.d/60-ioschedulers.rules /etc/udev/rules.d/60-ioschedulers.rules _file_rename /usr/share/archboot/base/etc/udev/rules.d/60-ioschedulers.rules /etc/udev/rules.d/60-ioschedulers.rules
# add swapiness sysctl config file # add swapiness sysctl config file
_file /usr/share/archboot/base/etc/sysctl.d/99-sysctl.conf /etc/sysctl.d/99-sysctl.conf _file_rename /usr/share/archboot/base/etc/sysctl.d/99-sysctl.conf /etc/sysctl.d/99-sysctl.conf
### add pacman ### add pacman
_map _binary pacman pacman-conf pacman-key pacman-db-upgrade makepkg \ _map _binary pacman pacman-conf pacman-key pacman-db-upgrade makepkg \
@ -192,7 +192,7 @@ _run ()
_map _file /etc/pacman.conf /etc/makepkg.conf /etc/pacman.d/mirrorlist _map _file /etc/pacman.conf /etc/makepkg.conf /etc/pacman.d/mirrorlist
# add pacman initialisation of gpg keys # add pacman initialisation of gpg keys
_dir /etc/pacman.d/gnupg _dir /etc/pacman.d/gnupg
_file /usr/share/archboot/base/etc/systemd/system/pacman-init.service /etc/systemd/system/pacman-init.service _file_rename /usr/share/archboot/base/etc/systemd/system/pacman-init.service /etc/systemd/system/pacman-init.service
_map _full_dir /usr/share/pacman/keyrings /usr/share/makepkg _map _full_dir /usr/share/pacman/keyrings /usr/share/makepkg
# add local installed pacman database in container mode # add local installed pacman database in container mode
if grep -qw 'archboot' /etc/hostname; then if grep -qw 'archboot' /etc/hostname; then

View file

@ -6,7 +6,7 @@ _run ()
{ {
_map _binary hwclock tzselect zic zdump _map _binary hwclock tzselect zic zdump
_map _full_dir /usr/share/zoneinfo /usr/share/zoneinfo-leaps _map _full_dir /usr/share/zoneinfo /usr/share/zoneinfo-leaps
_file /usr/bin/archboot-clock.sh /usr/bin/clock _file_rename /usr/bin/archboot-clock.sh /usr/bin/clock
} }
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et:

View file

@ -9,19 +9,19 @@ _run() {
/usr/lib/systemd/systemd-udevd udevadm systemd-tmpfiles kmod insmod modprobe \ /usr/lib/systemd/systemd-udevd udevadm systemd-tmpfiles kmod insmod modprobe \
gzip uname cat cp dmesg grep ln ls mv rm umount lsblk rmmod cut sed find mkdir dialog gzip uname cat cp dmesg grep ln ls mv rm umount lsblk rmmod cut sed find mkdir dialog
_file /usr/share/terminfo/l/linux _file /usr/share/terminfo/l/linux
_file /usr/share/kbd/consolefonts/ter-v16n.psf.gz /consolefont-16.psf.gz _file_rename /usr/share/kbd/consolefonts/ter-v16n.psf.gz /consolefont-16.psf.gz
_file /usr/share/kbd/consolefonts/ter-v32n.psf.gz /consolefont-32.psf.gz _file_rename /usr/share/kbd/consolefonts/ter-v32n.psf.gz /consolefont-32.psf.gz
rules_d=/usr/lib/udev/rules.d rules_d=/usr/lib/udev/rules.d
_map _file ${rules_d}/50-udev-default.rules ${rules_d}/60-persistent-storage.rules \ _map _file ${rules_d}/50-udev-default.rules ${rules_d}/60-persistent-storage.rules \
${rules_d}/64-btrfs.rules ${rules_d}/80-drivers.rules /usr/lib/udev/ata_id \ ${rules_d}/64-btrfs.rules ${rules_d}/80-drivers.rules /usr/lib/udev/ata_id \
/usr/lib/udev/scsi_id /usr/lib/udev/scsi_id
_file /usr/lib/archboot/cpio/init.sh /init _file_rename /usr/lib/archboot/cpio/init.sh /init
_map _dir /mnt /cdrom /sysroot /ventoy _map _dir /mnt /cdrom /sysroot /ventoy
_map _file /etc/bash.bash_logout /etc/bash.bashrc /etc/profile /etc/shells _map _file /etc/bash.bash_logout /etc/bash.bashrc /etc/profile /etc/shells
_file /usr/share/archboot/base/etc/dialogrc /etc/dialogrc _file_rename /usr/share/archboot/base/etc/dialogrc /etc/dialogrc
# add default bash setup # add default bash setup
for i in .bashrc .bash_profile .bash_logout; do for i in .bashrc .bash_profile .bash_logout; do
_file "/etc/skel/${i}" "/root/${i}" _file_rename "/etc/skel/${i}" "/root/${i}"
done done
# add custom bash options # add custom bash options
echo ". /root/.bashrc" >> "${_ROOTFS}/etc/bash.bashrc" echo ". /root/.bashrc" >> "${_ROOTFS}/etc/bash.bashrc"
@ -31,11 +31,11 @@ _run() {
echo "alias poweroff='echo o >/proc/sysrq-trigger'" >> "${_ROOTFS}/root/.bashrc" echo "alias poweroff='echo o >/proc/sysrq-trigger'" >> "${_ROOTFS}/root/.bashrc"
echo "root:x:0:root" > "${_ROOTFS}/etc/group" echo "root:x:0:root" > "${_ROOTFS}/etc/group"
echo "root:x:0:0:/root:/bin/bash" > "${_ROOTFS}/etc/passwd" echo "root:x:0:0:/root:/bin/bash" > "${_ROOTFS}/etc/passwd"
_file "/usr/share/archboot/base/etc/profile.d/custom-bash-options.sh" \ _file_rename "/usr/share/archboot/base/etc/profile.d/custom-bash-options.sh" \
"/etc/profile.d/custom-bash-options.sh" "/etc/profile.d/custom-bash-options.sh"
_BASIC_CONFIG="os-release modprobe.d/modprobe.conf" _BASIC_CONFIG="os-release modprobe.d/modprobe.conf"
for i in ${_BASIC_CONFIG}; do for i in ${_BASIC_CONFIG}; do
_file "/usr/share/archboot/base/etc/${i}" "/etc/${i}" _file_rename "/usr/share/archboot/base/etc/${i}" "/etc/${i}"
done done
} }

View file

@ -6,14 +6,14 @@ _run ()
{ {
_map _binary genfstab arch-chroot pacstrap \ _map _binary genfstab arch-chroot pacstrap \
archboot-binary-check.sh archboot-not-installed.sh hwdetect archboot-binary-check.sh archboot-not-installed.sh hwdetect
_file /usr/bin/archboot-setup.sh /usr/bin/setup _file_rename /usr/bin/archboot-setup.sh /usr/bin/setup
_file /usr/bin/archboot-launcher.sh /usr/bin/launcher _file_rename /usr/bin/archboot-launcher.sh /usr/bin/launcher
_file /usr/bin/archboot-quickinst.sh /usr/bin/quickinst _file_rename /usr/bin/archboot-quickinst.sh /usr/bin/quickinst
_file /usr/bin/archboot-localize.sh /usr/bin/localize _file_rename /usr/bin/archboot-localize.sh /usr/bin/localize
_file /usr/bin/archboot-pacsetup.sh /usr/bin/pacsetup _file_rename /usr/bin/archboot-pacsetup.sh /usr/bin/pacsetup
_file /usr/bin/archboot-copy-mountpoint.sh /usr/bin/copy-mountpoint.sh _file_rename /usr/bin/archboot-copy-mountpoint.sh /usr/bin/copy-mountpoint.sh
_file /usr/bin/archboot-rsync-backup.sh /usr/bin/rsync-backup.sh _file_rename /usr/bin/archboot-rsync-backup.sh /usr/bin/rsync-backup.sh
_file /usr/bin/archboot-restore-usbstick.sh /usr/bin/restore-usbstick.sh _file_rename /usr/bin/archboot-restore-usbstick.sh /usr/bin/restore-usbstick.sh
_full_dir /usr/lib/archboot/installer _full_dir /usr/lib/archboot/installer
_file /etc/archboot/defaults _file /etc/archboot/defaults
_file /usr/share/archboot/grub/archboot-background.png _file /usr/share/archboot/grub/archboot-background.png

View file

@ -8,7 +8,7 @@ _run ()
/usr/lib/archboot/container.sh /usr/bin/archboot-"$(uname -m)"-create-container.sh \ /usr/lib/archboot/container.sh /usr/bin/archboot-"$(uname -m)"-create-container.sh \
/usr/lib/archboot/login.sh /usr/lib/archboot/login.sh
_full_dir /usr/lib/archboot/update _full_dir /usr/lib/archboot/update
_file /usr/bin/archboot-update.sh /usr/bin/update _file_rename /usr/bin/archboot-update.sh /usr/bin/update
_file /usr/share/archboot/gpg/tpowa.gpg _file /usr/share/archboot/gpg/tpowa.gpg
# use /etc/profile to launch login.sh # use /etc/profile to launch login.sh
echo ". /usr/lib/archboot/login.sh" >> "${_ROOTFS}/root/.bashrc" echo ". /usr/lib/archboot/login.sh" >> "${_ROOTFS}/root/.bashrc"

View file

@ -5,30 +5,28 @@
_run () _run ()
{ {
### generate motd ### generate motd
MOTD=$(mktemp /var/tmp/motd.XXXX) _MOTD="${_ROOTFS}/etc/motd"
[[ "$(uname -m)" == "x86_64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux X86_64\e[m" >> "${MOTD}" [[ "$(uname -m)" == "x86_64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux X86_64\e[m" >> "${_MOTD}"
[[ "$(uname -m)" == "aarch64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux AARCH64\e[m" >> "${MOTD}" [[ "$(uname -m)" == "aarch64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux AARCH64\e[m" >> "${_MOTD}"
[[ "$(uname -m)" == "riscv64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux RISCV64\e[m" >> "${MOTD}" [[ "$(uname -m)" == "riscv64" ]] && echo -e "\e[1mWelcome to \e[36mArchboot\e[m\e[1m - Arch Linux RISCV64\e[m" >> "${_MOTD}"
#shellcheck disable=SC2129 #shellcheck disable=SC2129
echo -e "\e[1m----------------------------------------\e[m" >> "${MOTD}" echo -e "\e[1m----------------------------------------\e[m" >> "${_MOTD}"
echo -e "\e[1mVconsole:\e[m" >> "${MOTD}" echo -e "\e[1mVconsole:\e[m" >> "${_MOTD}"
echo -e " - Use the \e[1;92mALT + F1 - F12\e[m keys to change the virtual console." >> "${MOTD}" echo -e " - Use the \e[1;92mALT + F1 - F12\e[m keys to change the virtual console." >> "${_MOTD}"
if echo "${_HOOKS[@]}" | grep -qw net; then if echo "${_HOOKS[@]}" | grep -qw net; then
#shellcheck disable=SC2129 #shellcheck disable=SC2129
echo -e "\e[1mFor Additional Wi-Fi Authentification Or Online Help:\e[m" >> "${MOTD}" echo -e "\e[1mFor Additional Wi-Fi Authentification Or Online Help:\e[m" >> "${_MOTD}"
echo -e " - Use the \e[1;92m'elinks'\e[m text mode browser." >> "${MOTD}" echo -e " - Use the \e[1;92m'elinks'\e[m text mode browser." >> "${_MOTD}"
echo -e "\e[1mIRC Support Channel:\e[m" >> "${MOTD}" echo -e "\e[1mIRC Support Channel:\e[m" >> "${_MOTD}"
echo -e " - Use the \e[1;92m'weechat'\e[m IRC client." >> "${MOTD}" echo -e " - Use the \e[1;92m'weechat'\e[m IRC client." >> "${_MOTD}"
fi fi
if echo "${_HOOKS[@]}" | grep -qw installer; then if echo "${_HOOKS[@]}" | grep -qw installer; then
#shellcheck disable=SC2129 #shellcheck disable=SC2129
echo -e "\e[1mManage Archboot Environment:\e[m" >> "${MOTD}" echo -e "\e[1mManage Archboot Environment:\e[m" >> "${_MOTD}"
echo -e " - Use the \e[1;92m'launcher'\e[m or the expert \e[1;92m'update'\e[m script." >> "${MOTD}" echo -e " - Use the \e[1;92m'launcher'\e[m or the expert \e[1;92m'update'\e[m script." >> "${_MOTD}"
echo -e "\e[1mInstallation:\e[m" >> "${MOTD}" echo -e "\e[1mInstallation:\e[m" >> "${_MOTD}"
echo -e " - Use the \e[1;92m'setup'\e[m or the expert \e[1;92m'quickinst'\e[m script." >> "${MOTD}" echo -e " - Use the \e[1;92m'setup'\e[m or the expert \e[1;92m'quickinst'\e[m script." >> "${_MOTD}"
fi fi
chmod 644 "${MOTD}"
_file "${MOTD}" /etc/motd
} }
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et:

View file

@ -9,7 +9,7 @@ _run ()
_map _file /usr/share/licenses/neovim/LICENSE.txt _map _file /usr/share/licenses/neovim/LICENSE.txt
# add lastplace plugin: # add lastplace plugin:
# https://github.com/neovim/neovim/issues/16339 # https://github.com/neovim/neovim/issues/16339
_file /usr/share/archboot/nvim/nvim-lastplace.lua /usr/share/nvim/runtime/plugin/nvim-lastplace.lua _file_rename /usr/share/archboot/nvim/nvim-lastplace.lua /usr/share/nvim/runtime/plugin/nvim-lastplace.lua
} }
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et:

View file

@ -16,12 +16,12 @@ _run ()
for i in ${_PLUGINS}; do for i in ${_PLUGINS}; do
_file "/usr/lib/weechat/plugins/${i}.so" _file "/usr/lib/weechat/plugins/${i}.so"
done done
_file /usr/share/archboot/net/etc/weechat/irc.conf /etc/weechat/irc.conf _file_rename /usr/share/archboot/net/etc/weechat/irc.conf /etc/weechat/irc.conf
_file /usr/share/archboot/net/etc/weechat/weechat.conf /etc/weechat/weechat.conf _file_rename /usr/share/archboot/net/etc/weechat/weechat.conf /etc/weechat/weechat.conf
_file /usr/share/archboot/net/etc/profile.d/weechat.sh /etc/profile.d/weechat.sh _file_rename /usr/share/archboot/net/etc/profile.d/weechat.sh /etc/profile.d/weechat.sh
# add elinks defaults # add elinks defaults
_file /usr/share/archboot/net/etc/elinks/bookmarks /etc/elinks/bookmarks _file_rename /usr/share/archboot/net/etc/elinks/bookmarks /etc/elinks/bookmarks
_file /usr/share/archboot/net/etc/profile.d/elinks.sh /etc/profile.d/elinks.sh _file_rename /usr/share/archboot/net/etc/profile.d/elinks.sh /etc/profile.d/elinks.sh
# fixing licenses # fixing licenses
_map _file /usr/share/licenses/krb5/LICENSE /usr/share/licenses/openssh/LICENCE \ _map _file /usr/share/licenses/krb5/LICENSE /usr/share/licenses/openssh/LICENCE \
/usr/share/licenses/openssl/LICENSE.txt /usr/share/licenses/sqlite/license.txt \ /usr/share/licenses/openssl/LICENSE.txt /usr/share/licenses/sqlite/license.txt \

View file

@ -6,12 +6,12 @@ _run ()
{ {
_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' _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 _binary ip getent ping _map _binary ip getent ping
_file /usr/bin/archboot-network.sh /usr/bin/network _file_rename /usr/bin/archboot-network.sh /usr/bin/network
# start dhcpcd on startup # start dhcpcd on startup
_file /usr/share/archboot/net/etc/systemd/network/10-wired-auto-dhcp.network \ _file_rename /usr/share/archboot/net/etc/systemd/network/10-wired-auto-dhcp.network \
/etc/systemd/network/10-wired-auto-dhcp.network /etc/systemd/network/10-wired-auto-dhcp.network
# ipv6 privacy extensions # ipv6 privacy extensions
_file /usr/share/archboot/net/etc/systemd/network.conf.d/ipv6-privacy-extensions.conf \ _file_rename /usr/share/archboot/net/etc/systemd/network.conf.d/ipv6-privacy-extensions.conf \
/etc/systemd/network.conf.d/ipv6-privacy-extensions.conf /etc/systemd/network.conf.d/ipv6-privacy-extensions.conf
} }

View file

@ -12,7 +12,6 @@ _run ()
/etc/rsyncd.conf /etc/exports /usr/lib/ssh/sftp-server /usr/lib/ssh/ssh-keysign \ /etc/rsyncd.conf /etc/exports /usr/lib/ssh/sftp-server /usr/lib/ssh/ssh-keysign \
/usr/lib/ssh/ssh-pkcs11-helper \ /usr/lib/ssh/ssh-pkcs11-helper \
/etc/netconfig /etc/netconfig
_file /etc/ssh/sshd_config
# allow root login and empty passwords # allow root login and empty passwords
echo "PermitRootLogin yes" >> "${_ROOTFS}/etc/ssh/sshd_config" echo "PermitRootLogin yes" >> "${_ROOTFS}/etc/ssh/sshd_config"
echo "PermitEmptyPasswords yes" >> "${_ROOTFS}/etc/ssh/sshd_config" echo "PermitEmptyPasswords yes" >> "${_ROOTFS}/etc/ssh/sshd_config"
@ -29,8 +28,8 @@ _run ()
_symlink /etc/systemd/system/multi-user.target.wants/sshd.service /usr/lib/systemd/system/sshd.service _symlink /etc/systemd/system/multi-user.target.wants/sshd.service /usr/lib/systemd/system/sshd.service
# start ttyd on startup # start ttyd on startup
_file /usr/lib/libwebsockets-evlib_uv.so _file /usr/lib/libwebsockets-evlib_uv.so
_file /usr/share/archboot/remote/usr/bin/remote-login.sh /usr/bin/remote-login.sh _file_rename /usr/share/archboot/remote/usr/bin/remote-login.sh /usr/bin/remote-login.sh
_file /usr/share/archboot/remote/etc/systemd/system/ttyd.service /etc/systemd/system/ttyd.service _file_rename /usr/share/archboot/remote/etc/systemd/system/ttyd.service /etc/systemd/system/ttyd.service
_symlink /etc/systemd/system/multi-user.target.wants/ttyd.service /etc/systemd/system/ttyd.service _symlink /etc/systemd/system/multi-user.target.wants/ttyd.service /etc/systemd/system/ttyd.service
# fix licenses # fix licenses
_map _file /usr/share/licenses/nfsidmap/LICENSE \ _map _file /usr/share/licenses/nfsidmap/LICENSE \

View file

@ -4,14 +4,12 @@
_run () _run ()
{ {
# https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot
_RUNNING_ARCH="$(uname -m)"
_map _binary openssl sbattach sbkeysync sbsiglist sbsign sbvarsign sbverify mokutil sbctl _map _binary openssl sbattach sbkeysync sbsiglist sbsign sbvarsign sbverify mokutil sbctl
_map _file /etc/ssl/openssl.cnf /usr/share/licenses/sbctl/LICENSE _map _file /etc/ssl/openssl.cnf /usr/share/licenses/sbctl/LICENSE
# add mkkeys.sh, # add mkkeys.sh,
# curl -s -L -O https://www.rodsbooks.com/efi-bootloaders/mkkeys.sh # curl -s -L -O https://www.rodsbooks.com/efi-bootloaders/mkkeys.sh
# modiiied to use uuidgen instead of python # modiiied to use uuidgen instead of python
_file /usr/bin/archboot-mkkeys.sh /usr/bin/mkkeys.sh _file_rename /usr/bin/archboot-mkkeys.sh /usr/bin/mkkeys.sh
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then
for i in shimx64.efi mmx64.efi mmia32.efi shimia32.efi; do for i in shimx64.efi mmx64.efi mmia32.efi shimia32.efi; do
_file "/usr/share/archboot/bootloader/${i}" _file "/usr/share/archboot/bootloader/${i}"
@ -23,7 +21,7 @@ _run ()
done done
fi fi
# add generate keys script # add generate keys script
_file /usr/bin/archboot-secureboot-keys.sh /usr/bin/secureboot-keys.sh _file_rename /usr/bin/archboot-secureboot-keys.sh /usr/bin/secureboot-keys.sh
} }
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et: