Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SuLingGG committed Feb 4, 2020
0 parents commit 0bed50b
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/build-openwrt-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================

name: Build Raspberry Pi OpenWrt Docker Image

on:
release:
types: [published]
push:
branches:
- master
paths:
- 'rpi-openwrt-docker.config'
schedule:
- cron: 0 16 * * *
# watch:
# types: [started]

jobs:
build:
runs-on: ubuntu-18.04

steps:
- name: Checkout
uses: actions/checkout@master

- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
echo "Deleting files, please wait ..."
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d/*
sudo swapoff /swapfile
sudo rm -f /swapfile
#sudo -E apt-get -q purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt-get -qq update
sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- name: Clone Source Code
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
run: git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt

- name: Update Feeds
run: |
cd openwrt
echo "src-git lienol https://github.com/Lienol/openwrt-package" >> feeds.conf.default
./scripts/feeds update -a
- name: Install Feeds
run: cd openwrt && ./scripts/feeds install -a

- name: Load Custom Configuration
env:
CONFIG_FILE: 'rpi-openwrt-docker.config'
DIY_SH: 'lean-openwrt.sh'
run: |
[ -e files ] && mv files openwrt/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
chmod +x $DIY_SH
cd openwrt
../$DIY_SH
make defconfig
# - name: SSH Connection to Actions
# uses: P3TERX/debugger-action@master

- name: Download Package
run: |
cd openwrt && make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Multi-Thread Compile
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc)
- name: Single-Thread Compile
if: failure()
run: |
cd openwrt
make -j1 V=s
- name: Upload RootFS Archive
uses: actions/upload-artifact@master
with:
name: openwrt-brcm2708-bcm2709-rpi-2-rootfs.tar.gz.zip
path: openwrt/bin/targets/brcm2708/bcm2709/openwrt-brcm2708-bcm2709-rpi-2-rootfs.tar.gz

- name: Docker Hub Login
run: docker login -u sulinggg -p ${{ secrets.DOCKER_HUB_PWD }}

- name: Build Docker Image
run: |
cd openwrt/bin/targets/brcm2708/bcm2709/
docker import openwrt-brcm2708-bcm2709-rpi-2-rootfs.tar.gz sulinggg/openwrt:test
- name: Push Docker Image
run: docker push sulinggg/openwrt:test
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 P3TERX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Actions-OpenWrt

[![LICENSE](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square&label=LICENSE)](https://github.com/P3TERX/Actions-OpenWrt/blob/master/LICENSE)
[![GitHub Stars](https://img.shields.io/github/stars/P3TERX/Actions-OpenWrt.svg?style=flat-square&label=Stars)](https://github.com/P3TERX/Actions-OpenWrt/stargazers)
[![GitHub Forks](https://img.shields.io/github/forks/P3TERX/Actions-OpenWrt.svg?style=flat-square&label=Forks)](https://github.com/P3TERX/Actions-OpenWrt/fork)

Build OpenWrt using GitHub Actions

[Read the details in my blog (in Chinese) | 中文教程](https://p3terx.com/archives/build-openwrt-with-github-actions.html)

[GitHub Actions Group](https://t.me/GitHub_Actions) | [GitHub Actions Channel](https://t.me/GitHub_Actions_Channel)

## Usage

- Sign up for [GitHub Actions](https://github.com/features/actions/signup)
- Fork [this GitHub repository](https://github.com/P3TERX/Actions-OpenWrt)
- Generate `.config` files using [Lean's OpenWrt](https://github.com/coolsnowwolf/lede) source code.
- Push `.config` file to the GitHub repository, and the build starts automatically.Progress can be viewed on the Actions page.
- When the build is complete, click the `Artifacts` button in the upper right corner of the Actions page to download the binaries.

## Acknowledgments

- [Microsoft](https://www.microsoft.com)
- [Microsoft Azure](https://azure.microsoft.com)
- [GitHub](https://github.com)
- [GitHub Actions](https://github.com/features/actions)
- [tmate](https://github.com/tmate-io/tmate)
- [mxschmitt/action-tmate](https://github.com/mxschmitt/action-tmate)
- [csexton/debugger-action](https://github.com/csexton/debugger-action)
- [Cisco](https://www.cisco.com/)
- [OpenWrt](https://github.com/openwrt/openwrt)
- [Lean's OpenWrt](https://github.com/coolsnowwolf/lede)

## License

[MIT](https://github.com/P3TERX/Actions-OpenWrt/blob/master/LICENSE) © P3TERX
21 changes: 21 additions & 0 deletions files/etc/config/network
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'fd32:0344:e875::/48'

config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.123.100'
option netmask '255.255.255.0'
option ip6assign '60'
option gateway '192.168.123.1'
list dns '192.168.123.1'
option broadcast '192.168.123.255'

9 changes: 9 additions & 0 deletions files/etc/rc.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

# Fix Luci Don't Remove!!
umount /etc/resolv.conf
rm /etc/resolv.conf
ln -s /tmp/resolv.conf.auto /etc/resolv.conf

exit 0
58 changes: 58 additions & 0 deletions lean-openwrt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
#=================================================
# Description: DIY script
# Lisence: MIT
# Author: P3TERX
# Blog: https://p3terx.com
#=================================================
# Modify default IP
#sed -i 's/192.168.1.1/192.168.50.5/g' package/base-files/files/bin/config_generate

# Clone community packages to package/community
mkdir package/community
cd package/community

# Add mentohust & luci-app-mentohust.
git clone https://github.com/BoringCat/luci-app-mentohust
git clone https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk

# Add ServerChan
git clone https://github.com/tty228/luci-app-serverchan

# Add OpenClash
git clone https://github.com/vernesong/OpenClash

# Add luci-app-koolproxyR
git clone https://github.com/Leo-Jo/luci-app-koolproxyR

# Add luci-app-onliner (need luci-app-nlbwmon)
git clone https://github.com/rufengsuixing/luci-app-onliner

# Add luci-app-dockerman
git clone https://github.com/lisaac/luci-lib-docker
git clone https://github.com/lisaac/luci-app-dockerman

# Add luci-app-adguardhome
git clone https://github.com/rufengsuixing/luci-app-adguardhome

# Add Rclone-OpenWrt
git clone https://github.com/ElonH/Rclone-OpenWrt

# Add luci-app-diskman
git clone https://github.com/lisaac/luci-app-diskman
mkdir parted
cp luci-app-diskman/Parted.Makefile parted/Makefile

# Add luci-theme-argon
git clone https://github.com/jerrykuku/luci-theme-argon
rm -rf ../lean/luci-theme-argon

# Change timezone
cd ../..
sed -i "s/'UTC'/'CST-8'\n set system.@system[-1].zonename='Asia\/Shanghai'/g" package/base-files/files/bin/config_generate

# Change default theme
sed -i 's/config internal themes/config internal themes\n option Argon \"\/luci-static\/argon\"/g' feeds/luci/modules/luci-base/root/etc/config/luci

# Remove bootstrap theme
sed -i '/set luci.main.mediaurlbase=\/luci-static\/bootstrap/d' feeds/luci/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap
Loading

0 comments on commit 0bed50b

Please sign in to comment.