Fix mixed-permission Linux installs

This commit is contained in:
jetfir3
2026-08-09 18:03:45 -04:00
parent a68b29fd9d
commit ad18c4bb62
+2 -1
View File
@@ -494,7 +494,7 @@ check_write_permission() {
for path_to_check in "$@"; do for path_to_check in "$@"; do
[[ -d "${path_to_check}" ]] && writePath="${path_to_check}" || writePath="${path_to_check%/*}" [[ -d "${path_to_check}" ]] && writePath="${path_to_check}" || writePath="${path_to_check%/*}"
[[ ! -w "${path_to_check}" ]] && stagedInstall='true' [[ ! -w "${path_to_check}" ]] && stagedInstall='true'
[[ ! -w "${writePath}" ]] && { [[ ! -w "${writePath}" || ( "${platformType}" == "Linux" && -f "${path_to_check}" && ! -O "${path_to_check}" ) ]] && {
stagedInstall='true' stagedInstall='true'
protectedInstall='true' protectedInstall='true'
((EUID == 0)) && continue ((EUID == 0)) && continue
@@ -564,6 +564,7 @@ protected_prepare_file() {
local source="${1}" destination="${2}" reference="${3}" tempFile local source="${1}" destination="${2}" reference="${3}" tempFile
tempFile=$(sudo_run mktemp "${destination}.spotx.XXXXXXXX") || return 1 tempFile=$(sudo_run mktemp "${destination}.spotx.XXXXXXXX") || return 1
sudo_run cp -a -- "${reference}" "${tempFile}" && sudo_run cp -a -- "${reference}" "${tempFile}" &&
sudo_run chmod u+w -- "${tempFile}" &&
sudo_run cp -- "${source}" "${tempFile}" && sudo_run cp -- "${source}" "${tempFile}" &&
sudo_run chown --reference="${reference}" "${tempFile}" && sudo_run chown --reference="${reference}" "${tempFile}" &&
sudo_run chmod --reference="${reference}" "${tempFile}" && sudo_run chmod --reference="${reference}" "${tempFile}" &&