Firefox Install Script

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Drone-87401
Posts: 72
Joined: Sun 03 Jan 2010, 18:54

Firefox Install Script

#1 Post by Drone-87401 »

Updated: 01-21-2010
Added even more options to our script. User now has the choice of downloading and installing Firefox, Opera 10 & 9, Google Chrome, OpenOffice 3.2 & 3.1, Thunderbird. Firefox is still set at 63 language packs. Here is a preview of the code, this code has not yet been released however.

Code: Select all

#!/bin/sh
firefox_select()
{
while true
do
dialog --clear --title "Select a Version" \
        --menu "\n\n\
        Choose a suite to install:" 20 51 4 \
        "Firefox_3.6rc1"		"Release Canidate" \
        "Firefox_3.5.7"			"Latest Stable Version Suite"\
        "Firefox_3.5.6"			"Older Firefox Version"\
        "Firefox_3.0.17"		"Older Firefox Version"\
        "Menu"					"Return to Menu"\
	    "Exit"          		"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    Firefox_3.6rc1) icon_locale="http://askyourpc.com/media/blogs/a/images_2/2006800168.png" type_desktop="X-Internet" execute="firefox" trunk="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/" icon="2006800168.png" package_name="firefox-3.6rc1.tar.bz2"  gname="Firefox 3.6"     base_type="3.6rc1/linux-i686/"  dbus_check $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Firefox_3.5.7)	icon_locale="http://askyourpc.com/media/blogs/a/images_2/2006800168.png" type_desktop="X-Internet" execute="firefox" trunk="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/" icon="2006800168.png" package_name="firefox-3.5.7.tar.bz2"   gname="Firefox 3.5.7"   base_type="3.5.7/linux-i686/"   dbus_check $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Firefox_3.5.6)	icon_locale="http://askyourpc.com/media/blogs/a/images_2/2006800168.png" type_desktop="X-Internet" execute="firefox" trunk="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/" icon="2006800168.png" package_name="firefox-3.5.6.tar.bz2"   gname="Firefox 3.5.6"   base_type="3.5.6/linux-i686/"   dbus_check $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Firefox_3.0.17)	icon_locale="http://askyourpc.com/media/blogs/a/images_2/2006800168.png" type_desktop="X-Internet" execute="firefox" trunk="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/" icon="2006800168.png" package_name="firefox-3.0.17.tar.bz2"  gname="Firefox 3.0.1.7" base_type="3.0.17/linux-i686/"  dbus_check $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Menu)			main_menu $dialect;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done	
}
install_dbus()
{
	clear
	wget http://pupbuntu.50webs.com/dbus-glib.pet
	wget http://pupbuntu.50webs.com/dbus.pet
	aplay dbus.wav & 
	petget dbus-glib.pet
	petget dbus.pet
	process_install $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop
}
dbus_check()
{
	aplay dbustro.wav & 
	while true
do
dialog --clear --title "Install Dbus Library?" \
        --menu "\n\n\
        Do you need to install Dbus:" 20 51 4 \
        "Yes"				"Installs Dbus Library" \
        "No"    			"Do not install Dbus Library"\
	    "Exit"          	"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    Yes) install_dbus   $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    No) process_install $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done	
}
thunderbird_select()
{
while true
do
dialog --clear --title "Select a Version" \
        --menu "\n\n\
        Choose a suite to install:" 20 51 4 \
        "Thunderbird_3.0"		"Latest Version" \
        "Return"    			"Return To Menu"\
	    "Exit"          		"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    Thunderbird_3.0) icon_locale="http://www.iconarchive.com/icons/benjigarner/softdimension/256/Thunderbird-icon.png" type_desktop="X-Internet" execute="thunderbird" trunk="http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/" icon="Thunderbird-icon.png" package_name="thunderbird-3.0.tar.bz2" gname="Thunderbird 3.0rc"   base_type="3.0/linux-i686/" process_install $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Return) main_menu $dialect;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done	
}
process_install()
{
while true
do
dialog --clear --title "$gname - $dialect" \
        --menu "\n\n\
        Confirm/Cancel Your Selection...." 20 51 4 \
        "$gname"       "$dialect" \
        "Menu"		"Return to the Menu"\
	    "Exit"          "To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    $gname) start_install $icon_locale $trunk $icon $execute $package_name $dialect $base_type $gname $type_desktop;;
	    Exit) exit 0;; 
        Menu) main_menu $dialect;;
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done
}
internet_cat()
{
	while true
do
dialog --clear --title "Select a Version" \
        --menu "\n\n\
        Choose a Program Below:" 20 51 4 \
        "Firefox"				"Firefox Browser Suite" \
        "Thunderbird"			"POP3 Mail Manager"\
        "Google_Chrome"    		"Latest Release"\
        "Opera_9.23"			"Older Opera Browser"\
        "Opera_10.1"			"Latest Stable Release"\
        "Menu"					"Return to Menu"\
	    "Exit"          		"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    Firefox)       aplay firefox.wav & firefox_select $dialect;;
	    Thunderbird)   aplay thunderbird.wav & thunderbird_select $dialect;;
	    Google_Chrome) base2="googleChrome-004.pet" pets="http://brainwavedesigncentral.net/mike/googleChrome-004.pet" pet_installer $dialect $base2 $pets;;
	    Opera_9.23)    base2="opera-9.23.pet" pets="http://brainwavedesigncentral.net/mike/opera-9.23.pet" pet_installer $dialect $base2 $pets;;
	    Opera_10.1)    base2="opera-10.10-4644.pet" pets="http://brainwavedesigncentral.net/mike/opera-10.10-4644.pet" pet_installer $dialect $base2 $pets;;
	    Menu)		   main_menu $dialect;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done
}
office_cat()
{
while true
do
dialog --clear --title "Select an Install Package" \
        --menu "\n\n\
        Choose a suite to install:" 20 51 4 \
        "OpenOffice_3.2_s"		"Open Office Suite"\
        "OpenOffice_3.11.0"		"Older Open Office Release"\
        "Menu"					"Return to Menu"\
	    "Exit"          		"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    OpenOffice_3.2_s)  base2="openoffice_cutdown3-2.2.0.pet" 		pets="http://brainwavedesigncentral.net/mike/openoffice_cutdown3-2.2.0.pet" 		pet_installer $pets $base2 $dialect;;
	    OpenOffice_3.11.0) base2="openoffice.org-l10n-nl_3.1.1-v2.pet"	pets="http://brainwavedesigncentral.net/mike/openoffice.org-l10n-nl_3.1.1-v2.pet" 	pet_installer $pets $base2 $dialect;;
	    Menu)			   main_menu $dialect;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done
}
start_install()
{
	aplay 1.wav & 
	wget "$trunk/$base_type/$dialect/$package_name"
	clear
	aplay 2.wav & 
	wget "$icon_locale"
	mv $icon /usr/share/icons/$icon
	echo "Adding Packages to local menues...."
echo > /usr/share/applications/$gname.desktop
echo "[Desktop Entry]
Encoding=UTF-8
Name=$gname
Comment=Mozilla Product
Exec=$execute
Icon=/usr/share/icons/$icon
Categories=$type_desktop
MimeType=
Type=Application" > /usr/share/applications/$gname.desktop
# End - add to /usr/share/applications
	sleep 2
    aplay 3.wav & 
	tar -xvjf $package_name -C /root/my-applications/
	ln -s /root/my-applications/$execute/$execute /root/my-applications/bin/ 
	clear 
	rm $package_name
	echo "Installations reported as 10/4."
	aplay 4.wav &	
	rox /usr/share/applications/
	#firefox http://murga-linux.com/puppy/viewtopic.php?t=51500
	clear
	main_menu $dialect
exit
}
pet_installer()
{
	aplay 1.wav & 
	wget   "$pets"
	echo   "Please click okay when a dialog appears asking you if you would like to "
	echo   "install the program.  Setup will continue once installation is complete."
	petget "$base2"
	clear
	rm "$base2"
	main_menu $dialect
}
select_language()
{
while true
do
dialog --clear --title "Select a Language" \
        --menu "\n\nChoose a language:" 20 51 10 \
        "English"   	    "English Suite" \
        "Spanish"   	    "Spanish Suite"\
        "Afrikaans"			"Afrikaans Suite"\
        "Arabic"    	    "Arabic Suite"\
        "Belarusian"    	"Belarusian Suite"\
        "Bulgarian"  	    "Bulgarian Suite"\
        "BengaliBD"  	    "Bengali Suite BD"\
        "BengaliIN"         "Bengali Suite IN"\
        "Catalan"			"Catalan Suite"\
        "Czech"				"Czech Suite"\
        "Welsh"				"Welsh Suite"\
        "Danish"			"Danish Suite"\
        "German"			"German Suite"\
        "Greek"				"Greek Suite"\
        "Esperanto"			"Esperanto Suite"\
        "Estonian"			"Estonian Suite"\
        "Basque"			"Basque Suite"\
        "Persian"			"Persian Suite"\
        "Finnish"			"Finnish Suite"\
        "French"			"French Suite"\
        "Frisian"			"Frisian Suite"\
        "Irish"				"Irish Suite"\
        "Galician"			"Galician Suite"\
        "Gujarati"			"Gujarati Suite"\
        "Hebrew"			"Hebrew Suite"\
        "Croatian"			"Croatian Suite"\
        "Hungarian"			"Hungarian Suite"\
        "Indonesian"		"Indonesian Suite"\
        "Icelandic"			"Icelandic Suite"\
        "Italian"			"Italian Suite"\
        "Japanese"			"Japanese Suite"\
        "Georgian"			"Georgian Suite"\
        "Kazakh"			"Kazakh Suite"\
        "Kannada"			"Kannada Suite"\
        "Korean"			"Korean Suite"\
        "Kurdish"			"Kurdish Suite"\
        "Lithuanian"		"Lithuanian Suite"\
        "Latvian"			"Latvian Suite"\
        "Macedonian"		"Macedonian Suite"\
        "Malayalam"			"Malayalam Suite"\
        "Mongolian"			"Mongolian Suite"\
        "Marathi"			"Marathi Suite"\
        "Norwegian"			"Norwegian Suite"\
        "Flemish"			"Flemish Suite"\
        "Nynorsk"			"Nynorsk Suite"\
        "Occitan"			"Occitan Suite"\
        "Oriya"				"Oriya Suite"\
        "Punjabi"			"Punjabi Suite"\
        "Polish"			"Polish Suite"\
        "Portuguese"		"Portuguese Suite"\
        "Romansh"			"Romansh Suite"\
        "Romanian"			"Romanian Suite"\
        "Russian"			"Russian Suite"\
        "Sinhalese"			"Sinhalese Suite"\
        "Slovak"			"Slovak Suite"\
        "Slovene"			"Slovene Suite"\
        "Albanian"			"Albanian Suite"\
        "Serbian"			"Serbian Suite"\
        "Swedish"			"Swdish Suite"\
        "Tamil"				"Tamil Suite"\
        "Telugu"			"Telugu Suite"\
        "Thai"				"Thai Suite"\
        "Turkish"			"Turkish Suite"\
        "Ukrainian"			"Ukrainian Suite"\
        "Exit"				"Cancel & Exit" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    English) 		dialect="en-US" main_menu	$dialect;;
	    Spanish)	    dialect="es-MX" main_menu	$dialect;;
	    Afrikaans)		dialect="af" 	main_menu	$dialect;;
	    Arabic)			dialect="ar" 	main_menu	$dialect;;
	    Belarusian)		dialect="be" 	main_menu	$dialect;;
	    BengaliBD)		dialect="bn-BD" main_menu	$dialect;;
	    BengaliIN)		dialect="bn-IN" main_menu	$dialect;;
	    Catalan)		dialect="ca" 	main_menu	$dialect;;
	    Czech)			dialect="cs" 	main_menu	$dialect;;
	    Welsh)			dialect="cy" 	main_menu	$dialect;;
	    Danish)			dialect="da" 	main_menu	$dialect;;
	    German)			dialect="de" 	main_menu	$dialect;;
	    Greek)			dialect="el" 	main_menu	$dialect;;
	    Esperanto)		dialect="eo" 	main_menu	$dialect;;
	    Estonian)		dialect="et" 	main_menu	$dialect;;
	    Basque)			dialect="eu" 	main_menu	$dialect;;
	    Persian)		dialect="fa" 	main_menu	$dialect;;
	    Finnish)		dialect="fi" 	main_menu	$dialect;;
	    French)			dialect="fr" 	main_menu	$dialect;;
	    Frisian)		dialect="fy-NL" main_menu	$dialect;;
	    Irish)			dialect="ga-IE" main_menu	$dialect;;
	    Galician)		dialect="gl" 	main_menu	$dialect;;
	    Gujarati)		dialect="gu" 	main_menu	$dialect;;
	    Hebrew)			dialect="he" 	main_menu	$dialect;;
	    Croatian)		dialect="hr" 	main_menu	$dialect;;
	    Hungarian)		dialect="hu" 	main_menu	$dialect;;
	    Indonesian)		dialect="id" 	main_menu	$dialect;;
	    Icelandic)		dialect="is" 	main_menu	$dialect;;
	    Italian)		dialect="it" 	main_menu	$dialect;;
	    Japanese)		dialect="ja" 	main_menu	$dialect;;
	    Georgian)		dialect="ka" 	main_menu	$dialect;;
	    Kazakh)			dialect="kk" 	main_menu	$dialect;;
	    Kannada)		dialect="kn" 	main_menu	$dialect;;
	    Korean)			dialect="ko" 	main_menu	$dialect;;
	    Kurdish)		dialect="ku" 	main_menu	$dialect;;
	    Lithuanian)		dialect="lt" 	main_menu	$dialect;;
	    Latvian)		dialect="lv" 	main_menu	$dialect;;
	    Macedonian)		dialect="mk" 	main_menu	$dialect;;
	    Malayalam)		dialect="ml" 	main_menu	$dialect;;
	    Mongolian)		dialect="mn" 	main_menu	$dialect;;
	    Marathi)		dialect="mr" 	main_menu	$dialect;;
	    Norwegian)		dialect="nb-NO" main_menu	$dialect;;
	    Flemish)		dialect="nl" 	main_menu	$dialect;;
	    Nynorsk)		dialect="nn-NO" main_menu	$dialect;;
	    Occitan)		dialect="oc" 	main_menu	$dialect;;
	    Oriya)			dialect="or"	main_menu	$dialect;;
	    Punjabi)		dialect="pa-IN" main_menu	$dialect;;
	    Polish)			dialect="pl"	main_menu	$dialect;;
	    Portuguese)		dialect="pt-PT" main_menu	$dialect;;
	    Romansh)		dialect="rm"	main_menu	$dialect;;
	    Romanian)		dialect="ro"	main_menu	$dialect;;
	    Russian)		dialect="ru"	main_menu	$dialect;;
	    Sinhalese)		dialect="si"	main_menu	$dialect;;
	    Slovak)			dialect="sk"	main_menu	$dialect;;
	    Albanian)		dialect="sq"	main_menu	$dialect;;
	    Serbian)		dialect="sr"	main_menu	$dialect;;
	    Swedish)		dialect="sv-SE" main_menu	$dialect;;
	    Tamil)			dialect="ta"	main_menu	$dialect;;
	    Telugu)			dialect="te"	main_menu	$dialect;;
	    Thai)			dialect="th"	main_menu	$dialect;;
	    Turkish)		dialect="tr"	main_menu	$dialect;;
	    Ukrainian)		dialect="uk"	main_menu	$dialect;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
 done
}
main_menu()
{
	while true
do
dialog --clear --title "Select a Version" \
        --menu "\n\n\
        Choose a catagory:" 20 51 4 \
        "Internet"				"Internet\Office Programs" \
        "Office"				"Office Programs"\
        "Return"    			"Return To Menu"\
	    "Exit"          		"To exit this Program" 2> menuchoice.temp.$$
retopt=$?
choice=`cat menuchoice.temp.$$`
rm -f menuchoice.temp.$$
case $retopt in
    0)
	case $choice in
	    Internet)	internet_cat $dialect;;
	    Office)		office_cat;;
	    Exit) 		exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done	
}
	wget "http://pupbuntu.50webs.com/1.wav"
	wget "http://pupbuntu.50webs.com/2.wav"
	wget "http://pupbuntu.50webs.com/3.wav"
	wget "http://pupbuntu.50webs.com/4.wav"
	wget "http://pupbuntu.50webs.com/firefox.wav"
	wget "http://pupbuntu.50webs.com/thunderbird.wav"
	wget "http://pupbuntu.50webs.com/dbus.wav"
	wget "http://pupbuntu.50webs.com/dbustro.wav"
	clear
	echo "Menu will appear after begin in 5 seconds...."
	sleep 5
