14 Commits

11 changed files with 143 additions and 40 deletions

View File

@ -7,7 +7,7 @@ builds:
- CGO_ENABLED=0
binary: alr
ldflags:
- -X https://gitverse.ru/Xpamych/ALR/content/master/internal/config.Version={{.Version}}
- -X gitea.plemya-x.ru/xpamych/ALR/src/branch/master/internal/config.Version={{.Version}}
goos:
- linux
goarch:
@ -39,7 +39,7 @@ nfpms:
{{- else if .Arch | eq "arm64"}}aarch64
{{- else }}{{ .Arch }}{{ end -}}
description: "Any Linux Repository"
homepage: 'https://gitverse.ru/Xpamych/ALR'
homepage: 'https://gitea.plemya-x.ru/xpamych/ALR'
maintainer: 'Евгений Храмов <xpamych@yandex.ru>'
license: GPLv3
formats:
@ -60,7 +60,7 @@ nfpms:
dst: /usr/share/zsh/site-functions/_alr
aurs:
- name: linux-user-repository-bin
homepage: 'https://gitverse.ru/Xpamych/ALR'
homepage: 'https://gitea.plemya-x.ru/xpamych/ALR'
description: "Any Linux Repository"
maintainers:
- 'Евгений Храмов <xpamych@yandex.ru>'

View File

@ -17,9 +17,7 @@ build: check-no-root $(BIN)
export CGO_ENABLED := 0
$(BIN):
go build \
-ldflags="-X 'gitverse.ru/Xpamych/ALR/internal/config.Version=$(GIT_VERSION)'" \
-o $@
go build -ldflags="-X 'gitea.plemya-x.ru/xpamych/ALR/internal/config.Version=$(GIT_VERSION)'" -o $@
check-no-root:
@if [[ "$$(whoami)" == 'root' ]]; then \

View File

