Fix Codex upgrade script edge cases
This commit is contained in:
@@ -42,7 +42,9 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
pid_from_file() {
|
pid_from_file() {
|
||||||
tr -cd '0-9' < "$PID_FILE" 2>/dev/null || true
|
if [[ -f "$PID_FILE" ]]; then
|
||||||
|
tr -cd '0-9' < "$PID_FILE" 2>/dev/null || true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
server_pid() {
|
server_pid() {
|
||||||
@@ -349,7 +351,10 @@ extract_codex_binary() {
|
|||||||
tar -xzf "$archive" -C "$dest/extract"
|
tar -xzf "$archive" -C "$dest/extract"
|
||||||
found="$(find "$dest/extract" -type f -name codex -print | head -n 1)"
|
found="$(find "$dest/extract" -type f -name codex -print | head -n 1)"
|
||||||
if [[ -z "$found" ]]; then
|
if [[ -z "$found" ]]; then
|
||||||
echo "downloaded archive does not contain a codex binary" >&2
|
found="$(find "$dest/extract" -type f -name 'codex-*' -perm -u+x -print | head -n 1)"
|
||||||
|
fi
|
||||||
|
if [[ -z "$found" ]]; then
|
||||||
|
echo "downloaded archive does not contain a Codex executable" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
chmod +x "$found"
|
chmod +x "$found"
|
||||||
|
|||||||
Reference in New Issue
Block a user