这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(main/lux-cli): implement custom termux_pkg_auto_update() function #25441

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

Merged
merged 1 commit into from
Jul 26, 2025
Merged
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
32 changes: 32 additions & 0 deletions packages/lux-cli/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,38 @@ TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_HOSTBUILD=true

termux_pkg_auto_update() {
# based on `termux_github_api_get_tag.sh`
# fetch newest tags
local newest_tags newest_tag
newest_tags="$(curl -d "$(cat <<-EOF | tr '\n' ' '
{
"query": "query {
repository(owner: \"nvim-neorocks\", name: \"lux\") {
refs(refPrefix: \"refs/tags/\", first: 20, orderBy: {
field: TAG_COMMIT_DATE, direction: DESC
})
{ edges { node { name } } }
}
}"
}
EOF
)" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
--silent \
--location \
--retry 10 \
--retry-delay 1 \
https://api.github.com/graphql \
| jq '.data.repository.refs.edges[].node.name')"
# filter only tags having "v" at the start and extract only raw version.
read -r newest_tag < <(echo "$newest_tags" | grep -Po '(?<=^"v)\d+\.\d+\.\d+' | sort -Vr)

[[ -z "${newest_tag}" ]] && termux_error_exit "ERROR: Unable to get tag from ${TERMUX_PKG_SRCURL}"
termux_pkg_upgrade_version "${newest_tag}"
}

# Function to obtain the .deb URL
obtain_deb_url() {
local url attempt retries wait PAGE deb_url
Expand Down