Files
containerd/script/setup/install-runhcs-shim
Wei Fu 363e02310b install-runhcs-shim: fetch target commit instead of tags
No idea why it blames lock during fetching.

```bash
...
 * [new tag]           v0.9.9           -> v0.9.9
error: cannot lock ref 'refs/tags/v0.6.3': Unable to create 'C:/Users/runneradmin/AppData/Local/Temp/tmp.N2FTxfARN9/.git/refs/tags/v0.6.3.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
+ cleanup
+ rm -rf /tmp/tmp.N2FTxfARN9
```

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-08-29 00:08:40 -04:00

47 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright The containerd Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
scripts_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
: ${RUNHCS_VERSION:="$(cat $scripts_path/runhcs-version)"}
: ${RUNHCS_REPO:="https://github.com/Microsoft/hcsshim.git"}
: ${HCSSHIM_SRC:=''}
: ${DESTDIR:=''}
: ${GOOS:="windows"}
tmpdir="$(mktemp -d)"
cleanup() {
rm -rf "$tmpdir"
}
trap 'cleanup' EXIT
export GOOS
if [ "$HCSSHIM_SRC" == "" ]
then
set -e -x
cd "$tmpdir"
git init .
git remote add origin "$RUNHCS_REPO"
git fetch --depth 1 origin ${RUNHCS_VERSION}
git checkout FETCH_HEAD
else
cd "${HCSSHIM_SRC}"
git checkout "refs/tags/${RUNHCS_VERSION}" || git checkout "refs/heads/${RUNHCS_VERSION}" || git checkout "${RUNHCS_VERSION}"
fi
GO111MODULE=on go build -mod=vendor -o "${DESTDIR}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1