mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-06 14:57:50 -07:00
Shellcheck everything (#10730)
Some checks failed
Shellcheck / Shellcheck (push) Has been cancelled
Some checks failed
Shellcheck / Shellcheck (push) Has been cancelled
* Shellcheck all shell scripts * Implement Shellcheck's recommendations * Shellcheck the distribution-specific files * Include the distro scripts to trigger action * Fix array usage (hopefully) * Use single-quote string TIL: single quote string in yaml treats everything as literal, but double quote allows backslash escaping. * Make all cmake commands use set+-x dance and fix macos getopts line Make Claude happy getopts has colon after a command which takes an argument --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
fa6a73ec5e
commit
7aa3ce8a4d
11 changed files with 90 additions and 65 deletions
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
# these are the Arch Linux specific build functions
|
||||
export FOUND_GTK3
|
||||
FOUND_GTK3=$(pacman -Q gtk3)
|
||||
|
||||
# Addtional Dev packages for OrcaSlicer
|
||||
|
|
@ -30,16 +32,17 @@ export REQUIRED_DEV_PACKAGES=(
|
|||
if [[ -n "$UPDATE_LIB" ]]
|
||||
then
|
||||
echo -n -e "Updating linux ...\n"
|
||||
NEEDED_PKGS=""
|
||||
for PKG in ${REQUIRED_DEV_PACKAGES[@]}; do
|
||||
pacman -Q ${PKG} > /dev/null || NEEDED_PKGS+=" ${PKG}"
|
||||
NEEDED_PKGS=()
|
||||
for PKG in "${REQUIRED_DEV_PACKAGES[@]}"; do
|
||||
pacman -Q "${PKG}" > /dev/null || NEEDED_PKGS+=("${PKG}")
|
||||
done
|
||||
|
||||
if [ -n "${NEEDED_PKGS}" ]; then
|
||||
sudo pacman -Syy --noconfirm ${NEEDED_PKGS}
|
||||
if [[ "${#NEEDED_PKGS[*]}" -gt 0 ]]; then
|
||||
sudo pacman -Syy --noconfirm "${NEEDED_PKGS[@]}"
|
||||
fi
|
||||
echo -e "done\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export FOUND_GTK3_DEV
|
||||
FOUND_GTK3_DEV=${FOUND_GTK3}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
# these are the Clear Linux specific build functions
|
||||
FOUND_GTK3=$(ls /usr/lib64/libgtk-3.so.* 2>/dev/null | tail -n 1 || true)
|
||||
export FOUND_GTK3
|
||||
FOUND_GTK3=$(find /usr/lib64/libgtk-3.so.* 2>/dev/null | tail -n 1 || true)
|
||||
|
||||
# Addtional bundles for OrcaSlicer
|
||||
export REQUIRED_BUNDLES=(
|
||||
|
|
@ -25,9 +27,10 @@ export REQUIRED_BUNDLES=(
|
|||
if [[ -n "$UPDATE_LIB" ]]
|
||||
then
|
||||
echo "Updating linux ..."
|
||||
echo swupd bundle-add -y ${REQUIRED_BUNDLES[@]}
|
||||
echo swupd bundle-add -y "${REQUIRED_BUNDLES[@]}"
|
||||
echo -e "done\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FOUND_GTK3_DEV=$(ls /usr/lib64/libgtk-3.so 2>/dev/null || true)
|
||||
export FOUND_GTK3_DEV
|
||||
FOUND_GTK3_DEV=$(find /usr/lib64/libgtk-3.so 2>/dev/null || true)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/bash
|
||||
export FOUND_GTK3
|
||||
FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3 || echo '')
|
||||
|
||||
REQUIRED_DEV_PACKAGES=(
|
||||
|
|
@ -27,6 +29,7 @@ REQUIRED_DEV_PACKAGES=(
|
|||
|
||||
if [[ -n "$UPDATE_LIB" ]]
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
source /etc/os-release
|
||||
if [ "${ID}" == "ubuntu" ] && [ -n "${VERSION_ID}" ]; then
|
||||
# It's ubuntu and we have a VERSION_ID like "24.04".
|
||||
|
|
@ -50,14 +53,13 @@ then
|
|||
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[@]}
|
||||
sudo apt install -y "${REQUIRED_DEV_PACKAGES[@]}"
|
||||
|
||||
echo -e "done\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export FOUND_GTK3_DEV
|
||||
FOUND_GTK3_DEV=$(dpkg -l libgtk* | grep gtk-3-dev || echo '')
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/bash
|
||||
export FOUND_GTK3
|
||||
FOUND_GTK3=$(rpm -qa | grep -P '^gtk3' || true)
|
||||
|
||||
REQUIRED_DEV_PACKAGES=(
|
||||
|
|
@ -34,16 +36,17 @@ REQUIRED_DEV_PACKAGES=(
|
|||
|
||||
if [[ -n "$UPDATE_LIB" ]]
|
||||
then
|
||||
NEEDED_PKGS=""
|
||||
for PKG in ${REQUIRED_DEV_PACKAGES[@]}; do
|
||||
rpm -q ${PKG} > /dev/null || NEEDED_PKGS+=" ${PKG}"
|
||||
NEEDED_PKGS=()
|
||||
for PKG in "${REQUIRED_DEV_PACKAGES[@]}"; do
|
||||
rpm -q "${PKG}" > /dev/null || NEEDED_PKGS+=("${PKG}")
|
||||
done
|
||||
|
||||
if [ -n "${NEEDED_PKGS}" ]; then
|
||||
sudo dnf install -y ${NEEDED_PKGS}
|
||||
if [[ "${#NEEDED_PKGS[*]}" -gt 0 ]]; then
|
||||
sudo dnf install -y "${NEEDED_PKGS[@]}"
|
||||
fi
|
||||
echo -e "done\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export FOUND_GTK3_DEV
|
||||
FOUND_GTK3_DEV=$(rpm -qa | grep -P '^gtk3-devel' || true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue