修改切换 linux 镜像源

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

View File

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

View File

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