[arch-projects] [mkinitcpio][PATCH 01/10] fsck: add helper for usr if different fs from root
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/fsck | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/install/fsck b/install/fsck index 852ae6a..e4927fc 100644 --- a/install/fsck +++ b/install/fsck @@ -3,8 +3,13 @@ build() { local added=0 - if (( ! fs_autodetect_failed )) && [[ $rootfstype ]]; then - add_binary /sbin/fsck.$rootfstype && (( ++added )) + if (( ! fs_autodetect_failed )) && [[ $rootfstype$usrfstype ]]; then + if [[ $rootfstype ]]; then + add_binary /sbin/fsck.$rootfstype && (( ++added )) + fi + if [[ $usrfstype && $usrfstype != $rootfstype ]]; then + add_binary /sbin/fsck.$rootfstype && (( ++added )) + fi else for fsck in "$BASEDIR"/sbin/fsck.*; do [[ -f $fsck ]] || continue -- 1.7.8.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio.8.txt | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mkinitcpio.8.txt b/mkinitcpio.8.txt index 7777c24..beb3e9c 100644 --- a/mkinitcpio.8.txt +++ b/mkinitcpio.8.txt @@ -114,13 +114,13 @@ Examples Perform a 'dry-run'. This will generate an initial ramdisk but will not write anything. Use -g to create the real image. -*mkinitcpio -p kernel26*:: - Create an initial ramdisk based on the 'kernel26' preset. +*mkinitcpio -p linux*:: + Create an initial ramdisk based on the 'linux' preset. -*mkinitcpio -b /mnt -g /mnt/boot/kernel26.img -k /boot/vmlinuz26*:: +*mkinitcpio -b /mnt -g /mnt/boot/initramfs-linux.img -k /boot/vmlinuz-linux*:: Create an initial ramdisk for the root at /mnt, with the kernel at - /mnt/boot/vmlinuz26. The resulting image will be written to - /mnt/boot/kernel26.img. + /mnt/boot/vmlinuz-linux. The resulting image will be written to + /mnt/boot/initramfs-linux.img. See also -------- -- 1.7.8.4
systemd passes 'kexec' on 'systemctl kexec' which isn't being caught. Catch the few possible verbs for a halt, and let everything else default to trying a kexec; falling back on a reboot. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- shutdown | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/shutdown b/shutdown index 100f505..39bcb97 100755 --- a/shutdown +++ b/shutdown @@ -16,14 +16,11 @@ END { done case $1 in - reboot) - type kexec >/dev/null && kexec -e - reboot -f - ;; poweroff|shutdown|halt) "$1" -f ;; *) - poweroff -f + type kexec >/dev/null && kexec -e + reboot -f ;; esac -- 1.7.8.4
All official hooks have been using build() for quite some time now. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 54b39d9..677f608 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -321,13 +321,7 @@ for hook in ${HOOKS}; do if [[ -r "${INSTDIR}/${hook}" ]]; then . "${INSTDIR}/${hook}" msg2 "Parsing hook: [%s]" "$hook" - if [[ $(type -t install) = 'function' ]]; then - warning "Hook '%s' uses a deprecated 'install' function. This should be renamed 'build'" "$hook" - install - unset install - else - build - fi + build parse_hook else error "Hook '$hook' can not be found." -- 1.7.8.4
Install kmod in /usr/bin and provide symlinks for all the applets to the kmod multi-call. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- PKGBUILD | 2 +- install/base | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 8cb8b2f..2a5968b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ license=('GPL') groups=('base') conflicts=('mkinitcpio') provides=("mkinitcpio=$pkgver") -depends=('mkinitcpio-busybox>=1.16.1-2' 'module-init-tools' 'util-linux>=2.20.1-2' 'libarchive' 'coreutils' +depends=('mkinitcpio-busybox>=1.16.1-2' 'kmod' 'util-linux>=2.20.1-2' 'libarchive' 'coreutils' 'bash' 'findutils' 'sed' 'grep' 'filesystem>=2011.10-1' 'udev>=177-1' 'file' 'gzip') makedepends=('asciidoc' 'git') optdepends=('xz: Use lzma or xz compression for the initramfs image' diff --git a/install/base b/install/base index 4df02e5..3faf368 100644 --- a/install/base +++ b/install/base @@ -15,7 +15,12 @@ build() { add_symlink "/usr/bin/$applet" busybox done - add_binary /sbin/modprobe + # add kmod with applet symlinks + add_binary kmod + for applet in {dep,ins,rm,ls}mod mod{probe,info}; do + add_symlink "/usr/bin/$applet" kmod + done + add_binary /sbin/blkid add_binary /bin/mount add_binary /sbin/switch_root -- 1.7.8.4
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- mkinitcpio.conf | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/mkinitcpio.conf b/mkinitcpio.conf index d53aabe..0f97131 100644 --- a/mkinitcpio.conf +++ b/mkinitcpio.conf @@ -54,7 +54,10 @@ FILES="" # ## This setup loads an lvm2 volume group on a usb device. # HOOKS="base udev usb lvm2 filesystems" -HOOKS="base udev autodetect pata scsi sata filesystems usbinput" +# +## NOTE: If you have /usr on a separate partition, you MUST include the +# fsck and shutdown hooks. +HOOKS="base udev autodetect pata scsi sata filesystems usbinput fsck" # COMPRESSION # Use this to compress the initramfs image. With kernels earlier than -- 1.7.8.4
This makes us more resilient against path changes -- add_binary is smart enough to resolve the path for us. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/base | 8 ++++---- install/fsck | 6 +++--- install/keymap | 2 +- install/udev | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/install/base b/install/base index 3faf368..3b7632f 100644 --- a/install/base +++ b/install/base @@ -21,10 +21,10 @@ build() { add_symlink "/usr/bin/$applet" kmod done - add_binary /sbin/blkid - add_binary /bin/mount - add_binary /sbin/switch_root - add_binary /bin/findmnt + add_binary blkid + add_binary mount + add_binary switch_root + add_binary findmnt add_symlink "/etc/mtab" "/proc/self/mounts" diff --git a/install/fsck b/install/fsck index e4927fc..f613c5b 100644 --- a/install/fsck +++ b/install/fsck @@ -5,10 +5,10 @@ build() { if (( ! fs_autodetect_failed )) && [[ $rootfstype$usrfstype ]]; then if [[ $rootfstype ]]; then - add_binary /sbin/fsck.$rootfstype && (( ++added )) + add_binary fsck.$rootfstype && (( ++added )) fi if [[ $usrfstype && $usrfstype != $rootfstype ]]; then - add_binary /sbin/fsck.$rootfstype && (( ++added )) + add_binary fsck.$rootfstype && (( ++added )) fi else for fsck in "$BASEDIR"/sbin/fsck.*; do @@ -18,7 +18,7 @@ build() { fi if (( added )); then - add_binary /sbin/fsck + add_binary fsck else warning "No fsck helpers found. fsck will not be run on boot." fi diff --git a/install/keymap b/install/keymap index 1c53c4a..51bb1a2 100644 --- a/install/keymap +++ b/install/keymap @@ -10,7 +10,7 @@ build() { touch "$BUILDROOT/keymap.utf8" uc=-u fi - /bin/loadkeys -q $uc $KEYMAP -b > "$BUILDROOT/keymap.bin" + loadkeys -q $uc $KEYMAP -b > "$BUILDROOT/keymap.bin" fi ) diff --git a/install/udev b/install/udev index e7cb901..a3e5ca3 100644 --- a/install/udev +++ b/install/udev @@ -5,7 +5,7 @@ build() { SCRIPT="udev" add_binary /lib/udev/udevd - add_binary /sbin/udevadm + add_binary udevadm for rules in 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do add_file "/lib/udev/rules.d/$rules" -- 1.7.8.4
We've disabled this subsystem since 3.1, and PATA really should be used in place of it. Remove the mentions of it from the config file as well. --- install/ide | 17 ----------------- mkinitcpio.conf | 4 ---- 2 files changed, 0 insertions(+), 21 deletions(-) delete mode 100644 install/ide diff --git a/install/ide b/install/ide deleted file mode 100644 index a8d9e97..0000000 --- a/install/ide +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -build() { - MODULES="$(checked_modules "/ide/" | grep -v "legacy")" - - [[ $MODULES ]] && MODULES+=" ide-gd_mod?" -} - -help() { - cat <<HELPEOF -This hook loads the necessary modules for an ide root device, using the old ide -subsystem. Detection will take place at runtime. To minimize the modules in -the image, add the autodetect hook too. -HELPEOF -} - -# vim: set ft=sh ts=4 sw=4 et: diff --git a/mkinitcpio.conf b/mkinitcpio.conf index 0f97131..82765c5 100644 --- a/mkinitcpio.conf +++ b/mkinitcpio.conf @@ -40,10 +40,6 @@ FILES="" ## work as a sane default # HOOKS="base udev autodetect pata scsi sata filesystems" # -## This is identical to the above, except the old ide subsystem is -## used for IDE devices instead of the new pata subsystem. -# HOOKS="base udev autodetect ide scsi sata filesystems" -# ## This setup will generate a 'full' image which supports most systems. ## No autodetection is done. # HOOKS="base udev pata scsi sata usb filesystems" -- 1.7.8.4
ide-generic no longer exists, and skipping ata-generic causes some macbooks to not boot. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- install/autodetect | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/install/autodetect b/install/autodetect index 7f40b9c..3fb87ce 100644 --- a/install/autodetect +++ b/install/autodetect @@ -14,7 +14,7 @@ build() { return 1 fi - auto_modules | grep -xEv '(ata|ide)_generic' >"$MODULE_FILE" + auto_modules >"$MODULE_FILE" if ! rootfstype=$(findmnt -uno fstype "${BASEDIR:-/}"); then error "failed to detect root filesystem" -- 1.7.8.4
An error in logic here would cause the --try flag to be passed to all modules after the first, if a hook added modules ending with a '?'. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- functions | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions b/functions index e5b4195..c85806a 100644 --- a/functions +++ b/functions @@ -341,10 +341,10 @@ parse_hook() { for item in $MODULES; do if [[ ${item:(-1)} = '?' ]]; then - try=--try - item=${item%\?} + add_module --try "${item%\?}" + else + add_module "$item" fi - add_module $try "$item" done for item in $BINARIES; do -- 1.7.8.4
On Sat, Jan 28, 2012 at 9:39 PM, Dave Reisner <d@falconindy.com> wrote:
systemd passes 'kexec' on 'systemctl kexec' which isn't being caught. Catch the few possible verbs for a halt, and let everything else default to trying a kexec; falling back on a reboot.
Why not just catch the kexec? -t
On Sat, Jan 28, 2012 at 9:39 PM, Dave Reisner <d@falconindy.com> wrote:
system since 3.1, and PATA really should be used in place of it. Remove the mentions of it from the config file as well. ---
What about linux-lts? -t
On Sat, Jan 28, 2012 at 11:23:49PM +0100, Tom Gundersen wrote:
On Sat, Jan 28, 2012 at 9:39 PM, Dave Reisner <d@falconindy.com> wrote:
system since 3.1, and PATA really should be used in place of it. Remove the mentions of it from the config file as well. ---
What about linux-lts?
-t
what about -lts indeed... so it shall be kept...
On Sat, Jan 28, 2012 at 11:22:15PM +0100, Tom Gundersen wrote:
On Sat, Jan 28, 2012 at 9:39 PM, Dave Reisner <d@falconindy.com> wrote:
systemd passes 'kexec' on 'systemctl kexec' which isn't being caught. Catch the few possible verbs for a halt, and let everything else default to trying a kexec; falling back on a reboot.
Why not just catch the kexec?
-t
because a kexec and a reboot are very much similar. i'm not sure what adding an extra branch buys me. Either you want to shutdown, or you want to reboot.
participants (2)
-
Dave Reisner
-
Tom Gundersen