updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / readahead-fedora / readahead
blob1a46daa9cf64927a4b10906eb59745bddf67c245
2 # File for starting readahead and readahead-collector
5 . /etc/readahead.conf
7 base_check_mem=$(grep "MemTotal" /proc/meminfo | sed 's/[ kB]//g' | cut -f2 -d":")
8 base_mem_checked=$(($base_check_mem/1024))
11 readahead-early() {
12   if [ "$base_mem_checked" -lt "1000" ]; then
13         printhl "Deactivating Readahead - Not enough memory"
14   elif [ -e /.readahead ]; then
15     stat_busy "Starting readahead-collector - collecting data"
16       /sbin/readahead-collector
17       /usr/bin/kill-readahead &
18     stat_done
19   else
20     stat_busy "Starting readahead - early read"
21       /sbin/readahead  /etc/readahead.d/*.early
22     stat_done
23   fi
27 readahead-dbus() {
28   #Fix some Networkmanager/... problems, if inittab is konfigured for readahead:
29   if [ -e /etc/rc.d/dbus ]; then
30       /etc/rc.d/dbus start
31   fi
35 readahead-later() {
36   if [ "$base_mem_checked" -lt "1000" ]; then
37         printhl "Deactivating Readahead - Not enough memory"
38   elif [ -e /.readahead ]; then
39     stat_busy "readahead - waiting $TIMEOUT_SWITCH_TO_LATER seconds to switch to later"
40       # Wait until X and Login Manager started up
41       sleep $TIMEOUT_SWITCH_TO_LATER 
42       touch /.switch-collector-to-later
43       rm /.readahead
44     stat_done
45   else
46     stat_busy "Starting readahead - later read"
47       # Give Xorg a bit time
48       sleep 1.6
49       /sbin/readahead  /etc/readahead.d/*.later
50     stat_done
51   fi
54 add_hook sysinit_start readahead-early
55 add_hook sysinit_end readahead-dbus
56 add_hook multi_start readahead-later