OrcaSlicer/linux.d/debian
Sebastian Kuzminsky 91ffc79c7b
Some checks failed
Build all / Build All (push) Has been cancelled
Build all / Flatpak (push) Has been cancelled
better version check in linux build script (#9496)
* better version check in linux build script

Running `BuildLinux.sh` on Debian Trixie (and probably on other platforms)
results in this warning:
```
$ sudo ./BuildLinux.sh -u
./linux.d/debian: line 32: [: ==: unary operator expected
./linux.d/debian: line 32: [: ==: unary operator expected
...
```

The script is looking for the `VERSION_ID` variable
in `/etc/os-release`, but that variable is optional (see
https://www.linux.org/docs/man5/os-release.html) and is not present in
my install of Debian Trixie.  The script handles the missing variable
incorrectly, resulting in the above warning.

This commit fixes the version check to be more tolerant and IMO clearer.

Tested on Ubuntu 22.04, 24.04, and Debian Trixie.
2025-06-02 23:11:19 +08:00

64 lines
1.6 KiB
Text

FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3 || echo '')
REQUIRED_DEV_PACKAGES=(
autoconf
build-essential
cmake
eglexternalplatform-dev
extra-cmake-modules
file
gettext
git
libcurl4-openssl-dev
libdbus-1-dev
libglew-dev
libgstreamerd-3-dev
libgtk-3-dev
libmspack-dev
libosmesa6-dev
libsecret-1-dev
libspnav-dev
libssl-dev
libtool
libudev-dev
ninja-build
texinfo
wget
)
if [[ -n "$UPDATE_LIB" ]]
then
source /etc/os-release
if [ "${ID}" == "ubuntu" ] && [ -n "${VERSION_ID}" ]; then
# It's ubuntu and we have a VERSION_ID like "24.04".
if dpkg --compare-versions "${VERSION_ID}" ge 22 && dpkg --compare-versions "${VERSION_ID}" lt 24 ;
then
# Some extra packages needed on Ubuntu 22.x and 23.x:
REQUIRED_DEV_PACKAGES+=(curl libfuse-dev libssl-dev libcurl4-openssl-dev m4)
fi
fi
if [[ -n "$BUILD_DEBUG" ]]
then
REQUIRED_DEV_PACKAGES+=(libssl-dev libcurl4-openssl-dev)
fi
# check which version of libwebkit2gtk is available
if [ "$(apt show --quiet libwebkit2gtk-4.0-dev)" != "" ]
then
REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.0-dev)
else
REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.1-dev)
fi
# TODO: optimize this by checking which, if any, packages are already installed
# install them all at once
sudo apt update
sudo apt install -y ${REQUIRED_DEV_PACKAGES[@]}
echo -e "done\n"
exit 0
fi
FOUND_GTK3_DEV=$(dpkg -l libgtk* | grep gtk-3-dev || echo '')