feat: create autonomous Nivora package repository

Maintain a validated cross-distribution package catalog.
Automate upstream updates, isolated builds, diagnostics, and direct publication.
Build the official GitHub Desktop sources for Linux with working OAuth.
This commit is contained in:
Александр
2026-07-25 00:49:32 +10:00
commit f405ae2bcf
168 changed files with 8483 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
package_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
repo_root="$(cd "${package_dir}/.." && pwd)"
exec "${repo_root}/tools/package_updates.sh" check "$(basename "$package_dir")"
+16
View File
@@ -0,0 +1,16 @@
Сведения о лицензии пакета Nivora Stapler Helper
Лицензия: MIT.
Исходный проект: https://github.com/Cheviiot/Nivora
Нюансы пакета:
- Пакет устанавливает CLI-helper для Stapler с командами `sl`, `sli`, `slr`, `slu`, `slf`, `slref`, `sls`, `slii` и `sll`.
- Helper не заменяет Stapler: все операции выполняются через системную команду `stplr`.
- Через команду повышения привилегий запускаются только `install`, `remove`, `up`, `fix` и `refresh`.
- Команды чтения `search`, `info` и `list` выполняются без повышения привилегий.
- Префикс репозитория задается через `--repo <name>` или `NIVORA_STPLR_REPO`; по умолчанию короткие имена не привязаны к одному репозиторию.
- Пути вида `repo/package` не изменяются.
- Helper не исполняет произвольные shell-строки через `sudo`.
Полный официальный текст MIT:
https://opensource.org/licenses/MIT
+55
View File
@@ -0,0 +1,55 @@
name='nivora-stplr'
version='0.3.0'
release=1
summary='Short command helper for Stapler'
summary_ru='Короткие команды для Stapler'
desc='Nivora Stapler Helper provides short commands for common Stapler operations across configured repositories and elevates only operations that modify packages or caches.'
desc_ru='Nivora Stapler Helper добавляет короткие команды для типовых операций Stapler и повышает привилегии только для изменения пакетов и кэша.'
group='System/Configuration/Packaging'
homepage='https://github.com/Cheviiot/Nivora'
maintainer='Cheviiot <https://github.com/Cheviiot>'
architectures=('all')
license=('MIT')
provides=()
replaces=('nivora-stplr')
conflicts=()
auto_reqprov_method='dirty'
auto_req=0
auto_prov=0
deps=()
deps_debian=('bash' 'sudo')
deps_ubuntu=("${deps_debian[@]}")
deps_fedora=('bash' 'sudo')
deps_arch=('bash' 'sudo')
deps_altlinux=('bash' 'sudo')
deps_opensuse=('bash' 'sudo')
sources=(
'local:///nivora-stplr'
'local:///LICENSE'
)
checksums=(
'sha256:7b0c2a69aed30bc39ac5546aabd0cb82d45b857a52408b4326ad1fd667684ecb'
'sha256:c5674e6873211a8ea0f08ee3a950f809c9145c60750746dafff9aee7e1c21cf1'
)
package() {
install -Dm755 "${srcdir}/nivora-stplr" "${pkgdir}/usr/bin/sl"
shortcut=''
for shortcut in sli slr slu slf slref sls slii sll; do
ln -sfn sl "${pkgdir}/usr/bin/${shortcut}"
done
install-license "${srcdir}/LICENSE" 'nivora-stplr/LICENSE.nivora'
}
files() {
files-find-binary
files-find-license
}
+239
View File
@@ -0,0 +1,239 @@
#!/bin/bash
set -euo pipefail
repo_prefix="${NIVORA_STPLR_REPO:-}"
usage() {
cat <<'EOF'
Nivora Stapler Helper
Usage:
sl <command> [args...]
sli <package> [stplr args...] sudo stplr install <package>
slr <package> [stplr args...] sudo stplr remove <package>
slu [stplr args...] sudo stplr up
slf [stplr args...] sudo stplr fix
slref [stplr args...] sudo stplr refresh
sls <query> [stplr args...] stplr search <query>
slii <package> [stplr args...] stplr info <package>
sll [stplr args...] stplr list
Commands:
install, in, i install package with sudo
remove, rm, r remove package with sudo
up, upgrade, u upgrade installed packages with sudo
fix, f run stplr fix with sudo
refresh, ref refresh repositories with sudo
search, s search packages
info, show show package info
list, ls list repository packages
help show this help
Options:
--repo <name> prefix short package names with repository, e.g. sli --repo nivora parsec
Environment:
NIVORA_STPLR_REPO optional repository prefix for short names, default: disabled
NIVORA_STPLR_SUDO privilege command, default: sudo
NIVORA_STPLR_QUIET=1 do not print command before execution
EOF
}
die() {
echo "nivora-stplr: $*" >&2
exit 2
}
need_stplr() {
command -v stplr >/dev/null 2>&1 || die "команда stplr не найдена"
}
sudo_cmd() {
if [[ "${EUID}" -eq 0 ]]; then
return 0
fi
local command_name="${NIVORA_STPLR_SUDO:-sudo}"
command -v "${command_name}" >/dev/null 2>&1 || die "команда ${command_name} не найдена"
printf '%s\n' "${command_name}"
}
is_package_token() {
local value="$1"
[[ -n "${value}" ]] || return 1
[[ "${value}" == -* ]] && return 1
[[ "${value}" == */* ]] && return 1
[[ "${value}" == ./* || "${value}" == ../* || "${value}" == /* ]] && return 1
[[ "${value}" == *.rpm || "${value}" == *.deb || "${value}" == *.pkg.tar.* ]] && return 1
return 0
}
normalize_package() {
local value="$1"
if [[ -n "${repo_prefix}" ]] && is_package_token "${value}"; then
printf '%s/%s\n' "${repo_prefix}" "${value}"
else
printf '%s\n' "${value}"
fi
}
normalize_package_args() {
local arg
for arg in "$@"; do
normalize_package "${arg}"
done
}
extract_repo_option() {
local -n output_ref="$1"
shift
output_ref=()
while [[ "$#" -gt 0 ]]; do
case "$1" in
--repo)
[[ "$#" -ge 2 ]] || die "для --repo нужно имя репозитория"
repo_prefix="$2"
shift 2
;;
--repo=*)
repo_prefix="${1#--repo=}"
shift
;;
*)
output_ref+=("$1")
shift
;;
esac
done
}
print_and_exec() {
local -a command=("$@")
if [[ "${NIVORA_STPLR_QUIET:-0}" != "1" ]]; then
printf '=>'
printf ' %q' "${command[@]}"
printf '\n'
fi
exec "${command[@]}"
}
run_stplr() {
local mode="$1"
shift
need_stplr
local -a command=()
if [[ "${mode}" == "sudo" ]]; then
local privilege
privilege="$(sudo_cmd)"
if [[ -n "${privilege}" ]]; then
command+=("${privilege}")
fi
fi
command+=(stplr "$@")
print_and_exec "${command[@]}"
}
require_args() {
local command_name="$1"
local count="$2"
if [[ "${count}" -eq 0 ]]; then
die "для команды ${command_name} нужен аргумент"
fi
}
dispatch() {
local command_name="$1"
shift
case "${command_name}" in
install | in | i)
require_args "${command_name}" "$#"
local -a args=()
extract_repo_option args "$@"
require_args "${command_name}" "${#args[@]}"
mapfile -t normalized < <(normalize_package_args "${args[@]}")
run_stplr sudo install "${normalized[@]}"
;;
remove | rm | r | erase | delete | del)
require_args "${command_name}" "$#"
local -a args=()
extract_repo_option args "$@"
require_args "${command_name}" "${#args[@]}"
mapfile -t normalized < <(normalize_package_args "${args[@]}")
run_stplr sudo remove "${normalized[@]}"
;;
up | upgrade | u)
run_stplr sudo up "$@"
;;
fix | f)
run_stplr sudo fix "$@"
;;
refresh | ref)
run_stplr sudo refresh "$@"
;;
search | s)
require_args "${command_name}" "$#"
run_stplr user search "$@"
;;
info | show)
require_args "${command_name}" "$#"
local -a args=()
extract_repo_option args "$@"
require_args "${command_name}" "${#args[@]}"
mapfile -t normalized < <(normalize_package_args "${args[@]}")
run_stplr user info "${normalized[@]}"
;;
list | ls | l)
run_stplr user list "$@"
;;
version | support)
run_stplr user "${command_name}" "$@"
;;
help | -h | --help | "")
usage
;;
*)
die "неизвестная команда: ${command_name}. Запустите: sl help"
;;
esac
}
main() {
local invoked
invoked="$(basename "$0")"
case "${invoked}" in
sli) dispatch install "$@" ;;
slr) dispatch remove "$@" ;;
slu) dispatch up "$@" ;;
slf) dispatch fix "$@" ;;
slref) dispatch refresh "$@" ;;
sls) dispatch search "$@" ;;
slii) dispatch info "$@" ;;
sll) dispatch list "$@" ;;
sl)
if [[ "$#" -eq 0 ]]; then
usage
return 0
fi
local command_name="$1"
shift
dispatch "${command_name}" "$@"
;;
*)
die "неизвестное имя запуска: ${invoked}"
;;
esac
}
main "$@"
+1
View File
@@ -0,0 +1 @@
include = "../stapler-repo.toml"