修改切换 linux 镜像源

This commit is contained in:
whyour 2023-12-17 18:03:37 +08:00
parent 7eb3b60af8
commit f1a044b59b
2 changed files with 7 additions and 7 deletions

View File

@ -218,15 +218,15 @@ export default class SystemService {
...oDoc,
info: { ...oDoc.info, ...info },
});
let defaultDomain = 'https://dl-cdn.alpinelinux.org';
let targetDomain = 'https://dl-cdn.alpinelinux.org';
let defaultDomain = 'http://deb.debian.org';
let targetDomain = 'http://deb.debian.org';
if (os.platform() !== 'linux') {
return;
}
const content = await fs.promises.readFile('/etc/apk/repositories', {
const content = await fs.promises.readFile('/etc/apt/sources.list', {
encoding: 'utf-8',
});
const domainMatch = content.match(/(http.*)\/alpine\/.*/);
const domainMatch = content.match(/(http.*)\/debian /);
if (domainMatch) {
defaultDomain = domainMatch[1];
}
@ -239,7 +239,7 @@ export default class SystemService {
)}/${targetDomain.replace(
/\//g,
'\\/',
)}/g' /etc/apk/repositories && apk update -f`;
)}/g' /etc/apt/sources.list && apt update`;
this.scheduleService.runTask(
command,

View File

@ -196,12 +196,12 @@ const Dependence = () => {
<Form.Item
label={intl.get('Linux 软件包镜像源')}
name="linux"
tooltip={intl.get('alpine linux 镜像源')}
tooltip={intl.get('debian linux 镜像源')}
>
<Input.Group compact>
<Input
style={{ width: 250 }}
placeholder={'https://mirrors.aliyun.com'}
placeholder={'http://deb.debian.org'}
value={systemConfig?.linuxMirror}
onChange={(e) => {
setSystemConfig({