Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[READY] - openwrt bump master -> 021420245 #839

Merged
merged 7 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/openwrt-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
target: ["ath79", "mt7622"]
target: ["ath79", "mt7622", "mt798x"]
container:
# Ubuntu 24.04
image: sarcasticadmin/openwrt-build@sha256:25ac9d0dd4eeaad1aaaa7c82c09e9ecc103c69224fc55eb9717c4cfb018a5281
Expand Down
2 changes: 1 addition & 1 deletion openwrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ KEYPATH ?= ../facts/keys/
GOMPLATE := $(shell command -v gomplate 2> /dev/null)
CURL := $(shell command -v curl 2> /dev/null)

OPENWRT_VER ?= fbe0bd5f6453a61fab871bee56883afc5c6308cf
OPENWRT_VER ?= 3dfd1f69a769bd857061b4856270dfc78e30c610
# If bumping opkg it needs to be a commit that exists in the fork
# https://github.com/sarcasticadmin/opkgs
OPENWRT_PKG_VERSION ?= 38e0f8c7d5c2f69f1603abb99e0fd3886c05f687
Expand Down
5 changes: 5 additions & 0 deletions openwrt/files/etc/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
# the result is wifi is up but the wifi tool detects it as down
(sleep 30 && /root/bin/apinger-pop.sh "8.8.8.8") &> /dev/null &

# if the device crashes capture the pstore crashlog ring-buffer, then
# ship that off to rsyslog and delete it. Need to wait for pstore to be
# mounted so sleep a little before trying to check for /sys/fs/pstore
(sleep 30 && logger -p kern.emerg -t pstore -f /sys/fs/pstore/dmesg-ramoops-0 && rm -f /sys/fs/pstore/dmesg-ramoops-0) &> /dev/null &

exit 0
15 changes: 8 additions & 7 deletions openwrt/files/etc/udhcpc.user
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
#!/bin/sh

# set case insensitive match. This only works if a comparison is made with
# double brackets
shopt -s nocasematch
# Since this is called from other udhcpc scripts this cannot be changed to
# use /bin/bash without also modifying the script that calls this.

case "$1" in
# Same actions for renew or bound for the time being
Expand All @@ -14,13 +13,13 @@ case "$1" in

if [[ ! -z "$opt224" ]] && [[ ! -z "$opt225" ]]; then
if [[ "$opt224" != "$radio0" ]] || [[ "$opt225" != "$radio1" ]]; then
if [[ "$opt224" != "off" ]]; then
if [[ "`echo $opt224 | tr '[A-Z]' '[a-z]'`" != "off" ]]; then
uci set 'wireless.radio0.channel'=$(printf %d "0x$opt224")
uci set 'wireless.radio0.disabled'=0
else
uci set 'wireless.radio0.disabled'=1
fi
if [[ "$opt225" != "off" ]]; then
if [[ "`echo $opt225 | tr '[A-Z]' '[a-z]'`" != "off" ]]; then
uci set 'wireless.radio1.channel'=$(printf %d "0x$opt225")
uci set 'wireless.radio1.disabled'=0
else
Expand All @@ -42,9 +41,11 @@ case "$1" in
if [ `echo "$HOSTNAME" | tr '[A-Z]' '[a-z]'` != `echo "$hostname" | tr '[A-Z]' '[a-z]'` ]; then
# reload/restart whatever needs the hostname updated
/etc/init.d/system reload
service zabbix_agentd restart
service rsyslog restart
service lldpd restart
# prometheus doesnt understand restart
service prometheus-node-exporter-lua stop
service prometheus-node-exporter-lua start
fi
fi
if [ ! -z "$opt226" ]; then
Expand Down
5 changes: 5 additions & 0 deletions tests/serverspec/spec/shared/openwrt/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
its(:stdout) { should eq "0\n" }
end

# Make sure ap_isolate=1 (enabled) always on hostapd
describe command("cat /tmp/run/hostapd-phy*.conf | awk -F= '$1==\"ap_isolate\" && $2!=1 {print; err = 1} END {exit err}'") do
its(:exit_status) { should eq 0 }
end

# Make sure bash is roots shell
describe command("awk -F: -v user='root' '$1 == user {print $NF}' /etc/passwd") do
its(:stdout) { should match /\/bin\/bash/ }
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/openwrt/golden/ath79/etc/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@
# the result is wifi is up but the wifi tool detects it as down
(sleep 30 && /root/bin/apinger-pop.sh "8.8.8.8") &> /dev/null &

# if the device crashes capture the pstore crashlog ring-buffer, then
# ship that off to rsyslog and delete it. Need to wait for pstore to be
# mounted so sleep a little before trying to check for /sys/fs/pstore
(sleep 30 && logger -p kern.emerg -t pstore -f /sys/fs/pstore/dmesg-ramoops-0 && rm -f /sys/fs/pstore/dmesg-ramoops-0) &> /dev/null &

exit 0
15 changes: 8 additions & 7 deletions tests/unit/openwrt/golden/ath79/etc/udhcpc.user
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
#!/bin/sh

# set case insensitive match. This only works if a comparison is made with
# double brackets
shopt -s nocasematch
# Since this is called from other udhcpc scripts this cannot be changed to
# use /bin/bash without also modifying the script that calls this.

case "$1" in
# Same actions for renew or bound for the time being
Expand All @@ -14,13 +13,13 @@ case "$1" in

if [[ ! -z "$opt224" ]] && [[ ! -z "$opt225" ]]; then
if [[ "$opt224" != "$radio0" ]] || [[ "$opt225" != "$radio1" ]]; then
if [[ "$opt224" != "off" ]]; then
if [[ "`echo $opt224 | tr '[A-Z]' '[a-z]'`" != "off" ]]; then
uci set 'wireless.radio0.channel'=$(printf %d "0x$opt224")
uci set 'wireless.radio0.disabled'=0
else
uci set 'wireless.radio0.disabled'=1
fi
if [[ "$opt225" != "off" ]]; then
if [[ "`echo $opt225 | tr '[A-Z]' '[a-z]'`" != "off" ]]; then
uci set 'wireless.radio1.channel'=$(printf %d "0x$opt225")
uci set 'wireless.radio1.disabled'=0
else
Expand All @@ -42,9 +41,11 @@ case "$1" in
if [ `echo "$HOSTNAME" | tr '[A-Z]' '[a-z]'` != `echo "$hostname" | tr '[A-Z]' '[a-z]'` ]; then
# reload/restart whatever needs the hostname updated
/etc/init.d/system reload
service zabbix_agentd restart
service rsyslog restart
service lldpd restart
# prometheus doesnt understand restart
service prometheus-node-exporter-lua stop
service prometheus-node-exporter-lua start
fi
fi
if [ ! -z "$opt226" ]; then
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/openwrt/test_udhcpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_dhcp(){
export opt225=$3 # radio1 channel | off

echo "" > $UCILOG
bash $TOPDIR/openwrt/files/etc/udhcpc.user renew
sh $TOPDIR/openwrt/files/etc/udhcpc.user renew

if ! diff "$testname"_uci.log "$testname"_expected.log; then
echo "FAILED: $testname"
Expand Down
Loading