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

Make install.sh more robust to not being root #258

Merged
merged 1 commit into from
Jun 19, 2024
Merged
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
18 changes: 15 additions & 3 deletions website/public/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,23 @@ tar -xzf "${file_name}.tar.gz"
echo -e "${bright_yellow}Installing ${cyan}${package}...${nc}"
cd ./dist/${file_name}
chmod +x ./spf
if sudo mv ./spf /usr/local/bin/; then
echo -e "${yellow}Press ctrl+C to not install as sudo and try locally.${nc}"
if ! sudo mv ./spf /usr/local/bin/; then
echo -e "${yellow}Unable to move binary to /usr/local/bin. Do you have sudo permissions?${nc}"
mkdir -p ~/.local/bin
if ! mv ./spf ~/.local/bin/; then
echo -e "${red}❌ Failed to install superfile: Unable to move to ~/.local/bin as well.${nc}"
else
if ! [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
export PATH="${PATH}:${HOME}/.local/bin"
echo 'export PATH="${PATH}:${HOME}/.local/bin"' >> ~/.bashrc
fi
echo -e "🎉 ${bright_cyan}Local ${bright_green}Installation complete!${nc}"
echo -e "${bright_cyan}You can type ${white}\"${bright_yellow}spf${white}\" ${bright_cyan}to start!${nc}"
fi
else
echo -e "🎉 ${bright_green}Installation complete!${nc}"
echo -e "${bright_cyan}You can type ${white}\"${bright_yellow}spf${white}\" ${bright_cyan}to start!${nc}"
else
echo -e "${red}❌ Fail install superfile: ${yellow}Unable to move binary to /usr/local/bin. Do you have sudo permissions?${nc}"
fi

rm -rf "$temp_dir"