bbprofile Backup Browser Profile

Here is a place for your projects which are not officially supported by the Porteus Team. For example: your own kernel patched with extra features; desktops not included in the standard ISO like Gnome; base modules that are different than the standard ISO, etc...
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

bbprofile Backup Browser Profile

Post#31 by Ed_P » 22 Sep 2021, 16:16

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:
Ed

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#32 by M. Eerie » 22 Sep 2021, 16:58

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.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

bbprofile Backup Browser Profile

Post#33 by Ed_P » 22 Sep 2021, 17:55

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..
Ed

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

bbprofile Backup Browser Profile

Post#34 by raja » 23 Sep 2021, 10:57

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.
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#35 by M. Eerie » 23 Sep 2021, 11:12

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!
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#36 by M. Eerie » 23 Sep 2021, 11:18

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.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#37 by M. Eerie » 23 Sep 2021, 19:47

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
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#38 by M. Eerie » 24 Sep 2021, 17:56

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.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

bbprofile Backup Browser Profile

Post#39 by Rapha_ » 25 Sep 2021, 00:29

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 ?

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#40 by M. Eerie » 25 Sep 2021, 11:17

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
Last edited by M. Eerie on 16 Oct 2021, 07:14, edited 1 time in total.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#41 by M. Eerie » 16 Oct 2021, 07:13

Fixed the above script to ensure /home is owned by root.

Please update your script
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#42 by M. Eerie » 22 Oct 2021, 08:07

In my tests, not solved at all.

Please, report yours.

Thanks.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

bbprofile Backup Browser Profile

Post#43 by raja » 24 Oct 2021, 09:41

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
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

User avatar
M. Eerie
Moderator
Moderator
Posts: 618
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

bbprofile Backup Browser Profile

Post#44 by M. Eerie » 24 Oct 2021, 10:37

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 $:
Last edited by M. Eerie on 24 Oct 2021, 11:26, edited 1 time in total.
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

bbprofile Backup Browser Profile

Post#45 by raja » 24 Oct 2021, 11:06

Please execute the script in root mode. profile and home will have 'root' permission.
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

Post Reply