2021-01-05 23:38:00 +00:00
|
|
|
#!/bin/bash
|
2021-06-06 05:55:56 +00:00
|
|
|
# AutoBuild Module by Hyy2001 <https://github.com/Hyy2001X/AutoBuild-Actions>
|
2021-01-05 23:38:00 +00:00
|
|
|
# AutoBuild Functions
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Firmware-Diy_Before() {
|
2021-07-23 08:13:15 +00:00
|
|
|
TIME "[Firmware-Diy_Before]"
|
2021-03-24 12:50:54 +00:00
|
|
|
Diy_Core
|
2021-04-16 10:57:19 +00:00
|
|
|
Home="${GITHUB_WORKSPACE}/openwrt"
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ -f ${GITHUB_WORKSPACE}/Openwrt.info ]] && source ${GITHUB_WORKSPACE}/Openwrt.info
|
|
|
|
[[ ${Short_Firmware_Date} == true ]] && Compile_Date="$(echo ${Compile_Date} | cut -c1-8)"
|
2021-07-09 14:04:24 +00:00
|
|
|
Author_Repository="$(grep "https://github.com/[a-zA-Z0-9]" ${GITHUB_WORKSPACE}/.git/config | cut -c8-100 | sed 's/^[ \t]*//g')"
|
|
|
|
[[ -z ${Author} ]] && Author="$(echo "${Author_Repository}" | cut -d "/" -f4)"
|
|
|
|
OP_Maintainer="$(echo "${Openwrt_Repository}" | cut -d "/" -f4)"
|
|
|
|
OP_REPO_NAME="$(echo "${Openwrt_Repository}" | cut -d "/" -f5)"
|
2021-07-16 16:11:35 +00:00
|
|
|
OP_BRANCH="$(Get_Branches)"
|
2021-07-09 14:04:24 +00:00
|
|
|
if [[ ${OP_BRANCH} == master || ${OP_BRANCH} == main ]];then
|
2021-07-02 15:51:31 +00:00
|
|
|
Openwrt_Version_Head="R$(date +%y.%m)-"
|
2021-06-23 09:53:59 +00:00
|
|
|
else
|
2021-07-09 14:04:24 +00:00
|
|
|
OP_BRANCH="$(echo ${OP_BRANCH} | egrep -o "[0-9]+.[0-9]+")"
|
|
|
|
Openwrt_Version_Head="R${OP_BRANCH}-"
|
2021-06-23 09:53:59 +00:00
|
|
|
fi
|
2021-07-09 14:04:24 +00:00
|
|
|
case "${OP_Maintainer}" in
|
2021-03-24 12:50:54 +00:00
|
|
|
coolsnowwolf)
|
2021-04-16 10:57:19 +00:00
|
|
|
Version_File=package/lean/default-settings/files/zzz-default-settings
|
2021-07-02 15:51:31 +00:00
|
|
|
zzz_Default_Version="$(egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" ${Version_File})"
|
|
|
|
CURRENT_Version="${zzz_Default_Version}-${Compile_Date}"
|
2021-03-24 12:50:54 +00:00
|
|
|
;;
|
|
|
|
immortalwrt)
|
2021-04-16 10:57:19 +00:00
|
|
|
Version_File=package/base-files/files/etc/openwrt_release
|
2021-07-02 15:51:31 +00:00
|
|
|
CURRENT_Version="${Openwrt_Version_Head}${Compile_Date}"
|
2021-03-24 12:50:54 +00:00
|
|
|
;;
|
|
|
|
*)
|
2021-07-02 15:51:31 +00:00
|
|
|
CURRENT_Version="${Openwrt_Version_Head}${Compile_Date}"
|
2021-03-24 12:50:54 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-06-17 09:55:08 +00:00
|
|
|
while [[ -z ${x86_Test} ]];do
|
2021-04-09 14:43:50 +00:00
|
|
|
x86_Test="$(egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/CONFIG_TARGET_(.*)_DEVICE_(.*)=y/\1/')"
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ -n ${x86_Test} ]] && break
|
2021-04-09 14:43:50 +00:00
|
|
|
x86_Test="$(egrep -o "CONFIG_TARGET.*Generic=y" .config | sed -r 's/CONFIG_TARGET_(.*)_Generic=y/\1/')"
|
2021-06-28 14:15:23 +00:00
|
|
|
[[ -z ${x86_Test} ]] && break
|
2021-04-09 14:43:50 +00:00
|
|
|
done
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ ${x86_Test} == x86_64 ]] && {
|
2021-06-06 05:55:56 +00:00
|
|
|
TARGET_PROFILE=x86_64
|
2021-04-16 10:57:19 +00:00
|
|
|
} || {
|
2021-02-19 08:17:31 +00:00
|
|
|
TARGET_PROFILE="$(egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/.*DEVICE_(.*)=y/\1/')"
|
2021-04-16 10:57:19 +00:00
|
|
|
}
|
2021-07-16 16:11:35 +00:00
|
|
|
[[ -z ${TARGET_PROFILE} ]] && TIME "Unable to obtain the [TARGET_PROFILE] !"
|
2021-04-16 17:38:13 +00:00
|
|
|
TARGET_BOARD="$(awk -F '[="]+' '/TARGET_BOARD/{print $2}' .config)"
|
2021-07-16 16:11:35 +00:00
|
|
|
TARGET_SUBTARGET="$(awk -F '[="]+' '/TARGET_SUBTARGET/{print $2}' .config)"
|
2021-06-06 05:55:56 +00:00
|
|
|
case "${TARGET_BOARD}" in
|
2021-07-09 14:04:24 +00:00
|
|
|
ramips | reltek | ipq40xx | ath79 | ipq807x)
|
2021-04-16 10:57:19 +00:00
|
|
|
Firmware_Type=bin
|
2021-02-19 08:17:31 +00:00
|
|
|
;;
|
2021-07-16 16:11:35 +00:00
|
|
|
rockchip | x86)
|
|
|
|
[[ $(cat ${Home}/.config) =~ CONFIG_TARGET_IMAGES_GZIP=y ]] && {
|
|
|
|
Firmware_Type=img.gz || Firmware_Type=img
|
|
|
|
}
|
2021-06-06 05:55:56 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-16 16:11:35 +00:00
|
|
|
case "${TARGET_BOARD}" in
|
|
|
|
x86)
|
|
|
|
AutoBuild_Firmware='AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}-${CURRENT_Version}-${FW_Boot_Type}-$(Get_sha256 $1).${Firmware_Type_Defined}'
|
2021-07-21 07:37:56 +00:00
|
|
|
REGEX_Firmware='AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}-R[0-9.]+-[0-9]+-${x86_Boot}.[0-9a-z]+.${Firmware_Type}'
|
2021-06-06 05:55:56 +00:00
|
|
|
;;
|
|
|
|
*)
|
2021-07-16 16:11:35 +00:00
|
|
|
AutoBuild_Firmware='AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}-${CURRENT_Version}-$(Get_sha256 $1).${Firmware_Type_Defined}'
|
2021-07-21 07:37:56 +00:00
|
|
|
REGEX_Firmware='AutoBuild-${OP_REPO_NAME}-${TARGET_PROFILE}-R[0-9.]+-[0-9]+-[0-9a-z]+.${Firmware_Type}'
|
2021-06-06 05:55:56 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-16 16:11:35 +00:00
|
|
|
cat >> VARIABLE_Main <<EOF
|
2021-06-06 05:55:56 +00:00
|
|
|
Author=${Author}
|
2021-07-09 14:04:24 +00:00
|
|
|
Github=${Author_Repository}
|
2021-06-06 05:55:56 +00:00
|
|
|
TARGET_PROFILE=${TARGET_PROFILE}
|
|
|
|
TARGET_BOARD=${TARGET_BOARD}
|
|
|
|
TARGET_SUBTARGET=${TARGET_SUBTARGET}
|
|
|
|
Firmware_Type=${Firmware_Type}
|
|
|
|
CURRENT_Version=${CURRENT_Version}
|
2021-07-09 14:04:24 +00:00
|
|
|
OP_Maintainer=${OP_Maintainer}
|
|
|
|
OP_BRANCH=${OP_BRANCH}
|
|
|
|
OP_REPO_NAME=${OP_REPO_NAME}
|
2021-07-21 07:37:56 +00:00
|
|
|
REGEX_Firmware=${REGEX_Firmware}
|
2021-06-06 05:55:56 +00:00
|
|
|
EOF
|
2021-07-16 16:11:35 +00:00
|
|
|
cat >> VARIABLE_FILE <<EOF
|
2021-06-06 05:55:56 +00:00
|
|
|
Home=${Home}
|
2021-07-16 16:11:35 +00:00
|
|
|
PKG_Compatible=${INCLUDE_Obsolete_PKG_Compatible}
|
|
|
|
Checkout_Virtual_Images=${Checkout_Virtual_Images}
|
|
|
|
Firmware_Path=${Home}/bin/targets/${TARGET_BOARD}/${TARGET_SUBTARGET}
|
|
|
|
AutoBuild_Firmware=${AutoBuild_Firmware}
|
2021-06-06 05:55:56 +00:00
|
|
|
EOF
|
2021-07-16 16:11:35 +00:00
|
|
|
echo "$(cat VARIABLE_Main)" >> VARIABLE_FILE
|
|
|
|
echo -e "### SYS-VARIABLE LIST ###\n$(cat VARIABLE_FILE)\n"
|
2021-01-11 13:44:45 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Firmware-Diy_Main() {
|
|
|
|
Firmware-Diy_Before
|
2021-07-23 08:13:15 +00:00
|
|
|
TIME "[Firmware-Diy_Main]"
|
2021-06-06 05:55:56 +00:00
|
|
|
mkdir -p package/base-files/files/etc/AutoBuild
|
2021-07-16 16:11:35 +00:00
|
|
|
[ -f VARIABLE_Main ] && cp VARIABLE_Main package/base-files/files/etc/AutoBuild/Default_Variable
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy CustomFiles/Depends/Custom_Variable package/base-files/files/etc/AutoBuild
|
2021-03-27 16:43:55 +00:00
|
|
|
chmod +x -R ${GITHUB_WORKSPACE}/Scripts
|
2021-06-06 05:55:56 +00:00
|
|
|
chmod 777 -R ${GITHUB_WORKSPACE}/CustomFiles
|
2021-07-19 04:17:05 +00:00
|
|
|
[[ ${Load_CustomPackages_List} == true ]] && {
|
|
|
|
bash -n ${GITHUB_WORKSPACE}/Scripts/AutoBuild_ExtraPackages.sh
|
|
|
|
[[ ! $? == 0 ]] && TIME "AutoBuild_ExtraPackages.sh syntax error,skip ..." || {
|
|
|
|
. ${GITHUB_WORKSPACE}/Scripts/AutoBuild_ExtraPackages.sh
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ ${INCLUDE_AutoBuild_Features} == true ]] && {
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy Scripts/AutoBuild_Tools.sh package/base-files/files/bin
|
|
|
|
Copy Scripts/AutoUpdate.sh package/base-files/files/bin
|
2021-07-16 16:11:35 +00:00
|
|
|
AddPackage git lean luci-app-autoupdate Hyy2001X main
|
2021-04-16 10:57:19 +00:00
|
|
|
}
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ ${INCLUDE_Argon} == true ]] && {
|
2021-07-16 16:11:35 +00:00
|
|
|
case "${OP_Maintainer},${OP_BRANCH}" in
|
|
|
|
coolsnowwolf,master)
|
2021-05-18 02:10:29 +00:00
|
|
|
AddPackage git lean luci-theme-argon jerrykuku 18.06
|
2021-04-09 15:12:34 +00:00
|
|
|
;;
|
2021-07-16 16:11:35 +00:00
|
|
|
[Ll]ienol,main)
|
|
|
|
AddPackage git other luci-theme-argon jerrykuku master
|
|
|
|
;;
|
|
|
|
[Ll]ienol,19.07)
|
|
|
|
AddPackage git other luci-theme-argon jerrykuku v2.2.5
|
|
|
|
;;
|
2021-04-09 15:12:34 +00:00
|
|
|
*)
|
2021-07-16 16:11:35 +00:00
|
|
|
[[ ${OP_Maintainer} != immortalwrt ]] && {
|
|
|
|
case "${OP_BRANCH}" in
|
|
|
|
19.07)
|
|
|
|
AddPackage git other luci-theme-argon jerrykuku v2.2.5
|
|
|
|
;;
|
|
|
|
21.02)
|
|
|
|
AddPackage git other luci-theme-argon jerrykuku master
|
|
|
|
;;
|
|
|
|
18.06)
|
|
|
|
AddPackage git other luci-theme-argon jerrykuku 18.06
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
} || :
|
2021-04-09 15:12:34 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-08-01 15:53:24 +00:00
|
|
|
AddPackage git other luci-app-argon-config jerrykuku master
|
2021-05-09 13:16:10 +00:00
|
|
|
}
|
2021-07-09 14:04:24 +00:00
|
|
|
[[ -n ${Before_IP_Address} ]] && Default_LAN_IP="${Before_IP_Address}"
|
|
|
|
[[ -n ${Default_LAN_IP} && ${Default_LAN_IP} =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && {
|
|
|
|
Old_IP_Address=$(awk -F '[="]+' '/ipaddr:-/{print $3}' package/base-files/files/bin/config_generate | awk 'NR==1')
|
|
|
|
if [[ ! ${Default_LAN_IP} == ${Old_IP_Address} ]];then
|
|
|
|
TIME "Setting default IP Address to ${Default_LAN_IP} ..."
|
|
|
|
sed -i "s/${Old_IP_Address}/${Default_LAN_IP}/g" package/base-files/files/bin/config_generate
|
2021-04-24 14:24:26 +00:00
|
|
|
fi
|
2021-07-16 16:11:35 +00:00
|
|
|
}
|
2021-07-16 16:42:47 +00:00
|
|
|
[[ ${INCLUDE_DRM_I915} == true && ${TARGET_BOARD} == x86 ]] && {
|
2021-06-19 12:59:19 +00:00
|
|
|
Copy CustomFiles/Depends/DRM-I915 target/linux/x86
|
2021-06-21 13:04:00 +00:00
|
|
|
for X in $(ls -1 target/linux/x86 | grep "config-"); do echo -e "\n$(cat target/linux/x86/DRM-I915)" >> target/linux/x86/${X}; done
|
2021-06-19 12:59:19 +00:00
|
|
|
}
|
2021-04-16 10:57:19 +00:00
|
|
|
[ -f package/base-files/files/bin/AutoUpdate.sh ] && {
|
2021-06-06 05:55:56 +00:00
|
|
|
AutoUpdate_Version=$(egrep -o "V[0-9].+" package/base-files/files/bin/AutoUpdate.sh | awk 'END{print}')
|
2021-04-16 10:57:19 +00:00
|
|
|
} || AutoUpdate_Version=OFF
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy CustomFiles/Depends/profile package/base-files/files/etc
|
|
|
|
Copy CustomFiles/Depends/base-files-essential package/base-files/files/lib/upgrade/keep.d
|
2021-07-09 14:04:24 +00:00
|
|
|
case "${OP_Maintainer}" in
|
2021-03-24 12:50:54 +00:00
|
|
|
coolsnowwolf)
|
2021-07-04 11:03:22 +00:00
|
|
|
sed -i "/dns_caching_dns/d" $(PKG_Finder d package luci-app-turboacc)/root/etc/config/turboacc
|
|
|
|
echo " option dns_caching_dns '223.5.5.5,114.114.114.114'" >> $(PKG_Finder d package luci-app-turboacc)/root/etc/config/turboacc
|
2021-07-04 09:21:13 +00:00
|
|
|
Copy CustomFiles/Depends/coremark.sh $(PKG_Finder d "package feeds" coremark)
|
2021-07-02 15:28:23 +00:00
|
|
|
Copy CustomFiles/Depends/cpuinfo_x86 $(PKG_Finder d package autocore | awk 'NR==1')/files/x86/sbin cpuinfo
|
2021-05-18 02:10:29 +00:00
|
|
|
AddPackage git other helloworld fw876 master
|
2021-04-16 10:57:19 +00:00
|
|
|
sed -i 's/143/143,8080/' $(PKG_Finder d package luci-app-ssr-plus)/root/etc/init.d/shadowsocksr
|
2021-04-29 02:06:39 +00:00
|
|
|
sed -i "s?iptables?#iptables?g" ${Version_File}
|
2021-07-02 15:51:31 +00:00
|
|
|
sed -i "s?${zzz_Default_Version}?${zzz_Default_Version} @ ${Author} [${Display_Date}]?g" ${Version_File}
|
2021-03-24 12:50:54 +00:00
|
|
|
;;
|
|
|
|
immortalwrt)
|
2021-07-04 11:03:22 +00:00
|
|
|
sed -i "/dns_caching_dns/d" $(PKG_Finder d "package feeds" luci-app-turboacc)/root/etc/config/turboacc
|
|
|
|
echo " option dns_caching_dns '223.5.5.5,114.114.114.114'" >> $(PKG_Finder d "package feeds" luci-app-turboacc)/root/etc/config/turboacc
|
2021-07-09 14:04:24 +00:00
|
|
|
Copy CustomFiles/Depends/openwrt_release_${OP_Maintainer} package/base-files/files/etc openwrt_release
|
2021-07-02 15:28:23 +00:00
|
|
|
Copy CustomFiles/Depends/cpuinfo_x86 $(PKG_Finder d package autocore | awk 'NR==1')/files/x86/sbin cpuinfo
|
2021-06-28 14:15:23 +00:00
|
|
|
sed -i "s?ImmortalWrt?ImmortalWrt @ ${Author} [${Display_Date}]?g" ${Version_File}
|
2021-02-24 23:51:13 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-09 14:04:24 +00:00
|
|
|
case "${OP_Maintainer}" in
|
2021-03-29 09:11:16 +00:00
|
|
|
immortalwrt)
|
2021-07-02 15:28:23 +00:00
|
|
|
Copy CustomFiles/Depends/banner $(PKG_Finder d package default-settings)/files openwrt_banner
|
|
|
|
sed -i "s?By?By ${Author}?g" $(PKG_Finder d package default-settings)/files/openwrt_banner
|
|
|
|
sed -i "s?Openwrt?Openwrt ${CURRENT_Version} / AutoUpdate ${AutoUpdate_Version}?g" $(PKG_Finder d package default-settings)/files/openwrt_banner
|
2021-03-29 09:11:16 +00:00
|
|
|
;;
|
|
|
|
*)
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy CustomFiles/Depends/banner package/base-files/files/etc
|
2021-03-29 09:11:16 +00:00
|
|
|
sed -i "s?By?By ${Author}?g" package/base-files/files/etc/banner
|
2021-06-06 05:55:56 +00:00
|
|
|
sed -i "s?Openwrt?Openwrt ${CURRENT_Version} / AutoUpdate ${AutoUpdate_Version}?g" package/base-files/files/etc/banner
|
2021-03-29 09:11:16 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-16 16:11:35 +00:00
|
|
|
TIME "[Firmware-Diy_Main] All done !"
|
2021-05-26 13:28:07 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Firmware-Diy_Other() {
|
2021-07-23 08:13:15 +00:00
|
|
|
TIME "[Firmware-Diy_Other]"
|
2021-07-16 16:11:35 +00:00
|
|
|
source ./VARIABLE_FILE
|
|
|
|
case "${PKG_Compatible}" in
|
2021-05-26 13:28:07 +00:00
|
|
|
19.07)
|
2021-07-09 14:04:24 +00:00
|
|
|
OP_BRANCH=19.07
|
2021-05-26 13:28:07 +00:00
|
|
|
Force_mode=1
|
2021-07-16 16:11:35 +00:00
|
|
|
PKG_Compatible=true
|
2021-05-26 13:28:07 +00:00
|
|
|
;;
|
|
|
|
21.02)
|
2021-07-09 14:04:24 +00:00
|
|
|
OP_BRANCH=21.02
|
2021-05-26 13:28:07 +00:00
|
|
|
Force_mode=1
|
2021-07-16 16:11:35 +00:00
|
|
|
PKG_Compatible=true
|
2021-05-26 13:28:07 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-16 16:11:35 +00:00
|
|
|
if [[ ${PKG_Compatible} == true ]];then
|
|
|
|
if [[ ${OP_Maintainer} == openwrt || ${OP_Maintainer} == [Ll]ienol || ${Force_mode} == 1 ]];then
|
2021-07-19 04:17:05 +00:00
|
|
|
TIME "Starting to run Obsolete_Package_Compatible Scripts ..."
|
2021-07-09 14:04:24 +00:00
|
|
|
case "${OP_BRANCH}" in
|
2021-07-16 16:11:35 +00:00
|
|
|
19.07 | 21.02 | main)
|
|
|
|
[[ ${OP_BRANCH} == main ]] && OP_BRANCH=21.02
|
2021-07-09 14:04:24 +00:00
|
|
|
Copy CustomFiles/Patches/0003-upx-ucl-${OP_BRANCH}.patch ./
|
|
|
|
cat 0003-upx-ucl-${OP_BRANCH}.patch | patch -p1 > /dev/null 2>&1
|
2021-06-21 02:28:27 +00:00
|
|
|
# AddPackage svn feeds/packages golang coolsnowwolf/packages/trunk/lang
|
2021-07-19 04:17:05 +00:00
|
|
|
TIME "Starting to convert zh-cn translation files to zh_Hans ..."
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy Scripts/Convert_Translation.sh package
|
2021-05-26 13:28:07 +00:00
|
|
|
cd ./package && bash ./Convert_Translation.sh && cd ..
|
2021-04-09 14:43:50 +00:00
|
|
|
;;
|
|
|
|
*)
|
2021-07-09 14:04:24 +00:00
|
|
|
TIME "Current branch: [${OP_BRANCH}] is not supported,skip..."
|
2021-04-09 14:43:50 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-05-26 13:28:07 +00:00
|
|
|
else
|
2021-07-09 14:04:24 +00:00
|
|
|
TIME "Current source: [${OP_Maintainer}] is not supported,skip..."
|
2021-05-26 13:28:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
2021-06-21 02:28:27 +00:00
|
|
|
if [[ -s $GITHUB_WORKSPACE/Configs/Common ]];then
|
2021-07-25 17:29:03 +00:00
|
|
|
[[ ! "$(cat .config)" =~ "## TEST" ]] && {
|
2021-06-21 02:28:27 +00:00
|
|
|
TIME "Merging [Configs/Common] to .config ..."
|
2021-07-16 16:11:35 +00:00
|
|
|
echo -e "\n$(cat $GITHUB_WORKSPACE/Configs/Common)" >> .config
|
2021-06-21 02:28:27 +00:00
|
|
|
} || {
|
2021-07-25 17:29:03 +00:00
|
|
|
sed -i '/## TEST/d' .config >/dev/null 2>&1
|
2021-06-21 02:28:27 +00:00
|
|
|
}
|
|
|
|
fi
|
2021-01-11 13:44:45 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Firmware-Diy_End() {
|
2021-07-23 08:13:15 +00:00
|
|
|
TIME "[Firmware-Diy_End]"
|
2021-07-16 16:11:35 +00:00
|
|
|
source ./VARIABLE_FILE
|
2021-06-06 05:55:56 +00:00
|
|
|
mkdir -p bin/Firmware
|
2021-07-16 16:11:35 +00:00
|
|
|
sha256sums="${Firmware_Path}/sha256sums"
|
2021-06-06 05:55:56 +00:00
|
|
|
cd ${Firmware_Path}
|
2021-07-16 16:11:35 +00:00
|
|
|
echo -e "### FIRMWARE OUTPUT ###\n$(ls -1 | egrep -v "packages|buildinfo|sha256sums|manifest")\n"
|
|
|
|
case "${TARGET_BOARD}" in
|
|
|
|
x86)
|
|
|
|
[[ ${Checkout_Virtual_Images} == true ]] && {
|
|
|
|
Eval_Firmware $(List_Format)
|
|
|
|
} || {
|
|
|
|
Eval_Firmware ${Firmware_Type}
|
2021-06-17 09:55:08 +00:00
|
|
|
}
|
2021-02-19 08:17:31 +00:00
|
|
|
;;
|
|
|
|
*)
|
2021-07-16 16:11:35 +00:00
|
|
|
Eval_Firmware ${Firmware_Type}
|
2021-02-19 08:17:31 +00:00
|
|
|
;;
|
|
|
|
esac
|
2021-07-16 16:11:35 +00:00
|
|
|
[[ $(ls) =~ AutoBuild ]] && mv -f AutoBuild-* ${Home}/bin/Firmware
|
2021-02-19 08:17:31 +00:00
|
|
|
cd ${Home}
|
2021-04-06 13:56:16 +00:00
|
|
|
echo "[$(date "+%H:%M:%S")] Actions Avaliable: $(df -h | grep "/dev/root" | awk '{printf $4}')"
|
2021-01-11 13:44:45 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Eval_Firmware() {
|
|
|
|
while [[ $1 ]];do
|
|
|
|
Eval_Firmware_Core $1 $(List_Firmware $1)
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
Eval_Firmware_Core() {
|
|
|
|
Firmware_Type_Defined=$1
|
|
|
|
shift
|
|
|
|
while [[ $1 ]];do
|
|
|
|
case "${TARGET_BOARD}" in
|
|
|
|
x86)
|
|
|
|
[[ $1 =~ efi ]] && {
|
|
|
|
FW_Boot_Type=UEFI
|
|
|
|
} || {
|
|
|
|
FW_Boot_Type=Legacy
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
eval AutoBuild_Firmware=$(Get_Variable AutoBuild_Firmware=)
|
|
|
|
[[ -f $1 ]] && {
|
|
|
|
TIME "Copying [$1] to [${AutoBuild_Firmware}] ..."
|
|
|
|
cp -a $1 ${AutoBuild_Firmware}
|
|
|
|
} || TIME "Unable to access [${AutoBuild_Firmware}] ..."
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
List_Firmware() {
|
|
|
|
[[ -z $* ]] && {
|
|
|
|
List_All | while read X;do
|
|
|
|
echo $X | cut -d "*" -f2
|
|
|
|
done
|
|
|
|
} || {
|
|
|
|
while [[ $1 ]];do
|
|
|
|
for X in $(echo $(List_All));do
|
|
|
|
[[ $X == *$1 ]] && echo "$X" | cut -d "*" -f2
|
|
|
|
done
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List_Format() {
|
|
|
|
echo "$(List_All | cut -d "*" -f2 | cut -d "." -f2-3)" | sort | uniq
|
|
|
|
}
|
|
|
|
|
|
|
|
List_All() {
|
|
|
|
egrep -v "packages|buildinfo|sha256sums|manifest|kernel|rootfs|factory" ${sha256sums} | tr -s '\n'
|
2021-06-06 05:55:56 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Get_sha256() {
|
|
|
|
List_All | grep "$1" | cut -c1-5
|
2021-06-06 05:55:56 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Get_Variable() {
|
|
|
|
grep "$1" ${Home}/VARIABLE_FILE | cut -c$(echo $1 | wc -c)-200 | cut -d ":" -f2
|
2021-06-06 05:55:56 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 16:11:35 +00:00
|
|
|
Get_Branches() {
|
2021-06-06 05:55:56 +00:00
|
|
|
Folder="$(pwd)"
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ -n $1 ]] && Folder="$1"
|
2021-05-19 01:03:41 +00:00
|
|
|
git -C "${Folder}" rev-parse --abbrev-ref HEAD | grep -v HEAD || \
|
|
|
|
git -C "${Folder}" describe --exact-match HEAD || \
|
|
|
|
git -C "${Folder}" rev-parse HEAD
|
|
|
|
}
|
|
|
|
|
2021-06-06 05:55:56 +00:00
|
|
|
TIME() {
|
2021-06-17 09:55:08 +00:00
|
|
|
echo "[$(date "+%H:%M:%S")] $*"
|
2021-01-05 23:38:00 +00:00
|
|
|
}
|
|
|
|
|
2021-02-23 11:44:45 +00:00
|
|
|
PKG_Finder() {
|
2021-06-23 09:53:59 +00:00
|
|
|
local Result
|
2021-04-16 10:57:19 +00:00
|
|
|
[[ $# -ne 3 ]] && {
|
2021-06-23 09:53:59 +00:00
|
|
|
TIME "Usage: PKG_Finder <f | d> Search_Path Target_Name/Target_Path"
|
2021-04-16 10:57:19 +00:00
|
|
|
return 0
|
|
|
|
}
|
2021-07-04 09:21:13 +00:00
|
|
|
Result=$(find $2 -name $3 -type $1 -exec echo {} \;)
|
2021-06-23 09:53:59 +00:00
|
|
|
[[ -n ${Result} ]] && echo "${Result}"
|
2021-02-23 11:44:45 +00:00
|
|
|
}
|
|
|
|
|
2021-04-24 14:24:26 +00:00
|
|
|
AddPackage() {
|
2021-04-16 10:57:19 +00:00
|
|
|
[[ $# -lt 4 ]] && {
|
2021-07-19 04:17:05 +00:00
|
|
|
TIME "Syntax error: [$#] [$*] !"
|
2021-04-16 10:57:19 +00:00
|
|
|
return 0
|
|
|
|
}
|
2021-07-19 04:17:05 +00:00
|
|
|
PKG_PROTO=$1
|
|
|
|
case "${PKG_PROTO}" in
|
|
|
|
git | svn)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
TIME "Unknown type: ${PKG_PROTO}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PKG_DIR=$2
|
|
|
|
PKG_NAME=$3
|
2021-06-17 09:55:08 +00:00
|
|
|
REPO_URL="https://github.com/$4"
|
2021-07-19 05:18:50 +00:00
|
|
|
REPO_BRANCH=$5
|
2021-07-09 14:04:24 +00:00
|
|
|
[[ ${REPO_URL} =~ "${OP_Maintainer}/${OP_REPO_NAME}" ]] && return 0
|
2021-06-06 05:55:56 +00:00
|
|
|
|
2021-07-19 05:18:50 +00:00
|
|
|
mkdir -p package/${PKG_DIR} || {
|
|
|
|
TIME "Can't create download dir: [package/${PKG_DIR}]"
|
|
|
|
return 0
|
|
|
|
}
|
2021-06-17 09:55:08 +00:00
|
|
|
[[ -d package/${PKG_DIR}/${PKG_NAME} ]] && {
|
2021-04-16 13:37:28 +00:00
|
|
|
TIME "Removing old package: [${PKG_NAME}] ..."
|
2021-06-06 05:55:56 +00:00
|
|
|
rm -rf package/${PKG_DIR}/${PKG_NAME}
|
2021-04-16 10:57:19 +00:00
|
|
|
}
|
2021-04-08 08:45:11 +00:00
|
|
|
TIME "Checking out package [${PKG_NAME}] to package/${PKG_DIR} ..."
|
2021-03-04 03:48:24 +00:00
|
|
|
case "${PKG_PROTO}" in
|
|
|
|
git)
|
2021-07-19 05:18:50 +00:00
|
|
|
[[ -z ${REPO_BRANCH} ]] && {
|
|
|
|
TIME "WARNING: Missing <branch> ,using default branch: [master]"
|
|
|
|
REPO_BRANCH=master
|
|
|
|
}
|
2021-04-15 07:12:03 +00:00
|
|
|
PKG_URL="$(echo ${REPO_URL}/${PKG_NAME} | sed s/[[:space:]]//g)"
|
|
|
|
git clone -b ${REPO_BRANCH} ${PKG_URL} ${PKG_NAME} > /dev/null 2>&1
|
2021-03-04 03:48:24 +00:00
|
|
|
;;
|
|
|
|
svn)
|
|
|
|
svn checkout ${REPO_URL}/${PKG_NAME} ${PKG_NAME} > /dev/null 2>&1
|
|
|
|
;;
|
|
|
|
esac
|
2021-06-27 03:52:06 +00:00
|
|
|
[[ -f ${PKG_NAME}/Makefile || -n $(ls -A ${PKG_NAME}) ]] && {
|
2021-04-16 10:57:19 +00:00
|
|
|
mv -f "${PKG_NAME}" "package/${PKG_DIR}"
|
2021-07-19 04:17:05 +00:00
|
|
|
} || TIME "Package: ${PKG_NAME} failed to download"
|
2021-01-05 23:38:00 +00:00
|
|
|
}
|
|
|
|
|
2021-06-18 02:08:35 +00:00
|
|
|
Copy() {
|
2021-04-16 10:57:19 +00:00
|
|
|
[[ $# -lt 2 ]] && {
|
2021-07-16 16:11:35 +00:00
|
|
|
TIME "Error options: [$#] [$*] !"
|
2021-04-16 10:57:19 +00:00
|
|
|
return 0
|
|
|
|
}
|
2021-06-21 02:28:27 +00:00
|
|
|
[[ ! -f ${GITHUB_WORKSPACE}/$1 ]] && [[ ! -d ${GITHUB_WORKSPACE}/$1 ]] && {
|
2021-07-16 16:11:35 +00:00
|
|
|
TIME "Unable to access CustomFiles/$1,skip ..."
|
2021-06-18 02:08:35 +00:00
|
|
|
return 0
|
2021-04-16 10:57:19 +00:00
|
|
|
}
|
2021-07-16 16:11:35 +00:00
|
|
|
[[ ! -d ${GITHUB_WORKSPACE}/openwrt/$2 ]] && mkdir -p "${GITHUB_WORKSPACE}/openwrt/$2"
|
2021-06-18 02:08:35 +00:00
|
|
|
[[ -n $3 ]] && RENAME="$3" || RENAME=""
|
|
|
|
TIME "Copying $1 to $2 ${RENAME} ..."
|
|
|
|
cp -a "${GITHUB_WORKSPACE}/$1" "${GITHUB_WORKSPACE}/openwrt/$2/${RENAME}"
|
|
|
|
}
|