pinstall.sh 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/sh
  2. #post-install script.
  3. #Puppy Linux
  4. #assume current directory is rootfs-complete, which has the final filesystem.
  5. #this script is similar to the post-install scripts of the window managers.
  6. #Keywords are located in the Help page and the lines uncommented.
  7. #DISTRO_VERSION, DISTRO_NAME are global variables visible here.
  8. #110422 DISTRO_VERSION variable now has dotted format. note, also now using full dotted version# in puppy filenames.
  9. #120225 create symlink release-notes.htm to actual release-notes file. NO.
  10. #120225 backup doc files, refer /usr/sbin/indexgen.sh.
  11. #120818 now have /etc/xdg in Woof, taken out of xdg_puppy PET, relocated pinstall.sh to here.
  12. #132211 removed icewm template from default, who uses that anyway?
  13. WKGDIR="`pwd`"
  14. echo "Configuring Puppy skeleton..."
  15. #cleanup...
  16. rm -f /tmp/fbvideomode.txt
  17. echo "Configuring Puppy Help page..."
  18. #refer /usr/sbin/indexgen.sh...
  19. cp -f usr/share/doc/index.html.top usr/share/doc/index.html.top-raw #120225
  20. cp -f usr/share/doc/index.html.bottom usr/share/doc/index.html.bottom-raw #120225
  21. cp -f usr/share/doc/home.htm usr/share/doc/home-raw.htm #120225
  22. cutDISTRONAME="`echo -n "$DISTRO_NAME" | cut -f 1 -d ' '`"
  23. cPATTERN="s/cutDISTRONAME/${cutDISTRONAME}/g"
  24. RIGHTVER="$DISTRO_VERSION"
  25. PUPPYDATE="`date | tr -s " " | cut -f 2,6 -d " "`"
  26. dPATTERN="s/PUPPYDATE/${PUPPYDATE}/g"
  27. echo "Writing version number and distro name and date to Help page..."
  28. PATTERN1="s/RIGHTVER/${RIGHTVER}/g"
  29. PATTERN2="s/DISTRO_VERSION/${DISTRO_VERSION}/g"
  30. nPATTERN="s/DISTRO_NAME/${DISTRO_NAME}/g"
  31. sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" -e "$cPATTERN" usr/share/doc/index.html.top
  32. sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" usr/share/doc/index.html.bottom
  33. #...note, /usr/sbin/indexgen.sh puts these together as index.html (via rc.update and 3builddistro).
  34. echo "Writing distro name to jumping-off page..."
  35. sed -i -e "$nPATTERN" usr/share/doc/home.htm
  36. echo "Creating base release notes..."
  37. if [ ! -e usr/share/doc/release-${cutDISTRONAME}-${DISTRO_VERSION}.htm ];then
  38. mv -f usr/share/doc/release-skeleton.htm usr/share/doc/release-${cutDISTRONAME}-${DISTRO_VERSION}.htm
  39. sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" usr/share/doc/release-${cutDISTRONAME}-${DISTRO_VERSION}.htm
  40. #else
  41. # rm -f usr/share/doc/release-skeleton.htm
  42. fi
  43. if [ ! -e usr/share/doc/release-${cutDISTRONAME}-${RIGHTVER}.htm ];then
  44. ln -s release-${cutDISTRONAME}-${DISTRO_VERSION}.htm usr/share/doc/release-${cutDISTRONAME}-${RIGHTVER}.htm
  45. fi
  46. # write extra stuff for release notes
  47. . etc/DISTRO_SPECS
  48. if [ -f ../../support/release_extras/"${DISTRO_FILE_PREFIX}.htm" ];then
  49. echo "Customising ${cutDISTRONAME}-${DISTRO_VERSION}.htm"
  50. [ -f /tmp/release.htm ] && rm /tmp/release.*m
  51. ctrl=0
  52. while read htmline;do
  53. if [ $ctrl -lt 45 ];then # must be updated if the skeleton released notes are altered
  54. echo "$htmline" >> /tmp/release.htm
  55. else
  56. echo "$htmline" >> /tmp/release.bottom
  57. fi
  58. ctrl=$(($ctrl + 1))
  59. done < usr/share/doc/release-${cutDISTRONAME}-${DISTRO_VERSION}.htm
  60. cat "../../support/release_extras/${DISTRO_FILE_PREFIX}.htm" >> /tmp/release.htm
  61. sed -i "s/DISTRO_VERSION/$DISTRO_VERSION/g" /tmp/release.htm
  62. cat /tmp/release.bottom >> /tmp/release.htm
  63. cp -af /tmp/release.htm usr/share/doc/release-${cutDISTRONAME}-${DISTRO_VERSION}.htm
  64. fi
  65. #ln -snf release-${cutDISTRONAME}-${DISTRO_VERSION}.htm usr/share/doc/release-notes.htm #120225
  66. #echo "The default kernel for Puppy is vmlinuz."
  67. echo -n "vmlinuz" > /tmp/vmlinuzforpup.txt
  68. #note, createpuppy will read this.
  69. #120818 now have /etc/xdg in Woof, taken out of xdg_puppy PET, relocated pinstall.sh to here...
  70. #this code is to fix the icewm menu...
  71. if [ -f ./etc/xdg/templates/_root_.icewm_menu ];then
  72. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name evilwm`" = "" ];then
  73. grep -v ' evilwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  74. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  75. fi
  76. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name fluxbox`" = "" ];then
  77. grep -v ' fluxbox$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  78. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  79. fi
  80. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name fvwm95`" = "" ];then
  81. grep -v ' fvwm95$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  82. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  83. fi
  84. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name jwm`" = "" ];then
  85. grep -v ' jwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  86. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  87. fi
  88. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name pwm`" = "" ];then
  89. grep -v ' pwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  90. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  91. fi
  92. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name xfce4-session`" = "" ];then
  93. grep -v ' xfce4-session$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  94. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  95. fi
  96. fi
  97. #screenshot
  98. TAS=`find usr/bin usr/sbin usr/local/bin -name tas`
  99. SCREENY=`find usr/bin usr/sbin -name 'screeny'`
  100. if [ "$TAS" ];then echo '#!/bin/sh
  101. exec tas' > usr/local/bin/defaultscreenshot
  102. chmod 755 usr/local/bin/defaultscreenshot
  103. SCR=tas
  104. elif [ "$SCREENY" ];then echo '#!/bin/sh
  105. exec screeny' > usr/local/bin/defaultscreenshot
  106. chmod 755 usr/local/bin/defaultscreenshot
  107. SCR=screeny
  108. else
  109. echo '#!/bin/sh
  110. exec mtpaint -s' > usr/local/bin/defaultscreenshot
  111. chmod 755 usr/local/bin/defaultscreenshot
  112. SCR="mtpaint -s"
  113. fi
  114. echo "Setting $SCR as defaultscreenshot app"
  115. # firefox
  116. FF=`find usr -type d -name 'firefox*'`
  117. if [ "$FF" ];then echo '#!/bin/sh
  118. exec firefox "$@"' > usr/local/bin/defaultbrowser
  119. chmod 755 usr/local/bin/defaultbrowser
  120. echo '#!/bin/sh
  121. exec firefox "$@"' > usr/local/bin/defaulthtmlviewer
  122. chmod 755 usr/local/bin/defaulthtmlviewer
  123. echo "Setting Firefox as defaultbrowser"
  124. fi
  125. #end#