Firefox on a USB memory stick!

Discussion of general topics about Mozilla Firefox
Post Reply
User avatar
Nitin
Moderator
Posts: 3483
Joined: February 27th, 2003, 9:38 pm
Location: San Jose, CA
Contact:

Post by Nitin »

alanjstr wrote:The market for a portable browser probably is not very large. Firebird allows you to install it anywhere. The point of this "hack" is to take your profile anywhere, too. Unfortunately, that is not how it was engineered.
http://bugzilla.mozilla.org/show_bug.cgi?id=150453
http://bugzilla.mozilla.org/show_bug.cgi?id=157662


Thanks for the links! Seems like there are multiple bugs open for this (different people saying the same thing in different ways).
I marked this bug as dependant on the above two:
http://bugzilla.mozilla.org/show_bug.cgi?id=211628
If you're not using Firefox, you're not surfing the web, you're suffering it.
Join the MZ folding@home team.
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

Post by chris_s »

I was trying to figure out how to build a cross platform usb mem install. I found this thread after finding the problems discussed here. I do think the market for a portable browser is probably one that will grow extremly fast once people find out about it. It will probably be really big in the computer tech crowd who are already starting to carry around utilities on usb devices.

I feel that having at least a 3 way install (Windows Linux Mac and maby even freebsd) sharing the same profile should be the goal. It should be possible to install to a vfat format.
(I don't think that symbolic or hard links are supported on vfat so the solution should not rely on them)

If the firebird team does not incorporate something like a --profile-directory command line switch that accepts a relitive path like ../profile and or if fb starts being distributed installer only then a project that provides downloads for this should be started. This project should try not to fork but just be an alternate install that tracks current fb.
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

cross platform usb

Post by chris_s »

everything in this post refers to 0.7 I had already started and didn't have time to start over with 0.8 yet.

I was able to get the windows version sandboxed with the above script. A bit of warning to others copy and paste from the post to notepad can result in spaces at the ends of lines that introduce spaces into the paths.

Linux version was easy to sandbox just set $HOME before running this can be done in a seperate wrapper shell script or the main excutable is a script that runs the binary so it can be done there.

I was able to use the profile wizard to get both using the same profile. But I have determined that this should be avoided. I had problems when installing a theme in one and then changing to the other. So seperate profile folders for the different platforms should be created.

Some files should be shared between the platforms.

1. bookmarks --- this is probably the most esential file to share.
2. history --- this would be nice and looks like it might work
3. pages that are allowed to use popups ---- I have not looked into this yet.

any other sugestions? look and feel stuff is probably not going to be compatable but what we really need here is the functional stuff.

vfat is probably the best filesystem format to use. It is the only one supported by both linux and windows (rw) vfat does not support symbolic links so they cannot be used to point to the windows bookmark file. Windows fire* does not appear to handle the bookmark file being a windows shortcut to the bookmark file under linux

Is the location of any of these files coded into any human readable files or are they hardcoded into the binary relative to the profile folder?

I'll probably switch to 0.8 before going much further.
jedbro
Posts: 1899
Joined: November 10th, 2002, 12:35 pm
Location: Mexico / Boulder Co.
Contact:

Post by jedbro »

Chris, could you post your linux script for the rest of us?
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

Post by chris_s »

#!/bin/sh
export HOME=$PWD
./mozillafirebird/mozillafirebird $1 $2 $3 $4 $5

#you may wish to change the last line to whatever the real path to executable is
#the $1 $2..... is just to pass any options I have not tested that.
#just writing this from memory
#that should do it 0.7 will make a .mozilla and a .pheonix in the current directory
#profile will be in .pheonix
#isn't linux easier
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

Post by chris_s »

the line
./mozillafirebird/mozillafirebird
I made a mozlin folder on root of drive and put the contents of MozillaFirebird in it to keep it seperate from the windows version. in that case the line would be
./mozlin/MozillaFirebird $1 $2 $3 $4 $5
linux is case sensitive so watch that.

Unless there is a place to sellect a different location for the bookmarks file.
I guess the best kludge for now for sharing bookmarks is just to add move/mv statments to the .bat and script files to move it back and forth probably need to test where it is first.

something like
if [ ! -e "./.phoenix/Profiles/default/*.slt/bookmarks.html" ]; then
mv ./Profiles/usbuser/Application\ Data/Phoenix/Profiles/default/*.slt/bookmarks.html ./phoenix/default/*.slt/
fi

you would need to change *.slt to whatever random # thing was created
and also create a section in the .bat file that moved it back to the windows location testing first to see if it is already there. I'm not quite up to speed on all that .bat programing so I will not post that at least not at this time. I have not tested the above just making it up as I go.

then after getting the bookmarks shared then start adding other files that are the same format in both platforms

you would have to manually remove bookmarks.htm from one platform first or you could maby test -nt (newer than) to move the file if the other platform has a newer version

This could get really complex if doing it 3 platforms unless mac is totally compatable with linux

I'll try to see if I can get 0.8 setup and something like this tested and I'll post back then.
SimmonsJ2K
Posts: 920
Joined: February 3rd, 2004, 2:45 pm
Location: Michigan
Contact:

Post by SimmonsJ2K »

user_pref("browser.bookmarks.file", "Path\\bookmarks.html");

it goes in user.js

too bad user.js also goes in the profile directory.

(edit)then again, that shouldn't be hard to work around.(/edit)
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

Post by chris_s »

thanks probably next to bookmarks password manager is probably second on the list of things needed to share I'll look in that same file(user.js). I think I should set up 0.8 first before going further.
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

relative path?

Post by chris_s »

thanks simmons j2k I was able to get that working 0.8 windows so far. But only using

user_pref("browser.bookmarks.file", "d:\\profileshare\\bookmarks.html");

need a relative path like ../profileshare/bookmarks.html
(would it be relative to the profile or relative to firefox.exe?)

or need to set an environmental variable in the bat file and shell script such as sProfile
and use that in the path.

I know no javascript however learning it is somewhere on my todo list.
tried googleing for "javascript tutorial" "file path"
and other varaitions. Could not find anything easilly also checked out
http://www.mozilla.org/unix/customizing.html#prefs

kinda stuck because everything should not be dependant on the drive being the same letter or the same mount point in linux.
sun76459
Posts: 2
Joined: February 12th, 2004, 9:03 am

work around of opening file dialog boxes - tested on win2k

Post by sun76459 »

gutzalpus wrote:Using the above batch file causes all the file dialog boxes not to work (save link target as, save page as, etc).


Creating a fake "Recent" directory in your %USERPROFILE% direcotry should solve this problem :)
Also, delete %USERPROFILE%\Application Data\Phoenix\pluginreg.dat and registry.dat in your startup script, otherwise, firefox can not open your profile sometimes.
chris_s
Posts: 28
Joined: February 5th, 2004, 6:04 am

Post by chris_s »

maby all that is needed to delete is registry.dat because that contains an absolute path to the profile Is the problem if the drive letter changes?

I saw a sugestion in a thunderbird (or is that thunderfox) pertaining to usb sticks that sugested editing that part of registry.dat to use the environment variable %AppData%

I havn't tried this yet.
chuonthis
Posts: 519
Joined: July 23rd, 2003, 10:17 am

Re: work around of opening file dialog boxes - tested on win

Post by chuonthis »

sun76459 wrote:
gutzalpus wrote:Using the above batch file causes all the file dialog boxes not to work (save link target as, save page as, etc).


Creating a fake "Recent" directory in your %USERPROFILE% direcotry should solve this problem :)
Also, delete %USERPROFILE%\Application Data\Phoenix\pluginreg.dat and registry.dat in your startup script, otherwise, firefox can not open your profile sometimes.
Also, you might want to create a fake "Desktop" dir in your %USERPROFILE%. Clicking on the Desktop icon in the Folders bar on the left of the Save dialog will take you to %USERPROFILE%\Desktop and may cause problems, etc.
User avatar
Nitin
Moderator
Posts: 3483
Joined: February 27th, 2003, 9:38 pm
Location: San Jose, CA
Contact:

Post by Nitin »

If you're not using Firefox, you're not surfing the web, you're suffering it.
Join the MZ folding@home team.
Walter K
Posts: 45
Joined: November 8th, 2002, 3:12 pm

Post by Walter K »

Here is another version of the script I posted earlier. I think the script can be used to run other mozilla apps as well (at your own risk).

Fixed:
1. Ever-changing drive letter assigned to USB drive on different machines. Now it all maps to a single user-defined drive all the time.
2. Script can be both ran from Command Prompt and from Windows Explorer.
3. More profile default windows folders are created (e.g. Desktop and Recent).
4. Now should work on Win9x

As usual, it's assumed that you are running a zipped build. Probably, it's a good idea to chain a registry keys file with this script, but success of its execution would be user permissions dependent.

Enjoy.


@REM This script is for running a Mozilla App from a USB drive.
@REM Requirements:
@REM 1. myInstallDir - folder where you installed your mozapp
@REM 2. myExeName - name of your mozapp.exe
@REM 3. myRoot - drive name to which current folder will always be mapped
@REM 4. USERNAME - profile name

@echo off
set myInstallDir=MozillaFirefox
set myExeName=firefox.exe
set myRoot=Q:
title Running %myExeName%

set myUsbRoot=%cd%
rem Win9x specific code - Win9x doesn't have cd variable
if NOT X%myUsbRoot%==X GOTO skip
echo @Prompt set MyUsbRoot=$P$_>%TEMP%.\#ETCD1.BAT
%COMSPEC% /C %TEMP%.\#ETCD1.BAT > %TEMP%.\#ETCD2.BAT
call %TEMP%.\#ETCD2.BAT
del %TEMP%.\#ETCD?.BAT

:skip
rem Map current location to myRoot - moz apps settings hard code absolute paths
if exist "%myRoot%" subst %myRoot% /D
subst %myRoot% %myUsbRoot%

rem This vars must be set
set USERNAME=usbuser
set USERPROFILE=%myRoot%\Profiles\%USERNAME%
set APPDATA=%USERPROFILE%\Application Data

rem setting temp dirs
set TEMP=%myRoot%\temp
set TMP=%TEMP%

rem make sure all needed dirs exist
ECHO Creating required folders...
if NOT exist "%USERPROFILE%" mkdir "%USERPROFILE%"
if NOT exist "%APPDATA%" mkdir "%APPDATA%"
if NOT exist "%USERPROFILE%\Desktop" mkdir "%USERPROFILE%\Desktop"
if NOT exist "%USERPROFILE%\Recent" mkdir "%USERPROFILE%\Recent"
if NOT exist "%TEMP%" mkdir "%TEMP%"
if NOT exist "%TMP%" mkdir "%TMP%"
ECHO Done

set mzAppPathName=%myRoot%\%myInstallDir%\%myExeName%
if NOT exist "%mzAppPathName%" GOTO NotFound
ECHO Running %myExeName%...
start /WAIT %mzAppPathName% %1 %2 %3
ECHO Done
GOTO CleanUp

:NotFound
ECHO %mzAppPathName% does not exist

:CleanUp
rem Remove temp drive mapping
ECHO Cleaning up...
if exist "%myRoot%" subst %myRoot% /D
ECHO Done

echo on


Edit 1: removed confusing comented out code, streamlined IFs and minor clean up. chuonthis - thanks for reminding me about blocks.
Edit 2: added code to compensate for absence of %cd% on Win9x. Back to using goto's and labels - Win9x doesn't like blocks?
Last edited by Walter K on April 25th, 2004, 6:25 pm, edited 2 times in total.
User avatar
DizzyWeb
Posts: 637
Joined: March 27th, 2003, 9:56 am

Post by DizzyWeb »

I would concider changing the filenames for Firefox to firefox.exe ;)
The author can never, in no way, be held responsible for any harm caused, mental or physical, by reading this post.
Post Reply