1
0
forked from brl/citadel-tools

Updated everything for Rust 2018 with cargo fix --edition

This commit is contained in:
Bruce Leidl 2019-01-17 09:25:24 -05:00
parent 928e8cc41c
commit b258604fd0
33 changed files with 67 additions and 63 deletions

View File

@ -3,6 +3,7 @@ name = "citadel-desktopd"
version = "0.1.0"
authors = ["brl@subgraph.com"]
homepage = "https://github.com/subgraph/citadel"
edition = "2018"
[dependencies]
failure = "0.1.1"

View File

@ -1,7 +1,7 @@
use std::path::{Path,PathBuf};
use std::fs::File;
use std::io::Read;
use Result;
use crate::Result;
use toml;
#[derive(Clone)]

View File

@ -2,7 +2,7 @@ use std::io::Write;
use std::fs::File;
use std::path::Path;
use std::collections::HashMap;
use Result;
use crate::Result;
pub struct DesktopFile {

View File

@ -4,10 +4,10 @@ use std::fs;
use failure::ResultExt;
use monitor::{DirectoryMonitor,MonitorEventHandler};
use parser::DesktopFileParser;
use config::Config;
use Result;
use crate::monitor::{DirectoryMonitor,MonitorEventHandler};
use crate::parser::DesktopFileParser;
use crate::config::Config;
use crate::Result;
pub struct DesktopFileSync {

View File

@ -17,9 +17,9 @@ mod desktop_file_sync;
use std::result;
use std::process;
use failure::Error;
use desktop_file_sync::DesktopFileSync;
use crate::desktop_file_sync::DesktopFileSync;
use config::Config;
use crate::config::Config;
pub type Result<T> = result::Result<T, Error>;

View File

@ -11,7 +11,7 @@ use nix::sys::signal;
use inotify::{Events,Inotify,EventMask,WatchMask,Event,WatchDescriptor};
use Result;
use crate::Result;
pub trait MonitorEventHandler: Send+Sync {
fn file_added(&self, path: &Path) -> Result<()> { let _ = path; Ok(()) }

View File

@ -3,8 +3,8 @@ use std::io::Read;
use std::fs::File;
use std::path::Path;
use std::collections::HashSet;
use desktop::{DesktopFile,Line};
use Result;
use crate::desktop::{DesktopFile,Line};
use crate::Result;
lazy_static! {
// These are the keys which are copied into the translated .desktop files

View File

@ -6,7 +6,7 @@ use std::io::{self,Write};
use failure::ResultExt;
use libcitadel::{Result,ImageHeader,verity,util,devkeys};
use BuildConfig;
use crate::BuildConfig;
pub struct UpdateBuilder {
config: BuildConfig,

View File

@ -11,8 +11,8 @@ use std::path::Path;
use clap::{App,Arg,SubCommand,ArgMatches};
use clap::AppSettings::*;
use build::UpdateBuilder;
use config::BuildConfig;
use crate::build::UpdateBuilder;
use crate::config::BuildConfig;
use libcitadel::{Result,ResourceImage,set_verbose,format_error,Partition,KeyPair,ImageHeader};
mod build;

View File

@ -3,6 +3,7 @@ name = "citadel-install"
version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"]
homepage = "http://github.com/subgraph/citadel"
edition = "2018"
[dependencies]
libcitadel = { path = "../libcitadel" }

View File

@ -1,9 +1,9 @@
use std::io::{self,Write};
use std::path::Path;
use Result;
use util::Disk;
use crate::Result;
use crate::util::Disk;
use rpassword;
use installer::Installer;
use crate::installer::Installer;
pub fn run_cli_install() -> Result<bool> {
let disk = match choose_disk()? {

View File

@ -1,8 +1,8 @@
use std::path::{Path, PathBuf};
use std::fs;
use Result;
use util;
use crate::Result;
use crate::util;
///
/// Represents a disk partition device on the system

View File

@ -3,6 +3,7 @@ name = "citadel-realms"
version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"]
homepage = "http://github.com/subgraph/citadel"
edition = "2018"
[dependencies]
libc = "0.2"

View File

@ -1,8 +1,8 @@
use std::path::Path;
use std::process::Command;
use Realm;
use Result;
use crate::Realm;
use crate::Result;
const BASE_APPIMG_PATH: &str = "/storage/appimg/base.appimg";
const BTRFS_COMMAND: &str = "/usr/bin/btrfs";

View File

@ -2,7 +2,7 @@ use std::path::Path;
use std::fs::File;
use std::io::Read;
use toml;
use Result;
use crate::Result;
fn default_true() -> bool {
true

View File

@ -29,8 +29,8 @@ macro_rules! warn {
}
macro_rules! info {
($e:expr) => { if ::verbose() { println!("[+]: {}", $e); } };
($fmt:expr, $($arg:tt)+) => { if ::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } };
($e:expr) => { if crate::verbose() { println!("[+]: {}", $e); } };
($fmt:expr, $($arg:tt)+) => { if crate::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } };
}
mod manager;
@ -41,11 +41,11 @@ mod config;
mod network;
mod appimg;
use realm::{Realm,RealmSymlinks};
use manager::RealmManager;
use config::RealmConfig;
use systemd::Systemd;
use network::NetworkConfig;
use crate::realm::{Realm,RealmSymlinks};
use crate::manager::RealmManager;
use crate::config::RealmConfig;
use crate::systemd::Systemd;
use crate::network::NetworkConfig;
fn main() {
let app = App::new("citadel-realms")

View File

@ -6,12 +6,12 @@ use std::collections::HashMap;
use std::io::Write;
use Realm;
use Result;
use Systemd;
use RealmSymlinks;
use NetworkConfig;
use util::*;
use crate::Realm;
use crate::Result;
use crate::Systemd;
use crate::RealmSymlinks;
use crate::NetworkConfig;
use crate::util::*;
const REALMS_BASE_PATH: &str = "/realms";

View File

@ -4,7 +4,7 @@ use std::collections::{HashSet,HashMap};
use std::io::{BufReader,BufRead,Write};
use std::fs::{self,File};
use Result;
use crate::Result;
const MIN_MASK: usize = 16;
const MAX_MASK: usize = 24;

View File

@ -5,9 +5,9 @@ use std::cell::{RefCell,Cell};
use std::fs::{self,File};
use std::os::unix::fs::{symlink,MetadataExt};
use {RealmConfig,Result,Systemd,NetworkConfig};
use util::*;
use appimg::*;
use crate::{RealmConfig,Result,Systemd,NetworkConfig};
use crate::util::*;
use crate::appimg::*;
const REALMS_BASE_PATH: &str = "/realms";
const REALMS_RUN_PATH: &str = "/run/realms";

View File

@ -14,10 +14,10 @@ const SYSTEMD_UNIT_PATH: &str = "/run/systemd/system";
const DESKTOPD_SERVICE: &str = "citadel-desktopd.service";
use Realm;
use NetworkConfig;
use Result;
use util::{path_filename,is_first_char_alphabetic};
use crate::Realm;
use crate::NetworkConfig;
use crate::Result;
use crate::util::{path_filename,is_first_char_alphabetic};
#[derive(Clone)]
pub struct Systemd {

View File

@ -8,7 +8,7 @@ use std::io::{self,Write};
use libc;
use walkdir::WalkDir;
use Result;
use crate::Result;
pub fn path_filename(path: &Path) -> &str {

View File

@ -2,6 +2,7 @@
name = "libcitadel"
version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"]
edition = "2018"
[dependencies]
libc = "0.2"

View File

@ -6,7 +6,7 @@ use std::fs::OpenOptions;
use std::os::unix::fs::OpenOptionsExt;
use libc;
use Result;
use crate::Result;
// IO on block devices requires 4096 byte aligned buffer
const REQUIRED_ALIGNMENT: usize = 4096;

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::fs;
use Result;
use crate::Result;
lazy_static! {
static ref CMDLINE: CommandLine = match CommandLine::load() {

View File

@ -2,7 +2,7 @@ use std::path::Path;
use std::collections::HashMap;
use std::fs;
use Result;
use crate::Result;
lazy_static! {
static ref OS_RELEASE: Option<OsRelease> = match OsRelease::load() {

View File

@ -7,8 +7,8 @@ use failure::ResultExt;
use toml;
use blockdev::AlignedBuffer;
use {BlockDev,Result,public_key_for_channel,PublicKey};
use crate::blockdev::AlignedBuffer;
use crate::{BlockDev,Result,public_key_for_channel,PublicKey};
/// Expected magic value in header
const MAGIC: &[u8] = b"SGOS";

View File

@ -1,4 +1,4 @@
use Result;
use crate::Result;
use ring::rand;
use ring::signature::{self,Ed25519KeyPair,ED25519_PUBLIC_KEY_LEN,ED25519_PKCS8_V2_LEN};
use untrusted::Input;

View File

@ -66,14 +66,14 @@ pub mod util;
pub mod verity;
mod mount;
pub use config::OsRelease;
pub use blockdev::BlockDev;
pub use cmdline::CommandLine;
pub use header::{ImageHeader,MetaInfo};
pub use partition::Partition;
pub use resource::ResourceImage;
pub use keys::{KeyPair,PublicKey};
pub use mount::Mount;
pub use crate::config::OsRelease;
pub use crate::blockdev::BlockDev;
pub use crate::cmdline::CommandLine;
pub use crate::header::{ImageHeader,MetaInfo};
pub use crate::partition::Partition;
pub use crate::resource::ResourceImage;
pub use crate::keys::{KeyPair,PublicKey};
pub use crate::mount::Mount;
const DEVKEYS_HEX: &str =
"3053020101300506032b6570042204206ed2849c6c5168e1aebc50005ac3d4a4e84af4889e4e0189bb4c787e6ee0be49a1230321006b652764c62a1de35e7e37af2b743e9a5b82cee2211cf3091d2514441b417f5f";

View File

@ -1,7 +1,7 @@
use std::path::{PathBuf,Path};
use std::fs;
use Result;
use crate::Result;
pub struct Mount {
source: String,

View File

@ -1,6 +1,6 @@
use std::path::{Path,PathBuf};
use std::fs;
use {Result,ImageHeader,MetaInfo,Mount,PublicKey,public_key_for_channel};
use crate::{Result,ImageHeader,MetaInfo,Mount,PublicKey,public_key_for_channel};
#[derive(Clone)]
pub struct Partition {

View File

@ -3,7 +3,7 @@ use std::ffi::OsStr;
use std::io::{self,Seek,SeekFrom};
use std::path::{Path, PathBuf};
use {CommandLine,OsRelease,ImageHeader,MetaInfo,Result,Partition,Mount,verity,util};
use crate::{CommandLine,OsRelease,ImageHeader,MetaInfo,Result,Partition,Mount,verity,util};
use failure::ResultExt;

View File

@ -8,7 +8,7 @@ use std::env;
use failure::ResultExt;
use Result;
use crate::Result;
fn search_path(filename: &str) -> Result<PathBuf> {
let path_var = env::var("PATH")?;

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
use std::process::{Command, Stdio};
use failure::ResultExt;
use {Result,ImageHeader,MetaInfo,Partition,util};
use crate::{Result,ImageHeader,MetaInfo,Partition,util};
const VERITYSETUP: &str = "/sbin/veritysetup";
const LOSETUP: &str = "/sbin/losetup";