Split netbsd out

This commit is contained in:
Aoran Zeng 2024-08-16 01:23:29 +08:00
parent ccaf8d2b33
commit 5bfdcdc564
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 67 additions and 56 deletions

View File

@ -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);

View File

@ -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"
/**

View File

@ -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
View 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);