mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17: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 () {
|
storeDirs () {
|
||||||
storeA="$TEST_ROOT/store-a"
|
storesRoot="$TEST_ROOT/stores"
|
||||||
storeBTop="$TEST_ROOT/store-b"
|
mkdir -p "$storesRoot"
|
||||||
storeB="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
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
|
# 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
|
# Mounting Overlay Store
|
||||||
mountOverlayfs () {
|
mountOverlayfs () {
|
||||||
mergedStorePath="$TEST_ROOT/merged-store/nix/store"
|
mergedStorePath="$storesRoot/merged-store/nix/store"
|
||||||
mount -t overlay overlay \
|
mount -t overlay overlay \
|
||||||
-o lowerdir="$storeA/nix/store" \
|
-o lowerdir="$storeA/nix/store" \
|
||||||
-o upperdir="$storeBTop" \
|
-o upperdir="$storeBTop" \
|
||||||
-o workdir="$TEST_ROOT/workdir" \
|
-o workdir="$storesRoot/workdir" \
|
||||||
"$mergedStorePath" \
|
"$mergedStorePath" \
|
||||||
|| skipTest "overlayfs is not supported"
|
|| skipTest "overlayfs is not supported"
|
||||||
|
|
||||||
cleanupOverlay () {
|
cleanupOverlay () {
|
||||||
umount "$TEST_ROOT/merged-store/nix/store"
|
umount "$storesRoot/merged-store/nix/store"
|
||||||
rm -r $TEST_ROOT/workdir
|
rm -r $storesRoot/workdir
|
||||||
}
|
}
|
||||||
trap cleanupOverlay EXIT
|
trap cleanupOverlay EXIT
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ initLowerStore
|
||||||
mountOverlayfs
|
mountOverlayfs
|
||||||
|
|
||||||
# Create a file to add to store
|
# Create a file to add to store
|
||||||
dupFilePath="$TEST_ROOT/dup-file"
|
dupFilePath="$storesRoot/dup-file"
|
||||||
echo Duplicate > "$dupFilePath"
|
echo Duplicate > "$dupFilePath"
|
||||||
|
|
||||||
# Add it to the overlay store (it will be written to the upper layer)
|
# Add it to the overlay store (it will be written to the upper layer)
|
||||||
|
|
Loading…
Reference in a new issue