OpenWrt之feeds.conf.default详解
OpenWrt之feeds.conf.default详解
文件内容
src-git-full packages https://git.openwrt.org/feed/packages.git
src-git-full luci https://git.openwrt.org/project/luci.git
src-git-full routing https://git.openwrt.org/feed/routing.git
src-git-full telephony https://git.openwrt.org/feed/telephony.git
#src-git-full video https://github.com/openwrt/video.git
#src-git-full targets https://github.com/openwrt/targets.git
#src-git-full oldpackages http://git.openwrt.org/packages.git
#src-link custom /usr/src/openwrt/custom-feed
OpenWrt的feeds.conf.default, 是添加一些应用和包的文件, 看过之后下面解析命令用法
命令解释
先说
#, 这个是注释用, 不会有人不知道吧这个文件主要是由
scripts/feeds这个perl脚本控制着, 贴一个命令的定义my %update_method = (
'src-svn' => {
'init' => "svn checkout '%s' '%s'",
'update' => "svn update",
'controldir' => ".svn",
'revision' => "svn info | grep 'Revision' | cut -d ' ' -f 2 | tr -d '\n'"},
'src-cpy' => {
'init' => "cp -Rf '%s' '%s'",
'update' => "",
'revision' => "echo -n 'local'"},
'src-link' => {
'init' => "ln -s '%s' '%s'",
'update' => "",
'revision' => "echo -n 'local'"},
'src-dummy' => {
'init' => "true '%s' && mkdir '%s'",
'update' => "",
'revision' => "echo -n 'dummy'"},
'src-git' => {
'init' => "git clone --depth 1 '%s' '%s'",
'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'",
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff-only",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-git-full' => {
'init' => "git clone '%s' '%s'",
'init_branch' => "git clone --branch '%s' '%s' '%s'",
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff-only",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-gitsvn' => {
'init' => "git svn clone -r HEAD '%s' '%s'",
'update' => "git svn rebase",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-bzr' => {
'init' => "bzr checkout --lightweight '%s' '%s'",
'update' => "bzr update",
'controldir' => ".bzr"},
'src-hg' => {
'init' => "hg clone '%s' '%s'",
'update' => "hg pull --update",
'controldir' => ".hg"},
'src-darcs' => {
'init' => "darcs get '%s' '%s'",
'update' => "darcs pull -a",
'controldir' => "_darcs"},
); # src-git: pull broken
# src-cpy: broken if `basename $src` != $name
src-svn与src-gitsvn
'src-svn' => {
'init' => "svn checkout '%s' '%s'",
'update' => "svn update",
'controldir' => ".svn",
'revision' => "svn info | grep 'Revision' | cut -d ' ' -f 2 | tr -d '\n'"},
'src-gitsvn' => {
'init' => "git svn clone -r HEAD '%s' '%s'",
'update' => "git svn rebase",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
- 用法:
src-svn NueXini_Packages https://github.com/NueXini/NueXini_Packages/trunk/
# 拉取默认分支
src-svn NueXini_Packages https://github.com/NueXini/NueXini_Packages/branches/v20220620
# 拉取指定分支
src-svn NueXini_Packages https://github.com/NueXini/NueXini_Packages/trunk/luci-app-disableipv6/
# 拉取指定文件夹
src-gitsvn我愿称之为git与svn的结合体
这个主要命令是
git svn clone -r HEAD, 参考https://git-scm.com/docs/git-svn用法:
src-gitsvn NueXini_Packages https://github.com/NueXini/NueXini_Packages.git
src-git与src-git-full
'src-git' => {
'init' => "git clone --depth 1 '%s' '%s'",
'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'",
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff-only",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
'src-git-full' => {
'init' => "git clone '%s' '%s'",
'init_branch' => "git clone --branch '%s' '%s' '%s'",
'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
'update' => "git pull --ff-only",
'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)",
'post_update' => "git submodule update --init --recursive",
'controldir' => ".git",
'revision' => "git rev-parse --short HEAD | tr -d '\n'"},
- 这两者共同操作是
git clone区别是clone的深度不一样,src-git-full是全clone, 而src-git的深度为--depth 1 - 用法:
src-git-full / src-git-full 保存的文件夹名 仓库地址 - 注: 后面可指定 分支, tag, commit , 不填则是拉取默认分支
src-git NueXini_Packages https://github.com/NueXini/NueXini_Packages.git;main
# 指定branch
src-git NueXini_Packages https://github.com/NueXini/NueXini_Packages.git;v20220620
# 指定tag
src-git NueXini_Packages https://github.com/NueXini/NueXini_Packages.git^47e35dd380b88d5cffc267eabe7a125da86d194b
# 指定commit
src-cpy与src-link
'src-cpy' => {
'init' => "cp -Rf '%s' '%s'",
'update' => "",
'revision' => "echo -n 'local'"},
'src-link' => {
'init' => "ln -s '%s' '%s'",
'update' => "",
'revision' => "echo -n 'local'"},
这两个命令的唯一区别是src-cpy会复制一份源到feeds目录, src-link则是ln -s创建一个软链接, 我个人是比较倾向src-link的, 这样可以修改源码能及时响应.
- 用法:
src-cpy / src-link 保存的文件名 源目录
src-link NueXini_Packages package/NueXini_Packages
# 拉取package目录下的NueXini_Packages目录
其他的src命令
- 像
bzr,hg,darcs一些其他的分布式版本控制系统, 基本很少用到, 可以自行参考命令解释了解使用方法
feeds命令用法
sub usage() {
print <<EOF;
Usage: $0 <command> [options]
Commands:
list [options]: List feeds, their content and revisions (if installed)
Options:
-n : List of feed names.
-s : List of feed names and their URL.
-r <feedname>: List packages of specified feed.
-d <delimiter>: Use specified delimiter to distinguish rows (default: spaces)
-f : List feeds in feeds.conf compatible format (when using -s).
install [options] <package>: Install a package
Options:
-a : Install all packages from all feeds or from the specified feed using the -p option.
-p <feedname>: Prefer this feed when installing packages.
-d <y|m|n>: Set default for newly installed packages.
-f : Install will be forced even if the package exists in core OpenWrt (override)
search [options] <substring>: Search for a package
Options:
-r <feedname>: Only search in this feed
uninstall -a|<package>: Uninstall a package
Options:
-a : Uninstalls all packages.
update -a|<feedname(s)>: Update packages and lists of feeds in feeds.conf .
Options:
-a : Update all feeds listed within feeds.conf. Otherwise the specified feeds will be updated.
-i : Recreate the index only. No feed update from repository is performed.
-f : Force updating feeds even if there are changed, uncommitted files.
clean: Remove downloaded/generated files.
EOF
exit(1);
}
my %commands = (
'list' => \&list,
'update' => \&update,
'install' => \&install,
'search' => \&search,
'uninstall' => \&uninstall,
'feed_config' => \&feed_config,
'clean' => sub {
system("rm -rf ./feeds ./package/feeds ./target/linux/feeds");
}
);
branch与commit的分割符号
sub update_feed_via($$$$$) {
my $type = shift;
my $name = shift;
my $src = shift;
my $relocate = shift;
my $force = shift;
my $m = $update_method{$type};
my $localpath = "./feeds/$name";
my $safepath = $localpath;
$safepath =~ s/'/'\\''/;
my ($base_branch, $branch) = split(/;/, $src, 2);
my ($base_commit, $commit) = split(/\^/, $src, 2);
if( $relocate || !$m->{'update'} || !-d "$localpath/$m->{'controldir'}" ) {
system("rm -rf '$safepath'");
if ($m->{'init_branch'} and $branch) {
system(sprintf($m->{'init_branch'}, $branch, $base_branch, $safepath)) == 0 or return 1;
} elsif ($m->{'init_commit'} and $commit) {
system(sprintf($m->{'init_commit'}, $base_commit, $safepath, $safepath, $commit, $commit)) == 0 or return 1;
} else {
system(sprintf($m->{'init'}, $src, $safepath)) == 0 or return 1;
}
} elsif ($m->{'init_commit'} and $commit) {
# in case git hash has been provided don't update the feed
} else {
my $update_cmd = $m->{'update'};
if ($force && exists $m->{'update_force'}) {
$update_cmd = $m->{'update_force'};
}
system("cd '$safepath'; $update_cmd") == 0 or return 1;
}
if ($m->{'post_update'}) {
my $cmd = $m->{'post_update'};
system("cd '$safepath'; $cmd") == 0 or return 1;
}
return 0;
}
- 透过以上代码, 主要能看见
branch与commit的分割是不一样的 branch用的分割符号是;commit用的分割符号是^
my ($base_branch, $branch) = split(/;/, $src, 2);
my ($base_commit, $commit) = split(/\^/, $src, 2);
branch与tag的区别
tag就是给commit的hash校验和取的一个名字,比较直观,方便记忆和使用
tag就像是一个里程碑一个标志一个点,branch是一个新的征程一条线;tag是静态的,branch要向前走;
tag 对应某次 commit, 是一个点,是不可移动的。
branch 对应一系列 commit,是很多点连成的一根线,有一个HEAD 指针,是可以依靠 HEAD 指针移动的。所以,两者的区别决定了使用方式,改动代码用 branch ,不改动只查看用 tag。
参考https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E6%89%93%E6%A0%87%E7%AD%BE
Enjoy it ~
OpenWrt之feeds.conf.default详解的更多相关文章
- Redis 配置文件 redis.conf 项目详解
Redis.conf 配置文件详解 # [Redis](http://yijiebuyi.com/category/redis.html) 配置文件 # 当配置中需要配置内存大小时,可以使用 1k, ...
- webpack.dev.conf.js详解
转载自:https://www.cnblogs.com/ye-hcj/p/7087205.html webpack.dev.conf.js详解 //引入当前目录下的utils.js文件模块var ut ...
- redis.windows.conf配置详解
redis.windows.conf配置详解 转自:https://www.cnblogs.com/kreo/p/4423362.html # redis 配置文件示例 # 当你需要为某个配置项指定内 ...
- Linux-apache httd.conf文件详解
Linux-apache httd.conf文件详解 # This is the main Apache server configuration file. It contains the # co ...
- Nginx配置文件nginx.conf中文详解(转)
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
- apache 虚拟主机详细配置:http.conf配置详解
apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...
- VSFTPD全攻略(/etc/vsftpd/vsftpd.conf文件详解)
/etc/vsftpd/vsftpd.conf文件详解,分好类,方便大家查找与学习 #################匿名权限控制############### anonymous_enable=YE ...
- Nginx配置文件nginx.conf中文详解【转】
PS:Nginx使用有两三年了,现在经常碰到有新用户问一些很基本的问题,我也没时间一一回答,今天下午花了点时间,结合自己的使用经验,把Nginx的主要配置参数说明分享一下,也参考了一些网络的内容,这篇 ...
- nginx.conf配置详解
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
随机推荐
- 一个登录点两个逻辑漏洞-edusrc
最近呢, 也是基础漏洞学的差不多了, 就在edusrc上面实战, 刚开始搞一些信息泄漏啥的, 提交了十几个, 结果就他娘的通过了一个. 咱也就不碰信息泄漏了, 没得意思. 关于这个学校测试时也是有坑的 ...
- 一篇文章说清 webpack、vite、vue-cli、create-vue 的区别
webpack.vite.vue-cli.create-vue 这些都是什么?看着有点晕,不要怕,我们一起来分辨一下. 先看这个表格: 脚手架 vue-cli create-vue 构建项目 vite ...
- 国产化设备鲲鹏CentOS7上源码安装Python3.7
具体编译过成与正常的Python源代码在x86平台上的过程无异,此篇随笔仅当用作复制黏贴的备忘录.不得不说在一个老旧系统上安装一个老旧的Python版本,从头编译一个Python还是一个较为稳健的选择 ...
- HCNP Routing&Switching之RSTP保护
前文我们了解了RSTP相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/16240348.html:今天我们来聊一聊RSTP保护相关话题: 我们知道RST ...
- 用c语言调用Easy X实现图像的输出,附带音乐的读取
要实现此功能需要用EasyX 一.下载VS编译环境和EasyX. ①Vs2019https://iwx.mail.qq.com/ftn/download?func=3&key=9e9b6c33 ...
- 揭秘华为云GaussDB(for Influx)最佳实践:hint查询
摘要:GaussDB(for Influx)通过提供hint功能,在单时间线的查询场景下,性能有大幅度的提升,能有效满足客户某些特定场景的查询需求. 本文分享自华为云社区<华为云GaussDB( ...
- 低代码前景可期,JNPF灵活易用,用智能定义新型办公模式
JNPF是引迈信息从事多年软件研发和产品服务的一次时代性的技术革新产物,是集SaaS服务.工作流引擎.一站式低代码开发.支持多端使用于一体的快速开发平台. 强大易用 JNPF将 Excel. Acce ...
- python+selenium 自动化测试——显式等待详解
1.前言 之前有提到过等待函数,等待函数分为:强制等待(sleep).隐式等待(implicitly_wait),显示等待(WebDriverWait),这次以显示等待方式专门做一次总结,因为我个人是 ...
- 【Azure 应用服务】NodeJS Express + MSAL 应用实现AAD登录并获取AccessToken -- cca.acquireTokenByCode(tokenRequest)
问题描述 在上一篇博文 "[Azure 应用服务]NodeJS Express + MSAL 应用实现AAD集成登录并部署在App Service Linux环境中的实现步骤"中, ...
- 二:动手实操SpringBoot-使用Spring Initializr创建项目
使用 Spring Initializr 初始化 Spring Boot 项目 Spring Initializr 从本质上说就是一个Web应用程序,它能为你构建Spring Boot项目结构. 虽然 ...