|
@@ -1,7 +1,7 @@
|
|
|
|
|
|
from os import name as _OS_NAME, environ as _env
|
|
|
from os import listdir as _listdir, mkdir as _mkdir, chown as _chown
|
|
|
-from os.path import exists as _exists, join as _join, isdir as _isdir
|
|
|
+from os.path import exists as _exists, join as _join, isdir as _isdir, sep as _sep
|
|
|
from copy import copy as _copy
|
|
|
from time import sleep as _sleep
|
|
|
|
|
@@ -87,10 +87,8 @@ def _profile_pre_check(profile_name: str):
|
|
|
_chown(_join(profile_name, "keys"), int(_env['SUDO_UID']), int(_env['SUDO_GID']))
|
|
|
|
|
|
def _write_profile(profile_name: str):
|
|
|
- if profile_name.endswith(".toml"):
|
|
|
- profile_name = profile_name.removesuffix(".toml")
|
|
|
_profile_pre_check(profile_name)
|
|
|
- with open(_join(profile_name, profile_name+".toml"), "w") as f:
|
|
|
+ with open(_join(profile_name, "profile.toml"), "w") as f:
|
|
|
f.writelines("\n".join([
|
|
|
f'# Tyrell :: v{VERSION} :: More human than human',
|
|
|
'',
|
|
@@ -134,7 +132,7 @@ def _write_profile(profile_name: str):
|
|
|
'hold = 20',
|
|
|
]))
|
|
|
if "SUDO_USER" in _env:
|
|
|
- _chown(_join(profile_name, profile_name+".toml"), int(_env['SUDO_UID']), int(_env['SUDO_GID']))
|
|
|
+ _chown(_join(profile_name, "profile.toml"), int(_env['SUDO_UID']), int(_env['SUDO_GID']))
|
|
|
|
|
|
def _write_example(profile_name: str):
|
|
|
if profile_name.endswith(".toml"):
|
|
@@ -475,6 +473,8 @@ class Profile:
|
|
|
self.name = name.removesuffix(".toml")
|
|
|
else:
|
|
|
self.name = name
|
|
|
+ # Fix Directory as name (Sometimes happens with tab complete on CLI)
|
|
|
+ self.name = self.name.removesuffix(_sep)
|
|
|
# Pre-Check
|
|
|
if not _exists(self.name):
|
|
|
# Does not exist, new everything
|
|
@@ -483,7 +483,7 @@ class Profile:
|
|
|
_write_example_mirror(self.name)
|
|
|
else:
|
|
|
# Profile config?
|
|
|
- if not _exists(_join(self.name, self.name+".toml")):
|
|
|
+ if not _exists(_join(self.name, "profile.toml")):
|
|
|
_write_profile(self.name)
|
|
|
# Do we have keys?
|
|
|
if not _exists(_join(self.name, "keys")):
|
|
@@ -493,7 +493,7 @@ class Profile:
|
|
|
_print_warn("Got example profile, creation only")
|
|
|
return # Done with example code
|
|
|
# Load toml config
|
|
|
- with open(_join(self.name, self.name+".toml"), "r") as f:
|
|
|
+ with open(_join(self.name, "profile.toml"), "r") as f:
|
|
|
dat = _toml_load(f)
|
|
|
self.placeholders = {
|
|
|
"name": False,
|