ALR-Wiki/usage.md

205 lines
6.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Использование
## Оглавление
- [Команды](#команды)
- [Установка](#install)
- [Удаление](#remove)
- [Обновление пакетов](#upgrade)
- [Информация](#info)
- [Список](#list)
- [Сборка](#build)
- [ДОбавление репозитория](#addrepo)
- [Удаление репозитория](#removerepo)
- [Обновление изменений](#refresh)
- [Исправление](#fix)
- [Версия](#version)
- [Переменные окружения](#environment-variables)
- [Дистрибутивы](#alr_distro)
- [Формат пакета](#alr_pkg_format)
- [Архитектура](#alr_arm_variant)
---
## команды
### install
Команда установки устанавливает пакет из репозиториев Alr. Любые пакеты, которых нет в репозиториях Alr, передаются в системный менеджер пакетов для установки.
Аргументы пакета не обязаны быть точными. Alr проверит массив и сообщит, если точное совпадение не найдено. Также поддерживается использование "%" в качестве замены.
Если найдено несколько пакетов, вы будете проинформированы о выборе пакета для установки.
По умолчанию, если пакет уже был собран, Alr установит кэшированный пакет вместо пересобирания. Используйте флаг -c или --clean, чтобы принудительно пересобрать пакет.
Примеры:
```shell
alr in alr-bin # найдёт только alr-bin
alr in alr # finds alr-bin and alr-git
alr in it% # finds alr-bin, alr-git, and itgui-git
alr in -c alr-bin
```
### remove
The remove command is for convenience. All it does is forwards the remove command to the system package manager.
Example:
```shell
alr rm firefox
```
### upgrade
The upgrade command looks through the packages installed on your system and sees if any of them match alr repo packages. If they do, their versions are compared using the `rpmvercmp` algorithm. If alr repos contain a newer version, the package is upgraded.
By default, if a package has already been built, alr will install the cached package rather than re-build it. Use the `-c` or `--clean` flag to force a re-build.
Example:
```shell
alr up
```
### info
The info command displays information about a package in alr's repos.
The package arguments do not have to be exact. alr will check the `provides` array if an exact match is not found. There is also support for using "%" as a wildcard.
If multiple packages are found, you will be prompted to select which you want to show.
Example:
```shell
alr info alr-bin # only finds alr-bin
alr info alr # finds alr-bin and alr-git
alr info it% # finds alr-bin, alr-git, and itgui-git
```
### list
The list command lists all alr repo packages as well as their versions
This command accepts a single optional argument. This argument is a pattern to filter found packages against.
The pattern does not have to be exact. alr will check the `provides` array if an exact match is not found. There is also support for using "%" as a wildcard.
There is a `-I` or `--installed` flag that filters out any packages that are not installed on the system
Examples:
```shell
alr ls # lists all alr packages
alr ls -I # lists all installed packages
alr ls i% # lists all packages starting with "i"
alr ls %d # lists all packages ending with "d"
alr ls -I i% # lists all installed packages that start with "i"
```
### build
The build command builds a package using a `alr.sh` build script in the current directory. The path to the script can be changed with the `-s` flag.
Example:
```shell
alr build
```
### addrepo
The addrepo command adds a repository to alr if it doesn't already exist. The `-n` flag sets the name of the repository, and the `-u` flag is the URL to the repository. Both are required.
Example:
```shell
alr ar -n default -u https://github.com/Elara6331/alr-repo
```
### removerepo
The removerepo command removes a repository from alr and deletes its contents if it exists. The `-n` flag specifies the name of the repo to be deleted.
Example:
```shell
alr rr -n default
```
### refresh
The refresh command pulls all changes from all alr repos that have changed.
Example:
```shell
alr ref
```
### fix
The fix command attempts to fix issues with alr by deleting and rebuilding alr's cache
Example:
```shell
alr fix
```
### version
The version command returns the current alr version and exits
Example:
```shell
alr version
```
---
## Environment Variables
### alr_DISTRO
The `alr_DISTRO` environment variable should be set to the distro for which the package should be built. It tells alr which overrides to use. Values should be the same as the `ID` field in `/etc/os-release` or `/usr/lib/os-release`. Possible values include:
- `arch`
- `alpine`
- `opensuse`
- `debian`
### alr_PKG_FORMAT
The `alr_PKG_FORMAT` environment variable should be set to the packaging format that should be used. Valid values are:
- `archlinux`
- `apk`
- `rpm`
- `deb`
### alr_ARM_VARIANT
The `alr_ARM_VARIANT` environment variable dictates which ARM variant to build for, if alr is running on an ARM system. Possible values include:
- `arm5`
- `arm6`
- `arm7`
---
## Cross-packaging for other Distributions
You can create packages for different distributions
setting the environment variables `alr_DISTRO` and `alr_PKG_FORMAT` as mentioned above.
Examples:
```
alr_DISTRO=arch alr_PKG_FORMAT=archlinux alr build
alr_DISTRO=alpine alr_PKG_FORMAT=apk alr build
alr_DISTRO=opensuse alr_PKG_FORMAT=rpm alr build
alr_DISTRO=debian alr_PKG_FORMAT=deb alr build
```
---