Page 3 of 5

bbprofile Backup Browser Profile

Posted: 22 Sep 2021, 16:16
by Ed_P
My system.

Code: Select all

guest@porteus:~$ uname -a
Linux porteus.example.net 5.14.3-porteus #1 SMP Sun Sep 12 11:12:49 MSK 2021 x86_64 Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz GenuineIntel GNU/Linux
guest@porteus:~$ whoami
guest
guest@porteus:~$ env | grep HOME
HOME=/home/guest
guest@porteus:~$ ls $HOME/.mozilla/
extensions/  firefox/  plugins@  systemextensionsdev/
guest@porteus:~$ echo $(xdg-user-dir DESKTOP)
/home/guest/Desktop
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# whoami
root
root@porteus:/home/guest# env | grep HOME
HOME=/root
root@porteus:/home/guest# ls $HOME/.mozilla/
/bin/ls: cannot access '/root/.mozilla/': No such file or directory
root@porteus:/home/guest# echo $(xdg-user-dir DESKTOP)
/root/Desktop
root@porteus:/home/guest# 
Note the output of my ls $HOME/.mozilla/ command.
M. Eerie wrote:
22 Sep 2021, 15:54
Peek it, man
In this very thread, you asked a year ago... For @ncmprhnsbl's sake, Peek it!!! :lol:
Ah! bbprofile Backup Browser Profile (Post by M. Eerie #77208) And I do have it, it's in my Optional folder. Thank you M. Eerie. :beer:

bbprofile Backup Browser Profile

Posted: 22 Sep 2021, 16:58
by M. Eerie
Ed_P wrote:
22 Sep 2021, 16:16
Note the output of my ls $HOME/.mozilla/ command.
Seems fine to me.
The "plugins@" folder is normal. Probably leftovers in your profile from older firefox versions.
Ed_P wrote:
22 Sep 2021, 16:16
/bin/ls: cannot access '/root/.mozilla/': No such file or directory
And this is fine too. Since you aren't using Firefox as root, there's not a ".mozilla" profile folder under /root folder.

bbprofile Backup Browser Profile

Posted: 22 Sep 2021, 17:55
by Ed_P
M. Eerie wrote:
22 Sep 2021, 16:58
The "plugins@" folder is normal. Probably leftovers in your profile from older firefox versions.
Actually it's a link to a folder that doesn't exist /usr/lib64/mozilla/plugins/. Thank you again M..

bbprofile Backup Browser Profile

Posted: 23 Sep 2021, 10:57
by raja
eerie, running the script in "guest" mode works. but,

the first requirement for building a "module"..whoami shall be "root" & module content folders with appropriate permissions.

I feel, script should execute under 'root', so that final module has root-root permissions and folder guest with 1000:100 permission.

bbprofile Backup Browser Profile

Posted: 23 Sep 2021, 11:12
by M. Eerie
raja wrote:
23 Sep 2021, 10:57
the first requirement for building a "module"..whoami shall be "root"
This seems to be the key :)
So, days ago I removed the "dir2xzm" command and replaced for the equivalent command below, which shouldn't need root permissions:

Code: Select all

mksquashfs $target/home $target/$profile -b 256K -comp xz -Xbcj x86 -noappend -keep-as-directory
Would you please check the posted (updated) script?
viewtopic.php?p=84191#p84191

Thanks for your feedback!

bbprofile Backup Browser Profile

Posted: 23 Sep 2021, 11:18
by M. Eerie
Hmmmm. Ok, I see that $target/home doesn't exists if you are root...

So it will work if you are normal (guest) user, but no if you are root.

I will test under root environment when I have the time.

Thanks.

bbprofile Backup Browser Profile

Posted: 23 Sep 2021, 19:47
by M. Eerie
Anyone running Firefox with root account, can tell me what the permissions look like?

I have no clue, since I have never used Firefox logged as root.

Thanks

bbprofile Backup Browser Profile

Posted: 24 Sep 2021, 17:56
by M. Eerie
OK, got it working also for root.

Just changed these lines:

Code: Select all

### mksquashfs $target/home $target/$profile -b 1M -comp zstd -b 1M -Xcompression-level 22 -noappend -keep-as-directory
### instead of the next one:
mksquashfs $target/home $target/$profile -b 256K -comp xz -Xbcj x86 -noappend -keep-as-directory
mv $target/$profile $(xdg-user-dir DESKTOP)
rsync -a --delete `mktemp -d`/ $target
by these:

Code: Select all

### mksquashfs $target$HOME $target/$profile -b 1M -comp zstd -b 1M -Xcompression-level 22 -noappend -keep-as-directory
### instead of the next one:
mksquashfs $target$HOME $target/$profile -b 256K -comp xz -Xbcj x86 -noappend -keep-as-directory
mv $target/$profile $(xdg-user-dir DESKTOP)
rsync -a --delete `mktemp -d`/ $target && rmdir /tmp/tmp.*
Please, update your script.

Thanks.

bbprofile Backup Browser Profile

Posted: 25 Sep 2021, 00:29
by Rapha_
With XFCE (v4)

