File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,18 @@ release_lock() {
107
107
sudo rm -rf " $lock_path "
108
108
}
109
109
110
+ # Function to get the SHA256 hash of a string.
111
+ get_sha256 () {
112
+ local input=$1
113
+ if command -v sha256sum > /dev/null; then
114
+ printf ' %s' " $input " | sha256sum | cut -d' ' -f1
115
+ elif command -v shasum > /dev/null; then
116
+ printf ' %s' " $input " | shasum -a 256 | cut -d' ' -f1
117
+ elif command -v openssl > /dev/null; then
118
+ printf ' %s' " $input " | openssl dgst -sha256 | cut -d' ' -f2
119
+ fi
120
+ }
121
+
110
122
# Function to download a file using cURL.
111
123
# mode: -s pipe to stdout, -v save file and return status code
112
124
# execute: -e save file as executable
@@ -120,7 +132,7 @@ get() {
120
132
sudo curl " ${curl_opts[@]} " " ${links[0]} "
121
133
else
122
134
if [ " $runner " = " self-hosted" ]; then
123
- lock_path=" $ file_path.lock "
135
+ lock_path=" /tmp/sp-lck- $( get_sha256 " $ file_path" ) "
124
136
acquire_lock " $lock_path "
125
137
if [ " $execute " = " -e" ]; then
126
138
until [ -z " $( fuser " $file_path " 2> /dev/null) " ]; do
You can’t perform that action at this time.
0 commit comments