脚本优化
This commit is contained in:
@@ -162,7 +162,8 @@ class DeviceInitializer:
|
||||
"xorg",
|
||||
"i3-wm",
|
||||
"libvlc-dev",
|
||||
"vlc",
|
||||
"vlc-plugin-base",
|
||||
"vlc-plugin-video-output",
|
||||
"libasound2-dev",
|
||||
"alsa-utils",
|
||||
"trzsz",
|
||||
@@ -170,10 +171,12 @@ class DeviceInitializer:
|
||||
"wireguard-tools"
|
||||
]
|
||||
|
||||
# 基础软件源(始终需要)
|
||||
self.repositories = [
|
||||
"ppa:xtradeb/apps",
|
||||
"ppa:trzsz/ppa"
|
||||
]
|
||||
# Chromium 仅在需要时添加的源
|
||||
self.chromium_repo = "ppa:xtradeb/apps"
|
||||
|
||||
def _edit_systemd_service(self, service_name: str, override_content: str, description: str):
|
||||
"""兼容地编辑 systemd 服务配置"""
|
||||
@@ -219,10 +222,18 @@ class DeviceInitializer:
|
||||
def add_repositories(self):
|
||||
"""添加软件源"""
|
||||
Logger.section(self.SECTION_ADD_REPOS)
|
||||
|
||||
for repo in self.repositories:
|
||||
|
||||
# 基础源始终添加;Chromium 源仅在需要安装 Chromium 时添加
|
||||
repos = list(self.repositories)
|
||||
if self.config.install_chromium:
|
||||
repos.append(self.chromium_repo)
|
||||
Logger.info("已选择安装 Chromium,将添加其 PPA 源")
|
||||
else:
|
||||
Logger.info("未选择安装 Chromium,跳过添加 xtradeb/apps PPA")
|
||||
|
||||
for repo in repos:
|
||||
self.runner.run(f"sudo add-apt-repository -y {repo}", f"添加软件源: {repo}")
|
||||
|
||||
|
||||
self.runner.run("sudo apt-get update", "更新软件包索引")
|
||||
|
||||
def install_packages(self):
|
||||
|
||||
Reference in New Issue
Block a user