mk_overlayfs: fix undefined behavior

kernel logs:
```
overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
```
This commit is contained in:
Howard Wu 2023-05-26 20:23:22 +08:00
parent b38fe8c678
commit 9b117b8c94

View File

@ -72,7 +72,7 @@ umount_clean() {
unset TMPDIR
fi
rm -f "${DOWNLOAD_DIR:?}/$DOWNLOAD_CONF_NAME"
if [ "$(python3 -c 'import sys ; print( 0 if sys.prefix == sys.base_prefix else 1 )')" = "1" ]; then
if [ "$(python3 -c 'import sys ; print( 1 if sys.prefix != sys.base_prefix else 0 )')" = "1" ]; then
echo "deactivate python3 venv"
deactivate
fi
@ -151,16 +151,8 @@ mk_overlayfs() {
local lowerdir="$1"
local upperdir workdir merged context own
merged="$3"
case "$2" in
system)
upperdir="$WORK_DIR/upper/$2"
workdir="$WORK_DIR/worker/$2"
;;
*)
upperdir="$WORK_DIR/upper/system/$2"
workdir="$WORK_DIR/worker/system/$2"
;;
esac
upperdir="$WORK_DIR/upper/$2"
workdir="$WORK_DIR/worker/$2"
echo "mk_overlayfs: label $2
lowerdir=$lowerdir
upperdir=$upperdir