pinstall.sh 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. #ln -snf release-${cutDISTRONAME}-${DISTRO_VERSION}.htm usr/share/doc/release-notes.htm #120225
  47. #echo "The default kernel for Puppy is vmlinuz."
  48. echo -n "vmlinuz" > /tmp/vmlinuzforpup.txt
  49. #note, createpuppy will read this.
  50. #120818 now have /etc/xdg in Woof, taken out of xdg_puppy PET, relocated pinstall.sh to here...
  51. #this code is to fix the icewm menu...
  52. if [ -f ./etc/xdg/templates/_root_.icewm_menu ];then
  53. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name evilwm`" = "" ];then
  54. grep -v ' evilwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  55. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  56. fi
  57. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name fluxbox`" = "" ];then
  58. grep -v ' fluxbox$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  59. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  60. fi
  61. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name fvwm95`" = "" ];then
  62. grep -v ' fvwm95$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  63. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  64. fi
  65. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name jwm`" = "" ];then
  66. grep -v ' jwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  67. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  68. fi
  69. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name pwm`" = "" ];then
  70. grep -v ' pwm$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  71. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  72. fi
  73. if [ "`find ./usr/local/bin ./usr/bin ./usr/sbin ./usr/X11R7/bin -maxdepth 1 -type f -name xfce4-session`" = "" ];then
  74. grep -v ' xfce4-session$' ./etc/xdg/templates/_root_.icewm_menu > /tmp/_root_.icewm_menu
  75. mv -f /tmp/_root_.icewm_menu ./etc/xdg/templates/
  76. fi
  77. fi
  78. #screenshot
  79. TAS=`find usr/bin usr/sbin usr/local/bin -name tas`
  80. SCREENY=`find usr/bin usr/sbin -name 'screeny'`
  81. if [ "$TAS" ];then echo '#!/bin/sh
  82. exec tas' > usr/local/bin/defaultscreenshot
  83. chmod 755 usr/local/bin/defaultscreenshot
  84. SCR=tas
  85. elif [ "$SCREENY" ];then echo '#!/bin/sh
  86. exec screeny' > usr/local/bin/defaultscreenshot
  87. chmod 755 usr/local/bin/defaultscreenshot
  88. SCR=screeny
  89. else
  90. echo '#!/bin/sh
  91. exec mtpaint -s' > usr/local/bin/defaultscreenshot
  92. chmod 755 usr/local/bin/defaultscreenshot
  93. SCR="mtpaint -s"
  94. fi
  95. echo "Setting $SCR as defaultscreenshot app"
  96. # firefox
  97. FF=`find /usr -type d -name 'firefox*'`
  98. if [ "$FF" ];then echo '#!/bin/sh
  99. exec firefox "$@"' > usr/local/bin/defaultbrowser
  100. chmod 755 usr/local/bin/defaultbrowser
  101. echo '#!/bin/sh
  102. exec firefox "$@"' > usr/local/bin/defaulthtmlviewer
  103. chmod 755 usr/local/bin/defaulthtmlviewer
  104. echo "Setting Firefox as defaultbrowser"
  105. fi
  106. #end#