mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
generator.generate_pacman_conf_body(): add in_chroot=False param to use config.get_path('pacman') if necessary
This commit is contained in:
parent
5a794ba3dd
commit
3952892029
5 changed files with 10 additions and 5 deletions
|
@ -300,7 +300,7 @@ class Chroot(AbstractChroot):
|
||||||
f'file://{config.get_path("packages")}',
|
f'file://{config.get_path("packages")}',
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
conf_text = get_base_distro(self.arch).get_pacman_conf(repos, check_space=check_space)
|
conf_text = get_base_distro(self.arch).get_pacman_conf(repos, check_space=check_space, in_chroot=in_chroot)
|
||||||
write_file(absolute_path, conf_text, user=user, group=group)
|
write_file(absolute_path, conf_text, user=user, group=group)
|
||||||
|
|
||||||
def create_user(
|
def create_user(
|
||||||
|
|
|
@ -34,7 +34,6 @@ class BaseChroot(Chroot):
|
||||||
'pacstrap',
|
'pacstrap',
|
||||||
'-C',
|
'-C',
|
||||||
pacman_conf_target,
|
pacman_conf_target,
|
||||||
'-c',
|
|
||||||
'-G',
|
'-G',
|
||||||
self.path,
|
self.path,
|
||||||
] + self.base_packages + [
|
] + self.base_packages + [
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Distro:
|
||||||
extras = [Repo(name, url_template=info.url_template, arch=self.arch, options=info.options, scan=False) for name, info in extra_repos.items()]
|
extras = [Repo(name, url_template=info.url_template, arch=self.arch, options=info.options, scan=False) for name, info in extra_repos.items()]
|
||||||
return '\n\n'.join(repo.config_snippet() for repo in (extras + list(self.repos.values())))
|
return '\n\n'.join(repo.config_snippet() for repo in (extras + list(self.repos.values())))
|
||||||
|
|
||||||
def get_pacman_conf(self, extra_repos: Mapping[str, RepoInfo] = {}, check_space: bool = True):
|
def get_pacman_conf(self, extra_repos: Mapping[str, RepoInfo] = {}, check_space: bool = True, in_chroot: bool = True):
|
||||||
body = generate_pacman_conf_body(self.arch, check_space=check_space)
|
body = generate_pacman_conf_body(self.arch, check_space=check_space)
|
||||||
return body + self.repos_config_snippet(extra_repos)
|
return body + self.repos_config_snippet(extra_repos)
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,9 @@ export LDFLAGS="$LDFLAGS,-L/usr/{hostspec}/lib,-L/{chroot}/usr/lib,-rpath-link,/
|
||||||
def generate_pacman_conf_body(
|
def generate_pacman_conf_body(
|
||||||
arch: Arch,
|
arch: Arch,
|
||||||
check_space: bool = True,
|
check_space: bool = True,
|
||||||
|
in_chroot: bool = True,
|
||||||
):
|
):
|
||||||
|
pacman_cache = config.get_path('pacman') if not in_chroot else CHROOT_PATHS['pacman']
|
||||||
return f'''
|
return f'''
|
||||||
#
|
#
|
||||||
# /etc/pacman.conf
|
# /etc/pacman.conf
|
||||||
|
@ -208,7 +210,7 @@ def generate_pacman_conf_body(
|
||||||
# If you wish to use different paths, uncomment and update the paths.
|
# If you wish to use different paths, uncomment and update the paths.
|
||||||
#RootDir = /
|
#RootDir = /
|
||||||
#DBPath = /var/lib/pacman/
|
#DBPath = /var/lib/pacman/
|
||||||
CacheDir = {CHROOT_PATHS['pacman']}/{arch}
|
CacheDir = {pacman_cache}/{arch}
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
#HookDir = /etc/pacman.d/hooks/
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
|
|
6
image.py
6
image.py
|
@ -324,7 +324,11 @@ def install_rootfs(
|
||||||
user=user,
|
user=user,
|
||||||
)
|
)
|
||||||
files = {
|
files = {
|
||||||
'etc/pacman.conf': get_base_distro(arch).get_pacman_conf(check_space=True, extra_repos=get_kupfer_https(arch).repos),
|
'etc/pacman.conf': get_base_distro(arch).get_pacman_conf(
|
||||||
|
check_space=True,
|
||||||
|
extra_repos=get_kupfer_https(arch).repos,
|
||||||
|
in_chroot=True,
|
||||||
|
),
|
||||||
'etc/sudoers.d/wheel': "# allow members of group wheel to execute any command\n%wheel ALL=(ALL:ALL) ALL\n",
|
'etc/sudoers.d/wheel': "# allow members of group wheel to execute any command\n%wheel ALL=(ALL:ALL) ALL\n",
|
||||||
'etc/hostname': profile['hostname'],
|
'etc/hostname': profile['hostname'],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue