添加local_feeds,将本地软件包存储在本仓库

This commit is contained in:
HEYAHONG 2024-04-30 14:42:40 +08:00
parent 4ec982bc9d
commit c78cf8bcef
No known key found for this signature in database
GPG Key ID: 97E3E469FE2C920B
9 changed files with 147 additions and 0 deletions

View File

@ -24,6 +24,8 @@ openwrt/.config: openwrt/Makefile
#feeds
feeds:openwrt/Makefile
${Q}cp openwrt/feeds.conf.default openwrt/feeds.conf
${Q}./local_feeds 1>> openwrt/feeds.conf
${Q}openwrt/scripts/feeds update -a
${Q}openwrt/scripts/feeds install -a -f

View File

@ -1792,6 +1792,12 @@ CONFIG_ZABBIX_POSTGRESQL=y
#
# end of Boot Loaders
#
# CoreBoard-001
#
CONFIG_PACKAGE_FirstBootInit=y
# end of CoreBoard-001
#
# Development
#

32
FW/openwrt-23.05/local_feeds Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
#此文件stdout输出的内容将出现在feed.conf中
# shellcheck disable=SC2128 # ignore array expansion warning
if [ -n "${BASH_SOURCE-}" ]
then
self_path="${BASH_SOURCE}"
elif [ -n "${ZSH_VERSION-}" ]
then
self_path="${(%):-%x}"
else
exit 1
fi
# shellcheck disable=SC2169,SC2169,SC2039 # unreachable with 'dash'
if [[ "$OSTYPE" == "darwin"* ]]; then
# convert possibly relative path to absolute
script_dir="$(realpath_int "${self_path}")"
# resolve any ../ references to make the path shorter
script_dir="$(cd "${script_dir}" || exit 1; pwd)"
else
# convert to full path and get the directory name of that
script_name="$(readlink -f "${self_path}")"
script_dir="$(dirname "${script_name}")"
fi
if [ -d "${script_dir}/../package" ]
then
echo src-link local_feeds `realpath "${script_dir}/../package"`
fi
exit 0

View File

@ -0,0 +1,31 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=FirstBootInit
PKG_RELEASE:=1.0.0-$(shell git rev-parse --short HEAD)
PKG_MAINTAINER:=HEYAHONG <2229388563@qq.com>
include $(INCLUDE_DIR)/package.mk
define Package/FirstBootInit
SECTION:= FirstBootInit
CATEGORY:= CoreBoard-001
TITLE:= Execute script when firstboot
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile/Default
endef
Build/Compile = $(Build/Compile/Default)
define Package/FirstBootInit/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,FirstBootInit))

View File

@ -0,0 +1,28 @@
# 说明
本软件包主要提供第一次启动的脚本初始化。
本软件包不依赖其它任何软件包。
## 原理
启动过程中,当检测到/etc/FirstBootInit/NeedFirstBoot文件后,执行/etc/FirstBootInit/script/中的可执行脚本并删除/etc/FirstBootInit/NeedFirstBoot。
第二次启动不会执行任何脚本。
## 脚本说明
### 00print
打印信息,表示这是第一次启动
### 10wifi
启动WIFI AP,AP名称为CoreBoard-[Mac地址],密码为CoreBoardWifiAp。
# 使用
将需要第一次启动的脚本文件放入[./files/etc/FirstBootInit/script/](./files/etc/FirstBootInit/script/) 目录中。
注意:推荐脚本名称前两个字符为数字字符。

View File

@ -0,0 +1,3 @@
#/bin/sh
logger -t FirstBootInit -p daemon.info This is firstboot

View File

@ -0,0 +1,30 @@
#!/bin/sh
. /lib/functions.sh
. /lib/functions/system.sh
#MAC地址
Mac=`get_mac_label | sed 's/://g'`
default_wifi_ap() {
uci -q batch <<-EOF
delete wireless.@wifi-iface[-1]
set wireless.WifiAp=wifi-iface
set wireless.WifiAp.device='radio0'
set wireless.WifiAp.mode='ap'
set wireless.WifiAp.ssid="CoreBoard-$Mac"
set wireless.WifiAp.key="CoreBoardWifiAp"
set wireless.WifiAp.network="lan"
set wireless.WifiAp.encryption="psk-mixed"
set wireless.radio0.disabled=0
commit
EOF
}
#加载wireless配置
config_load wireless
#默认wifi_ap
default_wifi_ap
#启动wifi
wifi

View File

@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
START=95
FirstBootInit() {
for i in `find /etc/FirstBootInit/script/`
do
[ -x $i ] && . $i
done
}
boot() {
[ -f /etc/FirstBootInit/NeedFirstBoot ] && FirstBootInit
[ -f /etc/FirstBootInit/NeedFirstBoot ] && rm /etc/FirstBootInit/NeedFirstBoot
}