This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 用法: ./dockersave.sh <镜像名[:tag]> | |
| # 例如: ./dockersave.sh myapp:1.0 | |
| # ./dockersave.sh registry.example.com/group/myapp:1.0 | |
| # 说明: 先尝试 pull,pull 失败不中断(本地编译的镜像本来就不在远端仓库里), | |
| # 只要本地存在该镜像就继续保存为 <镜像名>_<tag>.tar.gz | |
| set -o pipefail | |
| image="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:24.04 | |
| RUN apt update && apt -y upgrade && apt install -q -y tzdata ca-certificates software-properties-common curl && apt clean -y | |
| RUN sed -i "s|http://|https://|g" /etc/apt/sources.list.d/ubuntu.sources | |
| RUN apt update && apt -y upgrade && \ | |
| apt install -q -y tzdata novnc && apt clean -y | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal enabledelayedexpansion | |
| REM 遍历所有可能的盘符 | |
| for %%D in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( | |
| REM 检查盘符是否存在 | |
| if exist %%D:\ ( | |
| echo ------------------------------- | |
| echo [%date% %time%] 检查 %%D:\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal enabledelayedexpansion | |
| chcp 65001 >nul | |
| REM bat default is ANSI(gbk) set to utf-8 | |
| echo 脚本很可能需要管理员权限才能获取显示器SN | |
| where pwsh >nul 2>nul | |
| if %errorlevel% equ 0 ( | |
| echo "use PowerShell 7(pwsh)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 1.2 | |
| # 中间可以加的参数 --exclude='pattern' | |
| if [ "$#" -gt 0 ]; then | |
| # 获取最后一个参数,参数放在前面,要打包的路径放在最后 | |
| allarg="$*" | |
| last_arg="${!#}" | |
| if [[ "$last_arg" == "." || "$last_arg" == ".." ]]; then | |
| echo "请勿打包 . .. 目录,会导致产生的压缩文件被打包,造成问题" | |
| exit 1 |