Fixup a cure case where a store path already exists so we never make a symlink (#414)
This commit is contained in:
parent
045fe5fc5d
commit
b3c47227ff
2 changed files with 20 additions and 17 deletions
|
@ -93,8 +93,12 @@ impl Action for MoveUnpackedNix {
|
||||||
{
|
{
|
||||||
let entry_dest = dest_store.join(entry.file_name());
|
let entry_dest = dest_store.join(entry.file_name());
|
||||||
if entry_dest.exists() {
|
if entry_dest.exists() {
|
||||||
tracing::trace!(src = %entry.path().display(), dest = %entry_dest.display(), "Skipping, already exists");
|
tracing::trace!(src = %entry.path().display(), dest = %entry_dest.display(), "Removing already existing package");
|
||||||
} else {
|
tokio::fs::remove_dir_all(&entry_dest)
|
||||||
|
.await
|
||||||
|
.map_err(|e| ActionErrorKind::Remove(entry_dest.clone(), e))
|
||||||
|
.map_err(Self::error)?;
|
||||||
|
}
|
||||||
tracing::trace!(src = %entry.path().display(), dest = %entry_dest.display(), "Renaming");
|
tracing::trace!(src = %entry.path().display(), dest = %entry_dest.display(), "Renaming");
|
||||||
tokio::fs::rename(&entry.path(), &entry_dest)
|
tokio::fs::rename(&entry.path(), &entry_dest)
|
||||||
.await
|
.await
|
||||||
|
@ -111,7 +115,6 @@ impl Action for MoveUnpackedNix {
|
||||||
})
|
})
|
||||||
.map_err(Self::error)?;
|
.map_err(Self::error)?;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl Action for SetupDefaultProfile {
|
||||||
let nix_pkg = if let Some(nix_pkg) = found_nix_pkg {
|
let nix_pkg = if let Some(nix_pkg) = found_nix_pkg {
|
||||||
tokio::fs::read_link(&nix_pkg)
|
tokio::fs::read_link(&nix_pkg)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ActionErrorKind::Canonicalize(nix_pkg, e))
|
.map_err(|e| ActionErrorKind::ReadSymlink(nix_pkg, e))
|
||||||
.map_err(Self::error)?
|
.map_err(Self::error)?
|
||||||
} else {
|
} else {
|
||||||
return Err(Self::error(SetupDefaultProfileError::NoNix));
|
return Err(Self::error(SetupDefaultProfileError::NoNix));
|
||||||
|
@ -106,7 +106,7 @@ impl Action for SetupDefaultProfile {
|
||||||
let nss_ca_cert_pkg = if let Some(nss_ca_cert_pkg) = found_nss_ca_cert_pkg {
|
let nss_ca_cert_pkg = if let Some(nss_ca_cert_pkg) = found_nss_ca_cert_pkg {
|
||||||
tokio::fs::read_link(&nss_ca_cert_pkg)
|
tokio::fs::read_link(&nss_ca_cert_pkg)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ActionErrorKind::Canonicalize(nss_ca_cert_pkg, e))
|
.map_err(|e| ActionErrorKind::ReadSymlink(nss_ca_cert_pkg, e))
|
||||||
.map_err(Self::error)?
|
.map_err(Self::error)?
|
||||||
} else {
|
} else {
|
||||||
return Err(Self::error(SetupDefaultProfileError::NoNssCacert));
|
return Err(Self::error(SetupDefaultProfileError::NoNssCacert));
|
||||||
|
|
Loading…
Reference in a new issue