Advertisement
Guest User

Untitled

a guest
Feb 28th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. description "late rcS actions"
  2.  
  3. start on started hal
  4. stop on stopping hal
  5.  
  6. console none
  7.  
  8. script
  9. #mount /home; fix ext3 and retry mounting if 1st attempt fails
  10. mount_home ()
  11. {
  12. /bin/mount /home && grep -q "/home ext3 rw" /proc/mounts
  13. if [ $? -eq 0 ]
  14. then
  15. return 0
  16. else
  17. grep -q "/home ext3 ro" /proc/mounts
  18. if [ $? -eq 0 ]
  19. then
  20. umount /home
  21. fi
  22. HOME_DEV=`grep "/home ext3" /etc/fstab | cut -d' ' -f1`
  23. fsck.ext3 -y $HOME_DEV >> /var/lib/fsck_ext3_home.log 2>&1
  24. sync
  25. /bin/mount /home && grep -q "/home ext3 rw" /proc/mounts
  26. return $?
  27. fi
  28. }
  29.  
  30. ACT_DEAD=0
  31. HOME_MOUNTED=0
  32.  
  33. #check act_dead
  34. if [ -e /tmp/ACT_DEAD ]; then
  35. ACT_DEAD=1
  36. fi
  37.  
  38. # Generate fstab and mount /home
  39. . /etc/default/mount-opts
  40.  
  41. fstab=/etc/fstab
  42. tmp_fstab=/tmp/fstab
  43.  
  44. sfdisk -l /dev/mmcblk0 | /bin/busybox awk \
  45. -v home_opts="$home_opts" -v fat_opts="$fat_opts" \
  46. -f /usr/lib/genfstab.awk > $tmp_fstab
  47.  
  48. cmp -s $tmp_fstab $fstab || cp $tmp_fstab $fstab
  49. rm -f $tmp_fstab
  50.  
  51. if [ $ACT_DEAD -eq 0 ]; then
  52. /sbin/swapon -a || echo "Failed to enable paging partition."
  53. # Setup lowmem module
  54. echo 32768 > /proc/sys/vm/lowmem_deny_watermark_pages || true
  55. echo 98304 > /proc/sys/vm/lowmem_notify_high_pages || true
  56. echo 131072 > /proc/sys/vm/lowmem_notify_low_pages || true
  57. echo 1024 > /proc/sys/vm/lowmem_nr_decay_pages || true
  58. # Exclude some UIDs from memory allocation denial.
  59. # 30000 is messagebus, 30001 could be used by Matchbox
  60. echo "30000 30001 30002 30003" > /proc/sys/vm/lowmem_allowed_uids || true
  61. fi
  62.  
  63. mount_home && HOME_MOUNTED=1
  64.  
  65. # If failed to mount /home and system has been already optified - reboot
  66. if [ $HOME_MOUNTED -eq 0 ]
  67. then
  68. if [ -e /var/lib/maemo-optify-firstboot-do-not-clean-home-opt ]; then
  69. telinit 6
  70. fi
  71. else
  72. [ ! -d /home/opt ] && mkdir /home/opt
  73. [ ! -d /opt ] && mkdir /opt
  74. fi
  75.  
  76. if [ $ACT_DEAD -eq 0 ]
  77. then
  78. if [ $HOME_MOUNTED -eq 1 ]
  79. then
  80. if [ -x /usr/sbin/maemo-optify-firstboot.sh ]; then
  81. . /usr/sbin/maemo-optify-firstboot.sh
  82. fi
  83. fi
  84. fi
  85.  
  86. /bin/mount /opt || echo "Failed to mount(bind) /opt."
  87.  
  88. if [ $ACT_DEAD -eq 0 ]
  89. then
  90. if [ $HOME_MOUNTED -eq 1 ]
  91. then
  92. if [ -x /usr/sbin/maemo-optify-auto-opt.sh ]; then
  93. . /usr/sbin/maemo-optify-auto-opt.sh
  94. fi
  95. fi
  96.  
  97. if [ -d /home/preinstalled -a -d /home/user ]
  98. then
  99. rm -rf /home/user
  100. fi
  101.  
  102. if [ ! -d /home/user ]
  103. then
  104. if [ -d /home/preinstalled ]
  105. then
  106. mv /home/preinstalled /home/user
  107. else
  108. mkdir /home/user
  109. fi
  110. cd /etc/skel
  111. cp -a . /home/user
  112. chown -R user:users /home/user
  113. sync
  114. fi
  115. fi
  116.  
  117. if [ ! -d /home/user ]
  118. then
  119. mkdir /home/user
  120. chown user:users /home/user
  121. sync
  122. fi
  123.  
  124. # We can safely continue booting now.
  125. initctl emit MOUNTS_OK
  126.  
  127. # Adjust flushing of memory card buffers
  128. echo 40 > /proc/sys/vm/dirty_ratio
  129. echo 10 > /proc/sys/vm/dirty_background_ratio
  130.  
  131. # Initialize PRNG pool with the HW RNG. Slow, but that's ok.
  132. URANDOM_POOLSZ=512
  133. if [ -e /dev/hwrng ]; then
  134. echo "Seeding entropy pool"
  135. dd if=/dev/hwrng of=/dev/urandom bs=$URANDOM_POOLSZ count=1
  136. fi
  137.  
  138. # Data for the panic info driver
  139. (
  140. mount -t debugfs nodev /sys/kernel/debug
  141. modprobe panic_info_buff || true
  142. OSSO_VERSION="$(osso-product-info 2>/dev/null || true)"
  143. CSSU_VERSION="CSSU_VERSION=$(dpkg-query -W -f \${Version} mp-fremantle-community-pr 2>/dev/null || echo '<unknown>')"
  144. KERNEL_VERSION="KERNEL_VERSION=$(uname -a 2>/dev/null || echo '<unknown>')"
  145. sleep 1
  146. ( echo $OSSO_VERSION; echo $CSSU_VERSION; echo $KERNEL_VERSION ) > /sys/kernel/debug/panic_info_buff || true
  147. ) &
  148. end script
  149.  
  150. normal exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement