Skip to content
Open
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
38 changes: 19 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ jobs:
run: |
JSON='['
FIRST_BUILD=1
versions=$(curl https://downloads.openwrt.org/.versions.json)
stable=$(echo $versions | jq | grep \"stable_ | sed 's|.*\"stable_version\": \"\(.*\)\",|\1|')
oldstable=$(echo $versions | jq | grep oldstable_ | sed 's|.*\"oldstable_version\": \"\(.*\)\",|\1|')

for version in "main" "${stable:0:5}" "${oldstable:0:5}"; do

VERSION=$([ "$version" == "main" ] \
&& echo "main" || echo "openwrt-$version")
echo $VERSION

OPENWRT_BRANCH_PATH="openwrt-$version"
echo $OPENWRT_BRANCH_PATH

[[ $FIRST_BUILD -ne 1 ]] && JSON="$JSON"','
FIRST_BUILD=0

JSON="$JSON"'{"version": "'"$VERSION"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
versions_json=$(curl -s https://downloads.openwrt.org/.versions.json)
stable_version=$(echo "$versions_json" | jq -r '.stable_version')
oldstable_version=$(echo "$versions_json" | jq -r '.oldstable_version')
upcoming_version=$(echo "$versions_json" | jq -r '.upcoming_version')
stable_branch=$(echo "$stable_version" | cut -d. -f1,2)
oldstable_branch=$(echo "$oldstable_version" | cut -d. -f1,2)
upcoming_branch=$(echo "$upcoming_version" | cut -d. -f1,2)

for branch in "main" "$stable_branch" "$oldstable_branch" "$upcoming_branch"; do
if [ ! -z "$branch" ] && [ -n "$branch" ]; then

VERSION=$([ "$branch" == "main" ] && echo "main" || echo "openwrt-$branch")
OPENWRT_BRANCH_PATH="openwrt-$branch"
echo $VERSION

[[ $FIRST_BUILD -ne 1 ]] && JSON="$JSON"','
FIRST_BUILD=0
JSON="$JSON"'{"version": "'"$VERSION"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
fi
done

echo $JSON

matrix_include='{"include": '"$JSON"']}'
echo "matrix_builds=${matrix_include}" >> "$GITHUB_OUTPUT"

Expand Down
70 changes: 35 additions & 35 deletions .github/workflows/multi-arch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,50 +59,50 @@ jobs:
VERSIONS='['
FIRST_BUILD=1
FIRST_VERSION=1
versions=$(curl https://downloads.openwrt.org/.versions.json)
stable=$(echo $versions | jq | grep \"stable_ | sed 's|.*\"stable_version\": \"\(.*\)\",|\1|')
oldstable=$(echo $versions | jq | grep oldstable_ | sed 's|.*\"oldstable_version\": \"\(.*\)\",|\1|')
versions_json=$(curl -s https://downloads.openwrt.org/.versions.json)
stable_version=$(echo "$versions_json" | jq -r '.stable_version')
oldstable_version=$(echo "$versions_json" | jq -r '.oldstable_version')
upcoming_version=$(echo "$versions_json" | jq -r '.upcoming_version')

ARCH_FILTER="${{ github.event.inputs.arch }}"
BRANCHES_FILTER="${{ github.event.inputs.branches }}"
BRANCHES_LIST=$([ "$BRANCHES_FILTER" != "" ] && echo "$BRANCHES_FILTER" \
|| echo "main" "${stable:0:5}" "${oldstable:0:5}")
|| echo "main" "${stable_version:0:5}" "${oldstable_version:0:5}" ${upcoming_version:0:5})

# BRANCHES_LIST=main
# ARCH_FILTER=mips_24kc

for version in $BRANCHES_LIST; do

VERSION=$([ "$version" == "main" ] \
&& echo "main" || echo "openwrt-$version")
echo $VERSION

VERSION_PATH=$([ "$version" == "main" ] \
&& echo "snapshots" || echo "releases/$version-SNAPSHOT")
echo $VERSION_PATH

OPENWRT_BRANCH_PATH="openwrt-$version"
echo $OPENWRT_BRANCH_PATH

if [ "$ARCH_FILTER" != "" ]; then
JSON="$JSON"'{"version": "'"$VERSION"'", "arch": "'"$ARCH_FILTER"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
else
archs=$(curl https://downloads.openwrt.org/$VERSION_PATH/.targets.json | jq .[] | sort -u | sed 's|"||g')

for ARCH in $archs; do
# skip x86_64 as it should be built only by .github/workflows/build.yml
if [ "$ARCH" != "x86_64" ]; then

[[ $FIRST_BUILD -ne 1 ]] && JSON="$JSON"','
FIRST_BUILD=0

JSON="$JSON"'{"version": "'"$VERSION"'", "arch": "'"$ARCH"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
for branch in $BRANCHES_LIST; do
if [ ! -z "$branch" ] && [ -n "$branch" ]; then
VERSION=$([ "$branch" == "main" ] && echo "main" || echo "openwrt-$branch")
VERSION_PATH=$([ "$branch" == "main" ] && echo "snapshots" || echo "releases/$branch-SNAPSHOT")
OPENWRT_BRANCH_PATH="openwrt-$branch"

# skip x86_64 as it should be built only by .github/workflows/build.yml
if [ "$ARCH_FILTER" != "" ] && [ "$ARCH_FILTER" != "x86_64" ]; then
JSON="$JSON"'{"version": "'"$VERSION"'", "arch": "'"$ARCH_FILTER"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
else

archs=$(curl -s https://downloads.openwrt.org/$VERSION_PATH/.targets.json)
if [[ "$archs" == *"html"* ]]; then
echo "Cannot retrieve archs - skipping"
continue
else

archs=$(echo $archs | jq -r '.[]' | sort -u | grep -v x86_64)
for ARCH in $archs; do
[[ $FIRST_BUILD -ne 1 ]] && JSON="$JSON"','
FIRST_BUILD=0

JSON="$JSON"'{"version": "'"$VERSION"'", "arch": "'"$ARCH"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
done
fi
done
fi
fi

[[ $FIRST_VERSION -ne 1 ]] && VERSIONS="$VERSIONS"','
FIRST_VERSION=0
VERSIONS="$VERSIONS"'{"version": "'"$VERSION"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
[[ $FIRST_VERSION -ne 1 ]] && VERSIONS="$VERSIONS"','
FIRST_VERSION=0
VERSIONS="$VERSIONS"'{"version": "'"$VERSION"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }'
fi
done

echo $JSON
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# [LibreMesh][5] packages

[![LibreMesh logo](https://raw.githubusercontent.com/libremesh/lime-web/master/logo/logo.png)](https://libremesh.org)
[![LibreMesh logo](https://raw.githubusercontent.com/libremesh/lime-web/master/assets/logo/logo.png)](https://libremesh.org)

[LibreMesh project][5] includes the development of several tools used for
deploying libre/free mesh networks.
Expand Down
1 change: 1 addition & 0 deletions packages/lime-report/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Ilario Gelmetti <[email protected]>
URL:=https://libremesh.org
DEPENDS:=+jq
PKGARCH:=all
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ generate_status() {
paste_cmd swconfig dev switch0 show
paste_cmd fw4 print
paste_cmd nft list ruleset
paste_cmd opkg list-installed
paste_cmd "ubus call rpc-sys packagelist
'{\"all\":true}' | jq -S '.packages'"
}

generate_all() {
Expand Down
105 changes: 42 additions & 63 deletions packages/lime-system/files/etc/uci-defaults/92_add-lime-repos
Original file line number Diff line number Diff line change
@@ -1,73 +1,52 @@
#!/bin/sh

[ -f /etc/lime_release ] && . /etc/lime_release || {
echo "LibreMesh version not found in /etc/lime_release - skipping"
exit 0
[ ! -f /etc/lime_release ] && {
echo "LibreMesh version not found in /etc/lime_release - skipping" && exit 0
}

if [ -f /etc/apk/repositories.d/distfeeds.list ]; then
repo='apk'
feeds_file='/etc/apk/repositories.d/limefeeds.list'
dist_feeds_file='/etc/apk/repositories.d/distfeeds.list'
pkg_manager_path='apk/'
arch="$(cat /etc/apk/arch)"
key_name=libremesh.pem
key_content="-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdFJZ2qVti49Ol8LJZYuxgOCLowBS
8bI86a7zqhSbs5yon3JON7Yee7CQOgqwPOX5eMALGOu8iFGAqIRx5YjfYA==
-----END PUBLIC KEY-----"
fi
if [ -f /etc/opkg/distfeeds.conf ]; then
repo='opkg'
feeds_file='/etc/opkg/limefeeds.conf'
dist_feeds_file='/etc/opkg/distfeeds.conf'
pkg_manager_path=''
arch="$(grep OPENWRT_ARCH /etc/os-release | sed 's/OPENWRT_ARCH=\"\(.*\)\"/\1/')"
key_name="a71b3c8285abd28b"
key_content="RWSnGzyChavSiyQ+vLk3x7F0NqcLa4kKyXCdriThMhO78ldHgxGljM/8"
fi
[ ! -f /bin/apk ] && [ ! -f /bin/opkg ] &&
echo "No package manager found - skipping" && exit 0

[ -z "$repo" ] && {
echo "Package manager not found - skipping"
exit 0
}
. /etc/os-release
. /etc/lime_release

[ -f "$feeds_file" ] && {
echo "LibreMesh $repo feeds already defined - skipping"
exit 0;
}
feed_host='http://feed.libremesh.org'
feed_ref=$([ $LIME_CODENAME == "development" ] &&
echo "master" || echo "$LIME_RELEASE")
ow_branch=$( [ $VERSION == 'SNAPSHOT' ] &&
echo "openwrt-main" || echo openwrt-${VERSION:0:5})

openwrt_branch_ref="$(grep -m 1 "openwrt.org/" $dist_feeds_file | sed 's|.*openwrt.org/\(.*\)|\1|' )"
pkg_manager=apk
pkg_index=/packages.adb
feed_lime=/etc/apk/repositories.d/limefeeds.list
feed_keyname=libremesh.pem
feed_key="-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdFJZ2qVti49Ol8LJZYuxgOCLowBS
8bI86a7zqhSbs5yon3JON7Yee7CQOgqwPOX5eMALGOu8iFGAqIRx5YjfYA==
-----END PUBLIC KEY-----"

if [ '' != "$openwrt_branch_ref" ]; then
if $(echo $openwrt_branch_ref | grep -q 'snapshots'); then
openwrt_branch='openwrt-main'
fi
if $(echo $openwrt_branch_ref | grep -q 'releases'); then
branch_n="$(echo $openwrt_branch_ref | sed 's/releases\///')"
openwrt_branch="openwrt-${branch_n:0:5}"
fi
else
echo "String not found 'openwrt.org' in default ${repo} feeds, cannot determine openwrt branch"
if [ -f /bin/opkg ]; then
pkg_manager=opkg
pkg_index=''
feed_lime=/etc/opkg/limefeeds.conf
feed_keyname=a71b3c8285abd28b
feed_key="untrusted comment: signed by libremesh.org key a71b3c8285abd28b
RWSnGzyChavSiyQ+vLk3x7F0NqcLa4kKyXCdriThMhO78ldHgxGljM/8"
feed_prefix="src/gz "
fi

branch_release_path=$([ "$LIME_CODENAME" == "development" ] && echo "master" || echo "$LIME_RELEASE" )
packages_url="$feed_host/$feed_ref/$ow_branch/x86_64$pkg_index";
arch_packages_url="$feed_host/$feed_ref/$ow_branch/${OPENWRT_ARCH}$pkg_index";
profiles_url="$feed_host/profiles/$ow_branch/x86_64$pkg_index";

packages_url="http://feed.libremesh.org/${branch_release_path}/$openwrt_branch/x86_64";
arch_packages_url="http://feed.libremesh.org/${branch_release_path}/$openwrt_branch/$arch";
profiles_url="http://feed.libremesh.org/profiles/$openwrt_branch/x86_64";
[ $feed_prefix ] && {
packages_url="${feed_prefix}libremesh $packages_url"
arch_packages_url="${feed_prefix}libremesh_arch_packages $arch_packages_url"
profiles_url="${feed_prefix}profiles $profiles_url"
}

echo "Configuring official LibreMesh $repo feeds"
[ $repo == 'apk' ] && {
echo "$packages_url/packages.adb" > "$feeds_file"
echo "${arch_packages_url}/packages.adb" >> "$feeds_file"
echo "$profiles_url/packages.adb" >> "$feeds_file"
echo "$key_content" >> "/etc/apk/keys/$key_name"
} || (
[ $repo == 'opkg' ] && {
echo "src/gz libremesh $packages_url" > "$feeds_file"
echo "src/gz libremesh_arch_packages $arch_packages_url" >> "$feeds_file"
echo "src/gz profiles $profiles_url" >> "$feeds_file"
echo "untrusted comment: signed by libremesh.org key $key_name" > "/etc/opkg/keys/$key_name"
echo "$key_content" >> "/etc/opkg/keys/$key_name"
})
echo "Configuring official LibreMesh $pkg_manager feeds"
cat << EOF > $feed_lime
$packages_url
$arch_packages_url
$profiles_url
EOF
echo "$feed_key" > "/etc/$pkg_manager/keys/$feed_keyname"