mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 14:38:30 +00:00
update README.md, --update and aur
This commit is contained in:
4
.github/workflows/aur.yml
vendored
4
.github/workflows/aur.yml
vendored
@@ -56,6 +56,8 @@ jobs:
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "\$srcdir/\$pkgname-\$pkgver"
|
cd "\$srcdir/\$pkgname-\$pkgver"
|
||||||
|
export CARGO_PROFILE_RELEASE_LTO=false
|
||||||
|
export RUSTFLAGS="${RUSTFLAGS/-C link-arg=-fuse-ld=lld/}"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,10 +78,10 @@ jobs:
|
|||||||
arch = aarch64
|
arch = aarch64
|
||||||
license = MIT
|
license = MIT
|
||||||
makedepends = cargo
|
makedepends = cargo
|
||||||
options = !lto
|
|
||||||
depends = gcc-libs
|
depends = gcc-libs
|
||||||
optdepends = gcc: build C/C++ projects with GCC
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
optdepends = clang: build C/C++ projects with Clang
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
|
options = !lto
|
||||||
source = dcr-${PKGVER}.tar.gz::${SRC_URL}
|
source = dcr-${PKGVER}.tar.gz::${SRC_URL}
|
||||||
sha256sums = ${SHA256}
|
sha256sums = ${SHA256}
|
||||||
|
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -15,7 +15,7 @@ The current implementation is written in Rust.
|
|||||||
- Run the compiled binary
|
- Run the compiled binary
|
||||||
- Clean build artifacts
|
- Clean build artifacts
|
||||||
- Generate a minimal C project template
|
- Generate a minimal C project template
|
||||||
- Update the binary via `dcr --update` (GitHub Releases)
|
- Update the binary via `dcr --update` (GitHub Releases, not for pacman/AUR installs)
|
||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
- Linux: `x86_64-unknown-linux-gnu`
|
- Linux: `x86_64-unknown-linux-gnu`
|
||||||
@@ -25,6 +25,13 @@ The current implementation is written in Rust.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### Package Manager
|
||||||
|
|
||||||
|
**Arch Linux**
|
||||||
|
```sh
|
||||||
|
yay -S dcr # or paru and other AUR package managers
|
||||||
|
```
|
||||||
|
|
||||||
### From Source
|
### From Source
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -57,6 +64,14 @@ Release assets:
|
|||||||
- `dcr-aarch64-apple-darwin`
|
- `dcr-aarch64-apple-darwin`
|
||||||
- `dcr-x86_64-pc-windows-msvc.exe`
|
- `dcr-x86_64-pc-windows-msvc.exe`
|
||||||
|
|
||||||
|
## Update
|
||||||
|
|
||||||
|
- If DCR was installed from GitHub release assets, `install.sh`, `install.ps1`, or built manually:
|
||||||
|
- use `dcr --update`
|
||||||
|
- If DCR is installed via `pacman/AUR`:
|
||||||
|
- update with your package manager: `paru/yay -Syu dcr` or `sudo pacman -Syu dcr`
|
||||||
|
- `dcr --update` detects package-managed installs and asks you to update via package manager
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Create a new project:
|
Create a new project:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ DCR — это утилита для управления проектами н
|
|||||||
- Запуск собранного бинарника
|
- Запуск собранного бинарника
|
||||||
- Очистка результатов сборки
|
- Очистка результатов сборки
|
||||||
- Генерация минимального шаблона C-проекта
|
- Генерация минимального шаблона C-проекта
|
||||||
- Обновление бинарника через `dcr --update` (GitHub Releases)
|
- Обновление бинарника через `dcr --update` (GitHub Releases, не для pacman-установок)
|
||||||
|
|
||||||
## Поддерживаемые платформы
|
## Поддерживаемые платформы
|
||||||
- Linux: `x86_64-unknown-linux-gnu`
|
- Linux: `x86_64-unknown-linux-gnu`
|
||||||
@@ -25,6 +25,13 @@ DCR — это утилита для управления проектами н
|
|||||||
|
|
||||||
## Установка
|
## Установка
|
||||||
|
|
||||||
|
### Пакетный менеджер
|
||||||
|
|
||||||
|
**ArchLinux**
|
||||||
|
```sh
|
||||||
|
yay -S dcr # или paru и остальные менеджеры пакетов AUR
|
||||||
|
```
|
||||||
|
|
||||||
### Из исходников
|
### Из исходников
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -57,6 +64,14 @@ irm https://dcr.dexoron.su/install.ps1 | iex
|
|||||||
- `dcr-aarch64-apple-darwin`
|
- `dcr-aarch64-apple-darwin`
|
||||||
- `dcr-x86_64-pc-windows-msvc.exe`
|
- `dcr-x86_64-pc-windows-msvc.exe`
|
||||||
|
|
||||||
|
## Обновление
|
||||||
|
|
||||||
|
- Если DCR установлен из GitHub Releases, через `install.sh`, `install.ps1` или собран вручную:
|
||||||
|
- используйте `dcr --update`
|
||||||
|
- Если DCR установлен через `pacman/AUR`:
|
||||||
|
- обновляйте через пакетный менеджер: `paru/yay -Syu dcr` или `sudo pacman -Syu dcr`
|
||||||
|
- `dcr --update` определяет пакетную установку и подсказывает обновляться через пакетный менеджер
|
||||||
|
|
||||||
## Быстрый старт
|
## Быстрый старт
|
||||||
|
|
||||||
Создать новый проект:
|
Создать новый проект:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
pkgname=dcr
|
pkgname=dcr
|
||||||
pkgver=0.2.1
|
pkgver=0.2.1
|
||||||
pkgrel=2
|
pkgrel=3
|
||||||
pkgdesc="Cargo-like utility to manage C/C++ projects"
|
pkgdesc="Cargo-like utility to manage C/C++ projects"
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url="https://github.com/dexoron/dcr"
|
url="https://github.com/dexoron/dcr"
|
||||||
@@ -17,6 +17,8 @@ sha256sums=('30e334fa98cd51073c0fa84c80a982584b00156b57084311ad53419441ce6235')
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/$pkgname-$pkgver"
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
export CARGO_PROFILE_RELEASE_LTO=false
|
||||||
|
export RUSTFLAGS="${RUSTFLAGS/-C link-arg=-fuse-ld=lld/}"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use reqwest::blocking::Client;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::Command;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
const LATEST_RELEASE_URL: &str = "https://api.github.com/repos/dexoron/dcr/releases/latest";
|
const LATEST_RELEASE_URL: &str = "https://api.github.com/repos/dexoron/dcr/releases/latest";
|
||||||
@@ -25,6 +26,22 @@ pub fn flag_update(args: &[String]) -> i32 {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let current_exe = match std::env::current_exe() {
|
||||||
|
Ok(path) => path,
|
||||||
|
Err(_) => {
|
||||||
|
error("Failed to resolve current binary path");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(package_name) = pacman_owned_package(¤t_exe) {
|
||||||
|
warn("This dcr binary is managed by pacman/AUR");
|
||||||
|
println!(
|
||||||
|
"Update via package manager: yay/paru -Syu {package_name} or sudo pacman -Syu {package_name}"
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
let current_version = env!("CARGO_PKG_VERSION");
|
let current_version = env!("CARGO_PKG_VERSION");
|
||||||
let target = env!("DCR_TARGET");
|
let target = env!("DCR_TARGET");
|
||||||
let client = match Client::builder().user_agent("dcr-updater").build() {
|
let client = match Client::builder().user_agent("dcr-updater").build() {
|
||||||
@@ -67,13 +84,6 @@ pub fn flag_update(args: &[String]) -> i32 {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let current_exe = match std::env::current_exe() {
|
|
||||||
Ok(path) => path,
|
|
||||||
Err(_) => {
|
|
||||||
error("Failed to resolve current binary path");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let temp_path = temp_binary_path(¤t_exe);
|
let temp_path = temp_binary_path(¤t_exe);
|
||||||
|
|
||||||
if fs::write(&temp_path, &bytes).is_err() {
|
if fs::write(&temp_path, &bytes).is_err() {
|
||||||
@@ -157,3 +167,23 @@ fn set_executable_permissions(path: &Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
fn pacman_owned_package(path: &Path) -> Option<String> {
|
||||||
|
let output = Command::new("pacman").arg("-Qoq").arg(path).output().ok()?;
|
||||||
|
if !output.status.success() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let package_name = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||||
|
if package_name.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(package_name)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
fn pacman_owned_package(_path: &Path) -> Option<String> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user