feat: add overlay testing script
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
55d808d43b
commit
39d701f946
1 changed files with 36 additions and 0 deletions
36
overlay.sh
Normal file
36
overlay.sh
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
UID=$(id -u)
|
||||||
|
GID=$(id -g)
|
||||||
|
CURDIR=$(pwd)
|
||||||
|
|
||||||
|
set -u
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Umounting merge directory if it is mounted"
|
||||||
|
if mount | grep -q "${CURDIR}.merge"; then
|
||||||
|
sudo umount -lf "${CURDIR}.merge"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo "Removing old upper directory"
|
||||||
|
# sudo rm -rf "${CURDIR}.upper"
|
||||||
|
|
||||||
|
echo "Creating directories"
|
||||||
|
sudo mkdir -p "${CURDIR}.upper"
|
||||||
|
sudo mkdir -p "${CURDIR}.workdir"
|
||||||
|
sudo mkdir -p "${CURDIR}.merge"
|
||||||
|
|
||||||
|
echo "Setting permissions"
|
||||||
|
sudo chown "$UID:$GID" "${CURDIR}.upper"
|
||||||
|
sudo chown "$UID:$GID" "${CURDIR}.workdir"
|
||||||
|
sudo chown "$UID:$GID" "${CURDIR}.merge"
|
||||||
|
|
||||||
|
echo "Mounting filesystem"
|
||||||
|
sudo mount -t overlay \
|
||||||
|
-o "lowerdir=${CURDIR},upperdir=${CURDIR}.upper,workdir=${CURDIR}.workdir" \
|
||||||
|
overlay \
|
||||||
|
"${CURDIR}.merge"
|
||||||
|
|
||||||
|
echo "Running shell"
|
||||||
|
cd "${CURDIR}.merge" || exit 1
|
||||||
|
exec $SHELL
|
Loading…
Reference in a new issue