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
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

bbprofile Backup Browser Profile

Post#61 by Rava » 14 Sep 2022, 11:15

rych wrote:
14 Sep 2022, 09:59

Code: Select all

COMP_ZSTD="-comp zstd -b 256K"
mksquashfs /root/.mozilla/firefox/FirefoxProfile $PORTDIR/modules/fp.xzm $COMP_ZSTD -noappend -no-strip
That sure is a neat two-liner…
(a one-liner would be this)

Code: Select all

mksquashfs /home/guest/.mozilla/firefox/FirefoxProfile $PORTDIR/modules/fp.xzm -comp zstd -b 256K -noappend -no-strip
the reason M. Eerie uses the rsync approach is to stip all unneeded stuff like
M. Eerie wrote:
13 Sep 2022, 16:23
"Exclude caches, backups, storage and reports (crashes,dumps...)? [y/*] "
That would not work for your approach that easily.
Cheers!
Yours Rava

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

bbprofile Backup Browser Profile

Post#62 by rych » 14 Sep 2022, 15:07

Rava, I've edited my two-liner to use $HOME. As for exclusions, we can use -e (with -wildcards?) or -ef options to the mksquashfs. My Cache already points to a temporary location, and all other stuff inside I guess I still want to store exact -- I'm afraid to make assumptions about inner workings of Firefox profile. Perhaps I should experiment though and clean it, if it's safe, otherwise profile folder grown to hundreds of MB (without Cache)

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

bbprofile Backup Browser Profile

Post#63 by Rava » 14 Sep 2022, 15:23

I use a manual approach, I only update my browser profile when there is some major change in AddOns (which hardly ever happens), usually I create a new manual one by copying the most recent settings files - compressed this 985-palemoon-settings--RECENT--2022-08-19.xzm is 13.63 MB - but it also contains all my AddOns and their settings ( ematrix.sqlite - 5.06 MB uncompressed and ublock0.sqlite 20.50 MB uncompressed alone - and all my extensions are 15 MB uncompressed ) or when I do make an addition to my Bookmarks.

Even adding a search-plugin can be done in another way.

Aside from the palemoon-settings module I have 2 "settings/own scripts" modules - 991-usr_local_bin_YYYY-MM-DD.xzm which keeps my scripts and such, but no settings so that it can be used with any DE if I choose to use a different one - and 992-rootcopy_5.0_YYYY-MM-DD.xzm - that holds the settings from /etc/ /root/ and /home/guest/ (but not the browser ones) and is meant to be one version for every DE.
Both these modules are created regularly (via script), and currently I added /home/guest/.moonchild\ productions/pale\ moon/XXX.default/searchplugins/dictcc-deen.xml into 992-rootcopy_5.0_YYYY-MM-DD.xzm - instead of putting it into 985-palemoon-settings--RECENT--2022-08-19.xzm

I will move that there when there is a new palemoon version and I need updating my palemoon settings anyway.
Cheers!
Yours Rava

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

bbprofile Backup Browser Profile

Post#64 by M. Eerie » 14 Sep 2022, 18:15

Hi Rava.

Somehow the last lines of the script were stripped.

Please add this at the end after "sleep 2":

Code: Select all


sudo rsync -a --delete $empty/ $X && rmdir $X $empty && unset X empty brcfg excludeopts
exit 0
Thx
> 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
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

bbprofile Backup Browser Profile

Post#65 by Rava » 14 Sep 2022, 18:54

M. Eerie wrote:
14 Sep 2022, 18:15
Somehow the last lines of the script were stripped.
Ohh
M. Eerie wrote:
14 Sep 2022, 18:15
Please add this at the end after "sleep 2":
Done, hope it's fine now.

P.S. Maybe you want your script to catch Ctrl+C and other signals (e.g. the usual suspects are SIGHUP SIGINT SIGTERM)?

Look into some of porteus script's in /opt/porteus-scripts/ how that is done.
e.g. /opt/porteus-scripts/make-changes uses it:

Code: Select all

trap cleanup SIGHUP SIGINT SIGTERM
names the function to be called and the signals that should be trapped / monitored (SIGHUP SIGINT SIGTERM)
The function then defines what should be done (e.g. your cleanup as quoted in your post above) - That part can be put in whenever the user chooses a selection to end prematurely (that can happen at times that are not the end of the script) - or when some error occurred your script realized via looking into the return value of a critical call via $?, when a signal got trapped or at the end of the script:

Code: Select all

function cleanup(){
rm -rf $wrk >/dev/null 2>&1
rm -rf /mnt/vault*
[ -f $PIDLOCK ] && rm $PIDLOCK
}
Cheers!
Yours Rava

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

bbprofile Backup Browser Profile

Post#66 by Ed_P » 15 Sep 2022, 05:55

Rava wrote:
14 Sep 2022, 18:54
P.S. Maybe you want your script to catch Ctrl+C and other signals (e.g. the usual suspects are SIGHUP SIGINT SIGTERM)?

Look into some of porteus script's in /opt/porteus-scripts/ how that is done.
e.g. /opt/porteus-scripts/make-changes uses it:

Code: Select all

trap cleanup SIGHUP SIGINT SIGTERM
names the function to be called and the signals that should be trapped / monitored (SIGHUP SIGINT SIGTERM)
:shock: That's a phenomenal piece of code Rava. Thank you for posting it. :good: I never knew it was possible to catch a Ctrl+C !
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

bbprofile Backup Browser Profile

Post#67 by Rava » 15 Sep 2022, 06:04

Ed_P wrote:
15 Sep 2022, 05:55
That's a phenomenal piece of code Rava. Thank you for posting it. :good: I never knew it was possible to catch a Ctrl+C !
It's not my code, it's by our legendary Brokenman.
And defining such "exit_cleanup" function, it makes it easy to have it run the cleanup whenever there is a reason the script quits - be it at the end, be it due to an error that got caugh via examining $? (and is so severe that the script cannot continue) - or by trapping SIGHUP SIGINT SIGTERM. :)
Cheers!
Yours Rava

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

bbprofile Backup Browser Profile

Post#68 by M. Eerie » 20 Sep 2022, 10:24

Rava wrote:
14 Sep 2022, 18:54
Look into some of porteus script's in /opt/porteus-scripts/ how that is done
Yes, I'm aware of that. Already used this in my update-base nemesis script which is somewhat obsolete, btw. If I remember correctly, the updated version was included in my Nemesis MATE ISO because I wanted to split SIGINT and SIGTERM traps.

Been doing tests and even being easy as can be, I don't really feel the need for that, because the script runs fast and whenever you want to abort, it's almost done.

After all, it was once (sort of) a onliner as rych has also proved :)

Who knows, maybe sometime will be reworked. I'm thinking of setting default options and such...

Code: Select all


...

brcfg="${1,,}"
comp="${2,,}"
exclude="${3,}"
cp2mods="${4,}"

### SET YOUR DEFAULT OPTIONS HERE
get_defaults() {
brcfg="${1:-firefox}"   ### browser
comp="${2:-xzm}"      ### compression method
exclude="${3:-y}"     ### exclude option
cp2mods="${4:-y}"      ### copy to $MODDIR option
}

...

case $# in
    0) get_defaults; main; clean_exit ;;
    4) main; clean_exit ;;
    *) echo "==> Wrong number of arguments! (Used: ${#}) <=="
       echo
       display_usage
       exit 1
       ;;
esac
> 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

Post Reply