1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 19:09:44 +00:00
This commit is contained in:
deadc0de6
2020-11-09 15:16:53 +01:00
parent fc9c12c1b0
commit 4517c3902c
5 changed files with 7 additions and 6 deletions

View File

@@ -639,19 +639,19 @@ class CfgYaml:
if len(val) < 3: if len(val) < 3:
err = 'bad format for chmod: {}'.format(val) err = 'bad format for chmod: {}'.format(val)
self._log.err(err) self._log.err(err)
raise YamlException('dotfile chmod error: {}'.format(err)) raise YamlException(err)
try: try:
int(val) int(val)
except Exception: except Exception:
err = 'bad format for chmod: {}'.format(val) err = 'bad format for chmod: {}'.format(val)
self._log.err(err) self._log.err(err)
raise YamlException('dotfile chmod error: {}'.format(err)) raise YamlException(err)
for x in val: for x in val:
y = int(x) y = int(x)
if y < 0 or y > 7: if y < 0 or y > 7:
err = 'bad format for chmod: {}'.format(val) err = 'bad format for chmod: {}'.format(val)
self._log.err(err) self._log.err(err)
raise YamlException('dotfile chmod error: {}'.format(err)) raise YamlException(err)
return new return new

View File

@@ -501,7 +501,7 @@ def cmd_importer(o):
shutil.copy2(dst, srcf) shutil.copy2(dst, srcf)
chmod = None chmod = None
if o.import_mode or perm&o.umask: if o.import_mode or perm & o.umask:
# insert chmod # insert chmod
chmod = perm chmod = perm
retconf = o.conf.new(src, dst, linktype, chmod=chmod) retconf = o.conf.new(src, dst, linktype, chmod=chmod)

View File

@@ -80,7 +80,7 @@ Options:
-k --key Treat <path> as a dotfile key. -k --key Treat <path> as a dotfile key.
-l --link=<link> Link option (nolink|link|link_children). -l --link=<link> Link option (nolink|link|link_children).
-L --file-only Do not show diff but only the files that differ. -L --file-only Do not show diff but only the files that differ.
-m --preserve-mode Insert a chmod entry in the dotfile with its permissions. -m --preserve-mode Insert a chmod entry in the dotfile with its mode.
-n --nodiff Do not diff when installing. -n --nodiff Do not diff when installing.
-p --profile=<profile> Specify the profile to use [default: {}]. -p --profile=<profile> Specify the profile to use [default: {}].
-P --show-patch Provide a one-liner to manually patch template. -P --show-patch Provide a one-liner to manually patch template.

View File

@@ -308,7 +308,7 @@ def get_umask():
"""return current umask value""" """return current umask value"""
cur = os.umask(0) cur = os.umask(0)
os.umask(cur) os.umask(cur)
return 0o777-cur return 0o777 - cur
def get_file_perm(path): def get_file_perm(path):

View File

@@ -132,6 +132,7 @@ def _fake_args():
args['--as'] = None args['--as'] = None
args['--file-only'] = False args['--file-only'] = False
args['--workers'] = 1 args['--workers'] = 1
args['--preserve-mode'] = False
# cmds # cmds
args['profiles'] = False args['profiles'] = False
args['files'] = False args['files'] = False