@ -1,4 +1,7 @@
<img src="assets/logo.png" alt="ALR Logo" width="200">
<p align="center">
<img src="assets/logo.png" width="15%">
</p>
<b></b>
# ALR (Any Linux Repository)
@ -18,7 +21,7 @@ ALR написан на чистом Go и после сборки не имее
curl -fsSL plemya-x.ru/alr/install.sh | bash
```
**ВАЖНО**: При этом скрипт будет загружен и запущен с <https://gitverse.ru/Xpamych/ALR/install>. Пожалуйста, просматривайте любые скрипты, которые вы скачиваете из Интернета (включая этот), прежде чем запускать их.
**ВАЖНО**: При этом скрипт будет загружен и запущен с <https://gitea.plemya-x.ru/xpamych/ALR/install>. Пожалуйста, просматривайте любые скрипты, которые вы скачиваете из Интернета (включая этот), прежде чем запускать их.
### Сборка из исходного кода
@ -39,16 +42,18 @@ ALR был создан потому, что упаковка программн
## Документация
Документация по всем этим вопросам находится в [Wiki](https://gitverse.ru/Xpamych/ALR).
Документация по всем этим вопросам находится в [Wiki](https://gitea.plemya-x.ru/xpamych/ALR/wiki/Home).
---
## Репозитории
Репозитории alr - это git-хранилища, которые содержат каталог для каждого пакета с файлом `alr.sh` внутри. Файл `alr.sh` содержит все инструкции по сборке пакета и информацию о нем. Скрипты `alr.sh` аналогичны скриптам Aur PKGBUILD.
Репозитории alr - это git-хранилища, которые содержат каталог для каждого пакета с файлом `alr.sh` внутри. Файл `alr.sh` содержит все инструкции по сборке пакета и информацию о нем. Скрипты `alr.sh` аналогичны скриптам Aur PKGBUILD. Репозиторий [по-умолчанию](https://gitea.plemya-x.ru/xpamych/xpamych-alr-repo.git).
---
## Соцсети
VK - https://vk.com/plemya_kh
Discord - https://discord.com/channels/817759634105827358/1261631565084233749
Telegram - https://t.me/plemyakh

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -35,7 +35,7 @@ var defaultConfig = &types.Config{
Repos: []types.Repo{
{
Name: "default",
URL: "https://gitverse.ru/sc/Xpamych/xpamych-alr-repo.git",
URL: "https://gitea.plemya-x.ru/xpamych/xpamych-alr-repo.git",
},
},
}

View File

@ -37,7 +37,7 @@ var testPkg = db.Package{
"ru": "Проверочный пакет",
}),
Homepage: db.NewJSON(map[string]string{
"en": "https://gitverse.ru/Xpamych/ALR/",
"en": "https://gitea.plemya-x.ru/xpamych/ALR",
}),
Maintainer: db.NewJSON(map[string]string{
"en": "Evgeniy Khramov <xpamych@yandex.ru>",

View File

@ -56,7 +56,7 @@ const testScript = `
release=1
epoch=2
desc="Test package"
homepage='https://gitverse.ru/Xpamych/ALR'
homepage='//https://gitea.plemya-x.ru/xpamych/ALR'
maintainer='Евгений Храмов <xpamych@yandex.ru>'
architectures=('arm64' 'amd64')
license=('GPL-3.0-or-later')
@ -116,8 +116,8 @@ func TestDecodeVars(t *testing.T) {
Release: 1,
Epoch: 2,
Description: "Test package",
Homepage: "https://gitverse.ru/Xpamych/ALR",
Maintainer: "Arsen Musayelyan <arsen@arsenm.dev>",
Homepage: "https://gitea.plemya-x.ru/xpamych/ALR",
Maintainer: "Евгений Храмов <xpamych@yandex.ru>",
Architectures: []string{"arm64", "amd64"},
Licenses: []string{"GPL-3.0-or-later"},
Provides: []string{"test"},
@ -139,8 +139,8 @@ func TestDecodeVarsMissing(t *testing.T) {
name='test'
epoch=2
desc="Test package"
homepage='https://gitverse.ru/Xpamych/ALR'
maintainer='Arsen Musayelyan <arsen@arsenm.dev>'
homepage='https://gitea.plemya-x.ru/xpamych/ALR'
maintainer='Евгений Храмов <xpamych@yandex.ru>'
architectures=('arm64' 'amd64')
license=('GPL-3.0-or-later')
provides=('test')

View File

@ -36,7 +36,7 @@ const testScript = `
release=1
epoch=2
desc="Test package"
homepage='https://gitverse.ru/Xpamych/ALR'
homepage='https://gitea.plemya-x.ru/xpamych/ALR'
maintainer='Евгений Храмов <xpamych@yandex.ru>'
architectures=('arm64' 'amd64')
license=('GPL-3.0-or-later')

View File

@ -44,7 +44,7 @@ func TestFindPkgs(t *testing.T) {
err = repos.Pull(ctx, []types.Repo{
{
Name: "default",
URL: "https://gitverse.ru/sc/Xpamych/xpamych-alr-repo.git",
URL: "https://gitea.plemya-x.ru/xpamych/xpamych-alr-repo.git",
},
})
if err != nil {

View File

@ -81,7 +81,7 @@ func TestPull(t *testing.T) {
err = repos.Pull(ctx, []types.Repo{
{
Name: "default",
URL: "https://gitverse.ru/sc/Xpamych/xpamych-alr-repo.git",
URL: "https://gitea.plemya-x.ru/xpamych/ALR.git",
},
})
if err != nil {

View File

@ -1,22 +1,122 @@
#!/bin/bash
info() {
echo $'\x1b[32m[ИНФО]\x1b[0m' $@
}
# ALR - Any Linux Repository
# Copyright (C) 2024 Евгений Храмов
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
warn() {
echo $'\x1b[31m[ВНИМАНИЕ]\x1b[0m' $@
}
git clone https://gitverse.ru/sc/Xpamych/ALR.git /tmp/alr
cd /tmp/alr
sudo make install
rm -rf /tmp/alr
error() {
echo $'\x1b[31;1m[ОШИБКА]\x1b[0m' $@
exit 1
}
installPkg() {
rootCmd=""
if command -v doas &>/dev/null; then
rootCmd="doas"
elif command -v sudo &>/dev/null; then
rootCmd="sudo"
else
warn "Не обнаружена команда повышения привилегий (например, sudo, doas)"
fi
case $1 in
pacman) $rootCmd pacman --noconfirm -U ${@:2} ;;
apk) $rootCmd apk add --allow-untrusted ${@:2} ;;
zypper) $rootCmd zypper --no-gpg-checks install ${@:2} ;;
*) $rootCmd $1 install -y ${@:2} ;;
esac
}
if ! command -v curl &>/dev/null; then
error "Этот скрипт требует команду curl. Пожалуйста, установите её и запустите снова."
fi
pkgFormat=""
pkgMgr=""
if command -v pacman &>/dev/null; then
info "Обнаружен pacman"
pkgFormat="pkg.tar.zst"
pkgMgr="pacman"
elif command -v apt &>/dev/null; then
info "Обнаружен apt"
pkgFormat="deb"
pkgMgr="apt"
elif command -v dnf &>/dev/null; then
info "Обнаружен dnf"
pkgFormat="rpm"
pkgMgr="dnf"
elif command -v yum &>/dev/null; then
info "Обнаружен yum"
pkgFormat="rpm"
pkgMgr="yum"
elif command -v zypper &>/dev/null; then
info "Обнаружен zypper"
pkgFormat="rpm"
pkgMgr="zypper"
elif command -v apk &>/dev/null; then
info "Обнаружен apk"
pkgFormat="apk"
pkgMgr="apk"
else
warn "Не обнаружен поддерживаемый менеджер пакетов!"
noPkgMgr=true
fi
if [ -z "$noPkgMgr" ]; then
info "Получение списка файлов с https://plemya-x.ru/"
pageContent=$(curl -s https://plemya-x.ru/?dir=alr)
# Извлечение списка файлов из HTML
fileList=$(echo "$pageContent" | grep -oP '(?<=href=").*?(?=")' | grep -E 'alr-bin-.*.(pkg.tar.zst|rpm|deb)')
echo "Полученный список файлов:"
echo "$fileList"
if [ "$pkgMgr" == "pacman" ]; then
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*.pkg.tar.zst' | sort -V | tail -n 1)
elif [ "$pkgMgr" == "apt" ]; then
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*.amd64.deb' | sort -V | tail -n 1)
elif [[ "$pkgMgr" == "dnf" || "$pkgMgr" == "yum" || "$pkgMgr" == "zypper" ]]; then
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*.x86_64.rpm' | sort -V | tail -n 1)
else
error "Не поддерживаемый менеджер пакетов для автоматической установки"
fi
if [ -z "$latestFile" ]; then
error "Не удалось найти соответствующий пакет для $pkgMgr"
fi
info "Найдена последняя версия ALR: $latestFile"
url="https://plemya-x.ru/$latestFile"
fname="$(mktemp -u -p /tmp "alr.XXXXXXXXXX").${pkgFormat}"
info "Загрузка пакета ALR"
curl -L $url -o $fname
if [ ! -f "$fname" ]; then
error "Ошибка загрузки пакета ALR"
fi
info "Установка пакета ALR"
installPkg $pkgMgr $fname
info "Очистка"
rm $fname
info "Готово!"
else
info "Клонирование репозитория ALR"
git clone https://gitea.plemya-x.ru/xpamych/ALR.git /tmp/alr
info "Установка ALR"
cd /tmp/alr
sudo make install
info "Очистка репозитория ALR"
rm -rf /tmp/alr
info "Все задачи выполнены!"
fi