select_language

[/b][/code]

This is a flow chart for the unrealesed v1.2

Code: Select all

############################################################
############################################################
## Drone's Installer: (c) Ronald Lee Harsh 2010, NM  -USA ##
## This script and all of it's contents herein are the    ##
## sole property of Ronald Lee Harsh and their affiliates ##
## and may not be reproduced, modified or distributed un- ##
## less these headers remain in-tact.  Ronald Lee Harsh   ##
## distributes this program 'as-is' and does not accept   ##
## any liabilities for damages, errors or system damages  ##
## that may occur as a result of running this program.    ##
## By running this script you accept the fact that it co- ##
## mes with no warranty, and misuse may result in damages ##
## of your computing system (i.e. hardware, software, in- ##
## ternal and external components, file damages) in part  ##
## or in whole.  If you have any questions concerning th- ##
## is waiver of liability please halt, e-mail Ronald Lee- ##
## Harsh at: pupbuntu@hotmail.com, and do not run this    ##
## script until official contact has been made in regards ##
## to any reservations that you may have.  [END]          ##
############################################################
##				Drone's Automatic Installer				  ##
############################################################
############################################################
##														  ##
## The following reflects the hierarchy of the program t- ##
## his is an expanding numerical flow chart.			  ##
##														  ##
############################################################
############################################################
Program Structure:

