Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FreeBSD 换源 #11

Open
ccmywish opened this issue Sep 24, 2023 · 10 comments
Open

FreeBSD 换源 #11

ccmywish opened this issue Sep 24, 2023 · 10 comments
Assignees
Labels
os_target os target
Milestone

Comments

@ccmywish
Copy link
Contributor

ccmywish commented Sep 24, 2023

为了更好的帮助和服务 FreeBSD 中文社区,我们将在这里持续讨论 FreeBSD 的换源实现情况

  1. 换源代码在这里: https://github.com/RubyMetric/chsrc/blob/main/chsrc.c#L1255
  2. 镜像在这里: https://github.com/RubyMetric/chsrc/blob/main/sources.h#L550

上述地址可能随代码的更新而代码行变动,我尽量更新

@ccmywish ccmywish self-assigned this Sep 24, 2023
@ccmywish
Copy link
Contributor Author

ccmywish commented Sep 24, 2023

2023-09-24

今天重新实现了

  1. freebsd-pkg 换源代码
  2. freebsd-ports 换源代码

有几个问题:

  1. freebsd-pkg 源 有没有 http 和 https 的问题?
  2. https://help.mirrors.cernet.edu.cn/FreeBSD-ports/ 这里提供了一种换 freebsd-ports 的方式,这种并没有在你们的文档中记载,这种可行吗?选用哪一种最合适?
  3. freebsd-update 源目前的状况如何?

@ykla

@ccmywish ccmywish added the 改善加强 改善加强 label Sep 24, 2023
@ykla
Copy link

ykla commented Sep 25, 2023

  • 默认安装的 FreeBSD 基本系统是没有 SSL 证书的,需要先安装 security/ca_root_nss 这个包然后才能把软件源里的 http 改为 https
  • Ports 源(Ports Collection)和 Port 源是两个,之前是使用 portsnap 来拉取 Ports,现在推荐使用 git 或者 gitup 来拉取 Ports,也可以直接下载压缩包解压到指定路径。Ports 是 Port 的集合,一般来说一个 Port 就是一个单独的软件。Port 文件和 Gentoo 的机制类似(Gentoo 借鉴的 BSD),里面并不包含任何源代码,只是给出了补丁、链接、校验码、作者信息等信息,Port 源是指拉取源代码包的源,例如:MASTER_SITE_OVERRIDE?=https://mirrors.cernet.edu.cn/FreeBSD-ports/distfiles/${DIST_SUBDIR}/ 写入 /etc/make.conf。设置了这个源后就会在指定镜像站下载源代码包而无需再去 Port 指定的作者提供的最初始的链接地址去拉取源码包。在 FreeBSD 上要使用 Ports 安装 xorg,需要:①先拉取 Ports,② 进入 Ports 路径 cd /usr/ports/X11/xorg ③执行 make install clean 自动下载源码包打补丁进行编译等。
  • 目前境内无 freebsd-update 源,该源价值也不大,因为目前的升级文件是由几千个到上万个不等的小文件组成的,在有境内源的时候我测试过升级一个同一个系统所需要的时间相差不大,几乎一样。

@ykla
Copy link

ykla commented Sep 25, 2023

