mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
delete disk guid on reflash (#2334)
* delete disk guid on reflash * delete unnecessary files before copy
This commit is contained in:
@@ -153,18 +153,24 @@ pub async fn execute(
|
|||||||
{
|
{
|
||||||
if let Err(e) = async {
|
if let Err(e) = async {
|
||||||
// cp -r ${guard}/config /tmp/config
|
// cp -r ${guard}/config /tmp/config
|
||||||
Command::new("cp")
|
|
||||||
.arg("-r")
|
|
||||||
.arg(guard.as_ref().join("config"))
|
|
||||||
.arg("/tmp/config.bak")
|
|
||||||
.invoke(crate::ErrorKind::Filesystem)
|
|
||||||
.await?;
|
|
||||||
if tokio::fs::metadata(guard.as_ref().join("config/upgrade"))
|
if tokio::fs::metadata(guard.as_ref().join("config/upgrade"))
|
||||||
.await
|
.await
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
tokio::fs::remove_file(guard.as_ref().join("config/upgrade")).await?;
|
tokio::fs::remove_file(guard.as_ref().join("config/upgrade")).await?;
|
||||||
}
|
}
|
||||||
|
if tokio::fs::metadata(guard.as_ref().join("config/disk.guid"))
|
||||||
|
.await
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
|
tokio::fs::remove_file(guard.as_ref().join("config/disk.guid")).await?;
|
||||||
|
}
|
||||||
|
Command::new("cp")
|
||||||
|
.arg("-r")
|
||||||
|
.arg(guard.as_ref().join("config"))
|
||||||
|
.arg("/tmp/config.bak")
|
||||||
|
.invoke(crate::ErrorKind::Filesystem)
|
||||||
|
.await?;
|
||||||
guard.unmount().await
|
guard.unmount().await
|
||||||
}
|
}
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user