delayedrun 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/bin/sh
  2. #(c) copyright 2007 Barry Kauler
  3. #2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
  4. #launched from ~/.xinitrc, so X is running.
  5. #note, see also /usr/sbin/savepuppyd, launched from /etc/rc.d/rc.local0.
  6. #v3.91 BK oct,nov 2007, upated for Dingo.
  7. #v3.94 BK 15 dec 2007, updated.
  8. #v4.01 BK 19may2008: don't think loading usb-storage reqd here anymore.
  9. #v4.01 BK 19may2008: note the new pup_eventd also launched from .xinitrc.
  10. #w007 path fix for Xorg.
  11. #w481 warning if modules cannot be loaded.
  12. #100404 fix load applets for fbpanel. 100413 think needs some 'sleep 0.1'
  13. #100504 background color for retrovol.
  14. #100511 for ram-challenged pc, better to display welcome1stboot.png.
  15. #100513 jwm tray now uses freememapplet_tray and blinky_tray. NOTE: future, move these to /root/Startup.
  16. #100517 freememapplet_tray moved to /root/Startup.
  17. #100522 'surfer' is a simple viewer (uses libgtkhtml).
  18. #100608 if yaf-splash symlink to gtkdialog-splash, use '-fontsize large' parameter.
  19. #100821 01micko: fixes for background color in tray apps, also launch first-run.sh.
  20. #100917 have removed -font parameter from yaf-splash (see /usr/share/doc/yaf-splash-new.htm).
  21. #101004 jemimah has disabled tray applet in retrovol, now using obmixer_tray.
  22. #101007 sound alias modprobe info may have moved.
  23. #101009 problem as tray applets only got launched after welcome msg exited.
  24. #101017 Alsa modprobe file now /etc/modprobe.d/alsa.conf.
  25. #101019 welcome1stboot is now a gtkdialog app...
  26. #101112 alsa info in two different places.
  27. #101120, 101121 fix sound test, rewritten /sbin/pup_event_backend_modprobe.
  28. #101210 pup_event_alsa_cnt* are now in /tmp/pup_event_backend.
  29. #110113 test /dev/mixer for sound ready, see /etc/init.d/10alsa.
  30. #20110328 if mouse not working, popup dialog.
  31. #110412 welcome1stboot now written in BaCon, in /usr/sbin.
  32. #110516 only popup dlg for mouse not working, if DISTRO_XORG_AUTO='yes' (in /etc/DISTRO_SPECS)
  33. #110807 take out pngoverlay code, doing it in woof 3builddistro.
  34. #110925 fix, improvements, for flash player download.
  35. #111010 create /tmp/delayedrun_finished_flag to flag when this script exited.
  36. #111019 DISTRO_XORG_AUTO==yes and PUPMODE==5, run 'quickcountry'. mouse-checking moved to 'mousecheck'.
  37. #111026 decided not to run 'mousecheck' from here. instead, a button in 'quicksetup'.
  38. #111110 ping 64.233.169.103 address no longer responding. 01micko: use 8.8.8.8
  39. #111112 delay a bit more before flashplayer popup.
  40. #111113 fix for download url for flash player. 111117 fix.
  41. #120110 added sudo line. see also /etc/sudoers -- set delayedrun does not require password, probably a security hole, need to look at it again later.
  42. #120201 rodin.s: internationalized.
  43. #120227 call external /usr/sbin/check_internet
  44. #120329 shinobar: download tweaks.
  45. #120401 added warning flash player may not work.
  46. #120403 removed adobe flash download. no, have changed to older version.
  47. #120620 removed adobe flash download. want quicksetup/welcome1stboot for any PUPMODE at first startup.
  48. #120708 run 'quickarm' instead of 'quicksetup' on arm boards. see 3builddistro, /usr/sbin/quicksetup.
  49. #120714 revert 120708.
  50. #120718 modify initial sleep.
  51. #120823 rerwin: skip quicksetup if /etc/personal_settings_popup_disabled file created by remasterpup2 (modified by rerwin).
  52. #120823 rerwin: use distro-specific delayedrun if available.
  53. #120830 quicksetup restarts X, welcome1stboot did not run.
  54. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #120110
  55. export TEXTDOMAIN=delayedrun
  56. export OUTPUT_CHARSET=UTF-8
  57. . gettext.sh
  58. #variables created at bootup by 'init' in initramfs...
  59. . /etc/rc.d/PUPSTATE
  60. . /etc/DISTRO_SPECS
  61. [ -x ${0}-${DISTRO_FILE_PREFIX} ] && exec ${0}-${DISTRO_FILE_PREFIX} #120823 rerwin: use distro-specific delayedrun if available.
  62. . /etc/rc.d/BOOTCONSTRAINED #120708
  63. sleep 1 #let the dust settle first. 120718 reduce 2 to 1
  64. #120718 slow cpus need more delay....
  65. DELAYFACTOR=0
  66. CPUMHZ=`grep -m 1 -i '^cpu MHz' /proc/cpuinfo | tr -d ' ' | cut -f 2 -d ':' | cut -f 1 -d '.'` #my laptop: 933.000
  67. if [ $CPUMHZ ];then
  68. [ $CPUMHZ -gt 100 ] && DELAYFACTOR=`expr 900 \/ $CPUMHZ`
  69. else #120718 raspi: 697.95 my laptop: 4789.47
  70. BOGOMIPS=`grep -m 1 -i '^bogomips' /proc/cpuinfo | tr -d ' ' | cut -f 2 -d ':' | cut -f 1 -d '.'`
  71. [ $BOGOMIPS ] && [ $BOGOMIPS -gt 200 ] && DELAYFACTOR=`expr 800 \/ $BOGOMIPS`
  72. fi
  73. [ $DELAYFACTOR -gt 0 ] && sleep $DELAYFACTOR
  74. # cedar hack 120210 (JustGreg) #moved down 120226
  75. [ -x /usr/sbin/zcedar.sh ] && /usr/sbin/zcedar.sh
  76. #offer to popup a getting-started html page...
  77. #120620 change logic so get these when first boot full install...
  78. #the test for /etc/videomode is for when Xvesa has finished choosing a resolution...
  79. if [ "`readlink /usr/bin/X`" = "Xorg" -o -e /etc/videomode ];then #w007
  80. if [ ! -f /var/local/delayedrun_firstboot_flag ];then
  81. if [ ! -f /tmp/delayedrun_firstboot_flag ];then #120830 if quicksetup restarts X, reenter here jumps this...
  82. touch /tmp/delayedrun_firstboot_flag
  83. if [ "$DISTRO_XORG_AUTO" = "yes" ];then #see /etc/DISTRO_SPECS 111019
  84. #quick setup window for country and language and X resolution...
  85. QUICKSETUP="quicksetup"
  86. [ "`readlink /usr/bin/X | grep 'Xorg'`" = "" ] && QUICKSETUP="quickcountry" #probably Xvesa, offer country settings only.
  87. [ ! -f /etc/personal_settings_popup_disabled ] && ${QUICKSETUP} #120823 rerwin: skip quicksetup if /etc/personal_settings_popup_disabled file created by remasterpup2 (modified by rerwin).
  88. fi
  89. fi
  90. if [ -c /dev/mixer ];then #110113 test for sound ready, see /etc/init.d/10alsa.
  91. aplay /usr/share/audio/2barks.au &
  92. #wavplay /usr/share/audio/2barks.wav &
  93. RETAPLAY=$?
  94. PIDAPLAY=$!
  95. fi
  96. #desklayout #new gui for icon layout for slacko 121015 #fail
  97. #welcome1stboot.sh & #110412 now in /usr/sbin #121002 for slacko
  98. welcome1stboot #L18L 140206
  99. sleep 3 #101009
  100. #[ $RETAPLAY -eq 0 ] && kill $PIDAPLAY 2> /dev/null
  101. #[ "`pidof aplay`" != "" ] && killall aplay
  102. touch /var/local/delayedrun_firstboot_flag
  103. fi
  104. fi
  105. #v2.16 popup the BootManager if an extra SFS file added (once only)...
  106. if [ ! $PUPMODE -eq 5 ];then
  107. if [ -d /initrd ];then #test it isn't full hd installation.
  108. . /etc/rc.d/BOOTCONFIG
  109. #if EXTRASFSLIST variable not there, then auto-load of SFS files (meaning, user
  110. # has probably never run the BootManager)...
  111. if [ "`grep '^EXTRASFSLIST' /etc/rc.d/BOOTCONFIG`" = "" ];then
  112. #see /initrd/init which writes these to BOOTCONFIG..
  113. if [ "$LASTUNIONRECORD" != "" ];then
  114. if [ "$LASTUNIONRECORD" != "$PREVUNIONRECORD" ];then
  115. bootmanager extrasfs quiet
  116. fi
  117. fi
  118. fi
  119. fi
  120. fi
  121. #101121 handle multiple sound cards...
  122. if [ $PUPMODE -eq 5 ];then
  123. if [ -f /tmp/rc_d_rc_services_alsa_ok ];then #see /etc/rc.d/rc.services
  124. if [ `find /tmp/pup_event_backend -maxdepth 1 -type f -name 'pup_event_alsa_cnt*' | wc -l` -gt 1 ];then
  125. #run kirk's Multiple Sound Card Wizard...
  126. Multiple-Sound-Card-Wizard
  127. fi
  128. fi
  129. fi
  130. # give xchat unique username based on distro
  131. if [ $PUPMODE -eq 5 ];then
  132. if [ -f $HOME/.xchat2/xchat.conf ];then
  133. count=`grep '^irc_nick[0-9]' $HOME/.xchat2/xchat.conf|wc -l`
  134. x=$RANDOM
  135. for (( i=1;i <= $count;i++ ))
  136. do
  137. sed -i "s|irc_nick${i} =.*|irc_nick${i} = ${DISTRO_FILE_PREFIX}${x}${i}|" \
  138. $HOME/.xchat2/xchat.conf
  139. done
  140. fi
  141. fi
  142. #v2.16 popup a warning if booting from usb flash...
  143. if [ "$PMEDIA" = "usbflash" ];then
  144. /usr/lib/gtkdialog/box_splash -close never -fontsize large -bg yellow -timeout 3 -text "$(gettext 'WARNING! Do not unplug USB Flash drive!')" & #101009
  145. fi
  146. #v2.17 suggested by andrei...
  147. if [ -d /root/Startup ];then
  148. for a in /root/Startup/*
  149. do
  150. if [ -x "$a" ];then $a & #jamesbond
  151. fi
  152. sleep 0.2
  153. done
  154. fi
  155. touch /tmp/delayedrun_finished_flag #111010
  156. ###END###