Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: installation bug #792

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
error "Failed to create symlink."
fi

Expand Down
Loading