mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 21:11:46 +08:00
Split netbsd out
This commit is contained in:
parent
ccaf8d2b33
commit
5bfdcdc564
|
@ -354,22 +354,6 @@ os_freebsd_sources[] = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-05 更新
|
||||
* @note 源并不完整,且未经测试是否有效
|
||||
*/
|
||||
os_netbsd_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Ali, "https://mirrors.aliyun.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Netease, "https://mirrors.163.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Sohu, "https://mirrors.sohu.com/pkgsrc/packages/NetBSD/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-06 更新
|
||||
|
@ -544,7 +528,7 @@ def_sources_n(os_rocky); def_sources_n(os_alma);
|
|||
def_sources_n(os_linuxlite); def_sources_n(os_raspberrypi);
|
||||
def_sources_n(os_armbian);
|
||||
|
||||
def_sources_n(os_freebsd); def_sources_n(os_netbsd);
|
||||
def_sources_n(os_freebsd);
|
||||
|
||||
def_sources_n(os_ros);
|
||||
|
||||
|
|
39
src/chsrc.c
39
src/chsrc.c
|
@ -860,44 +860,7 @@ os_freebsd_setsrc (char *option)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
os_netbsd_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考:
|
||||
* 1. https://mirrors.tuna.tsinghua.edu.cn/help/pkgsrc/
|
||||
* 2. https://book.bsdcn.org/di-27-zhang-netbsd/di-27.2-jie-huan-yuan-yu-bao-guan-li-qi.html
|
||||
*
|
||||
* 根据 @ykla (https://github.com/ykla)
|
||||
* NetBSD 默认状态下没有 pkgsrc,用户可能安装了也可能没安装
|
||||
*
|
||||
* HELP: 未经测试
|
||||
*/
|
||||
void
|
||||
os_netbsd_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_netbsd);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
char *arch = chsrc_get_cpuarch ();
|
||||
char *vercmd = "cat /etc/os-release | grep \"VERSION=\" | grep -Po \"[8-9].[0-9]+\"";
|
||||
char *version = xy_run (vercmd, 0, NULL);
|
||||
|
||||
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
|
||||
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
#include "recipe/os/netbsd.c"
|
||||
#include "recipe/os/openbsd.c"
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,6 @@ static const char
|
|||
|
||||
def_target(os_ubuntu); def_target(os_mint); def_target(os_debian); def_target(os_kali);
|
||||
def_target(os_linuxlite);
|
||||
def_target(os_netbsd);
|
||||
def_target(os_deepin); def_target(os_openkylin);
|
||||
def_target(os_raspberrypi);
|
||||
def_target(os_armbian);
|
||||
|
|
65
src/recipe/os/netbsd.c
Normal file
65
src/recipe/os/netbsd.c
Normal file
|
@ -0,0 +1,65 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* | Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Created On : <2023-09-05>
|
||||
* Last Modified : <2024-08-16>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-05 更新
|
||||
*/
|
||||
static SourceInfo
|
||||
os_netbsd_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Ali, "https://mirrors.aliyun.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/pkgsrc/packages/NetBSD/"},
|
||||
{&Tencent, "https://mirrors.tencent.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Netease, "https://mirrors.163.com/pkgsrc/packages/NetBSD/"},
|
||||
{&Sohu, "https://mirrors.sohu.com/pkgsrc/packages/NetBSD/"}
|
||||
};
|
||||
def_sources_n(os_netbsd);
|
||||
|
||||
|
||||
void
|
||||
os_netbsd_getsrc (char *option)
|
||||
{
|
||||
chsrc_view_file ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考:
|
||||
* 1. https://mirrors.tuna.tsinghua.edu.cn/help/pkgsrc/
|
||||
* 2. https://book.bsdcn.org/di-27-zhang-netbsd/di-27.2-jie-huan-yuan-yu-bao-guan-li-qi.html
|
||||
*
|
||||
* 根据 @ykla (https://github.com/ykla)
|
||||
* NetBSD 默认状态下没有 pkgsrc,用户可能安装了也可能没安装
|
||||
*
|
||||
* HELP: 未经测试
|
||||
*/
|
||||
void
|
||||
os_netbsd_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_netbsd);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
char *arch = chsrc_get_cpuarch ();
|
||||
char *vercmd = "cat /etc/os-release | grep \"VERSION=\" | grep -Po \"[8-9].[0-9]+\"";
|
||||
char *version = xy_run (vercmd, 0, NULL);
|
||||
|
||||
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
|
||||
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_netbsd);
|
Loading…
Reference in New Issue
Block a user