mirror of
https://github.com/SpotX-Official/SpotX-Bash.git
synced 2026-08-11 02:21:07 +10:00
Fix mixed-permission Linux installs
This commit is contained in:
@@ -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}" &&
|
||||||
|
|||||||
Reference in New Issue
Block a user