This file is indexed.

postinst is in readahead-fedora 2:1.5.6-5.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/bin/sh

set -e

if [ "$1" = triggered ]; then
    touch /.readahead_collect
    exit 0
fi

# Automatically added by dh_installinit
if [ -x "/etc/init.d/early-readahead" ]; then
	if [ ! -e "/etc/init/early-readahead.conf" ]; then
		update-rc.d early-readahead start 03 S . >/dev/null
	fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/later-readahead" ]; then
	if [ ! -e "/etc/init/later-readahead.conf" ]; then
		update-rc.d later-readahead start 50 S . >/dev/null
	fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/stop-readahead-fedora" ]; then
	if [ ! -e "/etc/init/stop-readahead-fedora.conf" ]; then
		update-rc.d stop-readahead-fedora start 99 2 3 4 5 . stop 20 0 1 6 . >/dev/null
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/cron.daily/readahead 2:1.5.6-1 -- "$@"
# End automatically added section


# The rest of the code is only meant to be run the first time the
# package is installed
if [ "$1" != configure ] || [ "$2" ]; then
    exit 0
fi

# Trigger the collector on next boot
touch /.readahead_collect

# Bootstrap the files lists.
# It is intended to help reduce boot time even on
# the very next boot after the package is installed.

tmpdir="$(mktemp -d)"

# takes the name of a binary and writes to the misc-libs
# the libraries it uses
get_libs() {
    ldd "$1" 2>/dev/null | sed -nr 's,^[^/]+((/usr)?/lib/[^ ]+).+$,\1,;T;p' \
	    >> $tmpdir/${2:-misc-libs}
}

# is a kernel installed at all?
if [ -d /lib/modules ]; then
    kern="$(uname -r)"
    # try to find the kernel modules dir
    [ -d "/lib/modules/$kern" ] || {
	# the running kernel is not the one on the fs
	# try to find one:
	kern="$(find /lib/modules -mindepth 1 -maxdepth 1 -type d)"
	# if more than one was found, the next test will fail
    }
    if [ -d "/lib/modules/$kern/" ]; then
	# try to determine what modules are going to be loaded:
	for module in $(cut -d\  -f1 /proc/modules | tr "_" "-"); do
	    find /lib/modules/$kern/ -name "${module}.ko" -type f >> $tmpdir/mods
	done
	for t in alias dep; do
	    f="/lib/modules/$kern/modules.$t.bin"
	    [ -f "$f" ] || continue
	    echo "$f" >> $tmpdir/mods.bin
	done
    fi
fi

if [ -d /etc/rcS.d ] && [ -d /etc/rc2.d ]; then
    # init scripts, when using sysvrc:
    for rc in S 2; do
	find /etc/rc${rc}.d -maxdepth 1 -type l -name 'S*' | xargs -r -n1 readlink -m >> $tmpdir/rc${rc}
    done
    cat $tmpdir/rc? | sh -c 'while read init; do [ -f "$init" ] && echo "$init"; done' | sort -u > $tmpdir/rc
    rm $tmpdir/rc?
else
    touch $tmpdir/rc
fi

# default files
find /etc/default -type f > $tmpdir/def

if [ -d /etc/modprobe.d ]; then
    # modprobe
    find /etc/modprobe.d -name '*.conf' -type f > $tmpdir/modprobe
fi

if [ -d /etc/udev/ ]; then
    # udev rules
    find /etc/udev/rules.d/ /lib/udev/rules.d/ -type f > $tmpdir/udev
    find /etc/udev/ -maxdepth 1 -type f -name '*.conf' -o -name '*.rules' >> $tmpdir/udev
    # even more udev stuff
    find /lib/udev -maxdepth 1 -type f -perm /a+x >> $tmpdir/udev
fi

# init files
find /lib/init/ -maxdepth 1 -type f > $tmpdir/init

if [ -d /etc/acpi/events ]; then
    # not all the events are used, but the files are usually small enough
    # that it won't matter
    find /etc/acpi/events/ -type f > $tmpdir/acpi
fi

if [ -d /usr/share/dbus-1/services ] && [ -d /usr/share/dbus-1/system-services ]; then
    # dbus services
    find /usr/share/dbus-1/services/ /usr/share/dbus-1/system-services/ -type f > $tmpdir/dbus
