Advertisement
Guest User

getjavagui

a guest
Sep 21st, 2015
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.85 KB | None | 0 0
  1. #!/bin/bash -a
  2. #modified to getjavagui instead by aarf
  3. # getflash 0.5 original code by technosaurus and by Barry K. http://bkhome.org/blog/?viewDetailed=01897
  4. # 13 Nov 2011 01micko http://www.murga-linux.com/puppy/viewtopic.php?t=72805&start=201
  5. # v0.6 - 21 Dec 2011 shinobar: puppy version independent (may work 4.0 and later), flashblock checkbox, registration, i18n
  6. # v0.8 - 11 Jan 2012 shinobar: flashplayer version info (stu90), fix was not able to uninstall
  7. # v0.9 - 25 Mar 2012 shinobar: fix was the ownership under /usr messing up
  8. # v0.9.9 - 3 May 2012 shinobar: version choice, jwm -reload for no flicker(01mico)
  9. # v1.0 - 5 May 2012 shinobar: flashplayer11-11.2.202.228, insert sudo line
  10. # v1.1 - 9 Jun 2012 shinobar: URL changed, download size
  11. # v1.2 - 21 Jul 2012 shinobar: fix download pets,flashplayer10.3.183.23
  12. # v1.3 - 8 Oct 2013: change adobe url (ETP), forum URL by OscarTalks
  13. # v1.4 - 23 Nov 2013: fix was always offer flashblock
  14. # v1.5 - 4 Feb 2014: flashplayer10-10.3.183.90 from smokey01.com
  15. #150305 BK adobe site now https:. fix pet repo. fix register with ppm.
  16. #150310 BK: weird, some testers report that http: only works. test for either.
  17. #150311 BK: Argolance: bug fixes. refer: http://murga-linux.com/puppy/viewtopic.php?p=833174#833174
  18. #150311 yaf-splash (gtkdialog-splash) is deprecated in Quirky, in favour of 'popup'
  19. #150315 ASRI: try to improve main GUI, improve gettext, add conf file. And more...
  20. #150325 ASRI: substitute "strings" with "busybox strings" (Barry proposal)
  21.  
  22. AppVersion=0.001
  23.  
  24.  
  25.  
  26. ## ANL = Application Name writing Lowercase => to be use in different parts of the script
  27. ANL01="getjavagui"
  28.  
  29.  
  30. ## Get language settings (gettext method)
  31. export TEXTDOMAIN=getjavagui
  32. export TEXTDOMAINDIR=/usr/share/locale
  33. export OUTPUT_CHARSET=UTF-8
  34. LANG_USER=$LANG
  35.  
  36.  
  37. ## Application : name
  38. AppTitle01="$(gettext 'GetJavaGui')"
  39. AppTitle02="$(gettext '(get either jre or jdk)')"
  40. AppTitle="$AppTitle01 $AppTitle02"
  41.  
  42.  
  43. ## Get Application dir (zigbert method)
  44. APPDIR="`dirname $0`"
  45. [ "$APPDIR" = "." ] && APPDIR="`pwd`"
  46. export APPDIR="$APPDIR"
  47. export APPDIR=`dirname $0`
  48. [ $APPDIR = '.' ] && export APPDIR=`pwd`
  49.  
  50.  
  51. ## Check version of java installed
  52. java -version > /tmp/JAVAVERSION 2>&1
  53. RegExStr='\"(.+?)\"'
  54. egrep -o $RegExStr "/tmp/InstalledVERSION" > /tmp/JAVAinstv
  55. #RegExStr="[0-9][0-9]"
  56. #egrep -o $RegExStr "/tmp/instv" > /tmp/updateNo
  57.  
  58. while read p; do
  59. preupdateNo=${p}
  60. done </tmp/JAVAinstv
  61.  
  62. echo "$preupdateNo"
  63. preupdateNo=${preupdateNo%\"*}
  64. preupdateNo=${preupdateNo#\"*}
  65. JAVAVERSION=$preupdateNo
  66. echo "INSTALLED=$JAVAVERSION" >&2
  67.  
  68. if [ ! $JAVAVERSION ];then
  69. JAVAVERSION="0"
  70. TEXT=$(gettext "Currently, JAVA is not installed.")
  71. TEXT2=$(gettext "Note: currently, java is not installed.")
  72. else
  73.  
  74. echo "INSTALLED=$JAVAVERSION" >&2
  75. TEXT=$(gettext "Currently Java version $JAVAVERSION is installed.")
  76. TEXT=$(printf "$TEXT" "$JAVAVERSION")
  77. TEXT2=$(gettext "Note: Java version $JAVAVERSION is currently installed.")
  78. TEXT2=$(printf "$TEXT2" "$JAVAVERSION")
  79. fi
  80.  
  81.  
  82. ## Check data and variables/settings for script
  83. . /etc/DISTRO_SPECS
  84. APP_CONF="/usr/sbin/$ANL01-conf"
  85. . $APP_CONF
  86.  
  87.  
  88. ## Define messages for script
  89. T_title="$AppTitle01 v$AppVersion"
  90. WAIT_PLS=$(gettext "Please wait...")
  91. _WHICH=$(gettext "Select the version to install")
  92. _UNABLE_INTERNET="$(gettext 'No internet connection founded, please check your configuration, then restart') $AppTitle01.
  93.  
  94. $TEXT2"
  95. _UNABLE_SERVER="$(gettext 'Unable to contact the server, please check your internet connection, then restart') $AppTitle01.
  96.  
  97. $TEXT2"
  98.  
  99.  
  100. ## Test processor arch
  101. ARCH=$(uname -m)
  102. lsuffix=
  103. case "$ARCH" in #01micko, support 64 bit. 150305 BK now https: 150310 maybe either:
  104. i?86)CHECKURL=$CHECKURL_32
  105. FORUMURL=$FORUMURL_FLASKPKGS_32
  106. ;;
  107. *64)CHECKURL=$CHECKURL_64
  108. lsuffix=64
  109. ;;
  110. *)exit 1
  111. ;;
  112. esac
  113.  
  114.  
  115. ## Various tests/configs
  116. [ "$UID" != "0" ] && which sudo &>/dev/null exec sudo $0
  117.  
  118. [ "$HOME" ] || HOME='/root'
  119.  
  120.  
  121. ## Check gtkdialog version
  122. GTKDIALOG=gtkdialog3
  123. which gtkdialog4 &>/dev/null && GTKDIALOG=gtkdialog4
  124.  
  125.  
  126. ## Various tests to define applications used
  127. #for P in $BROWSER defaultbrowser seamonkey firefox $DEFAULTBROWSER; do
  128. #which $P &>/dev/null && MYBROWSER=$P && break
  129. #done
  130. MYBROWSER=defaultbrowser # defaulthtmlviewer is possible
  131.  
  132. RXVT=urxvt
  133. which $RXVT &>/dev/null || RXVT=rxvt
  134. TERMCONF="$RXVT -bg orange -geometry 80x4 -e"
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144. #### Function part
  145.  
  146. export X1PID=""
  147.  
  148. #150311 yaf-splash (gtkdialog-splash) is deprecated in Quirky, in favour of 'popup'
  149. POPUPFLAG=0
  150. [ `which popup` ] && POPUPFLAG=1
  151. #[ `which popadd` ] || POPUPFLAG=0
  152.  
  153.  
  154. mysplash() {
  155. if [ $POPUPFLAG -eq 1 ];then #150311
  156. [ `pidof popup` ] && killall popup #popadd 'name=gfpop terminate=now|'
  157. else
  158. [ "$X1PID" ] && kill $X1PID
  159. killall yaf-splash &>/dev/null
  160. X1PID=""
  161. BGCOLOR="orange"
  162. MYICON="gtk-info"
  163. TIMEOUT=50
  164. fi
  165. while [ "$1" ]; do
  166. case "$1" in
  167. -*stop) return;;
  168. -*bg) shift; BGCOLOR=$1; shift;;
  169. -*timeout) shift; TIMEOUT=$1; shift;;
  170. -*icon) shift; MYICON=$1; shift;;
  171. -*text) shift;;
  172. -*) shift; shift;;
  173. *) break;;
  174. esac
  175. done
  176. if [ $POPUPFLAG -eq 1 ];then #150311
  177. case $BGCOLOR in #hack
  178. yellow) BACKCOL='#FFFF00' ;;
  179. LightPink|hotpink) BACKCOL='#FF30FF' ;;
  180. orange) BACKCOL='#FFB030' ;;
  181. *) BACKCOL='#FFFF00' ;;
  182. esac
  183. LANG=$LANG_USER popup "name=gfpop placement=center fontname='Sans 14' background=${BACKCOL} terminate=${TIMEOUT} level=top|${@}" #daemonizes
  184. else
  185. if which gtkdialog-splash &>/dev/null ; then
  186. LANG=$LANG_USER gtkdialog-splash -fontsize "large" -icon $MYICON -placement center -bg $BGCOLOR -timeout $TIMEOUT -close never -text "$@" & #150311
  187. else
  188. LANG=$LANG_USER gxmessage -center -wrap -bg $BGCOLOR -title "$T_title" -buttons '' -timeout $TIMEOUT -nofocus "$@" &
  189. fi
  190. X1PID=$!
  191. fi
  192. }
  193. mysplash -bg yellow "$WAIT_PLS"
  194.  
  195.  
  196. internet_status() {
  197. LANG=C route | grep -q 'default[ ].*[ ]0\.0\.0\.0[ ]' && grep -wq 'nameserver' /etc/resolv.conf #&& ping -c1 google.com &>/dev/null
  198. }
  199.  
  200.  
  201. help_gui() {
  202. Xdialog --title "$T_title" --left --wrap --msgbox "$(gettext 'This utility allows to install the Flash player plugin.
  203.  
  204. Technical notes:
  205. - Flash player plugin is used by web browsers installed in your system.
  206. - Flash player plugin is saved in folder /usr/lib/mozilla/plugins.
  207. - Latest Flash player is not compatible with some old CPU, in this case choose older version of the plugin.
  208. - The latest version of Flash player is downloaded directly from the Adobe server ; older versions of Flash Player are downloaded from servers of Puppy users.
  209.  
  210. For expert users:
  211. - If need, you can edit manualy the configuration file of GetFlashPlayer (/usr/sbin/getflash-conf).
  212.  
  213. Licence: Flash Player is a proprietary software proposed by the Adobe company. You can consult the general terms at http://www.adobe.com/legal/general-terms.html')" 0 100
  214. }
  215.  
  216.  
  217. ## Check Internet connection, define messages, then start main GUI
  218. #mysplash -bg yellow "$WAIT_PLS"
  219. if ! internet_status; then
  220. #mysplash -bg hotpink -timeout 5 -icon gtk-dialog-error "$_UNABLE_INTERNET"
  221. mysplash --stop
  222. Xdialog --title "$T_title" --left --wrap --msgbox "$_UNABLE_INTERNET" 0 80
  223. exit 1
  224. fi
  225.  
  226. #111113 changed url, scrapped ping
  227. #DOWNLOADURL="`curl -s 'http://get.adobe.com/flashplayer/completion/?installer=Flash_Player_11_for_other_Linux_(.tar.gz)_32-bit'|tr ' ' '\n'|grep fpdownload|tr -d ';'`"
  228. #v1.1: CHECKURL, grep -o
  229. #DOWNLOADURL=$(curl -s "$CHECKURL" | grep -o 'http://fpdownload.*inux.i386.tar.gz')
  230.  
  231. case "$ARCH" in #150305 now https
  232. i?86)DOWNLOADURL=$(curl -s "https${CHECKURL}" | grep -o 'http.://fpdownload.*inux.i386\.tar\.gz') ;;
  233. *64)DOWNLOADURL=$(curl -s "https${CHECKURL}" | grep -o 'http.://fpdownload.*inux.x86_64\.tar\.gz') ;;
  234. esac
  235. if [ ! "$DOWNLOADURL" ];then #150310
  236. case "$ARCH" in
  237. i?86)DOWNLOADURL=$(curl -s "http${CHECKURL}" | grep -o 'http.://fpdownload.*inux.i386\.tar\.gz') ;;
  238. *64)DOWNLOADURL=$(curl -s "http${CHECKURL}" | grep -o 'http.://fpdownload.*inux.x86_64\.tar\.gz') ;;
  239. esac
  240. fi
  241. if [ ! "$DOWNLOADURL" ];then
  242. #mysplash -bg hotpink -timeout 5 -icon gtk-dialog-error "$_UNABLE_SERVER"
  243. mysplash --stop
  244. Xdialog --title "$T_title" --left --wrap --msgbox "$_UNABLE_SERVER" 0 80
  245. exit 1
  246. fi
  247. echo "$DOWNLOADURL" >&2
  248. #finding new java version number
  249. wget -4c http://www.oracle.com/technetwork/java/javase/downloads/
  250.  
  251. ##grep -i "Version [0-9] Update [0-9]" index.html > /tmp/CURRENTVersion
  252. grep -i "Java Platform (JDK) [0-9]u[0-9]" index.html > /tmp/CURRENTVersion
  253.  
  254. RegExStr="8u[0-9][0-9]"
  255. egrep -o $RegExStr "/tmp/CURRENTVersion" > /tmp/NEWVERSION
  256.  
  257. while read p; do
  258. NEWVERSION=${p}
  259. done </tmp/NEWVERSION
  260.  
  261.  
  262.  
  263.  
  264.  
  265. echo "NEWVERSION=$NEWVERSION"
  266. #v1.1 download size
  267. LENGTH=$(curl -s -I "$DOWNLOADURL" | grep -i 'Content-Length:' | cut -s -f2 -d':'| tr -dc '0-9') || LENGTH=0
  268. NEWMB=$((($LENGTH + 52429) / 104858))
  269. if [ $NEWMB -gt 0 ] ; then
  270. L=$(echo -n $NEWMB | wc -c)
  271. M=$(($L -1))
  272. NEWMB="$(echo $NEWMB -n | cut -c-$M).$(echo -n $NEWMB | cut -c$L) $(gettext 'MB')"
  273. else
  274. #NEWMB='---' #150311
  275. NEWMB="$(gettext "unknown size")"
  276. fi
  277. #DOWNTEXT=$(gettext "Click the 'Yes' button to download and install FlashPlayer-%s (6MB).")
  278. #DOWNTEXT=$(printf "$DOWNTEXT" "$NEWVERSION")
  279. if [ "$FLASHVERSION" = "$NEWVERSION" ]; then
  280. TEXT="$TEXT $(gettext "This is the latest version available, so you do not need to update it.")"
  281. else
  282. TEXT="$TEXT $(gettext "It is recommended to install the latest version available") (version 1.$NEWVERSION)."
  283. fi
  284.  
  285.  
  286. update_conf_file() {
  287. cd /tmp
  288. $TERMCONF wget -L "$CONFFILE_URL"
  289. sleep 2 # may be need for slower computers
  290.  
  291. if [ ! -f /tmp/getflash-conf ]; then
  292. Xdialog --title "$T_title" --left --wrap --msgbox "$(gettext 'No configuration file was found on the server. Please try again later.
  293. If the problem persists permanently, thank you to report on the GetFlashPlayer forum.')" 0 100
  294. else
  295. mv -f "/tmp/getflash-conf" "$APPDIR/getflash-conf"
  296. fi
  297. }
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309. #### GUI part
  310.  
  311. ## Define messages, icons and size of GUI
  312. MAIN_ICON="java-icon.png"
  313. FLASH_ICON="/usr/share/doc/java-icon.png"
  314. MAIN_ICON_WIDTH1="60"
  315. TEXT_WIDTH_CHARS1="10"
  316. TEXT_WIDTH1="500"
  317. SEE_TITLE=$(gettext "Find more on forums")
  318. SEE_MSG_01_32=$(gettext "Java download scripts")
  319. SEE_MSG_01_64=$(gettext "64-bit package available in forum.")
  320. SEE_MSG_02=$(gettext "Ready made Java sfs")
  321. SEE_LABEL=$(gettext "Forum")
  322. SEE_INSTALL=$(gettext "Install")
  323. SEE_INSTALL_TOOLTIP=$(gettext "Install selected version.")
  324. SEE_HELP_TOOLTIP=$(gettext "Consult help for Java.")
  325. SEE_EDITCONF_TOOLTIP=$(gettext "For expert users! Use default text editor to edit configuration file of GetJavaGui. Note: After your edit, you will need to click on the Refresh button to update the information (available versions of Java).")
  326. SEE_REFRESH_TOOLTIP=$(gettext "Restart GetJavaGui to refresh the information (available versions of Java).")
  327. SEE_UPDATECONF_TOOLTIP=$(gettext "Update configuration file of GetJavaGui. It is need if last version of Java is not detected. If this does not work, please report on the GetJavaGui forum.")
  328. SEE_QUITAPP_TOOLTIP=$(gettext "Quit GetJavaGui.")
  329. SEE_FORUM_TOOLTIP=$(gettext "Use the web browser to consult the forum.")
  330. SEE_LICENSE_TOOLTIP=$(gettext "Use the web browser to consult general terms about Java.")
  331. SEE_FORUM=
  332.  
  333.  
  334. ## Check if libstardust (zigbert prod) is installed
  335. CHECK_LIBSTARDUST="/usr/lib/gtkdialog/xml_scalegrip"
  336. if [ ! -f "$CHECK_LIBSTARDUST" ]; then
  337. SCALEGRIP=""
  338. else
  339. SCALEGRIP="`/usr/lib/gtkdialog/xml_scalegrip`"
  340. fi
  341.  
  342.  
  343. ## Define forum buttons
  344. if [ "$FORUMURL_FLASKPKGS_32" ]; then
  345. if [ "$DISTRO_TARGETARCH" == "x86" ];then #150305
  346. SEE_FORUM='<frame '$SEE_TITLE'>
  347. <hbox><text><label>"'$SEE_MSG_01_32'"</label></text>
  348. <button tooltip-text="'$SEE_FORUM_TOOLTIP'"><input file stock="gtk-network"></input><label>"'$SEE_LABEL'"</label>
  349. <action>'$MYBROWSER' '$FORUMURL_FLASKPKGS_32' &</action>
  350. </button></hbox>
  351. <hbox><text><label>"'$SEE_MSG_02'"</label></text>
  352. <button tooltip-text="'$SEE_FORUM_TOOLTIP'"><input file stock="gtk-network"></input><label>"'$SEE_LABEL'"</label>
  353. <action>'$MYBROWSER' '$FORUMURL_GETFLASHAPP' &</action>
  354. </button></hbox>
  355. <hbox><text><label>"Flash auto-updater"</label></text>
  356. <button tooltip-text="'$SEE_FORUM_TOOLTIP'"><input file stock="gtk-network"></input><label>"'$SEE_LABEL'"</label>
  357. <action>'$MYBROWSER' http://murga-linux.com/puppy/viewtopic.php?t=100523 &</action>
  358. </button></hbox>
  359. </frame>'
  360. else
  361. SEE_FORUM='<frame '$SEE_TITLE'>
  362. <text><label>"'$SEE_MSG_01_64'"</label></text>
  363. <hbox><text><label>"'$SEE_MSG_02'"</label></text>
  364. <button tooltip-text="'$SEE_FORUM_TOOLTIP'"><input file stock="gtk-network"></input><label>"'$SEE_LABEL'"</label>
  365. <action>'$MYBROWSER' '$FORUMURL_GETFLASHAPP' &</action>
  366. </button></hbox>
  367. </frame>'
  368. fi
  369. fi
  370.  
  371.  
  372. ## Define arch to select available packages
  373. _V11X="Java 1.$NEWVERSION ($NEWMB) - $(gettext "Latest version available")"
  374. case "$ARCH" in
  375. i?86)RADIOBTNS='<radiobutton><label>'$_V11_name' ('$_V11_size' '$(gettext "MB")')</label><variable>V11</variable></radiobutton>
  376. <radiobutton><label>'$_V10_name' ('$_V10_size' '$(gettext "MB")')</label><variable>V10</variable></radiobutton>
  377. <radiobutton><label>'$_V9_name' ('$_V9_size' '$(gettext "MB")')</label><variable>V9</variable></radiobutton>'
  378. esac
  379. #LANG=C Xdialog --center --title "Adobe Flash Player" --icon "/usr/share/doc/flashlogo.gif" --yesno "$TEXT" 0 0
  380. export FDLG='<window title="'$T_title'" icon-name="'$MAIN_ICON'">
  381. <vbox>
  382. <hbox>
  383. <pixmap><width>"'$MAIN_ICON_WIDTH1'"</width><input file>"'$FLASH_ICON'"</input></pixmap>
  384. <text width-chars="'$TEXT_WIDTH_CHARS1'" width-request="'$TEXT_WIDTH1'"><label>'"$TEXT"'</label></text>
  385. </hbox>
  386. <frame '$_WHICH'>
  387. <radiobutton><label>'$_V11X'</label><variable>V11X</variable></radiobutton>
  388. '$RADIOBTNS'
  389. <hbox>
  390. <button tooltip-text="'$SEE_INSTALL_TOOLTIP'">
  391. <label>'"$SEE_INSTALL"'</label>
  392. <input file stock="gtk-apply"></input>
  393. <action type="exit">OK</action>
  394. </button>
  395. </hbox>
  396. </frame>
  397. '$SEE_FORUM'
  398. <hbox>
  399. <button tooltip-text="'$SEE_HELP_TOOLTIP'">
  400. <input file stock="gtk-help"></input>
  401. <action>help_gui &</action>
  402. </button>
  403. <button tooltip-text="'$SEE_LICENSE_TOOLTIP'">
  404. <input file stock="gtk-info"></input>
  405. <action>$MYBROWSER $ADOBE_GENERAL_TERMS &</action>
  406. </button>
  407. <button tooltip-text="'$SEE_REFRESH_TOOLTIP'">
  408. <input file stock="gtk-refresh"></input>
  409. <action>$APPDIR/$ANL01 &</action>
  410. <action>exit:ok</action>
  411. </button>
  412. <button tooltip-text="'$SEE_UPDATECONF_TOOLTIP'">
  413. <input file stock="gtk-network"></input>
  414. <action>update_conf_file</action>
  415. <action>$APPDIR/$ANL01 &</action>
  416. <action>exit:ok</action>
  417. </button>
  418. <button tooltip-text="'$SEE_EDITCONF_TOOLTIP'">
  419. <input file stock="gtk-edit"></input>
  420. <action>defaulttexteditor $APP_CONF</action>
  421. </button>
  422. <button tooltip-text="'$SEE_QUITAPP_TOOLTIP'">
  423. <input file stock="gtk-quit"></input>
  424. <action type="exit">quit_now</action>
  425. </button>
  426. '$SCALEGRIP'
  427. </hbox>
  428. </vbox></window>'
  429. #echo "$FDLG" >&2
  430. mysplash --stop
  431. REPLY=$($GTKDIALOG -p FDLG -c |grep '=') || echo "$FDLG" >&2
  432. #echo "$REPLY"
  433. eval "$REPLY"
  434. [ "$EXIT" = "OK" ] || exit 0
  435. CHOICE=$(echo "$REPLY" | grep '=.*true'| head -n1| cut -f1 -d'=')
  436. if [ "$CHOICE" = "V11X" ]; then
  437. cd /usr/lib${lsuffix}/mozilla/plugins
  438. #echo -e "#!/bin/sh\nwget -O - http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_11_linux.i386.tar.gz | tar -xz" > /tmp/delayedrun_flashdl
  439. # v0.9: fix the ownership
  440. if [ "$(echo -n "$DOWNLOADURL" | grep 'https')" == "" ];then #150305
  441. echo -e "#!/bin/sh\nwget -O - $DOWNLOADURL | tar --no-same-owner -xz" > /tmp/delayedrun_flashdl
  442. else
  443. echo -e "#!/bin/sh\nwget --no-check-certificate -O - $DOWNLOADURL | tar --no-same-owner -xz" > /tmp/delayedrun_flashdl
  444. fi
  445. chmod 777 /tmp/delayedrun_flashdl
  446. $TERMCONF /tmp/delayedrun_flashdl
  447. mysplash -bg yellow "$WAIT_PLS"
  448. ldd /usr/lib${lsuffix}/mozilla/plugins/libflashplayer.so > /dev/null 2>&1
  449. [ $? -ne 0 ] && rm -f /usr/lib${lsuffix}/mozilla/plugins/libflashplayer.so 2>/dev/null
  450. if [ -f /usr/lib${lsuffix}/mozilla/plugins/libflashplayer.so ];then
  451. FLASHSIZE=$(du /usr/lib${lsuffix}/mozilla/plugins/libflashplayer.so| cut -f1)
  452. echo /usr/lib${lsuffix}/mozilla/plugins/libflashplayer.so > /tmp/flashplayer.files #register
  453. if [ -d /usr/lib${lsuffix}/mozilla/plugins/usr ];then #150305
  454. rm -rf /usr/lib${lsuffix}/mozilla/plugins/usr/lib 2>/dev/null
  455. rm -rf /usr/lib${lsuffix}/mozilla/plugins/usr/lib64 2>/dev/null
  456. rm -rf /usr/lib${lsuffix}/mozilla/plugins/usr/share/kde4 2>/dev/null
  457. cp -r -f /usr/lib${lsuffix}/mozilla/plugins/usr /
  458. #find /usr/lib${lsuffix}/mozilla/plugins/usr -type d -printf '/usr/%P/\n' >> /tmp/flashplayer.files
  459. #find /usr/lib${lsuffix}/mozilla/plugins/usr -type l -printf '/usr/%P\n' >> /tmp/flashplayer.files
  460. find /usr/lib${lsuffix}/mozilla/plugins/usr -type f -printf '/usr/%P\n' >> /tmp/flashplayer.files
  461. cd $HOME
  462. rm -rf /usr/lib${lsuffix}/mozilla/plugins/usr
  463. grep -vw '^flashplayer11' $HOME/.packages/user-installed-packages > /tmp/user-installed-packages
  464. NEWENTRY="flashplayer11-$NEWVERSION|flashplayer11|$NEWVERSION||Internet|17580K||flashplayer11-$NEWVERSION.pet||Adobe Flash Player 11 browser plugin and Preferences. Note, this may not work on older PCs, use instead an earlier 11.x or even 10.x||||"
  465. echo "$NEWENTRY" >> /tmp/user-installed-packages
  466. PACKAGE_ROOT=flashplayer11-$NEWVERSION #v1.0
  467. mv -f /tmp/flashplayer.files /tmp/$PACKAGE_ROOT.files
  468. cp -f /tmp/$PACKAGE_ROOT.files /tmp/user-installed-packages $HOME/.packages/
  469. if [ -f /usr/share/applications/flash-player-properties.desktop ];then #fix .desktop for menu
  470. OLDNAME="`grep "^Name" /usr/share/applications/flash-player-properties.desktop`"
  471. OLDCATEGORY="`grep "^Categories" /usr/share/applications/flash-player-properties.desktop`"
  472. #NEWCATEGORY="Categories=X-Internet;" #now info is in getflash-conf file
  473. OLDICON="`grep "^Icon" /usr/share/applications/flash-player-properties.desktop`"
  474. #NEWICON="Icon=/usr/share/icons/flash-player-properties.png" #now info is in getflash-conf file
  475. sed -i -e "s%$OLDNAME%$NEWNAME%" \
  476. -e "s%$OLDCATEGORY%$NEWCATEGORY%" \
  477. -e "s%$OLDICON%$NEWICON%" /usr/share/applications/flash-player-properties.desktop
  478. fi
  479. fixmenus
  480. if [ "`pidof jwm`" != "" ] ; then
  481. jwm -reload || jwm -restart #v1.0
  482. fi
  483. SUCCESS="y"
  484. fi
  485. fi
  486. else # v1.5 - 4 Feb 2014: flashplayer10-10.3.183.90 from smokey01.com
  487. #DOWNLOADURL="http://distro.ibiblio.org/quirky/quirky6/${DISTRO_TARGETARCH}/packages/pet_packages-common" #150305
  488. #case "$CHOICE" in
  489. #V11) PACKAGE_ROOT="flashplayer11-11.2.202.228";;
  490. #V10) DOWNLOADURL="http://www.smokey01.com/OscarTalks"
  491. #PACKAGE_ROOT="flashplayer10-10.3.183.90";;
  492. #V9) PACKAGE_ROOT="flashplayer9_pretend10-20110327";;
  493. DOWNLOADURL="$_V11_url" #150305
  494. case "$CHOICE" in
  495. V11) DOWNLOADURL="$_V11_url"
  496. PACKAGE_ROOT="$_V11_name";;
  497. V10) DOWNLOADURL="$_V10_url"
  498. PACKAGE_ROOT="$_V10_name";;
  499. V9) DOWNLOADURL="$_V9_url"
  500. PACKAGE_ROOT="$_V9_name";;
  501. *) exit 0;;
  502. esac
  503. DOWNLOADURL="$DOWNLOADURL/$PACKAGE_ROOT.pet"
  504. cd /tmp
  505. DOWNLOAD_FILE=$(which download_file)
  506. if [ "$DOWNLOAD_FILE" ]; then
  507. $DOWNLOAD_FILE "$DOWNLOADURL"
  508. else
  509. if [ "$(echo -n "$DOWNLOADURL" | grep 'https')" == "" ];then #150305
  510. echo -e "#!/bin/sh\nwget -O - $DOWNLOADURL" > /tmp/delayedrun_flashdl
  511. else
  512. echo -e "#!/bin/sh\nwget --no-check-certificate -O - $DOWNLOADURL" > /tmp/delayedrun_flashdl
  513. fi
  514. chmod 777 /tmp/delayedrun_flashdl
  515. $TERMCONF /tmp/delayedrun_flashdl
  516. fi
  517. #cd $HOME #V1.2 fix download pets
  518. if [ -s "$PACKAGE_ROOT.pet" ]; then
  519. petget +$PACKAGE_ROOT.pet
  520. [ -s $HOME/.packages/$PACKAGE_ROOT.files ] && SUCCESS="y"
  521. rm -f $PACKAGE_ROOT.pet
  522. fi
  523. fi
  524. if [ "$SUCCESS" ]; then
  525. #http://flashblock.mozdev.org/
  526. #LANG=C Xdialog --center --title "Adobe Flash Player" --icon "/usr/share/doc/flashlogo.gif" --msgbox "The Adobe Flash Player has been downloaded to:\\n /usr/lib/mozilla/plugins/libflashplayer.so\\nYou will need to exit from your web browser and restart it for the player to load" 0 0
  527. NOFB="`grep -i '^flashblock' $HOME/.packages/*-installed-packages`"
  528. if [ "$OFFERFB" -a "$NOFB" = "" ];then
  529. FLASHBLOCK='<hbox>
  530. <pixmap><input file>/usr/share/icons/flashblock.png</input></pixmap>
  531. <checkbox>
  532. <label>'$(gettext "Open your browser at the mozilla Flashblock page.")'</label>
  533. <variable>OPENFB</variable>
  534. <default>true</default>
  535. </checkbox></hbox>'
  536. else FLASHBLOCK='';
  537. fi
  538. TEXT="$(gettext 'The Adobe Flash Player has been installed in:')\n/usr/lib${lsuffix}/mozilla/plugins\n$(gettext 'You need to restart your web browser to load the new Flash player.')" #150311
  539. export FDLG='<window title="'$T_title'">
  540. <vbox>
  541. <frame><hbox>
  542. <pixmap><width>60</width><input file>/usr/share/doc/flashlogo.gif</input></pixmap>
  543. <text usemarkup="true"><input>echo -en "'$TEXT'"</input></text>
  544. </hbox></frame>
  545. '"$FLASHBLOCK"'
  546. <hbox>
  547. <button ok></button>
  548. </hbox>
  549. </vbox>
  550. </window>'
  551. mysplash --stop
  552. #I=$IFS; IFS=""
  553. STATEMENTS=$($GTKDIALOG -p FDLG -c) || echo "$FLDG" >&2
  554. STATEMENTS=$(echo "$STATEMENTS"|grep '^[A-Z][A-Z]*=')
  555. eval "$STATEMENTS"
  556. #IFS=$I
  557. [ "$EXIT" = "OK" -a "$OPENFB" = "true" ] && \
  558. exec $MYBROWSER $FLASHBLOCK_URL
  559. exit 0
  560. else
  561.  
  562. TEXT=$(gettext "Sorry, the Java did not download. Try the Puppy Package Manager.")
  563. export FDLG='<window title="'$T_title'">
  564. <vbox>
  565. <hbox>
  566. <pixmap><width>60</width><input file>/usr/share/doc/java-icon.png</input></pixmap>
  567. <text><input>echo -en "'$TEXT'"</input></text>
  568. </hbox>
  569. <hbox><button ok></button></hbox>
  570. </vbox></window>'
  571. mysplash --stop
  572. $GTKDIALOG -p FDLG -c
  573. fi
  574.  
  575. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement