docker images
docker rmi id_or_name
docker ps -a
docker rm id_or_name
echo "your_token" | docker login ghcr.io -u "smallprogram" --password-stdin
docker pull ghcr.io/smallprogram/openwrt-base-cache-immortalwrt-x86:latest
docker create --name temp_bin ghcr.io/smallprogram/openwrt-base-cache-immortalwrt-x86:latest /bin/true
docker export temp_bin > cache_exported.tar
docker rm temp_bin
rm -rf build_dir staging_dir
docker rm temp_bin
docker pull ghcr.io/smallprogram/openwrt-base-cache-immortalwrt-x86:latest
docker create --name temp_bin ghcr.io/smallprogram/openwrt-base-cache-immortalwrt-x86:latest /bin/true
docker export temp_bin > cache_exported.tar
mkdir -p immcache
tar -xf cache_exported.tar -C immcache --wildcards "op_cache_raw_*" || true
# 2. 探测中转文件夹里是否成功提取到了分块文件
if ls immcache/op_cache_raw_* 1> /dev/null 2>&1; then
echo "==== 按顺序合并分块并还原到指定目录 ===="
# 3. 读取 immcache 里的所有分块,流式合并,并释放到当前目录的配置文件夹下
cat immcache/op_cache_raw_* | tar -I "zstd -T0" -xf - -C /
# 4. 清理战场:删掉导出的 tar 包,并连锅端掉 immcache 中转站
rm -f cache_exported.tar
rm -rf immcache
echo "✅ 缓存合并恢复完成!"
else
echo "⚠️ 未找到有效缓存分块!"
# 即使没找到缓存,也顺手把刚才建的空文件夹清掉,保持环境整洁
rm -rf immcache
fi
time make tools/compile -j$(nproc)
time make toolchain/compile -j$(nproc)
time make target/compile -j$(nproc)
rm -rf ../immcache/
tar -I "zstd -T0 -10" -cf - build_dir staging_dir | split -a 3 -d -b 5000M - ../immcache/op_cache_raw_
if ls immcache/op_cache_raw_* 1> /dev/null 2>&1; then
echo "==== 按顺序合并分块并释放到当前目 录 ====";
cat immcache/op_cache_raw_* | tar -I "zstd -T0" -xf -;
rm -rf immcache;
echo "✅ 缓存合并恢复完成!";
else
echo "⚠️ 未找到有效缓存分块!";
rm -rf immcache; exit 1;
fi
cat ../immcache/op_cache_raw_* | tar -I "zstd -T0" -xf -
time make tools/compile -j$(nproc)
time make toolchain/compile -j$(nproc)
for linux_dir in build_dir/target-*/linux-*/; do
[ -d "$linux_dir" ] && (cd "$linux_dir" && ls -dt linux-* 2>/dev/null | tail -n +2 | xargs -I {} rm -rf "{}")
done
[ -d "build_dir" ] && (cd build_dir && ls -dt toolchain-* 2>/dev/null | tail -n +2 | xargs -I {} rm -rf "{}")
if [ -d "staging_dir" ]; then
(cd staging_dir && ls -dt target-* 2>/dev/null | tail -n +2 | xargs -I {} rm -rf "{}")
(cd staging_dir && ls -dt toolchain-* 2>/dev/null | tail -n +2 | xargs -I {} rm -rf "{}")
fi