Magellan Linux

Annotation of /trunk/prelink/prelink.cron

Parent Directory Parent Directory | Revision Log Revision Log


Revision 87 - (hide annotations) (download)
Sun Dec 24 14:02:24 2006 UTC (17 years, 4 months ago) by niro
File size: 2270 byte(s)
new files

1 niro 87 #!/bin/sh
2     # $Header: /root/magellan-cvs/src/prelink/prelink.cron,v 1.1 2006-12-24 14:02:24 niro Exp $
3    
4     . /etc/conf.d/prelink
5    
6     renice +19 -p $$ >/dev/null 2>&1
7    
8     if [ "$PRELINKING" != yes ]; then
9     if [ -f /etc/prelink.cache ]; then
10     echo /usr/sbin/prelink -uav > /var/log/prelink/prelink.log
11     /usr/sbin/prelink -uav >> /var/log/prelink/prelink.log 2>&1 \
12     || echo Prelink failed with return value $? >> /var/log/prelink/prelink.log
13     rm -f /etc/prelink.cache
14     # Restart init if needed
15     [ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
16     fi
17     exit 0
18     fi
19    
20     if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \
21     || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then
22     # If cache does not exist or is from older prelink versions or
23     # if we were asked to explicitely, force full prelinking
24     rm -f /etc/prelink.cache /var/lib/misc/prelink.force
25     PRELINK_OPTS="$PRELINK_OPTS -f"
26     date > /var/lib/misc/prelink.full
27     cp -a /var/lib/misc/prelink.{full,quick}
28     elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
29     -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \
30     = /var/lib/misc/prelink.full ]; then
31     # If no more than PRELINK_NONRPM_CHECK_INTERVAL days elapsed from last prelink
32     # (be it full or quick) and no packages have been upgraded via rpm since then,
33     # don't do anything.
34     [ "`find /var/lib/misc/prelink.quick -mtime -${PRELINK_NONRPM_CHECK_INTERVAL:-7} 2>/dev/null`" \
35     -a -f /var/lib/rpm/Packages \
36     -a /var/lib/rpm/Packages -ot /var/lib/misc/prelink.quick ] && exit 0
37     date > /var/lib/misc/prelink.quick
38     # If prelink without -q has been run in the last
39     # PRELINK_FULL_TIME_INTERVAL days, just use quick mode
40     PRELINK_OPTS="$PRELINK_OPTS -q"
41     else
42     date > /var/lib/misc/prelink.full
43     cp -a /var/lib/misc/prelink.{full,quick}
44     fi
45    
46     echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink/prelink.log
47     /usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink/prelink.log 2>&1 \
48     || echo Prelink failed with return value $? >> /var/log/prelink/prelink.log
49     # Restart init if needed
50     [ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
51    
52     exit 0