]> gitweb.fluxo.info Git - utils-x11.git/commitdiff
Enhance firefox-profile
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 8 Mar 2019 21:28:51 +0000 (18:28 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 8 Mar 2019 21:28:51 +0000 (18:28 -0300)
firefox-profile

index 7d40d5e417b69ff6ba851ec3f0f5db0d36f5472b..2490c85389a83115eef7f2dcdd8140093c0ac9c4 100755 (executable)
@@ -3,13 +3,27 @@
 # Wrapper around firefox
 #
 
+# Parameters
+BASE="$HOME/.mozilla/firefox"
+PROFILES="$BASE/profiles"
+
+# Check
 if ! which firefox &> /dev/null; then
   echo "Please install firefox"
   exit 1
 fi
 
-if [ ! -z "$1" ]; then
-  firefox -p $1 -new-instance &
+# Dispatch
+if [ ! -z "$1" ] && [ "$1" != "template" ]; then
+  if [ -d "$PROFILES/$1" ]; then
+    firefox -p $1 -new-instance &
+  else
+    firefox -CreateProfile $1 $PROFILES/$1
+
+    if [ -d "$PROFILES/template" ]; then
+      rm -rf $PROFILES/$1 && cp -a $PROFILES/template $PROFILES/$1
+    fi
+  fi
 else
   firefox --profilemanager -new-instance
 fi