-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqt5-devel.sh
61 lines (48 loc) · 1.57 KB
/
qt5-devel.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
56
57
58
59
60
#!/usr/bin/env bash
# Script that installs packages for Qt5 development.
# You need root permissions to run this script.
if [[ "${UID}" != '0' ]]; then
echo '> You need to become root to run this script.'
echo '> Aborting.'
exit 1
fi
# Function that checks if required binary exists and installs it if necessary.
ENSURE_PACKAGE () {
REQUIRED_BINARY=$(basename "${1}")
REPO_PACKAGES="${*:2}"
if [[ "${REQUIRED_BINARY}" != '-' ]]; then
[[ -n "${REPO_PACKAGES}" ]] || REPO_PACKAGES="${REQUIRED_BINARY}"
if command -v "${REQUIRED_BINARY}" 1> /dev/null; then
REPO_PACKAGES=''
fi
fi
[[ -n "${REPO_PACKAGES}" ]] || return
if [[ "${REPO_REFRESHED}" == '0' ]]; then
echo '> Refreshing package repository.'
dnf check-update 1> /dev/null
REPO_REFRESHED=1
fi
for REPO_PACKAGE in ${REPO_PACKAGES}
do
dnf install -y "${REPO_PACKAGE}"
done
}
# Install packages.
ENSURE_PACKAGE '-' 'qt5-devel' 'qt5-qtbase-devel'
ENSURE_PACKAGE 'grep'
ENSURE_PACKAGE 'sed'
# Link qmake binary.
if ! command -v qmake 1> /dev/null 2>&1; then
if command -v qmake-qt5 1> /dev/null 2>&1; then
ln -sf "$(command -v qmake-qt5)" /usr/local/bin/qmake
fi
fi
# Enable debug messages.
[[ -d /usr/share/qt5 ]] || mkdir -p /usr/share/qt5
if ! grep -Fq '*.debug=' /usr/share/qt5/qtlogging.ini; then
echo '*.debug=true' >> /usr/share/qt5/qtlogging.ini
else
sed -i -E 's/^\*\.debug=.*/*.debug=true/g' /usr/share/qt5/qtlogging.ini
fi
# Let user know that script has finished its job.
echo '> Finished.'