Skip to content

Commit

Permalink
Merge pull request #168 from happy-game/main
Browse files Browse the repository at this point in the history
fix `mint` setsrc
  • Loading branch information
happy-game authored Jan 7, 2025
2 parents da3f90a da87eac commit f1f97a3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/recipe/os/APT/Linux-Mint.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 2,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <[email protected]>
* Contributors : Nil Null <[email protected]>
* Contributors : Happy Game <[email protected]>
* |
* Created On : <2023-09-29>
* Last Modified : <2024-11-21>
* Last Modified : <2025-01-07>
* ------------------------------------------------------------*/

/**
Expand Down Expand Up @@ -49,15 50,21 @@ os_linuxmint_setsrc (char *option)

chsrc_backup (OS_LinuxMint_SourceList);

char* cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url,
"@g' " OS_LinuxMint_SourceList);
// deb xxx wilma main upstream import backport 为mint主要源, wilma为版本代号
// 暂不实现自动替换基于debian或ubuntu的基础源
char *version_codename = xy_run ("sed -nr 's/^VERSION_CODENAME=([^\"] )/\1/p' " ETC_OS_RELEASE, 0);
// sed -i '/<version_codename>/ s|http[^ ]*|<source.url>|g' OS_LinuxMint_SourceList
char* cmd = xy_strjoin (5, "sed -i '/",
version_codename, "/ s|http[^ ]*|",
source.url, "|g' " OS_LinuxMint_SourceList);

chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);

ProgMode_ChgType = ChgType_Auto;
chsrc_conclude (&source);
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
chsrc_warn2 ("已自动更换mint主要源, 但mint也使用基于debian或ubuntu的基础源, 可参考对应的debian或ubuntu换源方法进行手动换源");
}

def_target(os_linuxmint);

0 comments on commit f1f97a3

Please sign in to comment.