mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-13 09:45:26 +00:00
Updated the init process to get the branch from package_info in docker images
This commit is contained in:
parent
e88c94ccd2
commit
0c09bc2360
1 changed files with 24 additions and 2 deletions
|
@ -95,6 +95,28 @@ if isinstance(settings.general.enabled_providers, str) and not settings.general.
|
||||||
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||||
settings.write(handle)
|
settings.write(handle)
|
||||||
|
|
||||||
|
# make sure settings.general.branch is properly set when running inside a docker container
|
||||||
|
package_info_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'package_info')
|
||||||
|
if os.path.isfile(package_info_file):
|
||||||
|
try:
|
||||||
|
package_info = {}
|
||||||
|
with open(package_info_file) as file:
|
||||||
|
for line in file.readlines():
|
||||||
|
if line == '\n':
|
||||||
|
break
|
||||||
|
splitted_line = line.split('=')
|
||||||
|
if len(splitted_line) == 2:
|
||||||
|
package_info[splitted_line[0].lower()] = splitted_line[1].replace('\n', '')
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
if 'branch' in package_info:
|
||||||
|
settings.general.branch = package_info['branch']
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||||
|
settings.write(handle)
|
||||||
|
|
||||||
# create database file
|
# create database file
|
||||||
if not os.path.exists(os.path.join(args.config_dir, 'db', 'bazarr.db')):
|
if not os.path.exists(os.path.join(args.config_dir, 'db', 'bazarr.db')):
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
Loading…
Reference in a new issue