fi

if [ -d /etc/dbus-1/system.d ]; then
    # other dbus stuff
    find /etc/dbus-1/system.d/ -type f >> $tmpdir/dbus
fi

if [ -d /etc/cron.d ]; then
    # cron.d files
    find /etc/cron.d ! -name '.*' -type f > $tmpdir/cron
fi

if [ -d /etc/network ]; then
    # network config files
    find /etc/network/ -type f > $tmpdir/net
fi

if [ -d /etc/exim4/ ]; then
    #exim4 config
    find /etc/exim4/conf.d/ -type f > $tmpdir/exim4
fi

# some config files
for cfg in hostname sysctl.conf group passwd shadow nsswitch.conf fstab \
inetd.conf crontab anacrontab services issue host.conf fonts/fonts.conf \
modules localtime ld.so.cache motd.tail resolv.conf hosts X11/xorg.conf; do
    [ -f "/etc/$cfg" ] && echo "/etc/$cfg" >> $tmpdir/misc-etc
done

if [ -f /proc/mounts ]; then
    # mount.* and fsck.* commands
    sed -nr 's,^([^ ]+ ){2}([^ ]+).+$,\2,;T;h;s/^/mount./;p;g;s/^/fsck./;p' \
	/proc/mounts | sort -u |
    while read cmd; do
	[ -x "/sbin/$cmd" ] || continue
	echo "/sbin/$cmd" >> $tmpdir/fs-bin
    done
fi

# some binaries
# TODO: automate some of the gathering of these files
for bin in dash bash Xorg udevadm modprobe cut tail xargs find mv ln \
basename grep egrep rm mkdir mknod sleep which dd sed gzip ls cat \
rmdir logsave uname start-stop-daemon mount umount swapon touch tput \
mountpoint readlink ifup chown chmod chgrp loadkeys gunzip run-parts \
lsmod df tempfile date env stat head dirname tr id sysctl X hostname \
getopt savelog ps fsck getty dmesg stty xkbcomp locale gawk mawk \
ifconfig setupcon setterm dumpkeys; do
    for p in /bin /sbin /usr/bin /usr/sbin; do
	[ -x "$p/$bin" ] && {
	    echo "$p/$bin" >> $tmpdir/misc-bin
	    get_libs "$p/$bin"
	    continue 2
	}
    done
done

# binaries that match the name of the init scripts
for init in $(cat $tmpdir/rc); do
    init="${init#/etc/init.d/}"
    for p in /bin /sbin /usr/bin /usr/sbin; do
	for suffix in '' d; do
	    bin="$p/${init}${suffix}"
	    [ -x "$bin" ] || continue
	    echo "$bin" >> $tmpdir/init-misc
	    get_libs "$bin"
	done
    done
done

# config files that match the name of the init scripts
for init in $(cat $tmpdir/rc); do
    init="${init#/etc/init.d/}"
    for suffix in '' d .conf d.conf; do
	f="/etc/${init}${suffix}"
	[ -f "$f" ] && echo "$f" >> $tmpdir/init-misc
    done
done

# get the libs used by the libs
for lib in $(sort -u $tmpdir/misc-libs); do
    get_libs "$lib" misc-libs.new
done

sort -u $tmpdir/misc-libs $tmpdir/misc-libs.new | xargs -n1 readlink -f > $tmpdir/misc-libs.unique
rm $tmpdir/misc-libs.new $tmpdir/misc-libs

tmpf_early=$(mktemp)
tmpf_later=$(mktemp)

cat $tmpdir/* > $tmpf_early

# simple way to check if /usr is in a separate partition/device/etc
if [ "$(stat -c "%d" /)" != "$(stat -c "%d" /usr/bin)" ]; then
    sed -n '\,^/usr,p' $tmpf_early > $tmpf_later
    sed -i '\,^/usr,d' $tmpf_early
fi

rm -rf $tmpdir

# install the files lists
[ -f /etc/readahead.d/custom.early ] && \
rm -f $tmpf_early || \
mv $tmpf_early /etc/readahead.d/custom.early
[ -f /etc/readahead.d/custom.later ] && \
rm -f $tmpf_later || \
mv $tmpf_later /etc/readahead.d/custom.later

# now sort them
exec /usr/share/readahead-fedora/build-lists