1
0
forked from brl/citadel-tools

move /run/realms to /run/citadel/realms

This commit is contained in:
Bruce Leidl 2019-01-30 23:36:43 -05:00
parent d3ac4bb000
commit 28401b589e
2 changed files with 6 additions and 5 deletions

View File

@ -1,10 +1,11 @@
use std::path::PathBuf; use std::path::{Path,PathBuf};
use std::net::Ipv4Addr; use std::net::Ipv4Addr;
use std::collections::{HashSet,HashMap}; use std::collections::{HashSet,HashMap};
use std::io::{BufReader,BufRead,Write}; use std::io::{BufReader,BufRead,Write};
use std::fs::{self,File}; use std::fs::{self,File};
use crate::Result; use crate::Result;
use crate::realm::REALMS_RUN_PATH;
const MIN_MASK: usize = 16; const MIN_MASK: usize = 16;
const MAX_MASK: usize = 24; const MAX_MASK: usize = 24;
@ -58,7 +59,7 @@ impl NetworkConfig {
/// ///
/// Allocates IP addresses for a bridge shared by multiple realms. /// Allocates IP addresses for a bridge shared by multiple realms.
/// ///
/// State information is stored in /run/realms/network-$bridge as /// State information is stored in /run/citadel/realms/network-$bridge as
/// colon ':' separated pairs of realm name and allocated ip address /// colon ':' separated pairs of realm name and allocated ip address
/// ///
/// realm-a:172.17.0.2 /// realm-a:172.17.0.2
@ -160,7 +161,7 @@ impl BridgeAllocator {
} }
fn state_file_path(&self) -> PathBuf { fn state_file_path(&self) -> PathBuf {
PathBuf::from(format!("/run/realms/network-{}", self.bridge)) Path::new(REALMS_RUN_PATH).with_file_name(format!("network-{}", self.bridge))
} }

View File

@ -11,7 +11,7 @@ use crate::{RealmConfig,Result,Systemd,NetworkConfig,GLOBAL_CONFIG};
use crate::util::*; use crate::util::*;
const REALMS_BASE_PATH: &str = "/realms"; const REALMS_BASE_PATH: &str = "/realms";
const REALMS_RUN_PATH: &str = "/run/realms"; pub const REALMS_RUN_PATH: &str = "/run/citadel/realms";
#[derive(Clone)] #[derive(Clone)]
pub struct Realm { pub struct Realm {
@ -362,7 +362,7 @@ impl RealmSymlinks {
let path = runpath.join("current.realm"); let path = runpath.join("current.realm");
if let Some(n) = name { if let Some(n) = name {
let tmp = Path::new("/run/current.realm.tmp"); let tmp = Path::new("/run/citadel/current.realm.tmp");
let target = PathBuf::from(REALMS_BASE_PATH).join(format!("realm-{}", n)); let target = PathBuf::from(REALMS_BASE_PATH).join(format!("realm-{}", n));
symlink(&target, tmp) symlink(&target, tmp)
.map_err(|e| format_err!("failed to create symlink from {} to {}: {}", tmp.display(), target.display(), e))?; .map_err(|e| format_err!("failed to create symlink from {} to {}: {}", tmp.display(), target.display(), e))?;