Skip to content

Add Debian/Armbian support to Linux mirror configuration - #2879

Draft
whyour with Copilot wants to merge 5 commits into
developfrom
copilot/fix-linux-package-source-url
Draft

Add Debian/Armbian support to Linux mirror configuration#2879
whyour with Copilot wants to merge 5 commits into
developfrom
copilot/fix-linux-package-source-url

Conversation

Copilot AI commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

The Linux mirror update functionality only supported Alpine Linux (/etc/apk/repositories), causing Debian/Armbian systems to fail with malformed URLs containing repeated path segments: /armbian/dists/armbian/dists///armbian/armbian/armbian/debian.

Changes

  • Distribution detection: Check for both /etc/apt/sources.list and /etc/debian_version to identify Debian-based systems
  • Debian/Armbian handling:
    • Extract current mirror URL from sources.list via regex /^deb\s+(https?:\/\/[^\s]+)/m
    • Replace URLs in both /etc/apt/sources.list and /etc/apt/sources.list.d/ directory
    • Execute apt-get update after mirror changes
  • Security: Escape backslashes, forward slashes, and dots in URLs for sed commands to prevent injection
  • Backward compatibility: Alpine Linux logic unchanged

Implementation

// Detect Debian-based systems
const hasAptSourcesList = await fs.promises.access('/etc/apt/sources.list')
  .then(() => true).catch(() => false);
const hasDebianVersion = await fs.promises.access('/etc/debian_version')
  .then(() => true).catch(() => false);
const isDebianBased = hasAptSourcesList || hasDebianVersion;

if (isDebianBased) {
  // Extract and replace mirror URL with proper escaping
  const escapedDefault = defaultDomain
    .replace(/\\/g, '\\\\')
    .replace(/\//g, '\\/')
    .replace(/\./g, '\\.');
  
  command = `sed -i 's/${escapedDefault}/${escapedTarget}/g' /etc/apt/sources.list`;
  command += ` && find /etc/apt/sources.list.d -type f \\( -name "*.list" -o -name "*.sources" \\) -exec sed -i 's/${escapedDefault}/${escapedTarget}/g' {} \\;`;
  command += ` && apt-get update`;
}

Notes

  • Assumes all repositories use the same base mirror URL (replaces based on first detected mirror)
  • Supports both .list and .sources file formats in sources.list.d
Original prompt

This section details on the original issue you should resolve

<issue_title>Linux 软件包镜像源地址错误</issue_title>
<issue_description>### Qinglong version

v2.20.0

Steps to reproduce

无论是使用默认地址还是阿里云还是清华源,url都会都会重复好几遍armbian
Image
Image

于是查看源配置文件,发现里面也存在问题,手动修改sources.list文件后正常
Image

系统Armbian (24.11.0) aarch64,使用docker版青龙

What is expected?

正常更新软件源

What is actually happening?

无法更新软件源

System Info

Any additional comments?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Dec 22, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
qinglong Ready Ready Preview, Comment Dec 22, 2025 3:08pm
qinglong-back Ready Ready Preview, Comment Dec 22, 2025 3:08pm

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Copilot AI and others added 2 commits December 22, 2025 14:47
…or handling

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
…ping

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
…n and Alpine

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Linux software package mirror source URL error Add Debian/Armbian support to Linux mirror configuration Dec 22, 2025
Copilot AI requested a review from whyour December 22, 2025 14:55
@whyour
whyour force-pushed the develop branch 7 times, most recently from 7539d75 to e8ac195 Compare June 1, 2026 10:20
@whyour
whyour force-pushed the develop branch 5 times, most recently from f43efe3 to 7933fe0 Compare June 18, 2026 14:55
@whyour
whyour force-pushed the develop branch 7 times, most recently from 0169ebf to d301643 Compare June 28, 2026 10:08
@whyour
whyour force-pushed the develop branch 4 times, most recently from 23a1835 to 4ebc049 Compare July 7, 2026 16:28
@whyour
whyour force-pushed the develop branch 2 times, most recently from 509b0d0 to da6dac8 Compare July 9, 2026 17:43
@whyour
whyour force-pushed the develop branch 8 times, most recently from 152a9aa to 92e4f26 Compare July 24, 2026 14:34
@whyour
whyour force-pushed the develop branch 3 times, most recently from 9b37f06 to 0bb41eb Compare July 25, 2026 05:29
@whyour
whyour force-pushed the develop branch 2 times, most recently from de65d7f to 5f6049d Compare August 29, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux 软件包镜像源地址错误

2 participants