2022-07-29 06:29:03 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
|
2023-02-01 10:57:21 +00:00
|
|
|
GO_VERSION="1.19.5"
|
|
|
|
GO_INSTALL_DIR="/usr/local/go"
|
|
|
|
QT_VERSION="5.15.2"
|
|
|
|
QT_INSTALL_DIR="/opt/qt"
|
|
|
|
|
2022-07-29 06:29:03 +00:00
|
|
|
function check_version {
|
|
|
|
source /etc/os-release
|
2023-12-06 12:46:49 +00:00
|
|
|
[[ "${NAME}" != "Ubuntu" ]] && { echo "ERROR: This script only supports Ubuntu!"; exit 1; }
|
|
|
|
[[ "${VERSION_ID}" != '22.04' ]] && { echo "ERROR: Ubuntu version not 22.04!"; exit 1; }
|
2022-07-29 06:29:03 +00:00
|
|
|
}
|
|
|
|
|
2022-08-01 11:19:58 +00:00
|
|
|
function install_build_dependencies {
|
|
|
|
echo "Install build dependencies"
|
2022-07-29 06:29:03 +00:00
|
|
|
apt update
|
2024-10-08 14:06:20 +00:00
|
|
|
apt install -yq git wget build-essential \
|
|
|
|
cmake extra-cmake-modules pkg-config protoc-gen-go \
|
|
|
|
mesa-common-dev unixodbc-dev libpq-dev libglu1-mesa-dev libpcsclite-dev \
|
|
|
|
libpcre3-dev libssl-dev libpulse-mainloop-glib0 libxkbcommon-x11-dev
|
2022-08-01 11:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_release_dependencies {
|
|
|
|
echo "Install release dependencies"
|
|
|
|
mkdir -p /usr/local/bin
|
2023-10-24 10:23:29 +00:00
|
|
|
LINUXDEPLOYQT='linuxdeployqt-20230423-8428c59-x86_64.AppImage'
|
2024-02-08 16:15:46 +00:00
|
|
|
curl -L "https://status-misc.ams3.digitaloceanspaces.com/desktop/${LINUXDEPLOYQT}" \
|
2023-10-24 10:23:29 +00:00
|
|
|
-o /usr/local/bin/linuxdeployqt
|
2022-08-01 11:19:58 +00:00
|
|
|
chmod a+x /usr/local/bin/linuxdeployqt
|
2022-07-29 06:29:03 +00:00
|
|
|
|
2022-08-01 11:19:58 +00:00
|
|
|
apt install -yq gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
|
|
|
|
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools \
|
|
|
|
gstreamer1.0-alsa gstreamer1.0-pulseaudio
|
|
|
|
}
|
|
|
|
|
|
|
|
function install_runtime_dependencies {
|
|
|
|
echo "Install runtime dependencies"
|
2023-12-06 12:46:49 +00:00
|
|
|
# xvfb is needed in order run squish test into a headless server
|
2023-02-02 13:08:52 +00:00
|
|
|
apt install -yq libxcomposite-dev xvfb libxft-dev \
|
|
|
|
libxcb-shape0 libxcb-randr0 libxcb-render0 libxcb-icccm4 libxcb-image0 \
|
|
|
|
libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0
|
2022-07-29 06:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_qt {
|
|
|
|
echo "Install QT"
|
2022-08-08 08:29:15 +00:00
|
|
|
apt install -y python3-pip
|
2022-07-29 06:29:03 +00:00
|
|
|
pip install -U pip
|
|
|
|
pip install aqtinstall
|
2023-02-01 10:57:21 +00:00
|
|
|
aqt install-qt linux desktop ${QT_VERSION} gcc_64 -m qtwebengine -O ${QT_INSTALL_DIR}
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_go_arch {
|
|
|
|
case "$(uname -m)" in
|
|
|
|
"x86_64") echo "amd64" ;;
|
|
|
|
"aarch64") echo "arm64" ;;
|
|
|
|
"armv*") echo "armv6l" ;;
|
|
|
|
*) echo "UNKNOWN" ;;
|
|
|
|
esac
|
2022-07-29 06:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_golang {
|
2023-02-01 10:57:21 +00:00
|
|
|
if [[ -x "$(command -v go)" ]]; then
|
|
|
|
echo "Already present: $(go version)"
|
|
|
|
return
|
2022-08-01 11:19:58 +00:00
|
|
|
fi
|
2023-02-01 10:57:21 +00:00
|
|
|
declare -A GO_SHA256_MAP
|
|
|
|
GO_SHA256_MAP=(
|
2023-05-04 10:55:58 +00:00
|
|
|
["amd64"]="698ef3243972a51ddb4028e4a1ac63dc6d60821bf18e59a807e051fee0a385bd"
|
|
|
|
["arm64"]="105889992ee4b1d40c7c108555222ca70ae43fccb42e20fbf1eebb822f5e72c6"
|
|
|
|
["armv6l"]="0b75ca23061a9996840111f5f19092a1bdbc42ec1ae25237ed2eec1c838bd819"
|
2023-02-01 10:57:21 +00:00
|
|
|
)
|
|
|
|
echo "Install GoLang ${GO_VERSION}"
|
|
|
|
GO_OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
|
|
GO_ARCH=$(get_go_arch)
|
|
|
|
GO_TARBALL="go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz"
|
|
|
|
wget -q "https://dl.google.com/go/${GO_TARBALL}" -O "${GO_TARBALL}"
|
|
|
|
echo "${GO_SHA256_MAP[${GO_ARCH}]} ${GO_TARBALL}" | sha256sum -c
|
|
|
|
tar -C "${GO_INSTALL_DIR}" -xzf "${GO_TARBALL}"
|
|
|
|
rm "${GO_TARBALL}"
|
|
|
|
ln -s "${GO_INSTALL_DIR}/go/bin/go" /usr/local/bin
|
2022-07-29 06:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function success_message {
|
|
|
|
msg="
|
|
|
|
SUCCESS!
|
|
|
|
|
|
|
|
Before you attempt to build status-dektop you'll need a few environment variables set:
|
|
|
|
|
2023-02-01 10:57:21 +00:00
|
|
|
export QTDIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
|
2024-10-08 14:06:20 +00:00
|
|
|
export PATH=\$QTDIR:\$QTDIR/bin:\$(go env GOPATH)\bin:$PATH
|
2022-07-29 06:29:03 +00:00
|
|
|
"
|
|
|
|
echo $msg
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$0" = "$BASH_SOURCE" ]; then
|
|
|
|
check_version
|
2022-08-01 11:19:58 +00:00
|
|
|
install_build_dependencies
|
|
|
|
install_release_dependencies
|
|
|
|
install_runtime_dependencies
|
2022-07-29 06:29:03 +00:00
|
|
|
install_qt
|
|
|
|
install_golang
|
|
|
|
success_message
|
|
|
|
fi
|