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...
-
Rava
- Contributor

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

- Posts: 768
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
-
Contact:
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)
rych
-
Rava
- Contributor

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

- Posts: 711
- Joined: 31 Aug 2017, 21:18
- Distribution: Nemesis Xfce/MATE x64
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=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741
M. Eerie
-
Rava
- Contributor

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

- Posts: 8911
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
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)

That's a phenomenal piece of code
Rava. Thank you for posting it.

I never knew it was possible to catch a Ctrl+C !
Ed_P
-
Rava
- Contributor

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

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
Rava
-
M. Eerie
- Moderator

- Posts: 711
- Joined: 31 Aug 2017, 21:18
- Distribution: Nemesis Xfce/MATE x64
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=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741
M. Eerie
-
M. Eerie
- Moderator

- Posts: 711
- Joined: 31 Aug 2017, 21:18
- Distribution: Nemesis Xfce/MATE x64
Post#69
by M. Eerie » 13 Mar 2025, 03:23
Time for a revisited version.
Removed rsync dependency as this version relies solely on the mksquashfs options. Took a while to figure out the -wildcards handling...
Additionally, the new browsers Brave, Zen and Librewolf have been included.
Code: Select all
#!/usr/bin/env bash
#
# bbprofile v.2025-03
#
###
### SET YOUR DEFAULT OPTIONS HERE ###
###
set_defaults() {
brw="${1:-f}" ### browser: firefox by default
comp="${2:-z}" ### compression method: (x)zm / (z)std
exclude="${3:-y}" ### exclude option y/n
cp2mods="${4:-n}" ### copy to $MODDIR option y/n
}
#####################################
get_args() {
brw="${1,,}"
shift || true
comp="${1,,}"
shift || true
exclude="${1,,}"
shift || true
cp2mods="${1,,}"
}
display_usage() {
printf "Backs up your browser profile into a module.\n"
printf "\nUsage: %s [*f|b|c|u|l|o|p|v|z] [*x/z] [*y/n] [*y/n]\n" "${0##*/}"
printf "Optional parameters\n"
printf "===================\n\n"
printf "1) Supported Browsers:\n\tf :: firefox\n\tb :: brave\n\tc :: chrome\n\tu :: chromium\n\tl :: librewolf\n\to :: opera\n\tp :: palemoon\n\tv :: vivaldi\n\tz :: zen-browser\n"
printf "2) Accepted compression methods:\n\tx :: xzm or\n\tz :: zstd (lower, faster compression)\n"
printf "3) Whether to exclude bloat stuff from the profile or not. (Caches, backups, reports...)\n"
printf "4) Whether to automatically copy the resulting module to your %s directory or not.\n\n" "$MODDIR"
printf "(*) Marked options will be used by default. I.e: '%s f x y y'\n" "${0##*/}"
exit 1
}
case $# in
0) set_defaults "$@" ;;
[1-4]) get_args "$@" ;;
*) echo "==> Wrong number of arguments."; display_usage ;;
esac
! [[ $comp == "x" || $comp == "z" ]] && echo "==> Illegal compression parameter." && display_usage
profile=""
# (LOCATION OF BROWSER PROFILES AS OF 2024-02)
case "$brw" in
f) brw="firefox"; profile=".mozilla" ;;
b) brw="brave"; profile=".config/BraveSoftware" ;;
c) brw="chrome"; profile=".config/google-chrome" ;;
u) brw="chromium"; profile=".config/chromium" ;;
l) brw="librewolf"; profile=".librewolf" ;;
o) brw="opera"; profile=".config/opera" ;;
p) brw="palemoon"; profile=".moonchild productions" ;;
v) brw="vivaldi"; profile=".config/vivaldi" ;;
z) brw="zen"; profile=".zen" ;;
*) echo "==> Illegal parameter."; display_usage ;;
esac
[[ ! -d "$HOME/$profile" ]] && echo "==> Browser profile not found!" && exit 1
module="/tmp/009-$brw-profile-$(date +%Y%m%d-%H%M).xzm"
comp_method="-comp xz -Xbcj x86" ### -keep-as-directory
[[ $comp == x ]] || comp_method="-comp zstd" ### -Xcompression-level 22
exclude_patterns=()
[[ $exclude == "y" ]] && exclude_patterns=(
"*backups"
"cache*"
"data.safe.bin"
"*dumps"
"*popen*"
"*rash*"
"*report*"
"staged/*"
"*storage"
)
cmd="mksquashfs $HOME/$profile $module $comp_method -b 1M -noappend -no-strip -wildcards"
cmd+=$(printf " -e '... %s'" "${exclude_patterns[@]}")
if eval $cmd; then
tput bold
if [[ $cp2mods == "y" ]]; then
cp -a "$module" "$PORTDIR/modules" 2>/dev/null
tput setaf 2; echo "Module copied and ready to be activated at next boot"
else
tput setaf 4; echo "Your $module module was created"
fi
else
tput setaf 1; echo "Something went wrong"
exit 1
fi
exit 0
Feedback is always welcome.
> Does not compute_
https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741
M. Eerie
-
M. Eerie
- Moderator

