Skip to content

Commit

Permalink
fix: installation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Nov 6, 2024
1 parent dfde008 commit b783764
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ error() {
exit 1
}

# Check if running as root
if [[ $(id -u) -eq 0 ]]; then
error "Should not run as root"
fi

# Log detected OS and architecture
log_message "Detected OS: $OS"
log_message "Detected Architecture: $ARCH"
Expand All @@ -55,6 +60,18 @@ if ! command -v curl &>/dev/null; then
error "curl is required but not installed."
fi

# Check for escalation tool
for cmd in sudo doas; do
if command -v "$cmd" &>/dev/null; then
ESCALATION_TOOL="$cmd"
break
fi
done

if [ -z "$ESCALATION_TOOL" ]; then
error "Cannot find sudo or doas for escalated privileges"
fi

# Get installed FVM version if exists
INSTALLED_FVM_VERSION=""
if command -v fvm &>/dev/null; then
Expand Down Expand Up @@ -116,7 +133,7 @@ fi


# Create a symlink
if ! sudo ln -sf "$FVM_DIR_BIN/fvm" "$SYMLINK_TARGET"; then
if ! "$ESCALATION_TOOL" ln -sf "$FVM_DIR_BIN/fvm" "$SYMLINK_TARGET"; then
error "Failed to create symlink."
fi

Expand Down

0 comments on commit b783764

Please sign in to comment.