cleanup
This commit is contained in:
parent
4f94d6e40c
commit
ee6fea9a50
@ -14,10 +14,10 @@ create_symlink()
|
|||||||
ln -s "../../${dev_name}" "$sym"
|
ln -s "../../${dev_name}" "$sym"
|
||||||
}
|
}
|
||||||
|
|
||||||
# int main()
|
|
||||||
{
|
|
||||||
[ -b "/dev/${dev_name=${DEVPATH##*/}}" ] || exit 1
|
[ -b "/dev/${dev_name=${DEVPATH##*/}}" ] || exit 1
|
||||||
|
|
||||||
|
exec > /dev/null 2>&1
|
||||||
|
|
||||||
read -r dm_name < "/sys/block/${dev_name}/dm/name" && {
|
read -r dm_name < "/sys/block/${dev_name}/dm/name" && {
|
||||||
mkdir -p /dev/mapper
|
mkdir -p /dev/mapper
|
||||||
ln -sf "../${dev_name}" "/dev/mapper/${dm_name:?}"
|
ln -sf "../${dev_name}" "/dev/mapper/${dm_name:?}"
|
||||||
@ -33,4 +33,3 @@ create_symlink()
|
|||||||
LABEL) create_symlink /dev/disk/by-label "${line##*=}" ;;
|
LABEL) create_symlink /dev/disk/by-label "${line##*=}" ;;
|
||||||
PARTUUID) create_symlink /dev/disk/by-partuuid "${line##*=}" ;;
|
PARTUUID) create_symlink /dev/disk/by-partuuid "${line##*=}" ;;
|
||||||
esac; done
|
esac; done
|
||||||
} > /dev/null 2>&1
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
.nh
|
.nh
|
||||||
.ad l
|
.ad l
|
||||||
.\" Begin generated content:
|
.\" Begin generated content:
|
||||||
.TH "tinyramfs.cmdline" "7" "2020-09-07"
|
.TH "tinyramfs.cmdline" "7" "2020-09-10"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.P
|
.P
|
||||||
@ -37,7 +37,7 @@ Enable debug mode.\&
|
|||||||
.P
|
.P
|
||||||
.RS 4
|
.RS 4
|
||||||
Specify breakpoint where shell should be invoked.\& Useful for
|
Specify breakpoint where shell should be invoked.\& Useful for
|
||||||
debugging.\& List of supported breakpoints:
|
debugging.\& List of builtin breakpoints:
|
||||||
.P
|
.P
|
||||||
.RS 4
|
.RS 4
|
||||||
.ie n \{\
|
.ie n \{\
|
||||||
@ -46,24 +46,6 @@ debugging.\& List of supported breakpoints:
|
|||||||
.el \{\
|
.el \{\
|
||||||
.IP \(bu 4
|
.IP \(bu 4
|
||||||
.\}
|
.\}
|
||||||
keymap
|
|
||||||
.RE
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.IP \(bu 4
|
|
||||||
.\}
|
|
||||||
devmgr
|
|
||||||
.RE
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.IP \(bu 4
|
|
||||||
.\}
|
|
||||||
root
|
root
|
||||||
.RE
|
.RE
|
||||||
.RS 4
|
.RS 4
|
||||||
@ -74,27 +56,12 @@ root
|
|||||||
.IP \(bu 4
|
.IP \(bu 4
|
||||||
.\}
|
.\}
|
||||||
boot
|
boot
|
||||||
.RE
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.IP \(bu 4
|
|
||||||
.\}
|
|
||||||
luks
|
|
||||||
.RE
|
|
||||||
.RS 4
|
|
||||||
.ie n \{\
|
|
||||||
\h'-04'\(bu\h'+03'\c
|
|
||||||
.\}
|
|
||||||
.el \{\
|
|
||||||
.IP \(bu 4
|
|
||||||
.\}
|
|
||||||
lvm
|
|
||||||
|
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
|
Hooks can provide their own breakpoints.\& See source code of hooks
|
||||||
|
for more information.\&
|
||||||
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fBroot\fR=UUID|LABEL|/dev/*|PARTUUID
|
\fBroot\fR=UUID|LABEL|/dev/*|PARTUUID
|
||||||
.P
|
.P
|
||||||
|
@ -25,14 +25,13 @@ kernel parameters without needing to regenerate initramfs image.
|
|||||||
*break*=breakpoint
|
*break*=breakpoint
|
||||||
|
|
||||||
Specify breakpoint where shell should be invoked. Useful for
|
Specify breakpoint where shell should be invoked. Useful for
|
||||||
debugging. List of supported breakpoints:
|
debugging. List of builtin breakpoints:
|
||||||
|
|
||||||
- keymap
|
|
||||||
- devmgr
|
|
||||||
- root
|
- root
|
||||||
- boot
|
- boot
|
||||||
- luks
|
|
||||||
- lvm
|
Hooks can provide their own breakpoints. See source code of hooks
|
||||||
|
for more information.
|
||||||
|
|
||||||
*root*=UUID|LABEL|/dev/\*|PARTUUID
|
*root*=UUID|LABEL|/dev/\*|PARTUUID
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
for _binary in udevd udevadm; do
|
for _binary in udevd udevadm; do
|
||||||
copy_binary "$_binary"
|
copy_binary "$_binary"
|
||||||
done
|
done
|
||||||
@ -17,4 +17,3 @@
|
|||||||
[ "$monolith" = 1 ] || printf "%s\n" \
|
[ "$monolith" = 1 ] || printf "%s\n" \
|
||||||
'ENV{MODALIAS}=="?*", ACTION=="add", RUN+="/bin/modprobe %E{MODALIAS}"' \
|
'ENV{MODALIAS}=="?*", ACTION=="add", RUN+="/bin/modprobe %E{MODALIAS}"' \
|
||||||
>> "${tmpdir}/lib/udev/rules.d/device-helper.rules"
|
>> "${tmpdir}/lib/udev/rules.d/device-helper.rules"
|
||||||
}
|
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2034
|
# shellcheck disable=2154,2034
|
||||||
{
|
|
||||||
[ "$break" = devmgr ] && { print "break before run_eudev()"; sh; }
|
[ "$break" = eudev ] && { print "break before eudev.init"; sh; }
|
||||||
|
|
||||||
udevd -dN never
|
udevd -dN never
|
||||||
udevadm trigger -c add -t subsystems
|
udevadm trigger -c add -t subsystems
|
||||||
udevadm trigger -c add -t devices
|
udevadm trigger -c add -t devices
|
||||||
udevadm settle
|
udevadm settle
|
||||||
}
|
|
||||||
|
@ -3,6 +3,5 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
udevadm control -e
|
udevadm control -e
|
||||||
}
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
copy_file "$keymap_path" "$keymap_path" 644 0
|
copy_file "$keymap_path" "$keymap_path" 644 0
|
||||||
copy_binary loadkmap
|
copy_binary loadkmap
|
||||||
}
|
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
[ "$break" = keymap ] && { print "break before run_keymap()"; sh; }
|
[ "$break" = keymap ] && { print "break before keymap.init"; sh; }
|
||||||
|
|
||||||
loadkmap < "$keymap_path"
|
loadkmap < "$keymap_path"
|
||||||
}
|
|
||||||
|
@ -3,7 +3,25 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
|
[ "$luks_key" ] && {
|
||||||
|
copy_file "${luks_key#*=}" /root/key 400 0
|
||||||
|
|
||||||
|
sed "s|${luks_key#*=}|/root/key|" \
|
||||||
|
"${tmpdir}/etc/tinyramfs/config" > "${tmpdir}/_"
|
||||||
|
|
||||||
|
mv "${tmpdir}/_" "${tmpdir}/etc/tinyramfs/config"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$luks_header" ] && {
|
||||||
|
copy_file "${luks_header#*=}" /root/header 400 0
|
||||||
|
|
||||||
|
sed "s|${luks_header#*=}|/root/header|" \
|
||||||
|
"${tmpdir}/etc/tinyramfs/config" > "${tmpdir}/_"
|
||||||
|
|
||||||
|
mv "${tmpdir}/_" "${tmpdir}/etc/tinyramfs/config"
|
||||||
|
}
|
||||||
|
|
||||||
[ "$hostonly" = 1 ] &&
|
[ "$hostonly" = 1 ] &&
|
||||||
for _module in \
|
for _module in \
|
||||||
aes ecb xts lrw wp512 sha256 \
|
aes ecb xts lrw wp512 sha256 \
|
||||||
@ -17,22 +35,3 @@
|
|||||||
# avoid possible issues with libgcc_s.so.1
|
# avoid possible issues with libgcc_s.so.1
|
||||||
# see https://bugs.archlinux.org/task/56771
|
# see https://bugs.archlinux.org/task/56771
|
||||||
[ -e /lib/libgcc_s.so.1 ] && copy_file /lib/libgcc_s.so.1 /lib/libgcc_s.so.1 755 1
|
[ -e /lib/libgcc_s.so.1 ] && copy_file /lib/libgcc_s.so.1 /lib/libgcc_s.so.1 755 1
|
||||||
|
|
||||||
if [ "$luks_key" ]; then
|
|
||||||
copy_file "${luks_key#*=}" /root/key 400 0
|
|
||||||
|
|
||||||
sed "s|${luks_key#*=}|/root/key|" \
|
|
||||||
"${tmpdir}/etc/tinyramfs/config" > "${tmpdir}/_"
|
|
||||||
|
|
||||||
mv "${tmpdir}/_" "${tmpdir}/etc/tinyramfs/config"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$luks_header" ]; then
|
|
||||||
copy_file "${luks_header#*=}" /root/header 400 0
|
|
||||||
|
|
||||||
sed "s|${luks_header#*=}|/root/header|" \
|
|
||||||
"${tmpdir}/etc/tinyramfs/config" > "${tmpdir}/_"
|
|
||||||
|
|
||||||
mv "${tmpdir}/_" "${tmpdir}/etc/tinyramfs/config"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#
|
#
|
||||||
# word splitting is safe by design
|
# word splitting is safe by design
|
||||||
# shellcheck disable=2068
|
# shellcheck disable=2068
|
||||||
{
|
|
||||||
[ "$break" = luks ] && { print "break before unlock_luks()"; sh; }
|
[ "$break" = luks ] && { print "break before luks.init"; sh; }
|
||||||
|
|
||||||
export DM_DISABLE_UDEV=1
|
export DM_DISABLE_UDEV=1
|
||||||
mkdir -p /run/cryptsetup
|
mkdir -p /run/cryptsetup
|
||||||
@ -19,4 +19,3 @@
|
|||||||
"${luks_key:+-d $luks_key}" "$device" "${luks_name:-crypt-${device##*/}}"
|
"${luks_key:+-d $luks_key}" "$device" "${luks_name:-crypt-${device##*/}}"
|
||||||
|
|
||||||
cryptsetup open $@ || panic "failed to unlock LUKS"
|
cryptsetup open $@ || panic "failed to unlock LUKS"
|
||||||
}
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
[ "$hostonly" = 1 ] &&
|
[ "$hostonly" = 1 ] &&
|
||||||
for _module in \
|
for _module in \
|
||||||
dm-log dm-cache dm-mirror \
|
dm-log dm-cache dm-mirror \
|
||||||
@ -32,4 +32,3 @@
|
|||||||
--config "$lvm_config" \
|
--config "$lvm_config" \
|
||||||
${lvm_config:+--mergedconfig} \
|
${lvm_config:+--mergedconfig} \
|
||||||
> "${tmpdir}/etc/lvm/lvm.conf"
|
> "${tmpdir}/etc/lvm/lvm.conf"
|
||||||
}
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#
|
#
|
||||||
# word splitting is safe by design
|
# word splitting is safe by design
|
||||||
# shellcheck disable=2068
|
# shellcheck disable=2068
|
||||||
{
|
|
||||||
[ "$break" = lvm ] && { print "break before trigger_lvm()"; sh; }
|
[ "$break" = lvm ] && { print "break before lvm.init"; sh; }
|
||||||
|
|
||||||
export DM_DISABLE_UDEV=1
|
export DM_DISABLE_UDEV=1
|
||||||
mkdir -p /run/lvm /run/lock/lvm
|
mkdir -p /run/lvm /run/lock/lvm
|
||||||
@ -24,4 +24,3 @@
|
|||||||
else
|
else
|
||||||
lvm vgchange $@
|
lvm vgchange $@
|
||||||
fi || panic "failed to trigger LVM"
|
fi || panic "failed to trigger LVM"
|
||||||
}
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2016
|
# shellcheck disable=2154,2016
|
||||||
{
|
|
||||||
for _binary in mdev find; do
|
for _binary in mdev find; do
|
||||||
copy_binary "$_binary"
|
copy_binary "$_binary"
|
||||||
done
|
done
|
||||||
@ -15,4 +15,3 @@
|
|||||||
[ "$monolith" = 1 ] || printf "%s\n" \
|
[ "$monolith" = 1 ] || printf "%s\n" \
|
||||||
'$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"' \
|
'$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"' \
|
||||||
>> "${tmpdir}/etc/mdev.conf"
|
>> "${tmpdir}/etc/mdev.conf"
|
||||||
}
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2034
|
# shellcheck disable=2154,2034
|
||||||
{
|
|
||||||
[ "$break" = devmgr ] && { print "break before run_mdev()"; sh; }
|
[ "$break" = mdev ] && { print "break before mdev.init"; sh; }
|
||||||
|
|
||||||
mdev -s
|
mdev -s
|
||||||
mdev -df 2> /dev/null & mdev_pid="$!"
|
mdev -df 2> /dev/null & mdev_pid="$!"
|
||||||
@ -14,4 +14,3 @@
|
|||||||
while read -r uevent; do
|
while read -r uevent; do
|
||||||
printf add > "$uevent"
|
printf add > "$uevent"
|
||||||
done 2> /dev/null
|
done 2> /dev/null
|
||||||
}
|
|
||||||
|
@ -3,6 +3,5 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
kill "$mdev_pid"
|
kill "$mdev_pid"
|
||||||
}
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2016
|
# shellcheck disable=2154,2016
|
||||||
{
|
|
||||||
for _binary in mdevd mdevd-coldplug; do
|
for _binary in mdevd mdevd-coldplug; do
|
||||||
copy_binary "$_binary"
|
copy_binary "$_binary"
|
||||||
done
|
done
|
||||||
@ -15,4 +15,3 @@
|
|||||||
[ "$monolith" = 1 ] || printf "%s\n" \
|
[ "$monolith" = 1 ] || printf "%s\n" \
|
||||||
'$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"' \
|
'$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"' \
|
||||||
>> "${tmpdir}/etc/mdev.conf"
|
>> "${tmpdir}/etc/mdev.conf"
|
||||||
}
|
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2034
|
# shellcheck disable=2154,2034
|
||||||
{
|
|
||||||
[ "$break" = devmgr ] && { print "break before run_mdevd()"; sh; }
|
[ "$break" = mdevd ] && { print "break before mdevd.init"; sh; }
|
||||||
|
|
||||||
mdevd 2> /dev/null & mdevd_pid="$!"
|
mdevd 2> /dev/null & mdevd_pid="$!"
|
||||||
mdevd-coldplug
|
mdevd-coldplug
|
||||||
}
|
|
||||||
|
@ -3,6 +3,5 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
kill "$mdevd_pid"
|
kill "$mdevd_pid"
|
||||||
}
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# vim: set ft=sh:
|
# vim: set ft=sh:
|
||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
{
|
|
||||||
copy_binary find
|
copy_binary find
|
||||||
}
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
[ "$break" = devmgr ] && { print "break before run_proc()"; sh; }
|
[ "$break" = proc ] && { print "break before proc.init"; sh; }
|
||||||
|
|
||||||
command -v device-helper > /proc/sys/kernel/hotplug
|
command -v device-helper > /proc/sys/kernel/hotplug
|
||||||
|
|
||||||
@ -14,4 +14,3 @@
|
|||||||
while read -r uevent; do
|
while read -r uevent; do
|
||||||
printf add > "$uevent"
|
printf add > "$uevent"
|
||||||
done 2> /dev/null
|
done 2> /dev/null
|
||||||
}
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# vim: set ft=sh:
|
# vim: set ft=sh:
|
||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
{
|
|
||||||
printf '\n' > /proc/sys/kernel/hotplug
|
printf '\n' > /proc/sys/kernel/hotplug
|
||||||
}
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
for _binary in /lib/systemd/systemd-udevd udevadm; do
|
for _binary in /lib/systemd/systemd-udevd udevadm; do
|
||||||
copy_binary "$_binary"
|
copy_binary "$_binary"
|
||||||
done
|
done
|
||||||
@ -17,4 +17,3 @@
|
|||||||
[ "$monolith" = 1 ] || printf "%s\n" \
|
[ "$monolith" = 1 ] || printf "%s\n" \
|
||||||
'ENV{MODALIAS}=="?*", ACTION=="add", RUN+="/bin/modprobe %E{MODALIAS}"' \
|
'ENV{MODALIAS}=="?*", ACTION=="add", RUN+="/bin/modprobe %E{MODALIAS}"' \
|
||||||
>> "${tmpdir}/lib/udev/rules.d/device-helper.rules"
|
>> "${tmpdir}/lib/udev/rules.d/device-helper.rules"
|
||||||
}
|
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154,2034
|
# shellcheck disable=2154,2034
|
||||||
{
|
|
||||||
[ "$break" = devmgr ] && { print "break before run_systemd_udevd()"; sh; }
|
[ "$break" = systemd-udevd ] && { print "break before systemd-udevd.init"; sh; }
|
||||||
|
|
||||||
/lib/systemd/systemd-udevd -dN never
|
/lib/systemd/systemd-udevd -dN never
|
||||||
udevadm trigger -c add -t subsystems
|
udevadm trigger -c add -t subsystems
|
||||||
udevadm trigger -c add -t devices
|
udevadm trigger -c add -t devices
|
||||||
udevadm settle
|
udevadm settle
|
||||||
}
|
|
||||||
|
@ -3,6 +3,5 @@
|
|||||||
#
|
#
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=2154
|
# shellcheck disable=2154
|
||||||
{
|
|
||||||
udevadm control -e
|
udevadm control -e
|
||||||
}
|
|
||||||
|
11
init
11
init
@ -29,8 +29,6 @@ resolve_device()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# prevent race condition
|
# prevent race condition
|
||||||
# XXX what the hell happens here?
|
|
||||||
# why this loop sometimes trigger panic if i remove '|| :'
|
|
||||||
while [ ! -b "$device" ]; do sleep 1
|
while [ ! -b "$device" ]; do sleep 1
|
||||||
[ "$((count += 1))" = "${rootdelay:=30}" ] && {
|
[ "$((count += 1))" = "${rootdelay:=30}" ] && {
|
||||||
panic "failed to lookup partition"
|
panic "failed to lookup partition"
|
||||||
@ -41,14 +39,14 @@ resolve_device()
|
|||||||
|
|
||||||
run_hook()
|
run_hook()
|
||||||
{
|
{
|
||||||
type="$1"; hksdir=/usr/share/tinyramfs/hooks
|
type="$1"
|
||||||
|
|
||||||
# run hooks if any
|
# run hooks if any
|
||||||
# false positive
|
# false positive
|
||||||
# shellcheck disable=1090
|
# shellcheck disable=1090
|
||||||
for hook in $hooks; do
|
for hook in $hooks; do
|
||||||
[ -f "${hksdir}/${hook}/${hook}.${type}" ] || continue
|
[ -f "/usr/share/tinyramfs/hooks/${hook}/${hook}.${type}" ] || continue
|
||||||
. "${hksdir}/${hook}/${hook}.${type}"
|
. "/usr/share/tinyramfs/hooks/${hook}/${hook}.${type}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +119,6 @@ boot_system()
|
|||||||
switch_root $@ || panic "failed to boot system"
|
switch_root $@ || panic "failed to boot system"
|
||||||
}
|
}
|
||||||
|
|
||||||
# int main()
|
|
||||||
{
|
|
||||||
# enable exit on error and disable globbing
|
# enable exit on error and disable globbing
|
||||||
# trap EXIT signal
|
# trap EXIT signal
|
||||||
set -ef; trap panic EXIT
|
set -ef; trap panic EXIT
|
||||||
@ -133,4 +129,3 @@ boot_system()
|
|||||||
mount_root
|
mount_root
|
||||||
run_hook init.late
|
run_hook init.late
|
||||||
boot_system
|
boot_system
|
||||||
}
|
|
||||||
|
22
tinyramfs
22
tinyramfs
@ -134,11 +134,7 @@ prepare_initramfs()
|
|||||||
copy_binary "$_binary"
|
copy_binary "$_binary"
|
||||||
done
|
done
|
||||||
|
|
||||||
if command -v blkid > /dev/null; then
|
command -v blkid > /dev/null && copy_binary blkid
|
||||||
copy_binary blkid
|
|
||||||
else
|
|
||||||
print "blkid not found. you will unable to use UUID, LABEL, PARTUUID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
copy_file "${srcdir}/init" /init 755 0
|
copy_file "${srcdir}/init" /init 755 0
|
||||||
copy_file "$config" /etc/tinyramfs/config 644 0
|
copy_file "$config" /etc/tinyramfs/config 644 0
|
||||||
@ -237,7 +233,7 @@ copy_hook()
|
|||||||
{
|
{
|
||||||
hook="$1"
|
hook="$1"
|
||||||
|
|
||||||
for _dir in "$hksdir" /etc/tinyramfs/hooks "${srcdir}/hooks"; do
|
for _dir in "$hksdir" /etc/tinyramfs/hooks /usr/share/tinyramfs/hooks; do
|
||||||
[ -f "${_dir}/${hook}/${hook}" ] || ! continue
|
[ -f "${_dir}/${hook}/${hook}" ] || ! continue
|
||||||
done || panic "could not find $hook hook"
|
done || panic "could not find $hook hook"
|
||||||
|
|
||||||
@ -247,13 +243,13 @@ copy_hook()
|
|||||||
# shellcheck disable=1090
|
# shellcheck disable=1090
|
||||||
. "${_dir}/${hook}/${hook}"
|
. "${_dir}/${hook}/${hook}"
|
||||||
|
|
||||||
for _file in init init.late; do
|
for _type in init init.late; do
|
||||||
[ -f "${_dir}/${hook}/${hook}.${_file}" ] || continue
|
[ -f "${_dir}/${hook}/${hook}.${_type}" ] || continue
|
||||||
|
|
||||||
print "copying ${hook}.${_file}"
|
print "copying ${hook}.${_type}"
|
||||||
|
|
||||||
copy_file "${_dir}/${hook}/${hook}.${_file}" \
|
copy_file "${_dir}/${hook}/${hook}.${_type}" \
|
||||||
"/usr/share/tinyramfs/hooks/${hook}/${hook}.${_file}" 644 0
|
"/usr/share/tinyramfs/hooks/${hook}/${hook}.${_type}" 644 0
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +258,6 @@ copy_modules()
|
|||||||
# skip this function if kernel
|
# skip this function if kernel
|
||||||
# compiled with builtin modules
|
# compiled with builtin modules
|
||||||
if [ "$monolith" = 1 ]; then
|
if [ "$monolith" = 1 ]; then
|
||||||
print "skipping modules"
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
elif [ "$hostonly" = 1 ]; then
|
elif [ "$hostonly" = 1 ]; then
|
||||||
@ -351,8 +346,6 @@ make_initramfs()
|
|||||||
print "done! check out $output"
|
print "done! check out $output"
|
||||||
)
|
)
|
||||||
|
|
||||||
# int main()
|
|
||||||
{
|
|
||||||
[ "$(id -u)" = 0 ] || panic "must be run as root"
|
[ "$(id -u)" = 0 ] || panic "must be run as root"
|
||||||
|
|
||||||
# enable exit on error and disable globbing
|
# enable exit on error and disable globbing
|
||||||
@ -368,4 +361,3 @@ make_initramfs()
|
|||||||
|
|
||||||
copy_modules
|
copy_modules
|
||||||
make_initramfs
|
make_initramfs
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user