mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 01:44:16 +00:00
fix chmod install
This commit is contained in:
@@ -342,7 +342,7 @@ class CfgYaml:
|
|||||||
if chmod:
|
if chmod:
|
||||||
lnkval = df_dict.get(self.key_dotfile_link, None)
|
lnkval = df_dict.get(self.key_dotfile_link, None)
|
||||||
if lnkval != self.lnk_children:
|
if lnkval != self.lnk_children:
|
||||||
df_dict[self.key_dotfile_chmod] = format(chmod, 'o')
|
df_dict[self.key_dotfile_chmod] = str(format(chmod, 'o'))
|
||||||
|
|
||||||
# add to global dict
|
# add to global dict
|
||||||
self._yaml_dict[self.key_dotfiles][key] = df_dict
|
self._yaml_dict[self.key_dotfiles][key] = df_dict
|
||||||
@@ -639,7 +639,7 @@ class CfgYaml:
|
|||||||
v[self.key_dotfile_template] = val
|
v[self.key_dotfile_template] = val
|
||||||
# validate value of chmod if defined
|
# validate value of chmod if defined
|
||||||
if self.key_dotfile_chmod in v:
|
if self.key_dotfile_chmod in v:
|
||||||
val = v[self.key_dotfile_chmod]
|
val = str(v[self.key_dotfile_chmod])
|
||||||
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)
|
||||||
@@ -661,6 +661,7 @@ class CfgYaml:
|
|||||||
err = 'incompatible use of chmod and link_children'
|
err = 'incompatible use of chmod and link_children'
|
||||||
self._log.err(err)
|
self._log.err(err)
|
||||||
raise YamlException('config content error: {}'.format(err))
|
raise YamlException('config content error: {}'.format(err))
|
||||||
|
v[self.key_dotfile_chmod] = val
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class Installer:
|
|||||||
- False, error_msg : error
|
- False, error_msg : error
|
||||||
- False, None : ignored
|
- False, None : ignored
|
||||||
"""
|
"""
|
||||||
if not self._chmod_file(dst, chmod):
|
if not self._check_chmod(dst, chmod):
|
||||||
err = 'ignoring "{}", nothing installed'.format(dst)
|
err = 'ignoring "{}", nothing installed'.format(dst)
|
||||||
return False, err
|
return False, err
|
||||||
|
|
||||||
@@ -83,8 +83,8 @@ class Installer:
|
|||||||
ignore=ignore,
|
ignore=ignore,
|
||||||
template=template)
|
template=template)
|
||||||
|
|
||||||
if chmod:
|
if r and chmod:
|
||||||
os.chmod(dst, chmod)
|
os.chmod(dst, int(chmod, 8))
|
||||||
|
|
||||||
return self._log_install(r, err)
|
return self._log_install(r, err)
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class Installer:
|
|||||||
- False, error_msg : error
|
- False, error_msg : error
|
||||||
- False, None : ignored
|
- False, None : ignored
|
||||||
"""
|
"""
|
||||||
if not self._chmod_file(dst, chmod):
|
if not self._check_chmod(dst, chmod):
|
||||||
err = 'ignoring "{}", nothing installed'.format(dst)
|
err = 'ignoring "{}", nothing installed'.format(dst)
|
||||||
return False, err
|
return False, err
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ class Installer:
|
|||||||
actionexec=actionexec,
|
actionexec=actionexec,
|
||||||
template=template)
|
template=template)
|
||||||
if chmod:
|
if chmod:
|
||||||
os.chmod(dst, chmod)
|
os.chmod(dst, int(chmod, 8))
|
||||||
return self._log_install(r, err)
|
return self._log_install(r, err)
|
||||||
|
|
||||||
def _link(self, templater, src, dst, actionexec=None,
|
def _link(self, templater, src, dst, actionexec=None,
|
||||||
@@ -681,7 +681,7 @@ class Installer:
|
|||||||
self.log.dbg('install: IGNORED')
|
self.log.dbg('install: IGNORED')
|
||||||
return boolean, err
|
return boolean, err
|
||||||
|
|
||||||
def _chmod_file(self, path, chmod):
|
def _check_chmod(self, path, chmod):
|
||||||
"""chmod file if needed and return True to continue"""
|
"""chmod file if needed and return True to continue"""
|
||||||
if chmod:
|
if chmod:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user