apply_local: Fix nixos detection from os-release (#63)
This commit is contained in:
parent
2b281286d0
commit
9c179b0db8
1 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::env;
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use clap::{Arg, App, ArgMatches};
|
||||
|
@ -61,7 +62,8 @@ By default, Colmena will deploy keys set in `deployment.keys` before activating
|
|||
pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<(), ColmenaError> {
|
||||
// Sanity check: Are we running NixOS?
|
||||
if let Ok(os_release) = fs::read_to_string("/etc/os-release").await {
|
||||
if !os_release.contains("ID=nixos\n") {
|
||||
let re = Regex::new(r#"ID="?nixos"?"#).unwrap();
|
||||
if !re.is_match(&os_release) {
|
||||
log::error!("\"apply-local\" only works on NixOS machines.");
|
||||
quit::with_code(5);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue