#!/usr/bin/env sh

CI_DATA=$1
shift
suffix=$1
shift
sqfs_image=$1
shift
mount_point="$*"

for i in upper wd
do
    if [ -d ${CI_DATA}/overlayfs/$i-${suffix} ]
    then
        rm -rf ${CI_DATA}/overlayfs/$i-${suffix}
    fi
    mkdir -p ${CI_DATA}/overlayfs/$i-${suffix}
done

echo "squashfuse_ll $sqfs_image $mount_point"
/usr/libexec/apptainer/bin/squashfuse_ll $sqfs_image $mount_point