Tried the last one script :
- No error
- Module created
- Module can be extracted (be carefull the ".mozilla" directory is hidden !)

But even if it seems to be mounted, the .mozilla folder is not visible either in Guest or in Root

in

Code: Select all

/mnt/live/memory/images
all modules are Root, except the profile-firefox module (Guest)...

Also maybe there is a problem with the paths ?

bbprofile Backup Browser Profile

Posted: 25 Sep 2021, 11:17
by M. Eerie
Rapha_ wrote:
25 Sep 2021, 00:29
But even if it seems to be mounted, the .mozilla folder is not visible either in Guest or in Root
Thanks for reporting, Rapha.

Forgive me cause I'm really busy these days.

This one should work for both accounts:

Code: Select all

#!/bin/bash
# bbprofile: Saves your browser profile into a .xzm module in your Desktop directory
# 

display_usage() {
  echo "Usage: "${0##*/}" <browser>" >&2
  echo -e 'Supported Browsers: \n\t -f (firefox)\n\t -o (opera)\n\t -v (vilvaldi)\n\t -u (chromium)\n\t -c (chrome)'
  exit 1
}

[[ $# -eq 1 ]] || display_usage

# (LOCATION OF BROWSER PROFILES AS OF 2020-05)
profile=
case $1  in
    firefox|-f) profile=.mozilla; brw="firefox" ;;
    opera|-o)  profile=.config/$1; brw="opera" ;;
    vivaldi|-v) profile=.config/$1; brw="vivaldi" ;;
    chromium|-u) profile=.config/$1; brw="chromium" ;;
    chrome|-c) profile=.config/google-chrome brw="chrome" ;;
    *) display_usage ;;
esac

target=`mktemp -d` && mkdir -p $target$HOME/$profile || exit
excludeopts=
read -p "Exclude caches, backups, storage and reports (crashes,dumps...) ? [y/n] "
echo
[[ ! ${REPLY,,} =~ ^(yes|y)$ ]] || excludeopts="--exclude=Cache --exclude *backups --exclude *storage --exclude *rash* --exclude *dumps --exclude *report"

rsync -av --delete-before --exclude=lock $excludeopts $HOME/$profile/ $target$HOME/$profile
profile=009-profile-"$brw"-$(date +%Y%m%d-%H%M).xzm

cd $target && sudo chown 0.0 home && cd -  ### FIXED
### if you want .zstd compression, use the following line
### mksquashfs $target$HOME $target/$profile -b 1M -comp zstd -b 1M -Xcompression-level 22 -noappend
### instead of the next one:
mksquashfs $target/ /tmp/$profile -b 256K -comp xz -Xbcj x86 -noappend ###-keep-as-directory
mv /tmp/$profile $(xdg-user-dir DESKTOP)
rsync -a --delete `mktemp -d`/ $target && rmdir /tmp/tmp.*

echo
echo "Your profile module is saved in" $(xdg-user-dir DESKTOP)/$profile
read -p "Would you like to copy it into your $PORTDIR/modules folder? [y/n] "
echo
if [[ ${REPLY,,} =~ ^(yes|y)$ ]]; then
    cp -p $(xdg-user-dir DESKTOP)/$profile $PORTDIR/modules
    echo "Module copied and ready to be activated at next boot"
  else echo "Module not copied in $MODDIR"
fi

exit

bbprofile Backup Browser Profile

Posted: 16 Oct 2021, 07:13
by M. Eerie
Fixed the above script to ensure /home is owned by root.

Please update your script

bbprofile Backup Browser Profile

Posted: 22 Oct 2021, 08:07
by M. Eerie
In my tests, not solved at all.

Please, report yours.

Thanks.

bbprofile Backup Browser Profile

Posted: 24 Oct 2021, 09:41
by raja
Eerie,

Replacing your 'modified' line with this, would make the module with right "permissions".

Code: Select all

cd $target && sudo chown -R 1000:100 home/guest && cd - 
I extracted the profile module and checked permissions for main folder,home and guest. perfect. Cheers

bbprofile Backup Browser Profile

Posted: 24 Oct 2021, 10:37
by M. Eerie
raja wrote:
24 Oct 2021, 09:41
cd $target && sudo chown -R 1000:100 home/guest && cd -
Should be chown -R 1000:1000, but this is only in case the 'guest' account is named guest. Think about if one user chooses another name for his account. Or if he uses the root account. That's why we are using $HOME variable, which holds this.

In any case, the /home folder must be owned by root. Then, the normal user folder (usually 'guest') belongs to user in guest group (whatever its name is).

After applying your suggested line, home, shall be owned by guest:

Code: Select all

guest@porteus:/tmp/tmp.cPqSl8yihK $:  ls -l
total 0
drwxr-xr-x 3 guest guest 60 Oct 24 12:13 home/
guest@porteus:/tmp/tmp.cPqSl8yihK $:

bbprofile Backup Browser Profile

Posted: 24 Oct 2021, 11:06
by raja
Please execute the script in root mode. profile and home will have 'root' permission.