aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/setup-rh
blob: 7a5d28bfb51e78558166a5b77d503df6278318e8 (plain)
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
#!/bin/sh
# ---------------------------------------------------------------------------------------------------------------------
# SPDX-License-Identifier: GPL-2.0
# ---------------------------------------------------------------------------------------------------------------------
#
# Copyright 2022 Siemens
#
# This file is licensed under the terms of the GNU General Public License
# version 2.  This program  is licensed "as is" without any warranty of any
# kind, whether express or implied.

packages="python38 \
          patch diffstat git bzip2 tar \
          gzip gawk chrpath wget cpio perl file which \
          make gcc gcc-c++ rsync rpcgen \
          zstd lz4"

set -e

if [ "$(id -u)" != "0" ]; then
    echo "Verifying access to sudo, please enter your password if prompted."
    if ! sudo -v; then
        echo >&2 "Could not use sudo, exiting"
        exit 1
    fi
    exec sudo "$0" "$@"
fi

echo "Enabling any required repos"
if grep -q "^Red Hat Enterprise Linux release 8" /etc/redhat-release 2>/dev/null; then
    ARCH=$(/bin/arch)
    subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"
elif grep -q "^CentOS" /etc/redhat-release 2>/dev/null; then
    dnf config-manager --set-enabled PowerTools
fi

echo "Installing packages required to build Mentor Embedded Linux Flex OS"
dnf install --assumeyes "$@" $packages || {
    echo >&2 "Error installing our required packages, aborting"
    exit 1
}
echo "Setup complete"