3 # Prelink wrapper script
4 # Author: Andres Roldan <aroldan@debian.org>
6 # Needed to avoid annoying message in coreutils >= 6.0
9 # Recommended minimun free space, 50MB
12 will_prelink="$(for i in $(awk '! /#/ && ! /^-b/ && NF >= 1 {print $NF}' < /etc/prelink.conf); do test -e "$i" && echo "$i"; done)"
15 df -P $will_prelink | sort | uniq | {
17 while read part x x size x mount_point; do
18 if $(echo $part | grep -qv "^/"); then
22 if [ $size -le "$min_size" ]; then
23 echo "Partition $part ($mount_point) has only $size KB free." >&2
28 exit $have_warn # Exit from piped subshell
31 if [ "$?" -eq "1" ]; then
36 echo "It's recommended to have at least $min_size KB of disk space."
37 echo "Prelink would _really_ damage the ELF files on those partitions."
38 read -t 20 -p "Do you really want to run prelink? (yes/No): " answer
41 if [ "$answer" = "yes" ]; then
42 echo "You were warned. Running prelink..."
43 exec /usr/sbin/prelink.bin "$@"
46 echo "Aborting prelink."
51 exec /usr/sbin/prelink.bin "$@"