Skip to content
Snippets Groups Projects
Commit c2ce128f authored by Ben Hutchings's avatar Ben Hutchings
Browse files

Merge branch 'mount-usr-for-systemd-only'

Resolved trivial conflict in debian/control.
parents b6339034 d641934f
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ Depends: klibc-utils (>= 2.0-1~), cpio, kmod | module-init-tools, udev, ${misc:D
Suggests: bash-completion
Provides: linux-initramfs-tool
Conflicts: linux-initramfs-tool, usplash (<< 0.5.50)
Breaks: cryptsetup (<< 2:1.1.0-2.1), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), s390-tools (<< 1.8.3-2~), console-setup (<< 1.72)
Breaks: cryptsetup (<< 2:1.1.0-2.1), elilo (<< 3.12-3.1~), lilo (<< 22.8-8.2~), s390-tools (<< 1.8.3-2~), console-setup (<< 1.72), systemd-sysv (<< 186)
Description: generic modular initramfs generator
This package contains tools to create a bootable initramfs for Linux kernel
packages. The initramfs is a compressed cpio archive. At boot time, the
......
......@@ -224,7 +224,46 @@ mount_premount
mountroot
log_end_msg
if read_fstab_entry /usr; then
validate_init() {
checktarget="${1}"
# Work around absolute symlinks
if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then
checktarget="$(readlink "${rootmnt}${checktarget}")"
case "$checktarget" in
/*)
;;
*)
checktarget="${1%/*}/$checktarget"
;;
esac
fi
# Make sure the specified init can be executed
if [ ! -x "${rootmnt}${checktarget}" ]; then
return 1
fi
# Upstart uses /etc/init as configuration directory :-/
if [ -d "${rootmnt}${checktarget}" ]; then
return 1
fi
}
# Check init is really there
if ! validate_init "$init"; then
echo "Target filesystem doesn't have requested ${init}."
init=
for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
if validate_init "${inittest}"; then
init="$inittest"
break
fi
done
fi
# Mount /usr only if init is systemd (after reading symlink)
if [ "${checktarget##*/}" = systemd ] && read_fstab_entry /usr; then
log_begin_msg "Mounting /usr file system"
mountfs /usr
log_end_msg
......@@ -255,52 +294,9 @@ else
umount /run
fi
validate_init() {
checktarget="${1}"
# Work around absolute symlinks
if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then
case $(readlink "${rootmnt}${checktarget}") in /*)
checktarget="$(chroot ${rootmnt} readlink ${checktarget})"
;;
esac
fi
# Make sure the specified init can be executed
if [ ! -x "${rootmnt}${checktarget}" ]; then
return 1
fi
# Upstart uses /etc/init as configuration directory :-/
if [ -d "${rootmnt}${checktarget}" ]; then
return 1
fi
}
# Check init bootarg
if [ -n "${init}" ]; then
if ! validate_init "$init"; then
echo "Target filesystem doesn't have requested ${init}."
init=
fi
fi
# Common case: /sbin/init is present
if [ ! -x "${rootmnt}/sbin/init" ]; then
# ... if it's not available search for valid init
if [ -z "${init}" ] ; then
for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
if validate_init "${inittest}"; then
init="$inittest"
break
fi
done
fi
# No init on rootmount
if ! validate_init "${init}" ; then
panic "No init found. Try passing init= bootarg."
fi
# No init on rootmount
if ! validate_init "${init}" ; then
panic "No init found. Try passing init= bootarg."
fi
maybe_break init
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment