Jump to content


Photo

Firefox 3.6.6


  • Please log in to reply
78 replies to this topic

#46 God Ginrai

God Ginrai

    Godmaster

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 3514 posts

Posted 08 July 2010 - 04:31 PM


I don't believe that's correct - the CWD is specified in the PXML, which in the case of Firefox is the root of the mounted pnd filesystem. Can you give a link to where you're getting that info from? Cheers.

The CWD (startdir) can be specified in the PXML, but it should be a relative path (= _not_ starting with '/', that is NAND root). And startdir is an optional attribute, default is ".". After you're sure it's starting in the right folder, you can set home to be there like this:
export HOME="$(pwd)"


$(pwd) or $(cwd)?

-God Ginrai

#47 urjaman

urjaman

    "I Know. We're going for a ride."

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 680 posts
  • Gender:Male
  • Location:Finland

Posted 08 July 2010 - 04:35 PM



I don't believe that's correct - the CWD is specified in the PXML, which in the case of Firefox is the root of the mounted pnd filesystem. Can you give a link to where you're getting that info from? Cheers.

The CWD (startdir) can be specified in the PXML, but it should be a relative path (= _not_ starting with '/', that is NAND root). And startdir is an optional attribute, default is ".". After you're sure it's starting in the right folder, you can set home to be there like this:
export HOME="$(pwd)"


$(pwd) or $(cwd)?

-God Ginrai

pwd = print working directory
$( <command> ) = this is replaced with the commands output
"" = so that the resulting path handles spaces properly
thus, $(pwd)

#48 hdonk

hdonk

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 214 posts

Posted 08 July 2010 - 06:18 PM

Ok, so I've had a play.
I hadn't realised that through the magic of overlayed filesystems that writing to the cwd would write in to the (correct?) appdata directory.

So I've changed the run script to the following:
#!/bin/sh
if [ \! -e .mozilla ]; then
   if [ -e ${HOME}/.mozilla ]; then
      gksudo --description 'Copying old settings directory' "cp -a ${HOME}/.mozilla ."
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Copy of old settings failed" --timeout 6
        exit 1
      fi
      mv ${HOME}/.mozilla ${HOME}/.mozilla-old
   else
      gksudo --description 'Settings directory setup' "mkdir .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Creating new settings directory failed" --timeout 6
        exit 1
      fi
      gksudo --description 'Settings directory setup' "chown ${USER} .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Changing ownership of settings directory failed" --timeout 6
        exit 1
      fi
   fi
fi

export HOME=.
./bin/firefox
The idea being that:
1) If you already have a .mozilla directory, it will be moved to the appdata directory.
2) If you don't have a .mozilla directory, it will be created in the appdata directory.
3) The ownership will be correct (This is added because I was testing with root and my login user and had a conflict)

If you guys are happy with this, I'll repackage. I'm not doing it until you are though :)

#49 urjaman

urjaman

    "I Know. We're going for a ride."

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 680 posts
  • Gender:Male
  • Location:Finland

Posted 08 July 2010 - 06:32 PM

Ok, so I've had a play.
I hadn't realised that through the magic of overlayed filesystems that writing to the cwd would write in to the (correct?) appdata directory.

So I've changed the run script to the following:

#!/bin/sh
if [ \! -e .mozilla ]; then
   if [ -e ${HOME}/.mozilla ]; then
      gksudo --description 'Copying old settings directory' "cp -a ${HOME}/.mozilla ."
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Copy of old settings failed" --timeout 6
        exit 1
      fi
      mv ${HOME}/.mozilla ${HOME}/.mozilla-old
   else
      gksudo --description 'Settings directory setup' "mkdir .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Creating new settings directory failed" --timeout 6
        exit 1
      fi
      gksudo --description 'Settings directory setup' "chown ${USER} .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Changing ownership of settings directory failed" --timeout 6
        exit 1
      fi
   fi
fi

export HOME=.
./bin/firefox
The idea being that:
1) If you already have a .mozilla directory, it will be moved to the appdata directory.
2) If you don't have a .mozilla directory, it will be created in the appdata directory.
3) The ownership will be correct (This is added because I was testing with root and my login user and had a conflict)

If you guys are happy with this, I'll repackage. I'm not doing it until you are though :)

Umm, why do you need sudo to copy the files? I mean if you can mv them (just after that cp) you should be able to cp them too. For chown i understand if you really think people have run firefox as root but with HOME set to their home and have an ext2 card (oh what a case...), and with that cp command below, never. FAT32 cards can't store user names /permissions, so as long as the old .mozilla dir can be read (and you already assumed you can move it...), all should be fine. Also you could run cp like this: cp -dR --preserve=timestamps , which is equivalent to cp -a but will not attempt to preserve mode and ownership (both not useful on FAT32).

#50 sebt3

sebt3

    homebrew player (P. & C.)

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 1897 posts
  • Gender:Male
  • Location:QC

Posted 08 July 2010 - 06:43 PM

 if [ \! -e .mozilla ]; then

You don't need to escape the negation.

if [ $? \!\=0 ]; then


if [ $? -ne 0 ]; then

for what it worth....

#51 God Ginrai

God Ginrai

    Godmaster

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 3514 posts

Posted 08 July 2010 - 06:45 PM


Ok, so I've had a play.
I hadn't realised that through the magic of overlayed filesystems that writing to the cwd would write in to the (correct?) appdata directory.

So I've changed the run script to the following:

#!/bin/sh
if [ \! -e .mozilla ]; then
   if [ -e ${HOME}/.mozilla ]; then
      gksudo --description 'Copying old settings directory' "cp -a ${HOME}/.mozilla ."
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Copy of old settings failed" --timeout 6
        exit 1
      fi
      mv ${HOME}/.mozilla ${HOME}/.mozilla-old
   else
      gksudo --description 'Settings directory setup' "mkdir .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Creating new settings directory failed" --timeout 6
        exit 1
      fi
      gksudo --description 'Settings directory setup' "chown ${USER} .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Changing ownership of settings directory failed" --timeout 6
        exit 1
      fi
   fi
fi

export HOME=.
./bin/firefox
The idea being that:
1) If you already have a .mozilla directory, it will be moved to the appdata directory.
2) If you don't have a .mozilla directory, it will be created in the appdata directory.
3) The ownership will be correct (This is added because I was testing with root and my login user and had a conflict)

If you guys are happy with this, I'll repackage. I'm not doing it until you are though :)

Umm, why do you need sudo to copy the files? I mean if you can mv them (just after that cp) you should be able to cp them too. For chown i understand if you really think people have run firefox as root but with HOME set to their home and have an ext2 card (oh what a case...), and with that cp command below, never. FAT32 cards can't store user names /permissions, so as long as the old .mozilla dir can be read (and you already assumed you can move it...), all should be fine. Also you could run cp like this: cp -dR --preserve=timestamps , which is equivalent to cp -a but will not attempt to preserve mode and ownership (both not useful on FAT32).


I agree with urjaman's sentiments.

-God Ginrai

#52 hdonk

hdonk

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 214 posts

Posted 08 July 2010 - 07:49 PM



Ok, so I've had a play.
I hadn't realised that through the magic of overlayed filesystems that writing to the cwd would write in to the (correct?) appdata directory.

So I've changed the run script to the following:

#!/bin/sh
if [ \! -e .mozilla ]; then
   if [ -e ${HOME}/.mozilla ]; then
      gksudo --description 'Copying old settings directory' "cp -a ${HOME}/.mozilla ."
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Copy of old settings failed" --timeout 6
        exit 1
      fi
      mv ${HOME}/.mozilla ${HOME}/.mozilla-old
   else
      gksudo --description 'Settings directory setup' "mkdir .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Creating new settings directory failed" --timeout 6
        exit 1
      fi
      gksudo --description 'Settings directory setup' "chown ${USER} .mozilla"
      if [ $? \!\=0 ]; then
         zenity --error --title="Problem" \
        --text "Changing ownership of settings directory failed" --timeout 6
        exit 1
      fi
   fi
fi

export HOME=.
./bin/firefox
The idea being that:
1) If you already have a .mozilla directory, it will be moved to the appdata directory.
2) If you don't have a .mozilla directory, it will be created in the appdata directory.
3) The ownership will be correct (This is added because I was testing with root and my login user and had a conflict)

If you guys are happy with this, I'll repackage. I'm not doing it until you are though :)

Umm, why do you need sudo to copy the files? I mean if you can mv them (just after that cp) you should be able to cp them too. For chown i understand if you really think people have run firefox as root but with HOME set to their home and have an ext2 card (oh what a case...), and with that cp command below, never. FAT32 cards can't store user names /permissions, so as long as the old .mozilla dir can be read (and you already assumed you can move it...), all should be fine. Also you could run cp like this: cp -dR --preserve=timestamps , which is equivalent to cp -a but will not attempt to preserve mode and ownership (both not useful on FAT32).


I agree with urjaman's sentiments.

-God Ginrai

I don't! I use ext2, so permissions & ownership are important to me, so I'd rather go overkill than underkill.
The sudo is needed in case the destination is non-current-user owned. The mv renames directories in the user's home dir, so no extra privs are needed. It's all been added to cope with edge conditions that I have run into.
As for using -ne instead of \!\=, I use -ne for string comparisons & \!\= for numerical comparisons, as a stylistic thing. As for the escapes, I've encountered versions of busybox bash that don't recognise those operators without the escape. So as it does no harm, I'd rather have them in there.
Anyway, enough of the discussion of my coding style. The question was whether this achieves what you want in terms of configuration in the right place. Given the nitpicking hasn't covered that, I'm assuming it's ok, and I'm going ahead with packaging it up. If you're not happy, make your own version. Ner ner ner. (Picks up toys and goes sulk)
:D B) :D

#53 sebt3

sebt3

    homebrew player (P. & C.)

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 1897 posts
  • Gender:Male
  • Location:QC

Posted 08 July 2010 - 07:56 PM

As for using -ne instead of \!\=, I use -ne for string comparisons & \!\= for numerical comparisons, as a stylistic thing. As for the escapes, I've encountered versions of busybox bash that don't recognise those operators without the escape. So as it does no harm, I'd rather have them in there.


It's not a problem of coding style, but a problem of conformance as per : http://www.gnu.org/s...nal-Expressions

!= operator compare strings
-ne -eq etc operators compare integer...
And to be standard sh compliant string comparaison have to be done this way :
if [[ "string1" != "string2" ]];then

but I guess your script work so never mind....

#54 hdonk

hdonk

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 214 posts

Posted 08 July 2010 - 08:04 PM


As for using -ne instead of \!\=, I use -ne for string comparisons & \!\= for numerical comparisons, as a stylistic thing. As for the escapes, I've encountered versions of busybox bash that don't recognise those operators without the escape. So as it does no harm, I'd rather have them in there.


It's not a problem of coding style, but a problem of conformance as per : http://www.gnu.org/s...nal-Expressions

!= operator compare strings
-ne -eq etc operators compare integer...
And to be standard sh compliant string comparaison have to be done this way :
if [[ "string1" != "string2" ]];then

but I guess your script work so never mind....

You're absolutely right, that is the compliant way, but as both ways works, I've used the way that makes sense to me - symbols list >, <, =, etc for numbers and -ne -le -lt, whatever for strings just (to me) looks right. It may not be POSIX, but IDC. :rolleyes:
D!

#55 urjaman

urjaman

    "I Know. We're going for a ride."

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 680 posts
  • Gender:Male
  • Location:Finland

Posted 08 July 2010 - 08:06 PM

I don't! I use ext2, so permissions & ownership are important to me, so I'd rather go overkill than underkill.
The sudo is needed in case the destination is non-current-user owned. The mv renames directories in the user's home dir, so no extra privs are needed. It's all been added to cope with edge conditions that I have run into.
As for using -ne instead of \!\=, I use -ne for string comparisons & \!\= for numerical comparisons, as a stylistic thing. As for the escapes, I've encountered versions of busybox bash that don't recognise those operators without the escape. So as it does no harm, I'd rather have them in there.
Anyway, enough of the discussion of my coding style. The question was whether this achieves what you want in terms of configuration in the right place. Given the nitpicking hasn't covered that, I'm assuming it's ok, and I'm going ahead with packaging it up. If you're not happy, make your own version. Ner ner ner. (Picks up toys and goes sulk)
:D B) :D

Random comments follow. Not copying ownership => you will own the copied files == good thing (as you dont need to chown them FFS). You can add permissions to copyable things which would in this case (i think) do no harm, but dont see a reason to copy them. I think a pnd shouldnt have to handle the case of it's cwd being unwritable by the current user. Busybox doesnt have bash. It has a few shells, most of you've propably met ash as a busybox shell (There's others, like hush & msh (i <3 msh))). I think its ok to escape those "!"'s as there seems to be no ill effect.

#56 hdonk

hdonk

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 214 posts

Posted 08 July 2010 - 08:16 PM

[andom comments follow. Not copying ownership => you will own the copied files == good thing (as you dont need to chown them FFS). You can add permissions to copyable things which would in this case (i think) do no harm, but dont see a reason to copy them. I think a pnd shouldnt have to handle the case of it's cwd being unwritable by the current user. Busybox doesnt have bash. It has a few shells, most of you've propably met ash as a busybox shell (There's others, like hush & msh (i <3 msh))). I think its ok to escape those "!"'s as there seems to be no ill effect.

You know, I agree with you re the ownership it, etc - and I'm close to being persuaded to do it your way on the assumption that everything is hunky dory in the setup the PND is being run. However if I do it that way and people run in to problems, I *will* blame it on you - 'urjaman made me do it!' :)
As I said I made it this way because I ran in to problems due to how I've been using my Pandora - multi users, changing default UID numbers, doing testing as root, etc, and doing it this way worked around those problems.

#57 God Ginrai

God Ginrai

    Godmaster

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 3514 posts

Posted 08 July 2010 - 08:32 PM


[andom comments follow. Not copying ownership => you will own the copied files == good thing (as you dont need to chown them FFS). You can add permissions to copyable things which would in this case (i think) do no harm, but dont see a reason to copy them. I think a pnd shouldnt have to handle the case of it's cwd being unwritable by the current user. Busybox doesnt have bash. It has a few shells, most of you've propably met ash as a busybox shell (There's others, like hush & msh (i <3 msh))). I think its ok to escape those "!"'s as there seems to be no ill effect.

You know, I agree with you re the ownership it, etc - and I'm close to being persuaded to do it your way on the assumption that everything is hunky dory in the setup the PND is being run. However if I do it that way and people run in to problems, I *will* blame it on you - 'urjaman made me do it!' :)
As I said I made it this way because I ran in to problems due to how I've been using my Pandora - multi users, changing default UID numbers, doing testing as root, etc, and doing it this way worked around those problems.


I'm fine with that. As far as the setup being fine, it looks right to me, BUT I am not too well versed in bash scripting, so I don't know all that is going on there.

-God Ginrai

#58 hdonk

hdonk

    GP32 Hardcore

  • GP32 Hardcore
  • PipPipPipPip
  • 214 posts

Posted 08 July 2010 - 08:39 PM

There's a PND with the gksudo version & the HOME=. script here:

firefox366-3.pnd

I'll have it on the appstore when it uploads ok.

Edit: On that note, I'm going to catch some Zzzs. Ice time 6am!

Edited by hdonk, 08 July 2010 - 08:40 PM.


#59 God Ginrai

God Ginrai

    Godmaster

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 3514 posts

Posted 08 July 2010 - 08:45 PM

There's a PND with the gksudo version & the HOME=. script here:

firefox366-3.pnd

I'll have it on the appstore when it uploads ok.

Edit: On that note, I'm going to catch some Zzzs. Ice time 6am!


Awesome. Will test it out and let you know how everything works. Thanks a bunch. ^_^

EDIT: Sadly, this PND does not even run for me. :(

-God Ginrai

Edited by God Ginrai, 08 July 2010 - 09:06 PM.


#60 urjaman

urjaman

    "I Know. We're going for a ride."

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 680 posts
  • Gender:Male
  • Location:Finland

Posted 08 July 2010 - 09:37 PM

There's a PND with the gksudo version & the HOME=. script here:

firefox366-3.pnd

I'll have it on the appstore when it uploads ok.

Edit: On that note, I'm going to catch some Zzzs. Ice time 6am!

You forgot chmod +x firefox.sh, thus this wont run.