| 1 | fn main() { |
| 2 | // Cargo watches these directories recursively; any file added/changed/removed |
| 3 | // under them triggers a rebuild on the next `cargo build`/`cargo run`. |
| 4 | println!("cargo:rerun-if-changed=src"); |
| 5 | println!("cargo:rerun-if-changed=templates"); |
| 6 | println!("cargo:rerun-if-changed=static"); |
| 7 | println!("cargo:rerun-if-changed=git-rs.service"); |
| 8 | |
| 9 | // When running `cargo install` (release profile) with permissions to write to |
| 10 | // /etc/systemd/system, automatically install git-rs.service. |
| 11 | if std::env::var("PROFILE").as_deref() == Ok("release") { |
| 12 | let _ = std::fs::copy("git-rs.service", "/etc/systemd/system/git-rs.service"); |
| 13 | } |
| 14 | } |
