index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-11-29 19:49:55 +0000 |
---|---|---|
committer | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-11-29 19:49:55 +0000 |
commit | 9db54786f095bc8b6679df8453d1356cd017e8fc (patch) | |
tree | 109188a8149e1e67179e65b936c7aa17930c3b24 | |
parent | 4f2a6372f656323040ce1a3d5a1bf50234d392aa (diff) |
-rw-r--r-- | archinstall/lib/profiles.py | 17 | ||||
-rw-r--r-- | archinstall/lib/storage.py | 12 |
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index a5065d4a..021c48d6 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -64,25 +64,10 @@ def list_profiles(filter_irrelevant_macs=True): return cache -def find_examples(): - """ - Used to locate the examples, bundled with the module or executable. - - :return: {'guided.py' : './examples/guided.py', '<profile #2>' : '<path #2>'} - :rtype: dict - """ - - # We need to traverse backwards one step with /../ because - # We're living in src/lib/ and we're not executing from src/ anymore. - cwd = os.path.abspath(f'{os.path.dirname(__file__)}/../') - examples = f"{cwd}/examples" - - return {os.path.basename(path): path for path in glob.glob(f'{examples}/*.py')} - def find_installation_script(profile): parsed_url = urllib.parse.urlparse(profile) if not parsed_url.scheme: - examples = find_examples() + examples = list_profiles() if f"{profile}.py" in examples: with open(examples[f"{profile}.py"]) as file: return Script(file.read(), filename=os.path.basename(profile)+".py") diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py index 9ac1d51d..bb41c999 100644 --- a/archinstall/lib/storage.py +++ b/archinstall/lib/storage.py @@ -1,5 +1,15 @@ storage = {} -PROFILE_PATH = ['./profiles', '~/.config/archinstall/profiles', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'profiles')] +# There's a few scenarios of execution: +# 1. In the git repository, where ./profiles/ exist +# 2. When executing from a remote directory, but targeted a script that starts from the git repository +# 3. When executing as a python -m archinstall module where profiles exist one step back for library reasons. +# (4. Added the ~/.config directory as a additional option for future reasons) +PROFILE_PATH = [ + './profiles', + '~/.config/archinstall/profiles', + os.path.join(os.path.dirname(os.path.abspath(__file__)), 'profiles'), + os.path.abspath(f'{os.path.dirname(__file__)}/../examples') +] UPSTREAM_URL = 'https://raw.githubusercontent.com/Torxed/archinstall/master/profiles' PROFILE_DB = None # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
\ No newline at end of file |