RubyMetric / chsrc

chsrc 全平台通用换源工具. Change Source for every software on every platform from the command line.
https://gitee.com/RubyMetric/chsrc
GNU General Public License v3.0
1.32k stars 54 forks source link

FreeBSD 换源 #11

Open ccmywish opened 9 months ago

ccmywish commented 9 months ago

为了更好的帮助和服务 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 commented 9 months ago

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

ykla commented 9 months ago
ykla commented 9 months ago

需要注意的是

ccmywish commented 9 months ago

@ykla

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

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

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


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

FreeBSD 基本系统并不自带 gmake


其他问题

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

ykla commented 9 months ago

@ykla

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

  • [x] 已指定

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

  • [x] 已解决

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

  • [x] 已解决

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,即可完成换源?

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 #
ccmywish commented 9 months ago

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

FreeBSD 不自带 sudo。


其他问题

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

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

ykla commented 9 months ago

编译没有错误。使用命令应为 ./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 commented 9 months ago

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

RO~QV%)EMGJU~LU9$BU5$@Q