diff --git a/docs/zh/mozilla.mdx b/docs/zh/mozilla.mdx new file mode 100644 index 0000000..d96db17 --- /dev/null +++ b/docs/zh/mozilla.mdx @@ -0,0 +1,42 @@ +--- +mirrorId: mozilla +--- + +import MozillaConfigGenerator from '../../src/components/mozilla-config-generator' + +> mozilla 镜像目前正在测试中,行为可能不稳定,预计将在9月下旬完成测试。当下,不建议在生产环境下使用此镜像。 + +此仓库为基于 Debian 的发行版提供了官方打包的 FireFox 浏览器,支持 amd64、arm64 架构。 + +目前,Debian 稳定版只包含了长期支持版本 `firefox-esr`,而 Ubuntu 的 FireFox 切换到了 Snap 包。有需要的用户可使用本仓库提供的 APT 源。 + +### 使用方法 + +下面的内容修改自 [Install Firefox on Linux](https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions)。 + +首先,导入和检查 keyring: + +```bash +sudo install -d -m 0755 /etc/apt/keyrings +wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null +gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}' +``` + +#### APT 配置 + + + +如有需要,在 `/etc/apt/preferences.d/mozilla` 配置 APT 优先级: + +```properties +Package: * +Pin: release a=mozilla +Pin-Priority: 1000 +``` + +最后,更新 APT 缓存并安装: + +```bash +sudo apt update && sudo apt install firefox +sudo apt install firefox-l10n-zh-cn # 可选:中文语言包 +``` diff --git a/src/components/mozilla-config-generator.tsx b/src/components/mozilla-config-generator.tsx new file mode 100644 index 0000000..803a0ec --- /dev/null +++ b/src/components/mozilla-config-generator.tsx @@ -0,0 +1,106 @@ +import React, { useState } from 'react'; +import { + FormControl, + InputLabel, + Select, + MenuItem, + Box, + Grid, + Typography, + FormControlLabel, + Switch, + FormGroup, +} from '@mui/material'; +import { Trans } from 'gatsby-plugin-react-i18next'; +import CodeBlock from './code-block'; + +type ArchTypes = "amd64" | "arm64"; + +const configGenOld = ( + arch: ArchTypes, +): string => `deb [arch=${arch} signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://mirrors.zju.edu.cn/mozilla/apt mozilla main`; + +const configGenNew = ( + arch: ArchTypes, +) => ` +Types: deb +URIs: https://mirrors.zju.edu.cn/mozilla/apt +Suites: mozilla +Components: main +Signed-By: /etc/apt/keyrings/packages.mozilla.org.asc +Architectures: ${arch} +`; + +export default () => { + const [enableDeb822, setEnableDeb822] = useState(false); + + type ArchTypes = "amd64" | "arm64"; + const [arch, setArch] = useState("amd64" as ArchTypes); + + return ( + + + + 请选择您的系统架构: + + + + + 系统架构 + + + + + + + setEnableDeb822(e.target.checked)} + /> + } + label="使用 DEB822 格式" + /> + + + + 请在 + + {enableDeb822 + ? "/etc/apt/sources.list.d/mozilla.sources" + : "/etc/apt/sources.list.d/mozilla.list"} + + 添加 APT 源: + + + + {enableDeb822 ? configGenNew(arch) : configGenOld(arch)} + + + ); +}; diff --git a/src/utils/title-mirror-icon.tsx b/src/utils/title-mirror-icon.tsx index 3fbfc8f..0f22d6e 100644 --- a/src/utils/title-mirror-icon.tsx +++ b/src/utils/title-mirror-icon.tsx @@ -10,6 +10,7 @@ import debianIcon from '@iconify/icons-simple-icons/debian'; import deepinIcon from '@iconify/icons-simple-icons/deepin'; import dockerIcon from '@iconify/icons-simple-icons/docker'; import fedoraIcon from '@iconify/icons-simple-icons/fedora'; +import firefoxIcon from '@iconify/icons-simple-icons/firefox'; import gentooIcon from '@iconify/icons-simple-icons/gentoo'; import gnuIcon from '@iconify/icons-simple-icons/gnu'; import gnuEmacsIcon from '@iconify/icons-simple-icons/gnuemacs'; @@ -87,6 +88,8 @@ export default function TitleMirrorIcon( return ; case 'manjaro': return ; + case 'mozilla': + return ; case 'npm': return ; case 'opensuse':