33from shutil import copy2
44
55from archinstall .lib .models .packages import Repository
6+ from archinstall .lib .pathnames import PACMAN_CONF
67
78
89class PacmanConfig :
910 def __init__ (self , target : Path | None ):
10- self ._config_path = Path ('/etc' ) / 'pacman.conf'
1111 self ._config_remote_path : Path | None = None
1212
1313 if target :
14- self ._config_remote_path = target / 'etc' / 'pacman.conf'
14+ self ._config_remote_path = target / PACMAN_CONF . relative_to_root ()
1515
1616 self ._repositories : list [Repository ] = []
1717
@@ -32,7 +32,7 @@ def apply(self) -> None:
3232 else :
3333 repos_to_enable .append (repo .value )
3434
35- content = self . _config_path .read_text ().splitlines (keepends = True )
35+ content = PACMAN_CONF .read_text ().splitlines (keepends = True )
3636
3737 for row , line in enumerate (content ):
3838 # Check if this is a commented repository section that needs to be enabled
@@ -47,9 +47,9 @@ def apply(self) -> None:
4747 content [row + 1 ] = re .sub (r'^#\s*' , '' , content [row + 1 ])
4848
4949 # Write the modified content back to the file
50- with open (self . _config_path , 'w' ) as f :
50+ with PACMAN_CONF . open ('w' ) as f :
5151 f .writelines (content )
5252
5353 def persist (self ) -> None :
5454 if self ._repositories and self ._config_remote_path :
55- copy2 (self . _config_path , self ._config_remote_path )
55+ copy2 (PACMAN_CONF , self ._config_remote_path )
0 commit comments