diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 3d74cd6..5a62beb 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -6,5 +6,7 @@ jobs: Explore-Gitea-Actions: runs-on: ubuntu-latest steps: - - run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash - - run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash \ No newline at end of file + - name: test apt + run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-apt.sh | bash + - name: test docker + run: curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/init-docker.sh | bash \ No newline at end of file diff --git a/init-apt.sh b/init-apt.sh index aab715e..ffc3262 100644 --- a/init-apt.sh +++ b/init-apt.sh @@ -38,4 +38,8 @@ server ntp5.aliyun.com iburst driftfile /var/lib/chrony/drift allow 127.0.0.1 EOF -systemctl restart chrony && systemctl enable chrony \ No newline at end of file +if command -v systemctl >/dev/null 2>&1; then + systemctl restart chrony && systemctl enable chrony +else + echo "systemctl 不存在,跳过 chrony 的重启" +fi \ No newline at end of file diff --git a/init-docker.sh b/init-docker.sh index 6173005..6dbe239 100644 --- a/init-docker.sh +++ b/init-docker.sh @@ -21,4 +21,8 @@ cat > /etc/docker/daemon.json </dev/null 2>&1; then + systemctl restart docker +else + echo "systemctl 不存在,跳过 docker 重启。" +fi