代码拉取完成,页面将自动刷新
#!/bin/bash
set -euo pipefail
IMG_DIR=/efs/squash-images
MOUNT_DIR=/opt/compiler-explorer
shopt -s globstar
declare -A mounts
for img_file in "${IMG_DIR}"/**/*.img; do
dst_path=${img_file/${IMG_DIR}/${MOUNT_DIR}}
dst_path=${dst_path%.img}
if mountpoint -q "$dst_path"; then
echo "$dst_path is mounted already, skipping"
else
mounts["$img_file"]="$dst_path"
fi
done
if [ -z "${!mounts[*]}" ]; then
echo "Nothing to do, stopping"
exit
fi
# If we try and do this in the loop, the mountpoint and mount commands effectively
# serialise and we end up blocking until the whole thing's done.
for img_file in "${!mounts[@]}"; do
dst_path="${mounts[$img_file]}"
echo mount -v -t squashfs "${img_file}" "${dst_path}" -o ro,nodev,relatime
done | xargs -d'\n' -n1 -P16 sh -c
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。