mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[backup] allowing to specify the Timeshift mode: rsync or btrfs
This commit is contained in:
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [0.9.2] 2020
|
||||
### Improvements
|
||||
- Backup
|
||||
- new **type** field on settings to specify the Timeshift backup mode: **RSYNC** or **BTRFS**
|
||||
### UI
|
||||
- icons, buttons and colors changes
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ backup:
|
||||
uninstall: null # defines if the backup should be performed before uninstalling a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation
|
||||
upgrade: null # defines if the backup should be performed before upgrading a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation
|
||||
downgrade: null # defines if the backup should be performed before downgrading a package. Allowed values: null (a dialog will be displayed asking if a snapshot should be generated), true: generates the backup without asking. false: disables the backup for this operation
|
||||
|
||||
type: rsync # defines the Timeshift backup mode -> 'rsync' (default) or 'btrfs'
|
||||
```
|
||||
#### Tray icons
|
||||
Priority:
|
||||
|
||||
@@ -57,7 +57,8 @@ def read_config(update_file: bool = False) -> dict:
|
||||
'uninstall': None,
|
||||
'downgrade': None,
|
||||
'upgrade': None,
|
||||
'mode': 'incremental'
|
||||
'mode': 'incremental',
|
||||
'type': 'rsync'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ class GenericSettingsManager:
|
||||
|
||||
core_config['backup']['enabled'] = bkp_form.get_component('enabled').get_selected()
|
||||
core_config['backup']['mode'] = bkp_form.get_component('mode').get_selected()
|
||||
core_config['backup']['type'] = bkp_form.get_component('type').get_selected()
|
||||
core_config['backup']['install'] = bkp_form.get_component('install').get_selected()
|
||||
core_config['backup']['uninstall'] = bkp_form.get_component('uninstall').get_selected()
|
||||
core_config['backup']['upgrade'] = bkp_form.get_component('upgrade').get_selected()
|
||||
@@ -447,8 +448,14 @@ class GenericSettingsManager:
|
||||
],
|
||||
max_width=default_width,
|
||||
id_='mode')
|
||||
type_ = self._gen_select(label=self.i18n['type'].capitalize(),
|
||||
tip=None,
|
||||
value=core_config['backup']['type'],
|
||||
opts=[('rsync', 'rsync', None), ('btrfs', 'btrfs', None)],
|
||||
max_width=default_width,
|
||||
id_='type')
|
||||
|
||||
sub_comps = [FormComponent([enabled_opt, mode, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)]
|
||||
sub_comps = [FormComponent([enabled_opt, mode, type_, install_mode, uninstall_mode, upgrade_mode, downgrade_mode], spaces=False)]
|
||||
return TabComponent(self.i18n['core.config.tab.backup'].capitalize(), PanelComponent(sub_comps), None, 'core.bkp')
|
||||
|
||||
def _gen_select(self, label: str, tip: str, id_: str, opts: List[tuple], value: object, max_width: int, type_: SelectViewType = SelectViewType.RADIO):
|
||||
|
||||
@@ -9,5 +9,5 @@ def delete_all_snapshots(root_password: str) -> SimpleProcess:
|
||||
return SimpleProcess(['timeshift', '--delete-all', '--scripted'], root_password=root_password)
|
||||
|
||||
|
||||
def create_snapshot(root_password: str) -> SimpleProcess:
|
||||
return SimpleProcess(['timeshift', '--create', '--scripted'], root_password=root_password)
|
||||
def create_snapshot(root_password: str, mode: str) -> SimpleProcess:
|
||||
return SimpleProcess(['timeshift', '--create', '--scripted', '--{}'.format(mode)], root_password=root_password)
|
||||
|
||||
@@ -144,7 +144,7 @@ class AsyncAction(QThread, ProcessWatcher):
|
||||
return False
|
||||
|
||||
self.change_substatus('[{}] {}'.format(i18n['core.config.tab.backup'].lower(), i18n['action.backup.substatus.create']))
|
||||
created, _ = handler.handle_simple(timeshift.create_snapshot(root_pwd))
|
||||
created, _ = handler.handle_simple(timeshift.create_snapshot(root_pwd, app_config['backup']['type']))
|
||||
|
||||
if not created and not self.request_confirmation(title=i18n['core.config.tab.backup'],
|
||||
body='{}. {}'.format(i18n['action.backup.error.create'],
|
||||
|
||||
Reference in New Issue
Block a user