46 lines
1.1 KiB
Bash
Executable file
46 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
RESET="\e[0m"
|
|
BOLD="\e[1m"
|
|
GREEN="\e[32m"
|
|
RED="\e[31m"
|
|
|
|
info() { echo -en "\n${BOLD}>>${RESET} $1\n\n"; }
|
|
error() { echo -e "${BOLD}${RED}!!${RESET} $1" >&2; }
|
|
|
|
main() {
|
|
[ "$EUID" != 0 ] && error 'Run me as root' && exit 1
|
|
|
|
for directory in *; do
|
|
if [ "$directory" = 'dfetch' ]; then
|
|
continue
|
|
fi
|
|
|
|
if [ -d "$directory" ]; then
|
|
info "Compiling ${GREEN}$directory${RESET}"
|
|
|
|
make -C "$directory" clean
|
|
make -C "$directory" -j"$(($(nproc --all) * 4))"
|
|
make_return_code="$?"
|
|
|
|
if [ "$make_return_code" -ne 0 ]; then
|
|
error "${BOLD}make${RESET} exited with code of ${BOLD}$make_return_code${RESET}"
|
|
exit "$make_return_code"
|
|
fi
|
|
|
|
[ ! "$NO_INSTALL" ] && make -C "$directory" install
|
|
[ ! "$NO_CLEAN" ] && make -C "$directory" clean
|
|
fi
|
|
done
|
|
|
|
if command -v update-desktop-database >/dev/null; then
|
|
info "Updating ${BOLD}${GREEN}desktop database${RESET}"
|
|
update-desktop-database
|
|
fi
|
|
|
|
return "${make_return_code:-0}"
|
|
}
|
|
|
|
main "$@"
|