/etc/init.d/early-readahead is in readahead-fedora 2:1.5.6-5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/bin/sh
set -e
### BEGIN INIT INFO
# Provides: early-readahead
# Required-Start:
# Required-Stop:
# Should-Start: mountkernfs
# X-Start-Before: udev mountdevsubfs
# Default-Start: S
# Default-Stop:
# Short-Description: init script for readahead-fedora
### END INIT INFO
READAHEAD_CMD="/sbin/readahead"
READAHEAD_COLLECT_CMD="/sbin/readahead-collector"
[ -x $READAHEAD_CMD ] || exit 0
. /lib/lsb/init-functions
RUN_IN_BACKGROUND=
IO_PRIORITY=
MAX_FILE_SIZE=
READAHEAD_BASE=/etc/readahead.d
[ ! -f /etc/default/readahead-fedora ] || . /etc/default/readahead-fedora
[ "${READAHEAD:-yes}" = yes ] || exit 0
# Exit if the collector is already running
pidof readahead-collector > /dev/null && exit
LTYPE=early
if [ "$MAX_FILE_SIZE" ]; then
MAX_FILE_SIZE="-m $MAX_FILE_SIZE"
fi
NICE_COLLECTOR="-N ${NICE_COLLECTOR:-5}"
get_lists() {
if [ -f "$READAHEAD_BASE/$LTYPE.sorted" ]; then
printf -- "--dont-sort %s" "$READAHEAD_BASE/$LTYPE.sorted"
elif [ -s "$READAHEAD_BASE/custom.$LTYPE" ]; then
printf "%s" "$READAHEAD_BASE/custom.$LTYPE"
else
ls "$READAHEAD_BASE"/*."$LTYPE" 2>/dev/null || echo /dev/null
fi
}
SHOULD_COLLECT=false
if test -f /.readahead_collect || grep -qw profile /proc/cmdline; then
SHOULD_COLLECT=true
fi
case "$1" in
start|restart|force-reload)
[ -f /run/readahead ] || {
[ "$LTYPE" = early ] || {
log_warning_msg "Early readahead flag not found"
}
echo "
# This file was automatically generated by $0
# The following lines should indicate whether the /usr and /var file systems
# were available during the early boot process. Note that these flags do not
# directly modify the behaviour of the init scripts; they are used by the
# script that sorts the files lists
MOUNTED_USR=$([ -d /usr/bin ] && echo true || echo false)
MOUNTED_VAR=$([ -d /var/lib ] && echo true || echo false)
" > /run/readahead
}
if [ "$RUN_IN_BACKGROUND" = yes ] && ! $SHOULD_COLLECT; then
log_begin_msg "Reading $LTYPE boot files (in background)..."
if /sbin/start-stop-daemon --background --start --quiet \
-I ${IO_PRIORITY:-idle} --exec $READAHEAD_CMD \
-- $MAX_FILE_SIZE $(get_lists) > /dev/null; then
log_end_msg 0
else
log_end_msg $?
fi
else
log_begin_msg "Reading $LTYPE boot files..."
if /sbin/start-stop-daemon --start --quiet \
-I ${IO_PRIORITY:-real-time} --exec $READAHEAD_CMD \
-- $MAX_FILE_SIZE $(get_lists) > /dev/null; then
log_end_msg 0
else
log_end_msg $?
fi
fi
if $SHOULD_COLLECT; then
if [ -d /proc/1 ] && [ ! -e /proc/1/loginuid ]; then
log_failure_msg "Profiling on a kernel without audit subsystem..."
exit 1
fi
log_begin_msg "Preparing to profile boot sequence..."
if /sbin/start-stop-daemon --start --quiet $NICE_COLLECTOR \
--exec $READAHEAD_COLLECT_CMD; then
log_end_msg 0
else
log_end_msg $?
fi
if [ -f /etc/init.d/auditd ]; then
log_warning_msg "Auditd installed, read readahead's README"
fi
fi
;;
stop)
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}"
exit 1
;;
esac
|