-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·55 lines (48 loc) · 2.09 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
echo -e "\e[34m"
echo "########################################################################"
echo "########################################################################"
echo "## ########## ### ### ############# ################ ##"
echo "## ## ## ### ### ############# ################ ##"
echo "## ## ## ### ### ### ## ##"
echo "## ## ## ### ### ### ## ##"
echo "## ########## ### ### ############## ## ##"
echo "## ## ## ### ### ############## ## ##"
echo "## ## ## ### ### ### ## ##"
echo "## ## ## ### ### ### ## ##"
echo "## ## ## ############ ############## ## ##"
echo "## ## ## ########## ############## ## ##"
echo "########################################################################"
echo "########################################################################"
echo -e "\e[0m"
echo -e "\e[32m[INFO] Installing Rust compiler.\e[0m"
# Function to check if a command is available
command_exists() {
command -v "$1" &> /dev/null
}
# Install Rust based on the Linux distribution
if command_exists apt; then
# Debian/Ubuntu
sudo apt update
sudo apt install -y rustc
elif command_exists pacman; then
# Arch Linux
sudo pacman -Syu --noconfirm rust
elif command_exists dnf; then
# Red Hat/Fedora
sudo dnf install -y rust
elif command_exists zypper; then
# openSUSE
sudo zypper install -y rust
else
echo "Unsupported Linux distribution. Please install Rust manually."
exit 1
fi
echo -e -n "\n\e[32mRust version:\e[0m\n"
rustc --version
cargo --version
echo -e "\e[32m[INFO] Installing the rust-coderunner script."
sudo cp rrun /bin
sudo chmod +x /bin/rrun
echo -e "[INFO] Script installation successful."
echo -e "Just type \e[31mrrun \e[33mfile_name.rs\e[32m and the code-runner script would run!!\e[0m"