Created
August 29, 2024 12:41
-
-
Save chsbuffer/fef63d32980b31016e1ec82f42d92b08 to your computer and use it in GitHub Desktop.
directory as root archlinux mkinitcpio hook. why? Because I want to install linux and Windows on same partition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ash | |
| # this file is at /etc/initcpio/hooks/bedrock | |
| run_hook () | |
| { | |
| mount_handler="ramdisk_mount_handler" | |
| } | |
| ramdisk_mount_handler () | |
| { | |
| msg ":: mounting '$root' on dummy root" | |
| mkdir /dummy_root | |
| if ! mount -t "${rootfstype:-auto}" -o "${rwopt:-ro}${rootflags:+,$rootflags}" "$root" "/dummy_root"; then | |
| # shellcheck disable=SC2086 | |
| run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | |
| err "Failed to mount '$root' on dummy root" | |
| echo "You are now being dropped into an emergency shell." | |
| # shellcheck disable=SC2119 | |
| launch_interactive_shell | |
| msg "Trying to continue (this will most likely fail) ..." | |
| fi | |
| msg ":: mounting '/dummy_root/$rootdir' on real root" | |
| if ! mount --bind "/dummy_root/$rootdir" "$1"; then | |
| # shellcheck disable=SC2086 | |
| run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | |
| err "Failed to mount '$root' on real root" | |
| echo "You are now being dropped into an emergency shell." | |
| # shellcheck disable=SC2119 | |
| launch_interactive_shell | |
| msg "Trying to continue (this will most likely fail) ..." | |
| fi | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # this file is at /etc/initcpio/install/bedrock | |
| build() { | |
| add_runscript | |
| } | |
| help() { | |
| cat <<HELPEOF | |
| HELPEOF | |
| } | |
| # vim: set ft=sh ts=4 sw=4 et: |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add bedrock to /etc/mkinitcpio.conf HOOKS, rebuild initd
sudo mkinitcpio -P