Change umask to 0000 when running backup
This commit is contained in:
parent
9b8760346e
commit
dee233b25a
7
README
7
README
@ -57,19 +57,18 @@ Implementation Notes
|
|||||||
* pathlib is used for path handling
|
* pathlib is used for path handling
|
||||||
* Only absolute paths are used internally for consistency
|
* Only absolute paths are used internally for consistency
|
||||||
* Use --link-dest=
|
* Use --link-dest=
|
||||||
* Use --suffix=, --backup, and --backup-dir=
|
|
||||||
* When hardlinking, rbackup passes the entire path to avoid needing relative paths
|
* When hardlinking, rbackup passes the entire path to avoid needing relative paths
|
||||||
|
* The backup script changes the process umask to 0000 to determine the file modes for the files it writes i.e. snapshots
|
||||||
|
|
||||||
To-do
|
To-do
|
||||||
-----
|
-----
|
||||||
* Use --suffix=, --backup, and --backup-dir=
|
|
||||||
* Create config module
|
|
||||||
* Study how snapshots behave when --delete is passed
|
|
||||||
* Add __enter__ and __exit__ for PackageManager lockfiles to prevent transactions during backup
|
* Add __enter__ and __exit__ for PackageManager lockfiles to prevent transactions during backup
|
||||||
* Create snapshot manipulation script
|
* Create snapshot manipulation script
|
||||||
* Interactive cleanup script
|
* Interactive cleanup script
|
||||||
* Repository.__delitem__()
|
* Repository.__delitem__()
|
||||||
* Repository.delete_snapshot(name)
|
* Repository.delete_snapshot(name)
|
||||||
|
* Test functions in config module
|
||||||
|
* load_list_from_option()
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
@ -28,6 +28,7 @@ import rbackup.rsync
|
|||||||
from rbackup.struct.repository import Repository
|
from rbackup.struct.repository import Repository
|
||||||
|
|
||||||
# ========== Constants ==========
|
# ========== Constants ==========
|
||||||
|
SCRIPT_UMASK = 0000
|
||||||
LOGFORMAT = "==> %(levelname)s %(message)s"
|
LOGFORMAT = "==> %(levelname)s %(message)s"
|
||||||
EXTRA_RSYNC_OPTS = {
|
EXTRA_RSYNC_OPTS = {
|
||||||
"dry_run": "--dry-run",
|
"dry_run": "--dry-run",
|
||||||
@ -103,6 +104,9 @@ def parse_cmdline_arguments(**kwargs):
|
|||||||
|
|
||||||
# ========== Main Script ==========
|
# ========== Main Script ==========
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# Create some sort of cleanup routine for resetting the umask to previous value
|
||||||
|
old_umask = os.umask(SCRIPT_UMASK)
|
||||||
|
|
||||||
args = parse_cmdline_arguments()
|
args = parse_cmdline_arguments()
|
||||||
parsed_config = config.parse_configfile()
|
parsed_config = config.parse_configfile()
|
||||||
repo = Repository(args.repository)
|
repo = Repository(args.repository)
|
||||||
@ -142,10 +146,12 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
syslog.critical(e)
|
syslog.critical(e)
|
||||||
|
os.umask(old_umask)
|
||||||
exit(E_INVALID_SNAPSHOT_NAME)
|
exit(E_INVALID_SNAPSHOT_NAME)
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
syslog.critical("Backup process failed")
|
syslog.critical("Backup process failed")
|
||||||
syslog.critical(f"Failing command: {e.cmd}")
|
syslog.critical(f"Failing command: {e.cmd}")
|
||||||
|
os.umask(old_umask)
|
||||||
exit(E_FAILED_PROCESS)
|
exit(E_FAILED_PROCESS)
|
||||||
|
|
||||||
repo.symlink_snapshot(curr_snapshot)
|
repo.symlink_snapshot(curr_snapshot)
|
||||||
@ -153,3 +159,5 @@ if __name__ == "__main__":
|
|||||||
if args.run_post_sync:
|
if args.run_post_sync:
|
||||||
syslog.info("Running sync operation")
|
syslog.info("Running sync operation")
|
||||||
os.sync()
|
os.sync()
|
||||||
|
|
||||||
|
os.umask(old_umask)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user