Ist es möglich, firefox profiles.ini aus vorhandenen Profilen zu regenerieren?

1141
Rob Van Dam

Ich habe vor kurzem versehentlich meine Home-Partition in Ubuntu gefüllt. Bevor mir klar wurde, was passiert ist, habe ich Firefox neu gestartet, weil es merkwürdig (verständlich) wirkte.

Wenn ich nun Firefox mit dem Profilmanager starte (mit -p), werden keine meiner vorhandenen Profile aufgelistet. Ich habe geprüft und alle Profilordner sind noch vorhanden, aber meine Datei profiles.ini ist im Grunde leer. Ich vermute, es wurde versehentlich ausgeblendet, während die Partition voll war.

Ich habe versucht, die profiles.ini zu löschen, aber es wird nur leer regeneriert. Ist es möglich, meine profiles.ini basierend auf den vorhandenen Profilordnern neu zu erstellen, oder muss ich sie nur manuell neu erstellen (die Mozilla-Dokumente zeigen das Format an, damit es nicht allzu schwer aussieht), suche ich nur die faule Option).

4

2 Antworten auf die Frage

4
Sam

Einige Bash-Liebe; Nenne es, wie du willst. Ich habe thescript.sh verwendet

#!/bin/bash  echo '[General]' echo 'StartWithLastProfile=1' echo ''  n=0  for file in * ; do if [ -d $file ] ; then if [[ "$file" =~ .+\.(.+) ]] ; then echo "[Profile$]" echo "Name=$" echo "IsRelative=1" echo "Path=$" if [[ $ == default ]] ; then echo "Default=1" fi echo "" let n++ fi fi done 

Verwendungszweck

Legen Sie es zuerst in Ihr Mozilla-Profilverzeichnis ab (zB ~ / .mozilla / firefox für mich).

chmod +x thescript.sh ./thescript.sh ./thescript.sh > profiles.ini 

Ausgabe

nex@Computer:~/.mozilla/firefox > ./thescript.sh  [General] StartWithLastProfile=1  [Profile0] Name=default IsRelative=1 Path=03k202kd.default Default=1  [Profile1] Name=test IsRelative=1 Path=a023lkdl.test   nex@Computer:~/.mozilla/firefox > ./thescript.sh > profiles.ini 
Schön, ich hätte auch erwähnen sollen, wie ich meine benutze. Rob Van Dam vor 14 Jahren 1
2
Rob Van Dam

Ich kann nichts googeln, also schrieb ich ein Perl-Skript:

#!/usr/bin/perl  use strict; use warnings;  my $dir = glob($ARGV[0] || '~/.mozilla/firefox/');  chdir $dir or die "Unable to change to dir $dir: $!"; opendir my $dh, $dir or die "Unable to open dir $dir: $!"; my @dirs = grep { /^[^.]/ && -d $_ } readdir $dh;  # print some boilerplate print <<'START'; [General] StartWithLastProfile=0  START  # try to sort by oldest first (uses a schwartzian transform) # the 'chrome' folder in each profile folder seems to be the oldest file per profile generally @dirs = reverse map { $_->[0] } sort { $a->[1] <=> $b->[1] || $a->[0] cmp $b->[0] } map { [ $_, -C "$_/chrome" ] } grep { -e "$_/chrome" } @dirs;  my $i = 0; foreach my $profile_dir (@dirs) { # folder names are usually of the form zyxwabc.My Profile Name my ($name) = $profile_dir =~ /^[^.]+\.(.*)/; next if ! $name;  print <<"PROFILE"; [Profile$i] Name=$name IsRelative=1 Path=$profile_dir  PROFILE  $i++; }