Mozilla pre: Added Thunderbird

This commit is contained in:
2026-04-21 19:06:57 +02:00
parent 21fcd6aa49
commit 8d8594d2cd
3 changed files with 32 additions and 1 deletions
@@ -16,9 +16,10 @@ from os import environ
from webdav3.client import Client
#Variables
thunderbird_tar = os.path.dirname(__file__) + '/thunderbird.tar.zst'
firefox_tar = os.path.dirname(__file__) + '/firefox.tar.zst'
firefoxhome_path = environ['HOME'] + "/.config/mozilla/firefox"
firefoxhome_profile_src = os.path.dirname(__file__) + '/profiles.ini'
firefoxhome_profile_src = os.path.dirname(__file__) + '/profiles_ff.ini'
firefoxhome_profile_dst = firefoxhome_path + '/profiles.ini'
#Check Env
@@ -47,6 +48,7 @@ if 'PROFILE_FIREFOX_RESET_LOCAL' in environ:
shutil.copyfile(firefoxhome_profile_src, firefoxhome_profile_dst) # Copy initial profiles.ini to dir
print("Done.")
#Firefox first profile setup
if 'PROFILE_FIREFOX_SRC' in environ: # Check and setup mozilla
pathstr = environ['PROFILE_FIREFOX_SRC'] + "/default"
if not client.check(pathstr):
@@ -75,4 +77,33 @@ if 'PROFILE_FIREFOX_SRC' in environ: # Check and setup mozilla
print("Done.")
#Next sync will be executed by logon script
#Thunderbird first profile setup
if 'PROFILE_TB_SRC' in environ: # Check and setup mozilla
pathstr = environ['PROFILE_TB_SRC'] + "/default"
if not client.check(pathstr):
print("Path " + pathstr + " was not found on Server. Creating it.")
i = 0
while i >= 0: #Dive into subfolders of string
i = pathstr.find("/", i + 1)
if i >= 0:
#print("/" + pathstr[:i])
if not client.check(pathstr[:i]):
client.execute_request("mkdir", "/" + pathstr[:i])
#print("/" + pathstr)
client.execute_request("mkdir", "/" + pathstr)
print("Done.")
#Check and create local Folder
if not os.path.exists(environ['PROFILE_TB_DST'] + "/default"):
os.makedirs(environ['PROFILE_TB_DST'] + "/default")
#First sync to initialise sync-db
print("Call " + environ['SYSCONFIGPATH'] + "/system_setup/mozilla_starter.sh thunderbird sync")
retstr = subprocess.call(['sh', environ['SYSCONFIGPATH'] + '/system_setup/mozilla_starter.sh', 'thunderbird', 'sync'])
#Extract empty firefox profile to Folder
print("Extracting " + thunderbird_tar + " to " + environ['PROFILE_TB_DST'])
tar = tarfile.open(thunderbird_tar)
tar.extractall(path=environ['PROFILE_TB_DST'],filter='data')
tar.close()
print("Done.")
#Next sync will be executed by logon script
sys.exit(0)