├── diy-part2.sh ├── diy-part1.sh ├── LICENSE ├── .github └── workflows │ ├── update-checker.yml │ └── build-openwrt.yml └── README.md /diy-part2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2019-2020 P3TERX 4 | # 5 | # This is free software, licensed under the MIT License. 6 | # See /LICENSE for more information. 7 | # 8 | # https://github.com/P3TERX/Actions-OpenWrt 9 | # File name: diy-part2.sh 10 | # Description: OpenWrt DIY script part 2 (After Update feeds) 11 | # 12 | 13 | # Modify default IP 14 | #sed -i 's/192.168.1.1/192.168.50.5/g' package/base-files/files/bin/config_generate 15 | 16 | -------------------------------------------------------------------------------- /diy-part1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2019-2020 P3TERX 4 | # 5 | # This is free software, licensed under the MIT License. 6 | # See /LICENSE for more information. 7 | # 8 | # https://github.com/P3TERX/Actions-OpenWrt 9 | # File name: diy-part1.sh 10 | # Description: OpenWrt DIY script part 1 (Before Update feeds) 11 | # 12 | # Uncomment a feed source 13 | #sed -i 's/^#\(.*helloworld\)/\1/' feeds.conf.default 14 | # Add a feed source 15 | #sed -i '$a src-git lienol https://github.com/Lienol/openwrt-package' feeds.conf.default 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 P3TERX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/update-checker.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019-2021 P3TERX 3 | # 4 | # This is free software, licensed under the MIT License. 5 | # See /LICENSE for more information. 6 | # 7 | # https://github.com/P3TERX/Actions-OpenWrt 8 | # File: .github/workflows/update-checker.yml 9 | # Description: Source code update checker 10 | # 11 | 12 | name: Update Checker 13 | 14 | env: 15 | REPO_URL: https://github.com/x-wrt/x-wrt 16 | REPO_BRANCH: master 17 | 18 | on: 19 | workflow_dispatch: 20 | schedule: 21 | - cron: 0 19 * * 5 22 | 23 | jobs: 24 | check: 25 | runs-on: ubuntu-latest 26 | 27 | steps: 28 | 29 | - name: Get Commit Hash 30 | id: getHash 31 | run: | 32 | git clone --depth 1 $REPO_URL -b $REPO_BRANCH . 33 | echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT 34 | 35 | - name: Compare Commit Hash 36 | id: cacheHash 37 | uses: actions/cache@v3 38 | with: 39 | path: .commitHash 40 | key: HEAD-${{ steps.getHash.outputs.commitHash }} 41 | 42 | - name: Save New Commit Hash 43 | if: steps.cacheHash.outputs.cache-hit != 'true' 44 | run: | 45 | echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash 46 | 47 | - name: Trigger build 48 | if: steps.cacheHash.outputs.cache-hit != 'true' 49 | uses: peter-evans/repository-dispatch@v2 50 | with: 51 | token: ${{ secrets.ACTIONS_TRIGGER_PAT }} 52 | event-type: Source Code Update 53 | 54 | - name: Delete workflow runs 55 | uses: astolfogit/delete-workflow-runs@main 56 | with: 57 | retain_days: 1 58 | keep_minimum_runs: 1 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Actions-OpenWrt 2 | 3 | [![LICENSE](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square&label=LICENSE)](https://github.com/P3TERX/Actions-OpenWrt/blob/main/LICENSE) 4 | 5 | This repository contains releases of [X-WRT](https://github.com/x-wrt/x-wrt) for Mi Router 3 (mt7620) | Этот репозиторий содержит релизы [X-WRT](https://github.com/x-wrt/x-wrt) для Mi Router 3 (mt7620) 6 | 7 | Guide in English - [how to get ssh access, install X-WRT and so on](https://openwrt.org/toh/xiaomi/mir3#get_sshdropbear_access) 8 | 9 | Includes support for PPPoE, WPA3, 3G/4G dongles (e.g. Huawei E3372), USB drives (NTFS, EXT4, exFAT and FAT32 file systems supported) | Включает в себя поддержку PPPoE, WPA3, 3G/4G модемов, USB флешек (NTFS, EXT4, exFAT и FAT32 файловые системы поддерживаются) 10 | 11 | Установка: 12 | - Получаем доступ по SSH - [гайд](https://4pda.to/forum/index.php?s=&showtopic=736801&view=findpost&p=49333132) 13 | - Скопировать файлы openwrt-xxx-kernel1.bin и openwrt-xxx-rootfs0.bin на флешку, отформатированную в FAT32. Для удобства можно их переименовать в kernel1.bin и rootfs0.bin. Вставить флешку в роутер. 14 | - В консоли вводим: 15 | 16 | nvram set flag_last_success=1 17 | 18 | nvram set boot_wait=on 19 | 20 | nvram set uart_en=1 21 | 22 | nvram commit 23 | 24 | cd /extdisks/sda1 25 | 26 | mtd write kernel1.bin kernel1 27 | 28 | mtd write rootfs0.bin rootfs0 29 | 30 | reboot 31 | 32 | - Через несколько минут интерфейс будет доступен по адресу 192.168.15.1 33 | - Последующие обновления файлом openwrt-xxx-sysupgrade.bin в интерфейсе во вкладке System -> Backup / Flash Firmware -> Flash new firmware image 34 | - В случае неудачи - [возврат на сток через UART](https://4pda.to/forum/index.php?s=&showtopic=736801&view=findpost&p=50915904). 35 | 36 | ## Acknowledgments 37 | 38 | - [P3TERX/Actions-OpenWrt](https://github.com/P3TERX/Actions-OpenWrt) 39 | - [Aelliari/xwrt_action](https://github.com/Aelliari/xwrt_action) 40 | - [Microsoft Azure](https://azure.microsoft.com) 41 | - [GitHub Actions](https://github.com/features/actions) 42 | - [OpenWrt](https://github.com/openwrt/openwrt) 43 | - [X-WRT](https://github.com/x-wrt/x-wrt) 44 | - [Lean's OpenWrt](https://github.com/coolsnowwolf/lede) 45 | - [tmate](https://github.com/tmate-io/tmate) 46 | - [mxschmitt/action-tmate](https://github.com/mxschmitt/action-tmate) 47 | - [csexton/debugger-action](https://github.com/csexton/debugger-action) 48 | - [Cowtransfer](https://cowtransfer.com) 49 | - [WeTransfer](https://wetransfer.com/) 50 | - [Mikubill/transfer](https://github.com/Mikubill/transfer) 51 | - [softprops/action-gh-release](https://github.com/softprops/action-gh-release) 52 | - [ActionsRML/delete-workflow-runs](https://github.com/ActionsRML/delete-workflow-runs) 53 | - [dev-drprasad/delete-older-releases](https://github.com/dev-drprasad/delete-older-releases) 54 | - [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) 55 | 56 | ## License 57 | 58 | [MIT](https://github.com/P3TERX/Actions-OpenWrt/blob/main/LICENSE) © P3TERX 59 | -------------------------------------------------------------------------------- /.github/workflows/build-openwrt.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019-2020 P3TERX 3 | # 4 | # This is free software, licensed under the MIT License. 5 | # See /LICENSE for more information. 6 | # 7 | # https://github.com/P3TERX/Actions-OpenWrt 8 | # Description: Build OpenWrt using GitHub Actions 9 | # 10 | 11 | name: Build xwrt 12 | 13 | on: 14 | repository_dispatch: 15 | workflow_dispatch: 16 | inputs: 17 | ssh: 18 | description: 'SSH connection to Actions' 19 | required: false 20 | default: 'false' 21 | 22 | env: 23 | REPO_URL: https://github.com/x-wrt/x-wrt 24 | REPO_BRANCH: master 25 | FEEDS_CONF: feeds.conf.default 26 | CONFIG_FILE: .config 27 | DIY_P1_SH: diy-part1.sh 28 | DIY_P2_SH: diy-part2.sh 29 | #by default used .config for build from repo 30 | #if your repo not contain .config, you may download it from direct url setting by ALT_CONFIG_URL variable 31 | #if ALT_CONFIG_URL commented and repo not contain .config - use default for mt7620 32 | #.config from repo > .config from url > default .config 33 | ALT_CONFIG_URL: false 34 | UPLOAD_BIN_DIR: false 35 | UPLOAD_FIRMWARE: true 36 | UPLOAD_COWTRANSFER: false 37 | UPLOAD_WETRANSFER: false 38 | UPLOAD_RELEASE: true 39 | TZ: Europe/Moscow 40 | 41 | jobs: 42 | build: 43 | runs-on: ubuntu-22.04 44 | 45 | steps: 46 | - name: Checkout 47 | uses: actions/checkout@main 48 | 49 | - name: Initialization environment 50 | env: 51 | DEBIAN_FRONTEND: noninteractive 52 | run: | 53 | sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc 54 | sudo -E apt-get -qq update 55 | sudo -E apt-get -qq install build-essential clang flex g++ gawk gcc-multilib gettext git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev file wget 56 | sudo -E apt-get -qq autoremove --purge 57 | sudo -E apt-get -qq clean 58 | sudo timedatectl set-timezone "$TZ" 59 | sudo mkdir -p /workdir 60 | sudo chown $USER:$GROUPS /workdir 61 | 62 | - name: Clone source code 63 | working-directory: /workdir 64 | run: | 65 | df -hT $PWD 66 | git clone $REPO_URL -b $REPO_BRANCH xwrt 67 | ln -sf /workdir/xwrt $GITHUB_WORKSPACE/xwrt 68 | 69 | - name: Load custom feeds 70 | run: | 71 | [ -e $FEEDS_CONF ] && mv $FEEDS_CONF xwrt/feeds.conf.default 72 | chmod +x $DIY_P1_SH 73 | cd xwrt 74 | $GITHUB_WORKSPACE/$DIY_P1_SH 75 | 76 | - name: Update feeds 77 | run: cd xwrt && ./scripts/feeds update -a 78 | 79 | - name: Install feeds 80 | run: cd xwrt && ./scripts/feeds install -a 81 | 82 | - name: Load custom configuration 83 | env: 84 | check: 0 85 | run: | 86 | [ -e files ] && mv files xwrt/files 87 | if [ -e $CONFIG_FILE ]; 88 | then mv $CONFIG_FILE xwrt/.config; 89 | echo "Use .config from repo"; 90 | else if [ ! -z "$ALT_CONFIG_URL" ]; 91 | then curl -Lo xwrt/.config $ALT_CONFIG_URL; 92 | echo "successfully download .config from url, .config in repo don't exist"; 93 | echo "checking .config"; 94 | check=$(grep -e "^# Automatically generated file; DO NOT EDIT.$" xwrt/.config && grep -e "^# OpenWrt Configuration$" xwrt/.config); 95 | if [ ! "$(echo $check |wc -c)" = "69" ]; 96 | then echo ".config invalid, setting default for mt7620"; 97 | rm -rf xwrt/.config; 98 | cp xwrt/feeds/x/rom/lede/config.ramips-mt7620 xwrt/.config; 99 | else echo "naive check passed"; 100 | fi 101 | else cp xwrt/feeds/x/rom/lede/config.ramips-mt7620 xwrt/.config; 102 | echo "use default .config for mt7620 in xwrt, url not set and .config in repo don't exist"; 103 | fi 104 | fi 105 | chmod +x $DIY_P2_SH 106 | cd xwrt 107 | $GITHUB_WORKSPACE/$DIY_P2_SH 108 | 109 | - name: SSH connection to Actions 110 | uses: P3TERX/ssh2actions@v1.0.0 111 | if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') 112 | env: 113 | TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} 114 | TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} 115 | 116 | - name: Download package 117 | id: package 118 | run: | 119 | cd xwrt 120 | make defconfig 121 | make download -j8 122 | find dl -size -1024c -exec ls -l {} \; 123 | find dl -size -1024c -exec rm -f {} \; 124 | 125 | - name: Compile the firmware 126 | id: compile 127 | run: | 128 | cd xwrt 129 | echo -e "$(nproc) thread compile" 130 | make -j$(nproc) || make -j1 || make -j1 V=s 131 | echo "status=success" >> $GITHUB_OUTPUT 132 | grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME 133 | [ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV 134 | echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV 135 | 136 | - name: Check space usage 137 | if: (!cancelled()) 138 | run: df -hT 139 | 140 | - name: Upload bin directory 141 | uses: actions/upload-artifact@main 142 | if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' 143 | with: 144 | name: xwrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} 145 | path: xwrt/bin 146 | 147 | - name: Organize files 148 | id: organize 149 | if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() 150 | run: | 151 | cd xwrt/bin/targets/*/* 152 | rm -rf packages 153 | echo "FIRMWARE=$PWD" >> $GITHUB_ENV 154 | echo "status=success" >> $GITHUB_OUTPUT 155 | 156 | - name: Upload firmware directory 157 | uses: actions/upload-artifact@main 158 | if: steps.organize.outputs.status == 'success' && !cancelled() 159 | with: 160 | name: xwrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} 161 | path: ${{ env.FIRMWARE }} 162 | 163 | - name: Upload firmware to cowtransfer 164 | id: cowtransfer 165 | if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled() 166 | run: | 167 | curl -fsSL git.io/file-transfer | sh 168 | ./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log 169 | echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)" 170 | echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT 171 | 172 | - name: Upload firmware to WeTransfer 173 | id: wetransfer 174 | if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled() 175 | run: | 176 | curl -fsSL git.io/file-transfer | sh 177 | ./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log 178 | echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" 179 | echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT 180 | 181 | - name: Generate release tag 182 | id: tag 183 | if: env.UPLOAD_RELEASE == 'true' && !cancelled() 184 | run: | 185 | echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT 186 | touch release.txt 187 | [ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt 188 | [ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt 189 | echo "status=success" >> $GITHUB_OUTPUT 190 | 191 | - name: Upload firmware to release 192 | uses: softprops/action-gh-release@v1 193 | if: steps.tag.outputs.status == 'success' && !cancelled() 194 | env: 195 | GITHUB_TOKEN: ${{ secrets.ACTIONS_TRIGGER_PAT }} 196 | with: 197 | tag_name: ${{ steps.tag.outputs.release_tag }} 198 | body_path: release.txt 199 | files: ${{ env.FIRMWARE }}/* 200 | 201 | - name: Delete workflow runs 202 | uses: astolfogit/delete-workflow-runs@main 203 | with: 204 | retain_days: 1 205 | keep_minimum_runs: 3 206 | 207 | - name: Remove old Releases 208 | uses: dev-drprasad/delete-older-releases@v0.2.1 209 | if: env.UPLOAD_RELEASE == 'true' && !cancelled() 210 | with: 211 | keep_latest: 3 212 | delete_tags: true 213 | env: 214 | GITHUB_TOKEN: ${{ secrets.ACTIONS_TRIGGER_PAT }} 215 | 216 | --------------------------------------------------------------------------------