需要注意的是

  • nju 的源并不能使用 git 拉取 Ports。他没有设置 git。

  • 更换境内 pkg 源时,需要设置 url: "http://mirrors.163.com/freebsd-pkg/${ABI}/quarterly", 时,必须删掉自带的 pkg+

  • quarterlylatest 是两个源。前者是一个季度更新一次,后者是滚动更新的。(除了 release 其他版本都只有 latest

  • FreeBSD 基本系统并不自带 gmake,基本系统只自带 clang + llvm.

@ccmywish
Copy link
Contributor Author

ccmywish commented Sep 27, 2023

@ykla

Port 源是指拉取源代码包的源

  • 已指定

nju 的源并不能使用 git 拉取 Ports。他没有设置 git

  • 已解决

更换境内 pkg 源时,需要删掉自带的 pkg+

  • 已解决

quarterlylatest 是两个源。前者是一个季度更新一次,后者是滚动更新的

  • 现在 chsrc 只使用了 /freebsd-pkg/${ABI}/latest 你看可以吗

FreeBSD 基本系统并不自带 gmake

  • 请问有make命令吗?make是alias到bmake上了吗?FreeBSD自带的那个make(非gmake)可以运行我们的Makefile吗?还是说,FreeBSD 根本没有任何 make

其他问题

/usr/ports/usr/local/etc 这些路径都是用户级别(bsdcn.org文档中写的)的吗?也就是说不需要 root 权限是吗?这样的话,是否可以完全不需要 sudo,即可完成换源?

@ykla
Copy link

ykla commented Sep 27, 2023

@ykla

Port 源是指拉取源代码包的源

  • 已指定

nju 的源并不能使用 git 拉取 Ports。他没有设置 git

  • 已解决

更换境内 pkg 源时,需要删掉自带的 pkg+

  • 已解决

quarterlylatest 是两个源。前者是一个季度更新一次,后者是滚动更新的

  • 现在 chsrc 只使用了 /freebsd-pkg/${ABI}/latest 你看可以吗

FreeBSD 基本系统并不自带 gmake

  • 请问有make命令吗?make是alias到bmake上了吗?FreeBSD自带的那个make(非gmake)可以运行我们的Makefile吗?还是说,FreeBSD 根本没有任何 make

其他问题

/usr/ports/usr/local/etc 这些路径都是用户级别(bsdcn.org文档中写的)的吗?也就是说不需要 root 权限是吗?这样的话,是否可以完全不需要 sudo,即可完成换源?

  • FreeBSD 不自带 sudo。
  • make 如下:
root@ykla:~/chsrc # ls -aL /usr/bin/make
/usr/bin/make
root@ykla:~/chsrc # ls -aL /usr/bin/bmake
/usr/bin/bmake

root@ykla:~/chsrc # make
make: "/root/chsrc/Makefile" line 12: Invalid line type
make: "/root/chsrc/Makefile" line 14: Invalid line type
make: "/root/chsrc/Makefile" line 15: Invalid line type
make: "/root/chsrc/Makefile" line 16: warning: duplicate script for target "ifeq" ignored
make: "Makefile" line 13: warning: using previous script for "ifeq" defined here
make: "/root/chsrc/Makefile" line 17: Invalid line type
make: "/root/chsrc/Makefile" line 18: Invalid line type
make: "/root/chsrc/Makefile" line 19: warning: duplicate script for target "ifeq" ignored
make: "Makefile" line 13: warning: using previous script for "ifeq" defined here
make: "/root/chsrc/Makefile" line 19: warning: duplicate script for target "(,)" ignored
make: "Makefile" line 13: warning: using previous script for "(,)" defined here
make: "/root/chsrc/Makefile" line 20: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /root/chsrc
root@ykla:~/chsrc # 
root@ykla:~/chsrc # ls -al /usr/ports
total 9
drwxr-xr-x   2 root wheel  2 Aug 25 07:14 .
drwxr-xr-x  15 root wheel 15 Aug 18 21:01 ..
root@ykla:~/chsrc # ls -al /usr/local/etc
total 39
drwxr-xr-x   9 root wheel   13 Sep  9 15:42 .
drwxr-xr-x  13 root wheel   13 Sep  9 14:50 ..
drwxr-xr-x   2 root wheel    4 Sep  9 15:42 bash_completion.d
drwxr-xr-x   2 root wheel    6 Sep  9 14:50 dbus-1
drwxr-xr-x   2 root wheel    4 Sep  9 15:42 git
drwxr-xr-x   2 root wheel    3 Aug 25 07:23 man.d
drwxr-xr-x   5 root wheel    5 Aug 25 07:21 periodic
-rw-r--r--   1 root wheel 2392 Aug 26 09:31 pkg.conf
-rw-r--r--   1 root wheel 2392 Aug 26 09:31 pkg.conf.sample
drwxr-xr-x   2 root wheel    4 Sep  9 15:42 rc.d
drwxr-xr-x   2 root wheel    4 Aug 25 07:23 ssl
-rw-r--r--   1 root wheel 4945 Aug 26 23:01 wgetrc
-rw-r--r--   1 root wheel 4945 Aug 26 23:01 wgetrc.sample
root@ykla:~/chsrc #
  • 建议同时给出设置季度分支的命令。默认可以是 latest。

@ccmywish
Copy link
Contributor Author

建议同时给出设置季度分支的命令。默认可以是 latest。

  • 已提示用户

FreeBSD 不自带 sudo。

  • 不再进行root权限检测

其他问题

  1. 假设当前目录中 abc.txt 文件不存在,ee abc.txt 这个命令是创建并打开一个文件,还是只创建一个文件?

  2. 请参考 https://gitee.com/RubyMetric/chsrc#bsd 使用 chsrc,看看能否编译运行。若能运行,则接着使用 chsrc set freebsd 和其他你想要换源的,看看能不能工作 😶‍🌫️

@ykla
Copy link

ykla commented Oct 2, 2023

编译没有错误。使用命令应为 ./chsrc set freebsd


  1. ee abc.txt

ee abc.txt 是创建并打开一个文件。


ustc: { 
 url: "http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/latest",
 mirror_type: "srv",
 signature_type: "none",
 fingerprints: "/usr/share/keys/pkg",
 enabled: yes
}

写法不正确。正确的见 https://book.bsdcn.org/di-3-zhang-ruan-jian-yuan-ji-bao-guan-li-qi/di-3.2-jie-freebsd-huan-yuan-fang-shi.html


部分源没有 latest 或不再更新,另请见附图:http://pkg.freebsd.org/

S1TQ1HC3CV}~{I`~B7TH8PS_tmb

@ykla
Copy link

ykla commented Oct 2, 2023

另外您的提示都是中文,在 tty 会乱码,FreeBSD 默认没有中文字体。FreeBSD 默认安装是没有任何 GUI 的。也不会预装 XORG。如图:

ROQV%)EMGJULU9$BU5$@Q

ccmywish added a commit that referenced this issue Oct 5, 2023
ccmywish added a commit that referenced this issue Oct 5, 2023
@ccmywish ccmywish added os_target os target and removed 改善加强 改善加强 labels Jun 7, 2024
@ccmywish ccmywish added this to the v1.0 milestone Jun 11, 2024
@willemsestan
Copy link

还有支持centos换源的计划么?

ccmywish added a commit that referenced this issue Aug 17, 2024
@ccmywish
Copy link
Contributor Author

@willemsestan

你好,请参考 CentOS (Stream) Recipe Challenge! #48

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
os_target os target
Projects
None yet
Development

No branches or pull requests

3 participants