Skip to content

Instantly share code, notes, and snippets.

@Whizboy-Arnold
Created February 19, 2025 00:51
Show Gist options
  • Save Whizboy-Arnold/c0203cb11fdc04cc766cb5c6cccba6b2 to your computer and use it in GitHub Desktop.
Save Whizboy-Arnold/c0203cb11fdc04cc766cb5c6cccba6b2 to your computer and use it in GitHub Desktop.
elixir_setup_kit.sh
#!/bin/bash
# Exit on error
set -e
# Log file
LOG_FILE="./versioned_vfox_install.log"
# Utils
print_loader() {
local message="$1"
echo -ne "$message . \r"
sleep 0.3
echo -ne "$message .. \r"
sleep 0.3
echo -ne "$message ...\r"
sleep 0.4
}
loading() {
local start="$SECONDS"
local task_name="${1:-""}"
local task_pid="$2"
while kill -0 "$task_pid" 2>/dev/null; do
local elapsed=$((SECONDS - start))
print_loader "$task_name \t[$elapsed secs]"
done
local end=$((SECONDS - start))
echo -ne "[$task_pid : $task_name][$end secs] DONE!\n\r"
}
# Setup dependencies for Ubuntu 24.04
setup_dependencies() {
sudo apt-get update -y >> "$LOG_FILE" 2>&1
sudo apt-get install -y \
build-essential \
autoconf \
m4 \
libncurses5-dev \
libwxgtk3.2-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libpng-dev \
libssh-dev \
unixodbc-dev \
xsltproc \
fop \
libxml2-utils \
automake \
libreadline-dev \
libssl-dev \
libyaml-dev \
libxslt-dev \
libffi-dev \
libtool \
unzip \
curl \
git >> "$LOG_FILE" 2>&1
}
# Setup vfox
setup_vfox() {
echo "Installing vfox..."
echo "deb [trusted=yes] https://apt.fury.io/versionfox/ /" | sudo tee /etc/apt/sources.list.d/versionfox.list >> "$LOG_FILE" 2>&1
sudo apt-get update >> "$LOG_FILE" 2>&1
sudo apt-get install -y vfox >> "$LOG_FILE" 2>&1
echo 'eval "$(vfox activate bash)"' >> ~/.bashrc
}
# Main installation process
main() {
echo "Starting installation..."
# Create log file
touch "$LOG_FILE"
# Setup dependencies
setup_dependencies &
loading "Setting up dependencies" $!
wait
# Setup vfox
setup_vfox
echo """
Installation completed!
vfox has been installed. You can now manually install Erlang and Elixir as needed.
"""
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment