脚本优化
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):
|
||||
|
||||
@@ -13,9 +13,9 @@ sudo EDITOR=vim systemctl edit systemd-networkd-wait-online.service
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install curl gpg
|
||||
sudo add-apt-repository ppa:xtradeb/apps
|
||||
sudo add-apt-repository ppa:xtradeb/apps # 不安装 ungoogled-chromium 时,不要添加。可能与系统源的库冲突
|
||||
sudo add-apt-repository ppa:trzsz/ppa
|
||||
sudo apt install -y ungoogled-chromium fontconfig fonts-noto-cjk fonts-noto-color-emoji unclutter xorg i3-wm libvlc-dev libasound2-dev alsa-utils trzsz wireguard wireguard-tools
|
||||
sudo apt install -y ungoogled-chromium fontconfig fonts-noto-cjk fonts-noto-color-emoji unclutter xorg i3-wm libvlc-dev vlc-plugin-base vlc-plugin-video-output libasound2-dev alsa-utils trzsz wireguard wireguard-tools
|
||||
sudo timedatectl set-timezone Asia/Shanghai
|
||||
sudo usermod -aG audio,video,dialout $USER
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user