developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | MTK_FEEDS_DIR=${1} |
| 4 | |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame] | 5 | if [ -f feeds.conf.default_ori ]; then |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 6 | OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git packages" | awk -F ";openwrt-" '{print $2}'` |
developer | 068e1a4 | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 7 | |
| 8 | if [ -z ${OPENWRT_VER} ]; then |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 9 | OPENWRT_VER=`cat ./feeds.conf.default_ori | grep "src-git-full packages" | awk -F ";openwrt-" '{print $2}'` |
developer | 068e1a4 | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 10 | fi |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame] | 11 | else |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 12 | OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git packages" | awk -F ";openwrt-" '{print $2}'` |
developer | 068e1a4 | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 13 | |
| 14 | if [ -z ${OPENWRT_VER} ]; then |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 15 | OPENWRT_VER=`cat ./feeds.conf.default | grep "src-git-full packages" | awk -F ";openwrt-" '{print $2}'` |
developer | 068e1a4 | 2022-08-29 17:24:20 +0800 | [diff] [blame] | 16 | fi |
developer | 21871ba | 2021-11-05 17:00:05 +0800 | [diff] [blame] | 17 | fi |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 18 | |
| 19 | if [ -z ${1} ]; then |
| 20 | MTK_FEEDS_DIR=feeds/mtk_openwrt_feed |
| 21 | fi |
| 22 | |
| 23 | remove_patches(){ |
| 24 | echo "remove conflict patches" |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 25 | for aa in `cat ${MTK_FEEDS_DIR}/${OPENWRT_VER}/remove_list-mtwifi.txt` |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 26 | do |
| 27 | echo "rm $aa" |
| 28 | rm -rf ./$aa |
| 29 | done |
| 30 | } |
| 31 | |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 32 | # $1: Directory containing patches |
| 33 | apply_patches() { |
| 34 | local patches=`find ${1} -name "*.patch" | sort` |
| 35 | |
| 36 | for file in $patches; do |
| 37 | echo -e "\nApplying ${file}" |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 38 | patch -f -p1 -i ${file} || exit 1 |
| 39 | done |
| 40 | } |
| 41 | |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 42 | sdk_patch(){ |
| 43 | apply_patches "${MTK_FEEDS_DIR}/${OPENWRT_VER}/patches-base" |
| 44 | apply_patches "${MTK_FEEDS_DIR}/${OPENWRT_VER}/patches-feeds" |
| 45 | } |
| 46 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 47 | sdk_patch |
| 48 | #cp mtk target to OpenWRT |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 49 | cp -fpR ${MTK_FEEDS_DIR}/${OPENWRT_VER}/files/* ./ |
developer | 6f1fc75 | 2022-02-10 17:24:44 +0800 | [diff] [blame] | 50 | cp -fpR ${MTK_FEEDS_DIR}/tools ./ |
developer | 06755a8 | 2024-01-09 10:58:20 +0800 | [diff] [blame] | 51 | |
developer | fd40db2 | 2021-04-29 10:08:25 +0800 | [diff] [blame] | 52 | #remove patch if choose to not "keep" patch |
| 53 | if [ -z ${2} ]; then |
| 54 | remove_patches |
| 55 | fi |
| 56 | |