Signing fixed + manual

This commit is contained in:
Listum 2023-11-07 04:27:52 +03:00
parent ffc5ca7a16
commit afb553896b
3 changed files with 12 additions and 15 deletions

View File

@ -13,16 +13,12 @@
1. Укажите токен бота телеграм
```bash
# Unix-like
$ export TELOXIDE_TOKEN=<Your token here>
# Windows command line
$ set TELOXIDE_TOKEN=<Your token here>
# Windows PowerShell
$ $env:TELOXIDE_TOKEN=<Your token here>
$ export TELOXIDE_TOKEN=<Ваш токен>
```
2. Добаьте GPG ключ для подписи (опционально)
- ```$ gpg --list-keys --keyid-format=long```
- rsa4096/*D8DDA4AE70FAD33E* копируем ID ключа после rsa4096,3072..итд
- ```$ export GPGKEY=<ID ключа>```
3. Запустите бота
```bash
./aur_builder_bot

View File

@ -30,26 +30,27 @@ pub fn copy(dir: String, local_repo: String) -> Result<(), Box<dyn std::error::E
Ok(())
}
pub fn build(default_dir: PathBuf) -> Result<(), Box<dyn std::error::Error>> {
pub fn build() -> Result<(), Box<dyn std::error::Error>> {
match std::env::var("GPGKEY") {
Ok(value) => {
Command::new("makepkg")
.arg("-s")
.arg("--sign")
.arg(format!("--key {}/{}",default_dir.as_os_str().to_str().unwrap() , value))
.arg(format!("--key={}", value))
.arg("--noconfirm")
.output()?;
}
},
Err(_) => {
Command::new("makepkg")
.arg("-s")
.arg("--noconfirm")
.output()?;
},
}
Ok(())
}
Ok(())
}
pub fn delete(dir: String) -> std::io::Result<()> {
fs::remove_dir_all(dir)

View File

@ -29,7 +29,7 @@ async fn answer(bot: Bot, msg: Message, cmd: Commands) -> ResponseResult<()> {
bot.send_message(msg.chat.id, clone).await?;
env::set_current_dir(pkg_dir.clone())?;
let build = match build(default_dir.clone()) {
let build = match build() {
Ok(..) => { format!("Builded") },
Err(e) => { format!("Build error: {}", e) }
};