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

View File

@ -30,26 +30,27 @@ pub fn copy(dir: String, local_repo: String) -> Result<(), Box<dyn std::error::E
Ok(()) 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") { match std::env::var("GPGKEY") {
Ok(value) => { Ok(value) => {
Command::new("makepkg") Command::new("makepkg")
.arg("-s") .arg("-s")
.arg("--sign") .arg("--sign")
.arg(format!("--key {}/{}",default_dir.as_os_str().to_str().unwrap() , value)) .arg(format!("--key={}", value))
.arg("--noconfirm") .arg("--noconfirm")
.output()?; .output()?;
} },
Err(_) => { Err(_) => {
Command::new("makepkg") Command::new("makepkg")
.arg("-s") .arg("-s")
.arg("--noconfirm") .arg("--noconfirm")
.output()?; .output()?;
},
} }
Ok(())
} }
Ok(())
}
pub fn delete(dir: String) -> std::io::Result<()> { pub fn delete(dir: String) -> std::io::Result<()> {
fs::remove_dir_all(dir) 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?; bot.send_message(msg.chat.id, clone).await?;
env::set_current_dir(pkg_dir.clone())?; env::set_current_dir(pkg_dir.clone())?;
let build = match build(default_dir.clone()) { let build = match build() {
Ok(..) => { format!("Builded") }, Ok(..) => { format!("Builded") },
Err(e) => { format!("Build error: {}", e) } Err(e) => { format!("Build error: {}", e) }
}; };