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

rcsoccersim installation script #2

Merged
merged 5 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions bison.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

function is_root {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

if ! is_root; then
echo -e "\x1B[31m[ERROR] This script requires root privileges."
exit 1
fi

apt install bison -y
12 changes: 12 additions & 0 deletions flex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

function is_root {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

if ! is_root; then
echo -e "\x1B[31m[ERROR] This script requires root privileges."
exit 1
fi

apt install flex -y
42 changes: 42 additions & 0 deletions rcsoccersim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

function is_root {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

if ! is_root; then
echo -e "\x1B[31m[ERROR] This script requires root privileges."
exit 1
fi

GITHUB_RCSOCCERSIM_PREFIX="https://github.com/rcsoccersim"

function install_packages {
local package_name="$1"
local tmp_dir="/tmp/${package_name}"
local git_url="${GITHUB_RCSOCCERSIM_PREFIX}/${package_name}.git"

rm -rf "${tmp_dir}"
mkdir -p "${tmp_dir}"

git clone "${git_url}" -o "${package_name}" "${tmp_dir}"
pushd "${tmp_dir}" || exit 1
./bootstrap && ./configure --prefix "/opt/${package_name}" && make -j"$(nproc)" && make install
popd || exit 1

rm -rf "${tmp_dir}"
}

if [ "$#" -eq 0 ]; then
echo -e "\x1B[31m[ERROR] No arguments provided"
exit 1
fi

joseviccruz marked this conversation as resolved.
Show resolved Hide resolved
for arg in "$@"; do
install_packages $(echo "$arg")
if [ $? -ne 0 ]; then
echo -e "\x1B[31m[ERROR] failed installing $package_name module"
exit 1
fi
cd ..
done