replaced lsb_release with os-release file
Some checks failed
Codacy Scan / Codacy Security Scan (push) Successful in 7s
Build WHY2-chat / test-why2 (./out/why2-chat-client, ./configure.sh, ubuntu-latest, ./out/why2-chat-server) (push) Failing after 37s
Test WHY2-logger / test-why2 (why2-logger, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-logger-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Failing after 50s
Test WHY2-core / test-why2 (why2, ./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./out/why2-core-test, valgrind --leak-check=full --show-leak-kinds=reachable --track-origins=yes -s) (push) Failing after 53s
Test Project / test-project (./configure.sh, gdb -ex "run" -ex "quit" --batch, ubuntu-latest, ./test) (push) Failing after 50s

also supporting X-based distributions
This commit is contained in:
Václav Šmejkal 2025-01-25 10:44:16 +01:00
parent 17a73d9157
commit 6eeddbd14e
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -17,9 +17,14 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# Get linux distro # Get linux distro
DISTRO=$(lsb_release -is) DISTRO=$(grep ^ID_LIKE= /etc/os-release | cut -d= -f2 | tr -d '"')
if [ -e $DISTRO ]
then
DISTRO=$(grep ^ID= /etc/os-release | cut -d= -f2 | tr -d '"')
fi
if [[ $(id -u) != "0" ]] && [[ $1 != "force" ]]; then if [[ $(id -u) != "0" ]] && [[ $1 != "force" ]]
then
echo "You must run this script as root! (To skip this, run with 'force' arg: \"./configure.sh force\")" echo "You must run this script as root! (To skip this, run with 'force' arg: \"./configure.sh force\")"
exit 1 exit 1
fi fi
@ -28,11 +33,14 @@ COMMON="gcc make tmux curl"
ARCH_GENTOO_COMMON="$COMMON json-c libgit2 gmp openssl" ARCH_GENTOO_COMMON="$COMMON json-c libgit2 gmp openssl"
# Get COMMAND # Get COMMAND
if [[ $DISTRO == "Arch" ]]; then if [[ $DISTRO == "arch" ]]
then
COMMAND="pacman -S --needed --noconfirm $ARCH_GENTOO_COMMON" COMMAND="pacman -S --needed --noconfirm $ARCH_GENTOO_COMMON"
elif [[ $DISTRO == "Ubuntu" ]] || [[ $DISTRO == "Debian" ]]; then elif [[ $DISTRO == "Ubuntu" ]] || [[ $DISTRO == "Debian" ]]
then
COMMAND="apt-get install -y $COMMON libjson-c-dev libcurl4-openssl-dev libgit2-dev libgmp-dev libssl-dev" COMMAND="apt-get install -y $COMMON libjson-c-dev libcurl4-openssl-dev libgit2-dev libgmp-dev libssl-dev"
elif [[ $DISTRO == "Gentoo" ]]; then elif [[ $DISTRO == "Gentoo" ]]
then
COMMAND="emerge -vn $ARCH_GENTOO_COMMON" COMMAND="emerge -vn $ARCH_GENTOO_COMMON"
# Add # Add
@ -60,7 +68,8 @@ fi
$COMMAND $COMMAND
# Install Rust # Install Rust
if ! [ -x "$(command -v cargo)" ]; then if ! [ -x "$(command -v cargo)" ]
then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y # Install Rust and components curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y # Install Rust and components
source "$HOME/.cargo/env" source "$HOME/.cargo/env"
fi fi