commit 072f5fb9f08c1fd005894b6ffce038a4c2533ff4 Author: Alexandre CATTEAU Date: Mon Mar 14 19:45:28 2022 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8f86ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +variables.conf + diff --git a/README.md b/README.md new file mode 100644 index 0000000..76e2421 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Firefox profile archiving (Unix-like) + +Scripts permitting to save/restore Firefox profile to/from a defined location. + +### Requirements +* `p7zip` + +### Files +* `firefox-save.sh` performs a save of you Firefox profile. +* `firefox-load.sh` restores a save of you Firefox profile. +#### Installation +* `bashrc-ffarchiving` adds aliases to your shell prompt to call above scripts. +* `install.sh` copies `bashrc-ffarchiving` to bashrc extension directory with correct paths. + +### TODO diff --git a/firefox-load.sh b/firefox-load.sh new file mode 100755 index 0000000..034f562 --- /dev/null +++ b/firefox-load.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# The purpose of this script is to install a Firefox profile from a save location. + +source "$(dirname "$0")/variables.conf" + +# Remove current profile +rm -r $firefox_data_path/$profile_name + +# Install profile +7z x $local_path/$file_name -o$firefox_data_path + +exit 0 diff --git a/firefox-save.sh b/firefox-save.sh new file mode 100755 index 0000000..fbbdaab --- /dev/null +++ b/firefox-save.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# The purpose of this script is to zip a Firefox profile and stash it to a save location. + +source "$(dirname "$0")/variables.conf" + +# Remove old archive +rm $local_path/$file_name + +# Save profile +7z a $local_path/$file_name $firefox_data_path/$profile_name + +exit 0 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..f16a574 --- /dev/null +++ b/install.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +run_directory=$(dirname "$0") +$user=$(whoami) + +echo "Copying bashrc-ffarchiving to extensions directory..." +cp $run_directory/templates/bashrc-ffarchiving /home/$user/.bashrc.d/ +sed -i -e "s:PH_DIRECTORY:$run_directory:g" /home/$user/.bashrc.d/bashrc-ffarchiving + +echo "Finished install. Exiting..." +exit 0 diff --git a/templates/bashrc-ffarchiving b/templates/bashrc-ffarchiving new file mode 100644 index 0000000..60c5268 --- /dev/null +++ b/templates/bashrc-ffarchiving @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# ~/.bashrc.d/bashrc-ffarchiving +# byMasterKTO + +# Set Firefox profile archiving aliases +alias ff-load='PH_DIRECTORY/firefox-load.sh' +alias ff-save='PH_DIRECTORY/firefox-save.sh' diff --git a/variables.conf.template b/variables.conf.template new file mode 100644 index 0000000..c61145c --- /dev/null +++ b/variables.conf.template @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +file_name='profile.zip' +local_path="" # Set your "repository" here +firefox_data_path="$HOME/.mozilla/firefox" +profile_name='profile'