This commit is contained in:
2026-07-10 15:11:51 +08:00
parent 8bfcf23bc2
commit da17239d7d
148 changed files with 2542 additions and 4873 deletions
+55 -38
View File
@@ -1,54 +1,71 @@
#!/usr/bin/env bash
##makedesc: Install flameshot (latest)
source "$( dirname $(readlink -e -- "${BASH_SOURCE}"))/../helpers.sh" || exit 255
title
set -eo pipefail
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
# sudo apt install -y --autoremove flameshot && \
# sudo systemctl restart flameshot
installed() { command -v "$1" >/dev/null 2>&1; }
dir="$HOME/install"
clone_dir="$dir/flameshot"
mkdir -p "$dir"
install() {
if [ "$(uname -s)" = "Darwin" ]; then
if installed brew; then
brew install --cask flameshot
else
echo "ERROR: Install Homebrew first." >&2
exit 1
fi
return
fi
sudo apt install -y \
g++ \
cmake \
build-essential \
qtbase5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qttools5-dev \
libqt5dbus5 \
libqt5network5 \
libqt5core5a \
libqt5widgets5 \
libqt5gui5 \
libqt5svg5
echo
echo "==============================================="
echo "Installing flameshot"
echo "==============================================="
echo
if [ ! -d "$clone_dir" ]; then
git clone --depth=1 --single-branch https://github.com/flameshot-org/flameshot.git "$clone_dir"
fi
# https://github.com/flameshot-org/flameshot?tab=readme-ov-file#compilation
# sudo apt install -y --autoremove flameshot
# sudo systemctl restart flameshot
# Directory where build files will be placed, may be relative
export BUILD_DIR=build
dir="$HOME/install"
clone_dir="$dir/flameshot"
mkdir -p "$dir"
# Directory prefix where flameshot will be installed. If you are just building and don't want to
# install, comment this environment variable.
# This excludes the bin/flameshot part of the install,
# e.g. in /opt/flameshot/bin/flameshot, the CMAKE_INSTALL_PREFIX is /opt/flameshot
# This must be an absolute path. Requires CMAKE 3.29.
export CMAKE_INSTALL_PREFIX=/opt/flameshot
sudo apt install -y \
g++ \
cmake \
build-essential \
qtbase5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
qttools5-dev \
libqt5dbus5 \
libqt5network5 \
libqt5core5a \
libqt5widgets5 \
libqt5gui5 \
libqt5svg5
cd "$clone_dir" && \
git pull && \
cmake -S . -B "$BUILD_DIR" && \
if [ ! -d "$clone_dir" ]; then
git clone --depth=1 --single-branch https://github.com/flameshot-org/flameshot.git "$clone_dir"
fi
# Directory where build files will be placed, may be relative
export BUILD_DIR=build
# Directory prefix where flameshot will be installed.
export CMAKE_INSTALL_PREFIX=/opt/flameshot
cd "$clone_dir"
git pull
cmake -S . -B "$BUILD_DIR"
cmake --build "$BUILD_DIR"
[ $? = 0 ] && {
echo
success "flameshot installed!"
echo "Finish!"
# /opt/flameshot/flameshot -v
echo
}
case "$1" in
*) install ;;
esac