- Posts: 711
- Joined: 31 Aug 2017, 21:18
- Distribution: Nemesis Xfce/MATE x64
Post#70
by M. Eerie » 14 Mar 2025, 13:39
Modified so that the module is not copied by default to your $MODDIR folder.
> Does not compute_
https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741
M. Eerie
-
M. Eerie
- Moderator

- Posts: 711
- Joined: 31 Aug 2017, 21:18
- Distribution: Nemesis Xfce/MATE x64
Post#71
by M. Eerie » 12 Apr 2025, 10:05
New version that includes (and defaults to)
lz4 compression:
Code: Select all
#!/usr/bin/env bash
#
# bbprofile v.2025-04
#
###
### SET YOUR DEFAULT OPTIONS HERE ###
###
set_defaults() {
brw="${1:-f}" ### browser: portable firefox by default
comp="${2:-l}" ### compression method: (x)zm / (z)std / (l)z4
exclude="${3:-y}" ### exclude option y/n
cp2mods="${4:-y}" ### copy to $MODDIR option y/n
}
#####################################
get_args() {
brw="${1,,}"
shift || true
comp="${1,,}"
shift || true
exclude="${1,,}"
shift || true
cp2mods="${1,,}"
}
display_usage() {
printf "Backs up your browser profile into a module.\n"
printf "\nUsage: %s [*f|b|c|u|l|o|p|v|z] [*x/z] [*y/n] [*y/n]\n" "${0##*/}"
printf "Optional parameters\n"
printf "===================\n\n"
printf "1) Supported Browsers:\n\tf :: firefox\n\tb :: brave\n\tc :: chrome\n\tu :: chromium\n\tl :: librewolf\n\to :: opera\n\tp :: palemoon\n\tv :: vivaldi\n\tz :: zen-browser\n"
printf "2) Accepted compression methods:\n\tx :: xzm or\n\tz :: zstd (lower, faster compression)\n"
printf "3) Whether to exclude bloat stuff from the profile or not. (Caches, backups, reports...)\n"
printf "4) Whether to automatically copy the resulting module to your %s directory or not.\n\n" "$MODDIR"
printf "(*) Marked options will be used by default. I.e: '%s f x y y'\n" "${0##*/}"
exit 1
}
case $# in
0) set_defaults "$@" ;;
[1-4]) get_args "$@" ;;
*) echo "==> Wrong number of arguments."; display_usage ;;
esac
! [[ $comp == "l" || $comp == "z" || $comp == "x" ]] && echo "==> Illegal compression parameter." && display_usage
profile=""
# (LOCATION OF BROWSER PROFILES AS OF 2024-02)
case "$brw" in
f) brw="firefox"; profile=".mozilla" ;;
b) brw="brave"; profile=".config/BraveSoftware" ;;
c) brw="chrome"; profile=".config/google-chrome" ;;
u) brw="chromium"; profile=".config/chromium" ;;
l) brw="librewolf"; profile=".librewolf" ;;
o) brw="opera"; profile=".config/opera" ;;
p) brw="palemoon"; profile=".moonchild productions" ;;
v) brw="vivaldi"; profile=".config/vivaldi" ;;
z) brw="zen"; profile=".zen" ;;
*) echo "==> Illegal parameter."; display_usage ;;
esac
[[ ! -d "$HOME/$profile" ]] && echo "==> Browser profile not found!" && exit 1
module="/tmp/009-$brw-profile-$(date +%Y%m%d-%H%M).xzm"
comp_method="-comp xz -Xbcj x86" ### -keep-as-directory
[[ $comp == x ]] && comp_method="-comp xzm"
[[ $comp == z ]] && comp_method="-comp zstd" ### -Xcompression-level 22
[[ $comp == l ]] && comp_method="-comp lz4" ### -Xhc
exclude_patterns=()
[[ $exclude == "y" ]] && exclude_patterns=(
"*backups"
"cache*"
"data.safe.bin"
"*dumps"
"*popen*"
"*rash*"
"*report*"
"staged/*"
"*storage"
)
cmd="mksquashfs $HOME/$profile $module $comp_method -b 1M -noappend -no-strip -wildcards"
cmd+=$(printf " -e '... %s'" "${exclude_patterns[@]}")
if eval $cmd; then
tput bold
if [[ $cp2mods == "y" ]]; then
cp -a "$module" "$PORTDIR/modules" 2>/dev/null
tput setaf 2; echo "Module copied and ready to be activated at next boot"
else
tput setaf 4; echo "Your $module module was created"
fi
else
tput setaf 1; echo "Something went wrong"
exit 1
fi
exit 0
> Does not compute_
https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741
M. Eerie