mirror of
https://github.com/BigfootACA/arch-image-builder.git
synced 2024-11-11 07:57:53 +08:00
Compare commits
No commits in common. "1dae233b2ce0a1e7b9056adad659fc07b69499f0" and "0d8ef8a67c19d8d3e60b3e99203612531fb2e883" have entirely different histories.
1dae233b2c
...
0d8ef8a67c
@ -96,8 +96,8 @@ def add_file(ctx: ArchBuilderContext, file: dict):
|
||||
# at least path content
|
||||
if "path" not in file:
|
||||
raise ArchBuilderConfigError("no path set in file")
|
||||
if "content" not in file and "source" not in file and "url" not in file:
|
||||
raise ArchBuilderConfigError(f"no content, source or url set in file")
|
||||
if "content" not in file and "source" not in file:
|
||||
raise ArchBuilderConfigError("no content or source set in file")
|
||||
root = ctx.get_rootfs()
|
||||
path: str = file["path"]
|
||||
if path.startswith("/"): path = path[1:]
|
||||
@ -139,13 +139,9 @@ def add_file(ctx: ArchBuilderContext, file: dict):
|
||||
src = os.path.join(ctx.dir, src)
|
||||
log.debug(f"copy {src} to {real}")
|
||||
if folder:
|
||||
shutil.copytree(src, real, symlinks=follow, dirs_exist_ok=True)
|
||||
shutil.copytree(src, real, symlinks=follow)
|
||||
else:
|
||||
shutil.copyfile(src, real, follow_symlinks=follow)
|
||||
elif "url" in file:
|
||||
cmds = ["wget", file["url"], "-O", real]
|
||||
ret = ctx.run_external(cmds)
|
||||
if ret != 0: raise OSError(f"wget failed with {ret}")
|
||||
else:
|
||||
assert False
|
||||
log.debug(f"chmod file {real} to {mode:04o}")
|
||||
|
@ -64,7 +64,7 @@ def gen_config(ctx: ArchBuilderContext, pacman: Pacman):
|
||||
conf = os.path.join(ctx.get_rootfs(), "etc/pacman.conf")
|
||||
lines: list[str] = []
|
||||
append_config(ctx, lines)
|
||||
pacman.append_repos(lines, True)
|
||||
pacman.append_repos(lines)
|
||||
with open_config(conf) as f:
|
||||
f.writelines(lines)
|
||||
log.info(f"generated pacman config {conf}")
|
||||
|
@ -52,26 +52,17 @@ class PacmanRepo(SerializableDict):
|
||||
name: str = None
|
||||
priority: int = 10000
|
||||
servers: list[PacmanRepoServer] = None
|
||||
mirrorlist: str = None
|
||||
publickey: str = None
|
||||
keyid: str = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str = None,
|
||||
priority: int = None,
|
||||
servers: list[PacmanRepoServer] = None,
|
||||
mirrorlist: str = None,
|
||||
publickey: str = None,
|
||||
keyid: str = None
|
||||
servers: list[PacmanRepoServer] = None
|
||||
):
|
||||
if name is not None: self.name = name
|
||||
if priority is not None: self.priority = priority
|
||||
if servers is not None: self.servers = servers
|
||||
else: self.servers = []
|
||||
if mirrorlist is not None: self.mirrorlist = mirrorlist
|
||||
if publickey is not None: self.publickey = publickey
|
||||
if keyid is not None: self.keyid = keyid
|
||||
|
||||
def add_server(
|
||||
self,
|
||||
@ -95,15 +86,12 @@ class Pacman:
|
||||
caches: list[str]
|
||||
repos: list[PacmanRepo]
|
||||
|
||||
def append_repos(self, lines: list[str], rootfs: bool = False):
|
||||
def append_repos(self, lines: list[str]):
|
||||
"""
|
||||
Add all databases into config
|
||||
"""
|
||||
for repo in self.repos:
|
||||
lines.append(f"[{repo.name}]\n")
|
||||
if rootfs and repo.mirrorlist is not None:
|
||||
lines.append(f"Include = /etc/pacman.d/{repo.name}-mirrorlist\n")
|
||||
else:
|
||||
for server in repo.servers:
|
||||
if server.mirror:
|
||||
lines.append(f"# Mirror {server.name}\n")
|
||||
@ -148,24 +136,6 @@ class Pacman:
|
||||
log.info("initializing pacman keyring")
|
||||
self.pacman_key(["--init"])
|
||||
|
||||
# Download and add public keys and mirrorlist
|
||||
for repo in self.repos:
|
||||
if repo.mirrorlist is not None:
|
||||
mirrorlist = os.path.join(self.ctx.work, f"etc/pacman.d/{repo.name}-mirrorlist")
|
||||
cmds = ["wget", repo.mirrorlist, "-O", keypath]
|
||||
ret = self.ctx.run_external(cmds)
|
||||
if ret != 0: raise OSError(f"wget failed with {ret}")
|
||||
if repo.publickey is not None:
|
||||
keypath = os.path.join(self.ctx.work, f"{repo.name}.pub")
|
||||
cmds = ["wget", repo.publickey, "-O", keypath]
|
||||
ret = self.ctx.run_external(cmds)
|
||||
if ret != 0: raise OSError(f"wget failed with {ret}")
|
||||
self.pacman_key(["--add", keypath])
|
||||
self.lsign_key(repo.keyid)
|
||||
elif repo.keyid is not None:
|
||||
self.recv_keys(repo.keyid)
|
||||
self.lsign_key(repo.keyid)
|
||||
|
||||
def init_config(self):
|
||||
"""
|
||||
Create host pacman.conf
|
||||
@ -312,19 +282,6 @@ class Pacman:
|
||||
if "priority" in repo:
|
||||
pacman_repo.priority = repo["priority"]
|
||||
|
||||
if "mirrorlist" in repo:
|
||||
pacman_repo.mirrorlist = repo["mirrorlist"]
|
||||
|
||||
# add public key url and id
|
||||
if "publickey" in repo and "keyid" not in repo:
|
||||
raise ArchBuilderConfigError("publickey is provided without keyid")
|
||||
|
||||
if "publickey" in repo:
|
||||
pacman_repo.publickey = repo["publickey"]
|
||||
|
||||
if "keyid" in repo:
|
||||
pacman_repo.keyid = repo["keyid"]
|
||||
|
||||
originals: list[str] = []
|
||||
servers: list[str] = []
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
filesystem:
|
||||
files:
|
||||
- path: /etc/systemd/system/pacman-init.service
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Initializes Pacman keyring
|
||||
Requires=etc-pacman.d-gnupg.mount
|
||||
After=etc-pacman.d-gnupg.mount time-sync.target
|
||||
BindsTo=etc-pacman.d-gnupg.mount
|
||||
Before=archlinux-keyring-wkd-sync.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/bin/pacman-key --init
|
||||
ExecStart=/usr/bin/pacman-key --populate
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -2,9 +2,6 @@
|
||||
pacman:
|
||||
install:
|
||||
- plasma
|
||||
- konsole
|
||||
- kate
|
||||
- dolphin
|
||||
- sddm
|
||||
- packagekit-qt6
|
||||
systemd:
|
||||
@ -20,4 +17,3 @@ filesystem:
|
||||
+also:
|
||||
# Ensure NetworkManager is enabled
|
||||
- packages/network-manager
|
||||
- packages/firefox
|
||||
|
@ -1,33 +0,0 @@
|
||||
# I18N for English (US)
|
||||
locale:
|
||||
enable:
|
||||
- "en_US.UTF-8 UTF-8"
|
||||
default: en_US.UTF-8
|
||||
|
||||
systemd:
|
||||
enable:
|
||||
- systemd-timesyncd
|
||||
|
||||
filesystem:
|
||||
files:
|
||||
# Wireless regulatory
|
||||
- path: /etc/conf.d/wireless-regdom
|
||||
content: |
|
||||
WIRELESS_REGDOM="US"
|
||||
# Windows NTP Server
|
||||
- path: /etc/systemd/timesyncd.conf.d/windows-ntp.conf
|
||||
content: |
|
||||
[Time]
|
||||
NTP=time.windows.com
|
||||
|
||||
sysconf:
|
||||
environments:
|
||||
GTK_IM_MODULE: ibus
|
||||
QT_IM_MODULE: ibus
|
||||
XMODIFIERS: '@im=ibus'
|
||||
COUNTRY: US
|
||||
LANG: en_US.UTF-8
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
TZ: US/Eastern
|
||||
timezone: US/Eastern
|
@ -1,33 +0,0 @@
|
||||
# I18N for Russian
|
||||
locale:
|
||||
enable:
|
||||
- "ru_RU.UTF-8 UTF-8"
|
||||
- "en_US.UTF-8 UTF-8"
|
||||
default: en_US.UTF-8
|
||||
|
||||
systemd:
|
||||
enable:
|
||||
- systemd-timesyncd
|
||||
|
||||
filesystem:
|
||||
files:
|
||||
# Wireless regulatory
|
||||
- path: /etc/conf.d/wireless-regdom
|
||||
content: |
|
||||
WIRELESS_REGDOM="RU"
|
||||
- path: /etc/systemd/timesyncd.conf.d/ntp-pool-ntp.conf
|
||||
content: |
|
||||
[Time]
|
||||
NTP=0.ru.pool.ntp.org
|
||||
|
||||
sysconf:
|
||||
environments:
|
||||
GTK_IM_MODULE: ibus
|
||||
QT_IM_MODULE: ibus
|
||||
XMODIFIERS: '@im=ibus'
|
||||
COUNTRY: RU
|
||||
LANG: ru_RU.UTF-8
|
||||
LANGUAGE: ru_RU.UTF-8
|
||||
LC_ALL: ru_RU.UTF-8
|
||||
TZ: Europe/Moscow
|
||||
timezone: Europe/Moscow
|
@ -1,4 +0,0 @@
|
||||
# Firefox
|
||||
pacman:
|
||||
install:
|
||||
- firefox
|
@ -1,10 +0,0 @@
|
||||
pacman:
|
||||
install:
|
||||
- neovim
|
||||
- neovide
|
||||
- less
|
||||
sysconf:
|
||||
environments:
|
||||
EDITOR: nvim
|
||||
VISUAL: neovide
|
||||
PAGER: less
|
@ -1,12 +0,0 @@
|
||||
pacman:
|
||||
repo:
|
||||
- name: endeavouros
|
||||
priority: 200
|
||||
server: https://github.com/endeavouros-team/repo/raw/master/$$repo/$$arch/
|
||||
mirrorlist: https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/endeavouros-mirrorlist/endeavouros-mirrorlist
|
||||
trust:
|
||||
- info@endeavouros.com
|
||||
- manuel@endeavouros.com
|
||||
install:
|
||||
- endeavouros/endeavouros-keyring
|
||||
- endeavouros/endeavouros-mirrorlist
|
@ -1,3 +0,0 @@
|
||||
pacman:
|
||||
install:
|
||||
- bash
|
@ -1,4 +0,0 @@
|
||||
pacman:
|
||||
install:
|
||||
- fish
|
||||
- fisher
|
Loading…
Reference in New Issue
Block a user