fastfetch/run.sh
red-magic 99c0e9e719
run.sh: Improve compatibility with other systems (#1332)
* run.sh: Improve compatibility with other systems

For example $OSTYPE is empty in OpenBSD and the script fallsback to Linux option, with nproc isn't present it fails to build.

* Update run.sh

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2024-10-10 23:38:49 +08:00

27 lines
414 B
Bash
Executable File

#!/usr/bin/env sh
set -e
mkdir -p build/
cd build/
cmake ..
kernel_name="$(uname -s)"
case "${kernel_name}" in
"Linux" | "MINGW"*)
cmake_build_args="-j$(nproc)"
;;
"Darwin" | *"BSD" | "DragonFly")
cmake_build_args="-j$(sysctl -n hw.ncpu)"
;;
*)
cmake_build_args=""
;;
esac
cmake --build . --target fastfetch "${cmake_build_args}"
./fastfetch "$@"