Compare commits
4 commits
335baed266
...
887d5bf3c2
Author | SHA1 | Date | |
---|---|---|---|
887d5bf3c2 | |||
6e9233c21d | |||
03918ea53e | |||
4bbdb2f45f |
7 changed files with 50 additions and 20 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
bunbun.toml
|
bunbun.toml
|
||||||
|
out
|
||||||
|
|
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -382,7 +382,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bunbun"
|
name = "bunbun"
|
||||||
version = "0.4.1"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-rt 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -390,7 +390,6 @@ dependencies = [
|
||||||
"handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"handlebars 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hotwatch 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hotwatch 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bunbun"
|
name = "bunbun"
|
||||||
version = "0.4.1"
|
version = "0.5.0"
|
||||||
authors = ["Edward Shen <code@eddie.sh>"]
|
authors = ["Edward Shen <code@eddie.sh>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Re-implementation of bunny1 in Rust"
|
description = "Re-implementation of bunny1 in Rust"
|
||||||
|
@ -17,7 +17,6 @@ handlebars = "2.0"
|
||||||
hotwatch = "0.4"
|
hotwatch = "0.4"
|
||||||
percent-encoding = "2.1"
|
percent-encoding = "2.1"
|
||||||
itertools = "0.8"
|
itertools = "0.8"
|
||||||
libc = "0.2"
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
simple_logger = "1.3"
|
simple_logger = "1.3"
|
||||||
clap = { version = "2.33", features = ["yaml", "wrap_help"] }
|
clap = { version = "2.33", features = ["yaml", "wrap_help"] }
|
||||||
|
|
33
PKGBUILD
Normal file
33
PKGBUILD
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Maintainer: Edward Shen <code@eddie.sh>
|
||||||
|
pkgname=bunbun
|
||||||
|
pkgver=0.4.1
|
||||||
|
pkgrel=1
|
||||||
|
depends=('gcc-libs')
|
||||||
|
makedepends=('rust' 'cargo')
|
||||||
|
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
|
||||||
|
pkgdesc="Re-implementation of bunny1 in Rust"
|
||||||
|
url="https://github.com/edward-shen/bunbun"
|
||||||
|
license=('AGPL')
|
||||||
|
source=("$pkgname-$pkgver.tar.gz::https://github.com/edward-shen/$pkgname/archive/$pkgver.tar.gz")
|
||||||
|
sha512sums=('b8576b40e1912bb651b12a8adb591c93fe60116ea5870a77852789fcd3e5027438847120cd1f2549271365de1ba1387145d026c035473ab510e3628fe791458e')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$pkgname-$pkgver"
|
||||||
|
|
||||||
|
cargo build --release --locked
|
||||||
|
strip "target/release/$pkgname" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "$pkgname-$pkgver"
|
||||||
|
|
||||||
|
cargo test --release --locked
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$pkgname-$pkgver"
|
||||||
|
|
||||||
|
install -Dm755 "target/release/$pkgname" -t "$pkgdir/usr/bin"
|
||||||
|
install -Dm644 "$srcdir/aux/systemd/$pkgname.service" -t "$pkgdir/usr/lib/systemd/system"
|
||||||
|
install -Dm644 "$srcdir/$pkgname.default.yaml" "$pkgdir/etc/$pkgname.yaml"
|
||||||
|
}
|
13
aux/systemd/bunbun.service
Normal file
13
aux/systemd/bunbun.service
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Bunbun search multiplexer/jump service
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
ExecStart=/usr/bin/bunbun
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -14,10 +14,6 @@ args:
|
||||||
multiple: true
|
multiple: true
|
||||||
help: Decreases the log level to error or no logging at all, respectively.
|
help: Decreases the log level to error or no logging at all, respectively.
|
||||||
conflicts_with: "verbose"
|
conflicts_with: "verbose"
|
||||||
- daemon:
|
|
||||||
short: "d"
|
|
||||||
long: "daemon"
|
|
||||||
help: "Run bunbun as a daemon."
|
|
||||||
- config:
|
- config:
|
||||||
short: "c"
|
short: "c"
|
||||||
long: "config"
|
long: "config"
|
||||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -1,10 +1,8 @@
|
||||||
use actix_web::middleware::Logger;
|
use actix_web::{middleware::Logger, App, HttpServer};
|
||||||
use actix_web::{App, HttpServer};
|
|
||||||
use clap::{crate_authors, crate_version, load_yaml, App as ClapApp};
|
use clap::{crate_authors, crate_version, load_yaml, App as ClapApp};
|
||||||
use error::BunBunError;
|
use error::BunBunError;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use hotwatch::{Event, Hotwatch};
|
use hotwatch::{Event, Hotwatch};
|
||||||
use libc::daemon;
|
|
||||||
use log::{debug, error, info, trace, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
@ -53,15 +51,6 @@ async fn main() -> Result<(), BunBunError> {
|
||||||
groups: conf.groups,
|
groups: conf.groups,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Daemonize after trying to read from config and before watching; allow user
|
|
||||||
// to see a bad config (daemon process sets std{in,out} to /dev/null)
|
|
||||||
if matches.is_present("daemon") {
|
|
||||||
unsafe {
|
|
||||||
debug!("Daemon flag provided. Running as a daemon.");
|
|
||||||
daemon(0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let _watch = start_watch(state.clone(), conf_file_location)?;
|
let _watch = start_watch(state.clone(), conf_file_location)?;
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
|
|
Loading…
Reference in a new issue