mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2026-03-04 12:03:52 +01:00
Merge branch 'rclone-sysconfig' into 'main'
Add rclone option to the "sysconfig" scope of YAML config file See merge request systemrescue/systemrescue-sources!229
This commit is contained in:
commit
495fea0194
|
|
@ -5,6 +5,11 @@ IMPORTANT: The 32bit (i686) release of SystemRescue will be deprecated soon
|
|||
unless volunteers are found to help maintaining it. See
|
||||
https://gitlab.com/systemrescue/systemrescue-sources/-/issues/278
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
9.05 (YYYY-MM-DD):
|
||||
-------------------------------------------------------------------------------
|
||||
* Add rclone option to the "sysconfig" scope of YAML config file, it writes a rclone.conf file
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
9.04 (2022-08-07):
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import sys
|
|||
import re
|
||||
import tempfile
|
||||
import functools
|
||||
import configparser
|
||||
|
||||
# flush stdout buffer after each print call: immediately show the user what is going on
|
||||
print = functools.partial(print, flush=True)
|
||||
|
|
@ -249,6 +250,33 @@ if 'sysconfig' in config and 'bookmarks' in config['sysconfig'] and config['sysc
|
|||
with open(firefox_policy_path, "w", encoding='utf-8') as polfile:
|
||||
json.dump(ff_policy, polfile, ensure_ascii=False, indent=2)
|
||||
|
||||
# ==============================================================================
|
||||
# configure rclone
|
||||
# ==============================================================================
|
||||
|
||||
if 'sysconfig' in config and 'rclone' in config['sysconfig'] and \
|
||||
config['sysconfig']['rclone'] and isinstance(config['sysconfig']['rclone'], dict) and \
|
||||
'config' in config['sysconfig']['rclone'] and \
|
||||
config['sysconfig']['rclone']['config'] and \
|
||||
isinstance(config['sysconfig']['rclone']['config'], dict):
|
||||
print(f"====> Adding rclone config ...")
|
||||
|
||||
try:
|
||||
if not os.path.isdir("/root/.config"):
|
||||
os.mkdir("/root/.config")
|
||||
if not os.path.isdir("/root/.config/rclone"):
|
||||
os.mkdir("/root/.config/rclone")
|
||||
os.chmod("/root/.config/rclone", 0o700)
|
||||
|
||||
iniparser = configparser.ConfigParser()
|
||||
iniparser.read_dict(config['sysconfig']['rclone']['config'])
|
||||
with open('/root/.config/rclone/rclone.conf', 'w') as configfile:
|
||||
os.chmod("/root/.config/rclone/rclone.conf", 0o600)
|
||||
iniparser.write(configfile)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
errcnt+=1
|
||||
|
||||
# ==============================================================================
|
||||
# Configure custom CA certificates
|
||||
# ==============================================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue