From ed3d99da9026f41bea90f5b358c529e7e42198b6 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Tue, 24 May 2016 02:29:02 -0400 Subject: [PATCH] Added linux --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2fa3dc1..34adae9 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ A sane default Firefox profile ## Installation -### For Mac +### Mac ```bash NAME=$RANDOM git clone https://austenwares.com/gogs/stonewareslord/firefox-link "$HOME/Library/Application Support/Firefox/Profiles/$NAME" -egrep -q '\[Profile\d+\]' "$HOME/Library/Application Support/Firefox/profiles.ini" +egrep -q '\[Profile\d+\]' "$HOME/Library/Application Support/Firefox/profiles.ini" if (( $? == 0 )); then printf "\n[Profile$(expr 1 + $(cat "$HOME/Library/Application Support/Firefox/profiles.ini" | egrep '\[Profile\d+\]' | tail -n1 | sed -e 's/\[Profile//' -e 's/\]//'))]\nName=firefox-link\nIsRelative=1\nPath=Profiles/$NAME">>"$HOME/Library/Application Support/Firefox/profiles.ini" else @@ -20,3 +20,21 @@ else fi '/Applications/Firefox.app/Contents/MacOS/firefox' -p ``` + +### Linux +```bash +NAME=$RANDOM +git clone https://austenwares.com/gogs/stonewareslord/firefox-link ~/.mozilla/firefox/$NAME +grep -qP '\[Profile\d+\]' ~/.mozilla/firefox/profiles.ini 2>&1 >/dev/null +if (( $? == 0 )); then + printf "\n[Profile$(expr 1 + $(cat ~/.mozilla/firefox/profiles.ini | grep -P '\[Profile\d+\]' ~/.mozilla/firefox/profiles.ini | tail -n1 | sed -e 's/\[Profile//' -e 's/\]//'))]\nName=firefox-link\nIsRelative=1\nPath=$NAME">>~/.mozilla/firefox/profiles.ini +else + mkdir -p ~/.mozilla/firefox + printf "\n[Profile0]\nName=firefox-link\nIsRelative=1\nPath=$NAME">>~/.mozilla/firefox/profiles.ini +fi +if command -v firefox 2>&1 /dev/null; then + firefox -p +else + firefox-bin -p +fi +```