summaryrefslogtreecommitdiff
path: root/src/sota.rs
diff options
context:
space:
mode:
authorShaun Taheri <github@taheris.co.uk>2016-10-19 16:57:54 +0200
committerGitHub <noreply@github.com>2016-10-19 16:57:54 +0200
commitf01087b25987fd6e7b356c7a62c9f49c720be825 (patch)
tree1c9497eb1c4cb09b8f0125d9fbb1852340fa5213 /src/sota.rs
parentc6d3bb27c6e794f124259b8f7e749df1687f28b0 (diff)
parent41db1050631cfe0aaca8922ec4a58a0f2109ac5d (diff)
downloadrvi_sota_client-f01087b25987fd6e7b356c7a62c9f49c720be825.tar.gz
Merge pull request #132 from advancedtelematic/bugfix/PRO-1601/fix-sota-toml
Fix config generation
Diffstat (limited to 'src/sota.rs')
-rw-r--r--src/sota.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sota.rs b/src/sota.rs
index 9ea615e..57f9308 100644
--- a/src/sota.rs
+++ b/src/sota.rs
@@ -1,6 +1,6 @@
use rustc_serialize::json;
+use std::{fs, io};
use std::fs::File;
-use std::io;
use std::path::PathBuf;
use datatype::{Config, DeviceReport, DownloadComplete, Error, Package,
@@ -75,6 +75,7 @@ impl<'c, 'h> Sota<'c, 'h> {
let ref pacman = self.config.device.package_manager;
let path = self.package_path(id.clone()).expect("install_update expects a valid path");
pacman.install_package(&path).and_then(|(code, output)| {
+ let _ = fs::remove_file(&path).unwrap_or_else(|err| error!("couldn't remove installed package: {}", err));
Ok(UpdateReport::single(id.clone(), code, output))
}).or_else(|(code, output)| {
Err(UpdateReport::single(id.clone(), code, output))