This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: ARMv8 Docker BuildX | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '30 16 * * 5' | ||
|
||
env: | ||
REPO_URL: https://github.com/coolsnowwolf/lede | ||
REPO_BRANCH: master | ||
DOCKER_BUILD: buildImageX.sh | ||
DOCKER_IMAGE: summary/openwrt-aarch64 | ||
TZ: Asia/Shanghai | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@main | ||
|
||
- name: Initialization environment | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | ||
sudo -E apt-get -qq update | ||
sudo -E apt-get -qq install $(curl -fsSL is.gd/depends_ubuntu_2204) | ||
sudo -E apt-get -qq autoremove --purge | ||
sudo -E apt-get -qq clean | ||
sudo timedatectl set-timezone "$TZ" | ||
sudo mkdir -p /workdir | ||
sudo chown $USER:$GROUPS /workdir | ||
- name: Get openwrt version date | ||
working-directory: /workdir | ||
run: | | ||
df -hT $PWD | ||
git clone $REPO_URL -b $REPO_BRANCH openwrt | ||
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt | ||
cd openwrt | ||
version=$(echo "$(cat package/lean/default-settings/files/zzz-default-settings)" | grep -Po "DISTRIB_REVISION=\'\K[^\']*") | ||
echo "TAG=$version" >> $GITHUB_ENV | ||
- name: Check docker environment | ||
run: | | ||
echo "docker buildx version" | ||
docker buildx version | ||
echo "ls -l /proc/sys/fs/binfmt_misc" | ||
ls -l /proc/sys/fs/binfmt_misc | ||
echo "docker run --privileged --rm tonistiigi/binfmt --install all" | ||
docker run --privileged --rm tonistiigi/binfmt --install all | ||
echo "ls -l /proc/sys/fs/binfmt_misc" | ||
ls -l /proc/sys/fs/binfmt_misc | ||
echo "docker buildx ls" | ||
docker buildx ls | ||
- name: Build and push docker image | ||
run: | | ||
cd $GITHUB_WORKSPACE/docker | ||
wget -q https://github.com/${GITHUB_REPOSITORY}/releases/download/ROOTFS_PLUS/openwrt-armvirt-64-default-rootfs.tar.gz | ||
chmod +x $DOCKER_BUILD | ||
./$DOCKER_BUILD | ||
gzip -dc dockerimgs/docker/*.gz | docker load | ||
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }} | ||
docker tag ${{ env.DOCKER_IMAGE }} ${{ env.DOCKER_IMAGE }}:${{ env.TAG }} | ||
docker push ${{ env.DOCKER_IMAGE }}:${{ env.TAG }} | ||
docker push ${{ env.DOCKER_IMAGE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM scratch | ||
ADD openwrt-armvirt-64-default-rootfs-patched.tar / | ||
EXPOSE 22 53 80 443 7681 | ||
# using exec format so that /sbin/init is proc 1 (see procd docs) | ||
ENTRYPOINT ["/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
TAG=latest | ||
if [ ! -z "$1" ];then | ||
TAG=$1 | ||
fi | ||
|
||
TMPDIR=openwrt_rootfs | ||
OUTDIR=dockerimgs/docker | ||
IMG_NAME=summary/openwrt-aarch64 | ||
|
||
[ -d "$TMPDIR" ] && rm -rf "$TMPDIR" | ||
|
||
mkdir -p "$TMPDIR" && \ | ||
mkdir -p "$OUTDIR" && \ | ||
gzip -dc openwrt-armvirt-64-default-rootfs.tar.gz | ( cd "$TMPDIR" && tar xf - ) && \ | ||
cp -f patches/rc.local "$TMPDIR/etc/" && \ | ||
cp -f patches/cpustat "$TMPDIR/usr/bin/" && chmod 755 "$TMPDIR/usr/bin/cpustat" && \ | ||
cp -f patches/getcpu "$TMPDIR/bin/" && chmod 755 "$TMPDIR/bin/getcpu" && \ | ||
cat patches/luci-admin-status-index-html.patch | (cd "$TMPDIR/usr/lib/lua/luci/view/admin_status/" && patch -p0) && \ | ||
rm -f "$TMPDIR/etc/bench.log" && \ | ||
sed -e 's/\/opt/\/etc/' -i "${TMPDIR}/etc/config/qbittorrent" && \ | ||
# sed -e "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" -i "${TMPDIR}/etc/ssh/sshd_config" && \ | ||
sss=$(date +%s) && \ | ||
ddd=$((sss/86400)) && \ | ||
sed -e "s/:0:0:99999:7:::/:${ddd}:0:99999:7:::/" -i "${TMPDIR}/etc/shadow" && \ | ||
echo "17 3 * * * /etc/coremark.sh" >> "$TMPDIR/etc/crontabs/root" && \ | ||
rm -rf "$TMPDIR/lib/firmware/*" "$TMPDIR/lib/modules/*" && \ | ||
(cd "$TMPDIR" && tar cf ../openwrt-armvirt-64-default-rootfs-patched.tar .) && \ | ||
rm -f DockerImg-OpenwrtArm64-${TAG}.gz && \ | ||
# docker build -t ${IMG_NAME}:${TAG} . && \ | ||
docker buildx build --platform=linux/arm64 -o type=docker -t ${IMG_NAME}:${TAG} . && \ | ||
rm -f openwrt-armvirt-64-default-rootfs-patched.tar && \ | ||
rm -rf "$TMPDIR" && \ | ||
docker save ${IMG_NAME}:${TAG} | pigz -9 > $OUTDIR/docker-img-openwrt-aarch64-${TAG}.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env perl | ||
#use strict; | ||
use utf8; | ||
binmode(STDOUT, ":utf8"); | ||
|
||
sub get_soc_temp { | ||
my @fnames=( | ||
'/sys/devices/virtual/thermal/thermal_zone0/temp', | ||
'/sys/devices/platform/scpi/scpi:sensors/hwmon/hwmon0/temp1_input', | ||
); | ||
my $fh; | ||
my $temp = "Unknown"; | ||
for my $fname (@fnames) { | ||
if( -f $fname ) { | ||
open $fh, "<", $fname; | ||
$temp = sprintf "%0.1f℃", <$fh> / 1000; | ||
close $fh; | ||
return $temp; | ||
} | ||
} | ||
return $temp; | ||
} | ||
|
||
sub get_cpu_freq { | ||
my @fnames=( | ||
'/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq', | ||
); | ||
my $fh; | ||
my $freq = "Unknown"; | ||
for my $fname (@fnames) { | ||
if( -f $fname ) { | ||
open $fh, "<", $fname; | ||
$freq = sprintf "%dMhz", <$fh> / 1000; | ||
close $fh; | ||
return $freq; | ||
} | ||
} | ||
return $freq; | ||
} | ||
|
||
print &get_cpu_freq, " / ", &get_soc_temp, "\n"; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env perl | ||
#use strict; | ||
|
||
sub get_stat { | ||
open IN, "<", "/proc/stat"; | ||
$_ = <IN>; | ||
chomp; | ||
close(IN); | ||
my ($cpu, $user, $nice, $system, $idle, $iowait, $irq, $softirq, $steal, $guest, $guest_nice) = split; | ||
my $Idle = $idle + $iowait; | ||
my $Non_Idle = $user + $nice + $system + $irq + $softirq + $steal + $guest + $guest_nice; | ||
return ($Idle, $Non_Idle); | ||
} | ||
|
||
my($prev_idle, $prev_non_idle) = &get_stat; | ||
my $prev_total = $prev_idle + $prev_non_idle; | ||
sleep(3); | ||
my($idle, $non_idle) = &get_stat; | ||
my $total = $idle + $non_idle; | ||
|
||
my $totald = $total - $prev_total; | ||
my $idled = $idle - $prev_idle; | ||
my $cpu_percentage = ($totald - $idled) / $totald * 100; | ||
|
||
$| = 1; | ||
open OUT, ">", "/tmp/cpuusage"; | ||
printf OUT "%0.1f\%", $cpu_percentage; | ||
close(OUT); | ||
|
||
exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- index.htm.orig 2020-03-12 22:49:17.000000000 +0800 | ||
+++ index.htm 2020-03-13 00:49:19.000000000 +0800 | ||
@@ -17,6 +17,7 @@ | ||
local sysinfo = luci.util.ubus("system", "info") or { } | ||
local boardinfo = luci.util.ubus("system", "board") or { } | ||
local unameinfo = nixio.uname() or { } | ||
+ local cpustat = luci.sys.exec("/usr/bin/cpustat") or { } | ||
|
||
local meminfo = sysinfo.memory or { | ||
total = 0, | ||
@@ -43,8 +44,7 @@ | ||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0 | ||
|
||
local conn_max = tonumber(luci.sys.exec( | ||
- "sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max" | ||
- ):match("%d+")) or 4096 | ||
+ "sysctl -n -e net.netfilter.nf_conntrack_max net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max | head -n 1"):match("%d+")) or 4096 | ||
|
||
local user_info = tonumber(luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")) | ||
|
||
@@ -65,7 +65,8 @@ | ||
conncount = conn_count, | ||
leases = stat.dhcp_leases(), | ||
leases6 = stat.dhcp6_leases(), | ||
- wifinets = stat.wifi_networks() | ||
+ wifinets = stat.wifi_networks(), | ||
+ cpustat = luci.sys.exec("/usr/bin/cpustat") or { } | ||
} | ||
|
||
if wan then | ||
@@ -637,6 +638,9 @@ | ||
if (e = document.getElementById('localtime')) | ||
e.innerHTML = info.localtime; | ||
|
||
+ if (e = document.getElementById('cpustat')) | ||
+ e.innerHTML = info.cpustat; | ||
+ | ||
if (e = document.getElementById('uptime')) | ||
e.innerHTML = String.format('%t', info.uptime); | ||
|
||
@@ -701,6 +705,7 @@ | ||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr> | ||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr> | ||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr> | ||
+ <tr><td width="33%"><%:CPU状态%></td><td id="cpustat">-</td></tr> | ||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr> | ||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 修复在某些docker环境下网络卡顿的问题, 如果非必要请勿删除! | ||
cat > /etc/resolv.conf <<EOF | ||
search lan | ||
nameserver 127.0.0.1 | ||
options ndots:0 | ||
EOF | ||
|
||
# | ||
# | ||
# Put your custom commands here that should be executed once | ||
# the system init finished. By default this file does nothing. | ||
|
||
exit 0 |