Use chsrc_determine_chgtype()

This commit is contained in:
Aoran Zeng
2025-03-06 12:36:16 +08:00
parent 7226eecf3d
commit 2d75a48c19
67 changed files with 113 additions and 85 deletions

View File

@@ -58,7 +58,7 @@ os_armbian_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -74,7 +74,7 @@ os_debian_setsrc_for_deb822 (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
@@ -115,7 +115,7 @@ os_debian_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -60,7 +60,7 @@ os_kali_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -34,7 +34,7 @@ os_linuxlite_getsrc (char *option)
}
/**
* 参考: https://help.mirrors.cernet.edu.cn/linuxliteos/
* @consult https://help.mirrors.cernet.edu.cn/linuxliteos/
*/
void
os_linuxlite_setsrc (char *option)
@@ -49,7 +49,7 @@ os_linuxlite_setsrc (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -39,7 +39,7 @@ os_linuxmint_getsrc (char *option)
}
/**
* 参考: https://help.mirrors.cernet.edu.cn/linuxmint/
* @consult https://help.mirrors.cernet.edu.cn/linuxmint/
*/
void
os_linuxmint_setsrc (char *option)
@@ -55,13 +55,13 @@ os_linuxmint_setsrc (char *option)
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[^ ]*|",
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_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
chsrc_warn2 ("完成后请不要再使用 mintsources自带的图形化软件源设置工具进行任何操作因为在操作后无论是否有按“确定”mintsources 均会覆写我们刚才换源的内容");
chsrc_warn2 ("已自动更换mint主要源, 但mint也使用基于debian或ubuntu的基础源, 可参考对应的debian或ubuntu换源方法进行手动换源");

View File

@@ -56,7 +56,7 @@ os_ros_setsrc (char *option)
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -24,12 +24,14 @@ static Source_t os_raspberrypi_sources[] =
};
def_sources_n(os_raspberrypi);
void
os_raspberrypi_getsrc (char *option)
{
chsrc_view_file (OS_RaspberryPi_SourceList);
}
void
os_raspberrypi_setsrc (char *option)
{
@@ -45,7 +47,7 @@ os_raspberrypi_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -61,7 +61,7 @@ os_termux_setsrc (char *option)
chsrc_run ("apt update", RunOpt_Default);
chsrc_run ("apt upgrade", RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -48,7 +48,7 @@ os_trisquel_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -83,7 +83,7 @@ os_ubuntu_setsrc_for_deb822 (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}
@@ -128,7 +128,7 @@ os_ubuntu_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -52,7 +52,7 @@ os_deepin_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -40,7 +40,7 @@ os_openkylin_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -57,7 +57,7 @@ os_alpine_setsrc (char *option)
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -128,7 +128,7 @@ os_freebsd_setsrc (char *option)
chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
*/
ProgMode_ChgType = ChgType_SemiAuto;
chsrc_determine_chgtype (ChgType_SemiAuto);
chsrc_conclude (&source);
}

View File

@@ -58,7 +58,7 @@ os_netbsd_setsrc (char *option)
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -47,7 +47,7 @@ os_openbsd_setsrc (char *option)
chsrc_backup ("/etc/installurl");
chsrc_overwrite_file (source.url, "/etc/installurl");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -46,7 +46,7 @@ os_gentoo_setsrc (char *option)
chsrc_append_to_file (w, "/etc/portage/make.conf");
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -62,7 +62,7 @@ os_openwrt_setsrc (char *option)
chsrc_run (cmd, RunOpt_No_Last_New_Line);
chsrc_run ("opkg update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -33,7 +33,7 @@ os_solus_setsrc (char *option)
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -59,7 +59,8 @@ os_voidlinux_setsrc (char *option)
chsrc_note2 ("若报错可尝试使用以下命令:");
p(cmd);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -44,7 +44,7 @@ os_almalinux_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -37,7 +37,7 @@ os_anolis_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_Default);
chsrc_run ("dnf update", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -72,7 +72,7 @@ os_fedora_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -67,7 +67,7 @@ os_rockylinux_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -70,7 +70,7 @@ os_openeuler_setsrc (char *option)
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -76,7 +76,7 @@ os_opensuse_setsrc (char *option)
chsrc_run (cmd5, RunOpt_Default);
chsrc_run (cmd6, RunOpt_Default);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -92,7 +92,8 @@ os_arch_setsrc (char *option)
{
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
}
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (&source);
}

View File

@@ -48,7 +48,7 @@ os_msys2_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Untested;
chsrc_determine_chgtype (ChgType_Untested);
chsrc_conclude (&source);
}

View File

@@ -20,7 +20,8 @@ os_manjaro_setsrc (char *option)
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
ProgMode_ChgType = ChgType_Auto;
chsrc_determine_chgtype (ChgType_Auto);
chsrc_conclude (NULL);
}