Skip to content

Commit

Permalink
fix: ensure multi user installation keeps permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-zarrad committed Mar 26, 2024
1 parent 04dd57c commit 7dccd38
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi

# Dependencies that need to be installed
# On macOS we do not need the clipboard dependencies
if [[ "$detected_os" = "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
# zsh is default on mac, we can skip installation!
# Also tool used for clipboard is already included.
readonly DEPENDENCIES=(
Expand Down Expand Up @@ -119,7 +119,7 @@ while test $# != 0; do
*)
if [ "$start_arg_install_for_user_parameter" = "$(whoami)" ]; then
if [ "$(id -u)" -eq "0" ]; then
if [[ "$detected_os" = "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
print_error "psh supports installation on macOS only for the current user!"
exit 1
fi
Expand All @@ -135,7 +135,7 @@ while test $# != 0; do
done

# Construct the target home directory of the user which will receive psh
if [[ "$detected_os" = "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
CUSTOM_USER_HOME_DIR="$HOME"
else
if check_user_exists "$start_arg_install_for_user_parameter"; then
Expand Down Expand Up @@ -164,7 +164,7 @@ if [[ "$detected_os" = "Debian GNU/Linux" || "$detected_os" = "Ubuntu" || "$dete
source "lib/distdep/deb_based/package_management.sh"
elif [[ "$detected_os" = "Arch Linux" || "$detected_os" = "Manjaro Linux" ]]; then
source "lib/distdep/arch_based/package_management.sh"
elif [[ "$detected_os" = "Darwin" ]]; then
elif ! [[ "$detected_os" = "Darwin" ]]; then
source "lib/distdep/darwin_based/package_management.sh"
else
print_error "Your current distribution '$detected_os' is not supported!"
Expand All @@ -175,7 +175,7 @@ fi
print_message ""
print_message "Checking dependencies..."
not_installed=("$(packages_installed "${DEPENDENCIES[@]}")")
if [[ "$detected_os" = "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
print_message "You are running psh on macOS. psh assumes that zsh and clipboard utilities (pbcopy, pbpaste) are already installed."
fi
for dependency in "${DEPENDENCIES[@]}"; do
Expand All @@ -189,7 +189,7 @@ done
sudo_installed="1"
# Check if sudo is installed
print_message ""
if [[ "$detected_os" = "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
# macOS case is handled in "sudo not installed" branch below
sudo_installed="0"
print_message "Running on macOS, ignoring sudo install status!"
Expand Down Expand Up @@ -257,7 +257,7 @@ else
fi
fi

if [[ "$detected_os" != "Darwin" ]]; then
if ! [[ "$detected_os" = "Darwin" ]]; then
fix_user_permissions "${start_arg_install_for_user_parameter}" "${ZPLUG_FOLDER_PATH}"
fi

Expand Down

0 comments on commit 7dccd38

Please sign in to comment.