1 Star 1 Fork 0

mojerro/compiler-explorer-infra

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mount-all-img.sh 793 Bytes
一键复制 编辑 原始数据 按行查看 历史
Matt Godbolt 提交于 2022-09-26 10:20 +08:00 . Misc fixups post poetry
#!/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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mojerro/compiler-explorer-infra.git
git@gitee.com:mojerro/compiler-explorer-infra.git
mojerro
compiler-explorer-infra
compiler-explorer-infra
main

搜索帮助