initramfs-tools: performance and misc fixes.
mkinitramfs: run_bootloader shall be called if -B not specified for delete mode. mkinitramfs: use find -L when copying scripts files, so that it works in a chroot for xbps-src. init: do not mount devpts, do not create /var/lock, umount /sys and /proc in initramfs. scripts: simplify them and assume that blkid is used everywhere. scripts: remove specific stuff for lilo compat. --HG-- branch : gnome3
This commit is contained in:
parent
1f738d90d8
commit
01a9868a70
7 changed files with 35 additions and 93 deletions
|
@ -12,8 +12,8 @@ catenate_cpiogz() {
|
||||||
|
|
||||||
force_load()
|
force_load()
|
||||||
{
|
{
|
||||||
manual_add_modules ${@}
|
manual_add_modules ${@}
|
||||||
echo "${@}" >>"${DESTDIR}/conf/modules"
|
echo "${@}" >>"${DESTDIR}/conf/modules"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Takes a file containing a list of modules to be added as an
|
# Takes a file containing a list of modules to be added as an
|
||||||
|
@ -370,9 +370,6 @@ dep_add_modules()
|
||||||
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/ide" ]; then
|
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/ide" ]; then
|
||||||
sys_walk_modalias ${root_dev_path}
|
sys_walk_modalias ${root_dev_path}
|
||||||
manual_add_modules ide-gd_mod
|
manual_add_modules ide-gd_mod
|
||||||
# FIXME: remove post Squeeze
|
|
||||||
manual_add_modules ide-disk
|
|
||||||
manual_add_modules ide-cd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
|
if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
|
||||||
|
@ -539,8 +536,14 @@ cache_run_scripts()
|
||||||
compare_versions()
|
compare_versions()
|
||||||
{
|
{
|
||||||
local curv="$1" minv="$2"
|
local curv="$1" minv="$2"
|
||||||
|
local cmpver_cmd
|
||||||
|
|
||||||
xbps-uhelper cmpver $curv $minv
|
if ! command -v xbps-uhelper.static >/dev/null 2>&1; then
|
||||||
|
cmpver_cmd=xbps-uhelper.static
|
||||||
|
else
|
||||||
|
cmpver_cmd=xbps-uhelper
|
||||||
|
fi
|
||||||
|
${cmpver_cmd} cmpver $curv $minv
|
||||||
if [ $? -eq 0 ] || [ $? -eq 1 ]; then
|
if [ $? -eq 0 ] || [ $? -eq 1 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -13,31 +13,23 @@ done
|
||||||
[ -d /sys ] || mkdir /sys
|
[ -d /sys ] || mkdir /sys
|
||||||
[ -d /proc ] || mkdir /proc
|
[ -d /proc ] || mkdir /proc
|
||||||
[ -d /tmp ] || mkdir /tmp
|
[ -d /tmp ] || mkdir /tmp
|
||||||
mkdir -p /var/lock
|
|
||||||
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
|
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
|
||||||
mount -t proc -o nodev,noexec,nosuid proc /proc
|
mount -t proc -o nodev,noexec,nosuid proc /proc
|
||||||
|
|
||||||
# Note that this only becomes /dev on the real filesystem if udev's scripts
|
# Note that this only becomes /dev on the real filesystem if udev's scripts
|
||||||
# are used; which they will be, but it's worth pointing out
|
# are used; which they will be, but it's worth pointing out
|
||||||
tmpfs_size="10M"
|
|
||||||
if [ -e /etc/udev/udev.conf ]; then
|
if [ -e /etc/udev/udev.conf ]; then
|
||||||
. /etc/udev/udev.conf
|
. /etc/udev/udev.conf
|
||||||
fi
|
fi
|
||||||
if ! mount -t devtmpfs -o mode=0755 devtmpfs /dev; then
|
if ! mount -t devtmpfs -o mode=0755 devtmpfs /dev; then
|
||||||
|
tmpfs_size="10M"
|
||||||
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
|
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
|
||||||
mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev
|
mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev
|
||||||
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
|
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
|
||||||
[ -e /dev/null ] || mknod /dev/null c 1 3
|
[ -e /dev/null ] || mknod /dev/null c 1 3
|
||||||
fi
|
fi
|
||||||
mkdir /dev/pts
|
|
||||||
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
|
|
||||||
> /dev/.initramfs-tools
|
|
||||||
mkdir /dev/.initramfs
|
mkdir /dev/.initramfs
|
||||||
|
|
||||||
# Export the dpkg architecture
|
|
||||||
export DPKG_ARCH=
|
|
||||||
. /conf/arch.conf
|
|
||||||
|
|
||||||
# Set modprobe env
|
# Set modprobe env
|
||||||
export MODPROBE_OPTIONS="-qb"
|
export MODPROBE_OPTIONS="-qb"
|
||||||
|
|
||||||
|
@ -202,36 +194,31 @@ fi
|
||||||
[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
|
[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
|
||||||
|
|
||||||
maybe_break top
|
maybe_break top
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-top"
|
log_begin_msg "Running /scripts/init-top"
|
||||||
run_scripts /scripts/init-top
|
run_scripts /scripts/init-top
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
maybe_break modules
|
maybe_break modules
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
|
log_begin_msg "Loading essential drivers"
|
||||||
load_modules
|
load_modules
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
maybe_break premount
|
maybe_break premount
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
|
log_begin_msg "Running /scripts/init-premount"
|
||||||
run_scripts /scripts/init-premount
|
run_scripts /scripts/init-premount
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
maybe_break mount
|
maybe_break mount
|
||||||
log_begin_msg "Mounting root file system"
|
log_begin_msg "Mounting root file system"
|
||||||
. /scripts/${BOOT}
|
. /scripts/${BOOT}
|
||||||
parse_numeric ${ROOT}
|
|
||||||
maybe_break mountroot
|
maybe_break mountroot
|
||||||
mountroot
|
mountroot
|
||||||
log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
maybe_break bottom
|
maybe_break bottom
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
|
log_begin_msg "Running /scripts/init-bottom"
|
||||||
run_scripts /scripts/init-bottom
|
run_scripts /scripts/init-bottom
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
# Move virtual filesystems over to the real filesystem
|
|
||||||
mount -n -o move /sys ${rootmnt}/sys
|
|
||||||
umount /proc
|
|
||||||
|
|
||||||
validate_init() {
|
validate_init() {
|
||||||
checktarget="${1}"
|
checktarget="${1}"
|
||||||
|
@ -286,7 +273,6 @@ maybe_break init
|
||||||
# (keep init, rootmnt)
|
# (keep init, rootmnt)
|
||||||
unset debug
|
unset debug
|
||||||
unset MODPROBE_OPTIONS
|
unset MODPROBE_OPTIONS
|
||||||
unset DPKG_ARCH
|
|
||||||
unset ROOTFLAGS
|
unset ROOTFLAGS
|
||||||
unset ROOTFSTYPE
|
unset ROOTFSTYPE
|
||||||
unset ROOTDELAY
|
unset ROOTDELAY
|
||||||
|
@ -304,6 +290,10 @@ unset readonly
|
||||||
unset resume
|
unset resume
|
||||||
unset resume_offset
|
unset resume_offset
|
||||||
|
|
||||||
|
# Umount sysfs and procfs, they will be mounted by init scripts.
|
||||||
|
umount /sys
|
||||||
|
umount /proc
|
||||||
|
|
||||||
# Chain to real filesystem
|
# Chain to real filesystem
|
||||||
exec switch_root ${rootmnt} ${init} "$@"
|
exec switch_root ${rootmnt} ${init} "$@"
|
||||||
panic "Could not execute run-init."
|
panic "Could not execute run-init."
|
||||||
|
|
|
@ -239,21 +239,20 @@ hidden_dep_add_modules
|
||||||
cp -p /usr/share/initramfs-tools/init ${DESTDIR}/init
|
cp -p /usr/share/initramfs-tools/init ${DESTDIR}/init
|
||||||
|
|
||||||
# add existant boot scripts
|
# add existant boot scripts
|
||||||
for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \
|
for b in $(cd /usr/share/initramfs-tools/scripts/ && find -L . \
|
||||||
-regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do
|
-regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do
|
||||||
[ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \
|
[ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \
|
||||||
|| mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")"
|
|| mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")"
|
||||||
cp -p "/usr/share/initramfs-tools/scripts/${b}" \
|
cp -p "/usr/share/initramfs-tools/scripts/${b}" \
|
||||||
"${DESTDIR}/scripts/$(dirname "${b}")/"
|
"${DESTDIR}/scripts/$(dirname "${b}")/"
|
||||||
done
|
done
|
||||||
for b in $(cd "${CONFDIR}/scripts" && find . \
|
for b in $(cd "${CONFDIR}/scripts" && find -L . \
|
||||||
-regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do
|
-regextype posix-extended -regex '.*/[[:alnum:]\._-]+$' -type f); do
|
||||||
[ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \
|
[ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \
|
||||||
|| mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")"
|
|| mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")"
|
||||||
cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")/"
|
cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")/"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf
|
|
||||||
cp -p "${CONFDIR}/initramfs.conf" ${DESTDIR}/conf
|
cp -p "${CONFDIR}/initramfs.conf" ${DESTDIR}/conf
|
||||||
for i in ${EXTRA_CONF}; do
|
for i in ${EXTRA_CONF}; do
|
||||||
if [ -e "${CONFDIR}/conf.d/${i}" ]; then
|
if [ -e "${CONFDIR}/conf.d/${i}" ]; then
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_log_msg()
|
_log_msg()
|
||||||
{
|
{
|
||||||
if [ "$quiet" = "y" ]; then return; fi
|
[ "$quiet" = "y" ] && return
|
||||||
printf "\033[1m"
|
printf "\033[1m"
|
||||||
printf "$@"
|
printf "$@"
|
||||||
printf "\033[m\n"
|
printf "\033[m\n"
|
||||||
|
@ -25,26 +25,16 @@ log_warning_msg()
|
||||||
|
|
||||||
log_begin_msg()
|
log_begin_msg()
|
||||||
{
|
{
|
||||||
if [ -x /sbin/usplash_write ]; then
|
|
||||||
/sbin/usplash_write "TEXT $@"
|
|
||||||
fi
|
|
||||||
_log_msg "$@ ..."
|
_log_msg "$@ ..."
|
||||||
}
|
}
|
||||||
|
|
||||||
log_end_msg()
|
log_end_msg()
|
||||||
{
|
{
|
||||||
if [ -x /sbin/usplash_write ]; then
|
|
||||||
/sbin/usplash_write "SUCCESS ok"
|
|
||||||
fi
|
|
||||||
:
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
panic()
|
panic()
|
||||||
{
|
{
|
||||||
if [ -x /sbin/usplash_write ]; then
|
|
||||||
/sbin/usplash_write "QUIT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v chvt >/dev/null 2>&1; then
|
if command -v chvt >/dev/null 2>&1; then
|
||||||
chvt 1
|
chvt 1
|
||||||
fi
|
fi
|
||||||
|
@ -271,33 +261,6 @@ load_modules()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# lilo compatibility
|
|
||||||
parse_numeric() {
|
|
||||||
case $1 in
|
|
||||||
"")
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
/*)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
[0-9]*:[0-9]*)
|
|
||||||
minor=${1#*:}
|
|
||||||
major=${1%:*}
|
|
||||||
;;
|
|
||||||
[A-Fa-f0-9]*)
|
|
||||||
value=$(( 0x${1} ))
|
|
||||||
minor=$(( ${value} % 256 ))
|
|
||||||
major=$(( ${value} / 256 ))
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
mknod -m 600 /dev/root b ${major} ${minor}
|
|
||||||
ROOT=/dev/root
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parameter: device node to check
|
# Parameter: device node to check
|
||||||
# Echos fstype to stdout
|
# Echos fstype to stdout
|
||||||
# Return value: indicates if an fs could be recognized
|
# Return value: indicates if an fs could be recognized
|
||||||
|
@ -306,13 +269,7 @@ get_fstype ()
|
||||||
local FS FSTYPE FSSIZE RET
|
local FS FSTYPE FSSIZE RET
|
||||||
FS="${1}"
|
FS="${1}"
|
||||||
|
|
||||||
# vol_id has a more complete list of file systems,
|
FSTYPE=$(blkid -o value -s TYPE "${FS}")
|
||||||
# but fstype is more robust
|
|
||||||
if command -v blkid >/dev/null 2>&1 ; then
|
|
||||||
FSTYPE=$(blkid -o value -s TYPE "${FS}")
|
|
||||||
elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then
|
|
||||||
FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null)
|
|
||||||
fi
|
|
||||||
RET=$?
|
RET=$?
|
||||||
|
|
||||||
if [ -z "${FSTYPE}" ]; then
|
if [ -z "${FSTYPE}" ]; then
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
pre_mountroot()
|
pre_mountroot()
|
||||||
{
|
{
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
|
log_begin_msg "Running /scripts/local-top"
|
||||||
run_scripts /scripts/local-top
|
run_scripts /scripts/local-top
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
wait_for_udev 10
|
wait_for_udev 10
|
||||||
|
|
||||||
|
@ -29,10 +29,6 @@ pre_mountroot()
|
||||||
# Default delay is 30s
|
# Default delay is 30s
|
||||||
slumber=${ROOTDELAY:-30}
|
slumber=${ROOTDELAY:-30}
|
||||||
|
|
||||||
if [ -x /sbin/usplash_write ]; then
|
|
||||||
/sbin/usplash_write "TIMEOUT ${slumber}" || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
slumber=$(( ${slumber} * 10 ))
|
slumber=$(( ${slumber} * 10 ))
|
||||||
while [ ! -e "${ROOT}" ] \
|
while [ ! -e "${ROOT}" ] \
|
||||||
|| ! $(get_fstype "${ROOT}" >/dev/null); do
|
|| ! $(get_fstype "${ROOT}" >/dev/null); do
|
||||||
|
@ -46,9 +42,6 @@ pre_mountroot()
|
||||||
else
|
else
|
||||||
log_end_msg 1 || true
|
log_end_msg 1 || true
|
||||||
fi
|
fi
|
||||||
if [ -x /sbin/usplash_write ]; then
|
|
||||||
/sbin/usplash_write "TIMEOUT 15" || true
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We've given up, but we'll let the user fix matters if they can
|
# We've given up, but we'll let the user fix matters if they can
|
||||||
|
@ -92,9 +85,9 @@ mountroot()
|
||||||
FSTYPE=${ROOTFSTYPE}
|
FSTYPE=${ROOTFSTYPE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
|
log_begin_msg "Running /scripts/local-premount"
|
||||||
run_scripts /scripts/local-premount
|
run_scripts /scripts/local-premount
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
|
|
||||||
if [ "${readonly}" = "y" ]; then
|
if [ "${readonly}" = "y" ]; then
|
||||||
roflag=-r
|
roflag=-r
|
||||||
|
@ -113,7 +106,7 @@ mountroot()
|
||||||
mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
|
mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
|
log_begin_msg "Running /scripts/local-bottom"
|
||||||
run_scripts /scripts/local-bottom
|
run_scripts /scripts/local-bottom
|
||||||
[ "$quiet" != "y" ] && log_end_msg
|
log_end_msg
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,8 +341,6 @@ update()
|
||||||
|
|
||||||
generate_initramfs
|
generate_initramfs
|
||||||
|
|
||||||
[ -n "${dogrub}" ] && run_bootloader
|
|
||||||
|
|
||||||
backup_booted_initramfs
|
backup_booted_initramfs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +369,8 @@ delete()
|
||||||
delete_sha1
|
delete_sha1
|
||||||
|
|
||||||
rm -f "${initramfs}" "${initramfs}.bak"
|
rm -f "${initramfs}" "${initramfs}.bak"
|
||||||
|
|
||||||
|
[ -n "${dogrub}" ] && run_bootloader
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for update mode on existing and modified initramfs
|
# Check for update mode on existing and modified initramfs
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'initramfs-tools'
|
# Template file for 'initramfs-tools'
|
||||||
pkgname=initramfs-tools
|
pkgname=initramfs-tools
|
||||||
_localver=0.99.8.4 # This is the XBPS version
|
_localver=0.99.9 # This is the XBPS version
|
||||||
_distver=0.98.8 # This should match debian version
|
_distver=0.98.8 # This should match debian version
|
||||||
version=${_localver}.${_distver}
|
version=${_localver}.${_distver}
|
||||||
build_style=custom-install
|
build_style=custom-install
|
||||||
|
|
Loading…
Add table
Reference in a new issue