mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Mount tmpfs first to ensure overlayfs works consistently.
This commit is contained in:
parent
44f855d14e
commit
7fda19e2f1
2 changed files with 12 additions and 9 deletions
|
@ -13,26 +13,29 @@ setupConfig () {
|
|||
}
|
||||
|
||||
storeDirs () {
|
||||
storeA="$TEST_ROOT/store-a"
|
||||
storeBTop="$TEST_ROOT/store-b"
|
||||
storeB="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
||||
storesRoot="$TEST_ROOT/stores"
|
||||
mkdir -p "$storesRoot"
|
||||
mount -t tmpfs tmpfs "$storesRoot"
|
||||
storeA="$storesRoot/store-a"
|
||||
storeBTop="$storesRoot/store-b"
|
||||
storeB="local-overlay?root=$storesRoot/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
||||
# Creating testing directories
|
||||
mkdir -p "$TEST_ROOT"/{store-a/nix/store,store-b,merged-store/nix/store,workdir}
|
||||
mkdir -p "$storesRoot"/{store-a/nix/store,store-b,merged-store/nix/store,workdir}
|
||||
}
|
||||
|
||||
# Mounting Overlay Store
|
||||
mountOverlayfs () {
|
||||
mergedStorePath="$TEST_ROOT/merged-store/nix/store"
|
||||
mergedStorePath="$storesRoot/merged-store/nix/store"
|
||||
mount -t overlay overlay \
|
||||
-o lowerdir="$storeA/nix/store" \
|
||||
-o upperdir="$storeBTop" \
|
||||
-o workdir="$TEST_ROOT/workdir" \
|
||||
-o workdir="$storesRoot/workdir" \
|
||||
"$mergedStorePath" \
|
||||
|| skipTest "overlayfs is not supported"
|
||||
|
||||
cleanupOverlay () {
|
||||
umount "$TEST_ROOT/merged-store/nix/store"
|
||||
rm -r $TEST_ROOT/workdir
|
||||
umount "$storesRoot/merged-store/nix/store"
|
||||
rm -r $storesRoot/workdir
|
||||
}
|
||||
trap cleanupOverlay EXIT
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ initLowerStore
|
|||
mountOverlayfs
|
||||
|
||||
# Create a file to add to store
|
||||
dupFilePath="$TEST_ROOT/dup-file"
|
||||
dupFilePath="$storesRoot/dup-file"
|
||||
echo Duplicate > "$dupFilePath"
|
||||
|
||||
# Add it to the overlay store (it will be written to the upper layer)
|
||||
|
|
Loading…
Reference in a new issue