Exec: >> installer 										  (1
		>> select_language 								  (2
		>> menu_listing 								  (3
			>> internet_select 		(go:I)				  (4
			>> office_select 		(go:II)				  (5
			>> gaming_select 		(go:III)			  (6
			>> system_select 		(go:IV)				  (7
			>> utility_select 		(go:V)				  (8
				>> internet_select						  (I
					>> Firefox		(go:VI)
					>> Opera		(go:VI)
					>> GoogleChrome (go:VI)
						>> Firefox35(go:VI)				  (9
						>> Firefox36(go:VI)				  (10
						>> Opera1010(go:VI)				  (11
						>> GoogleC4 (go:VI)				  (12
				>> office_select						  (II
					>> OpenOfficeCD (go:VI)				  (13
				>> gaming_select						  (III
					>> gens			(go:VI)				  (14
					>> zsnes		(go:VI)				  (15
					>> eduke		(go:VI)				  (16
					>> freeciv		(go:VI)				  (17
				>> system_select						  (IV
					>> uninstaller	(go:VI)				  (18
				>> utility_select						  (V
					>> FileZilla	(go:VI)				  (19
					>> JRE_6		(go:VI)				  (20
					>> devx			(go:VI)				  (21
			>> dependancy_check							  (VI
				dbus_check								  (22
				sdl_check								  (23
				java_check								  (24
				glib_check								  (25
				nvida_check								  (26
				atar_check			(go:VII)			  (27
			>> download_packages						  (VII
				retain_pets			(go:29)				  (28
					>> install_pets						  (29
						>> link_desktop					  (30
							return	(go:3)				  (31
			>> download_firefox							  (VIII
				retain_packages							  (32
					>> extract_transfer					  (33
					>> link_xterm						  (34
					>> link_desktop						  (35
						return 		(go:3)				  (36
			>> uninstallaer								  (VX
				obtain_gname						      (37
					>> process_directories				  (38
						remove_directories				  (39
						remove_desktops					  (40
						remove_shared_files				  (41
			>> terminate_program
#############################################################
Variable Listing:
	base, execute, trunk, dirs, icon, icon_locale, pets, gpet,
	desktop_type, desktop_system, rcache, vlink, url_long, 
	url_short, gname, g_out, rnd_dir, set_path, function_q,
	mime_type, char_set, dialect, reigon_set, nnmods_set
*************************************************************
*******************(c)Ronald Lee Harsh***********************
				
Please note that this flow chart is subject to change at anytime w/out prior notices.
Last edited by Drone-87401 on Sun 24 Jan 2010, 13:31, edited 3 times in total.
// [i]A word from our sponsors..[/i]
#include <iostream>
using namespace std;
main()
{
cout << "Linux Rocks! \n";
return 0;
}

[img]http://tinypic.com/316x1kx.png[/img]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: Firefox Install Script

#2 Post by seaside »

Drone-87401,

Good start and also In addition to the suggestions posted here -

http://murga-linux.com/puppy/viewtopic. ... 098#384098
about combining variables and reducing the code size, this part -

Code: Select all

 echo '<Program label="Firefox Web Browser" icon="/usr/share/icons/2006800168.png">firefox</Program>' > file2.txt

sed '176r file2.txt' < /root/.jwmrc > tempFile.txt
mv tempFile.txt .jwmrc
rm file2.txt 
edits an automatically generated file (.jwmrc) which represents the current menu setup and has no permanent effect. The menu system can best be generated by creating or linking a "firefox.desktop" file in "/usr/share/applications".

When the window manager starts, it picks up the menu items for programs from the xxx.desktop files.

cheers,
s

User avatar
Drone-87401
Posts: 72
Joined: Sun 03 Jan 2010, 18:54

Re: Firefox Install Script

#3 Post by Drone-87401 »

seaside wrote:Drone-87401,

Good start and also In addition to the suggestions posted here -

http://murga-linux.com/puppy/viewtopic. ... 098#384098
about combining variables and reducing the code size, this part -

Code: Select all

 echo '<Program label="Firefox Web Browser" icon="/usr/share/icons/2006800168.png">firefox</Program>' > file2.txt

sed '176r file2.txt' < /root/.jwmrc > tempFile.txt
mv tempFile.txt .jwmrc
rm file2.txt 
edits an automatically generated file (.jwmrc) which represents the current menu setup and has no permanent effect. The menu system can best be generated by creating or linking a "firefox.desktop" file in "/usr/share/applications".

When the window manager starts, it picks up the menu items for programs from the xxx.desktop files.

cheers,
s
Great ideal about the firefox.desktop file, Ill get that in there. Yes I read the shrinking ideal & honestly the final version is going to be heavily reduced. However, several people wanted an automated install quickly (so that's what I gave them.) As you can tell, I only put about 2 hours worth of work into that script - I'm sure when I go back to edit the script I will heavily reduce it as well.

Here is food for thought, I am currently thinking about abandoning that script. As I am a C++ programmer, I can write a better program that will allow the user to more easily install. And as in my opinion C++ is far superior than terminal scripting, it will allow for far more advanced features. I have currently started a project w/several of my students @ SJJC that will allow Linux (puppy) users to install a broad-range of Linux apps (about 120) and have the apps support automatic-updating. But this program is still heavily in the alpha stages.

Your tip is very useful though, I find that your ideal is truly a unique ideal and we all thank you very much for giving us such a great ideal - and you can be assured that you see it implemented on the next release.

Thank you,

Ronald L. Harsh
// [i]A word from our sponsors..[/i]
#include <iostream>
using namespace std;
main()
{
cout << "Linux Rocks! \n";
return 0;
}

[img]http://tinypic.com/316x1kx.png[/img]

User avatar
Drone-87401
Posts: 72
Joined: Sun 03 Jan 2010, 18:54

Re: Firefox Install Script

#4 Post by Drone-87401 »

seaside wrote:Drone-87401,

Good start and also In addition to the suggestions posted here -

http://murga-linux.com/puppy/viewtopic. ... 098#384098
about combining variables and reducing the code size, this part -

Code: Select all

 echo '<Program label="Firefox Web Browser" icon="/usr/share/icons/2006800168.png">firefox</Program>' > file2.txt

sed '176r file2.txt' < /root/.jwmrc > tempFile.txt
mv tempFile.txt .jwmrc
rm file2.txt 
edits an automatically generated file (.jwmrc) which represents the current menu setup and has no permanent effect. The menu system can best be generated by creating or linking a "firefox.desktop" file in "/usr/share/applications".

When the window manager starts, it picks up the menu items for programs from the xxx.desktop files.

cheers,
s
We took your advice sir. We added a .desktop file that is now put into the /usr/share/applications folder as well. We added better icon support and multiple language as well. Check out our new program at: http://murga-linux.com/puppy/viewtopic.php?t=51500 and let us know what you think. Once again, thank you for your suggestions seaside.
// [i]A word from our sponsors..[/i]
#include <iostream>
using namespace std;
main()
{
cout << "Linux Rocks! \n";
return 0;
}

[img]http://tinypic.com/316x1kx.png[/img]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: Firefox Install Script

#5 Post by seaside »

Drone-87401 wrote:
We took your advice sir. We added a .desktop file that is now put into the /usr/share/applications folder as well. We added better icon support and multiple language as well. Check out our new program at: http://murga-linux.com/puppy/viewtopic.php?t=51500 and let us know what you think. Once again, thank you for your suggestions seaside.
Drone-87401,

Hey 10/4 (this is like the CB radio days) :D

A small item here-

"Firefox_3.5.7" "Thunderbird Email Suite"

I haven't tried to run the program yet, but as posted here,
If you ran this code, you probably noticed that the "firefox.desktop" file was not created.

In several places you'll find this -
$gname.desktop

Should you let your class find the answer as to what is wrong with this expression? or simply point out that there is no declared variable called "gname.desktop". In order for "xxx.desktop" to appear with the "xxx" part as a variable, it must be expanded with quotes like this "$gname".desktop.

Cheers,
s

User avatar
Drone-87401
Posts: 72
Joined: Sun 03 Jan 2010, 18:54

Re: Firefox Install Script

#6 Post by Drone-87401 »

seaside wrote:
Drone-87401 wrote:
We took your advice sir. We added a .desktop file that is now put into the /usr/share/applications folder as well. We added better icon support and multiple language as well. Check out our new program at: http://murga-linux.com/puppy/viewtopic.php?t=51500 and let us know what you think. Once again, thank you for your suggestions seaside.
Drone-87401,

Hey 10/4 (this is like the CB radio days) :D

A small item here-

"Firefox_3.5.7" "Thunderbird Email Suite"

I haven't tried to run the program yet, but as posted here,
If you ran this code, you probably noticed that the "firefox.desktop" file was not created.

In several places you'll find this -
$gname.desktop

Should you let your class find the answer as to what is wrong with this expression? or simply point out that there is no declared variable called "gname.desktop". In order for "xxx.desktop" to appear with the "xxx" part as a variable, it must be expanded with quotes like this "$gname".desktop.

Cheers,
s
Actually $gname is the name of the downloaded package as in the case with Firefox it is firefox.3.5.7.desktop and yes that file does show up where it is supposed to "$gname <- that is the expression we are looking at. .desktop is not being declared as a var so it will be added to the tail of $gname so firefox.3.5.7 becomes firefox.3.5.7.desktop. We had extensive runs of this script, and I can confirm that there are zero bugs within the script. It may look weird, but run it. Once you do, you'll notice it works. :D

Thank you,
Ronald Harsh
// [i]A word from our sponsors..[/i]
#include <iostream>
using namespace std;
main()
{
cout << "Linux Rocks! \n";
return 0;
}

[img]http://tinypic.com/316x1kx.png[/img]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#7 Post by seaside »

Drone-87401,

Yes, indeed it runs and gives great feedback. Very nice work.

As to variable use, look what happens when typing the following in a terminal.

Code: Select all

  
# gname="firefox"
# echo $gnameANYOTHERTEXT

# echo $gnameANYOTHERTEXT-9999
-9999
# 
Nothing or unintended items are returned when additional text or numbers are appended to a variable.

"$gname.desktop" works in this particular case because the .(dot) and certain other symbols, act as a separator for the variable. This will not always be so and not quoting the variables in many cases may lead to unexpected results.


I really liked all the vocalization of the installation - it gives a great feeling of efficient activity going on... :D

Cheers,
s

User avatar
Drone-87401
Posts: 72
Joined: Sun 03 Jan 2010, 18:54

thank you

#8 Post by Drone-87401 »

seaside wrote:Drone-87401,

Yes, indeed it runs and gives great feedback. Very nice work.

As to variable use, look what happens when typing the following in a terminal.

Code: Select all

  
# gname="firefox"
# echo $gnameANYOTHERTEXT

# echo $gnameANYOTHERTEXT-9999
-9999
# 
Nothing or unintended items are returned when additional text or numbers are appended to a variable.

"$gname.desktop" works in this particular case because the .(dot) and certain other symbols, act as a separator for the variable. This will not always be so and not quoting the variables in many cases may lead to unexpected results.


I really liked all the vocalization of the installation - it gives a great feeling of efficient activity going on... :D

Cheers,
s
Well sir, I guess we owe you a lot of thanks for your wonderful ideal about the .desktop file (that was really thinkin' on your behalf.) All programs must get their start from somewhere and we are glad that we have informed people such as yourself that are helping us out in our continuing quest to deliver the best product. We are really aimed at helping new linux users out, and a little automation can go a really long way. We are currently working on exporting this program to a GTK format (though I'm not yet sure how that's going.) Thank you for your kind words once more.

Ronald L. Harsh

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

Re: Firefox Install Script

#9 Post by DMcCunney »

Drone-87401 wrote: Here is food for thought, I am currently thinking about abandoning that script. As I am a C++ programmer, I can write a better program that will allow the user to more easily install. And as in my opinion C++ is far superior than terminal scripting, it will allow for far more advanced features. I have currently started a project w/several of my students @ SJJC that will allow Linux (puppy) users to install a broad-range of Linux apps (about 120) and have the apps support automatic-updating. But this program is still heavily in the alpha stages.
Are you thinking this way because C++ is your preferred language and you're simply more comfortable working in it?

I'd think twice about it. Shell scripts are intended for cases like the one you are dealing with. They can be written quickly, modified easily, and are efficient enough to handle this sort of task. There's nothing about a Mozilla apps install routine that really needs to be in machine code. (The Linux install routines with Mozilla Linux ports are shell scripts.)

And a shell script is easily modifiable/extensible. Mozilla apps are constantly evolving with frequent new alpha/beta/production releases. Far easier, I should think, to keep a shell script updated, than have to change the C++ code, compile, debug, and issue a fresh build. More folks here can program in the shell than in C++, so you are more likely to get contributed code.
______
Dennis

Post Reply