summaryrefslogtreecommitdiff
path: root/apps/compiler/includes/functions.sh
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2025-07-01 15:35:54 +0200
committerGitHub <noreply@github.com>2025-07-01 15:35:54 +0200
commite1b2689c3a2b1395323d2fc58588b1e1b3c07c53 (patch)
treef36a888ec1fef286ac59607c8a513668286e4065 /apps/compiler/includes/functions.sh
parentd3130f0d39064d03bed969c7bc135ebb6066442f (diff)
feat(bash): startup-scripts reworked + bash scripts workflow integration (#22401)
Diffstat (limited to 'apps/compiler/includes/functions.sh')
-rw-r--r--apps/compiler/includes/functions.sh26
1 files changed, 14 insertions, 12 deletions
diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh
index 2e7299905c..2299918187 100644
--- a/apps/compiler/includes/functions.sh
+++ b/apps/compiler/includes/functions.sh
@@ -1,3 +1,7 @@
+#!/usr/bin/env bash
+
+# Set SUDO variable - one liner
+SUDO=$([ "$EUID" -ne 0 ] && echo "sudo" || echo "")
function comp_clean() {
DIRTOCLEAN=${BUILDPATH:-var/build/obj}
@@ -134,23 +138,21 @@ function comp_compile() {
mkdir -p "$confDir"
echo "Cmake install..."
- sudo cmake --install . --config $CTYPE
+ $SUDO cmake --install . --config $CTYPE
popd >> /dev/null || exit 1
# set all aplications SUID bit
echo "Setting permissions on binary files"
- find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chown root:root -- {} +
- find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chmod u+s -- {} +
-
- if [[ -n "$DOCKER" ]]; then
- [[ -f "$confDir/worldserver.conf.dist" ]] && \
- cp -nv "$confDir/worldserver.conf.dist" "$confDir/worldserver.conf"
- [[ -f "$confDir/authserver.conf.dist" ]] && \
- cp -nv "$confDir/authserver.conf.dist" "$confDir/authserver.conf"
- [[ -f "$confDir/dbimport.conf.dist" ]] && \
- cp -nv "$confDir/dbimport.conf.dist" "$confDir/dbimport.conf"
- fi
+ find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec $SUDO chown root:root -- {} +
+ find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec $SUDO chmod u+s -- {} +
+
+ [[ -f "$confDir/worldserver.conf.dist" ]] && \
+ cp -v --update=none "$confDir/worldserver.conf.dist" "$confDir/worldserver.conf"
+ [[ -f "$confDir/authserver.conf.dist" ]] && \
+ cp -v --update=none "$confDir/authserver.conf.dist" "$confDir/authserver.conf"
+ [[ -f "$confDir/dbimport.conf.dist" ]] && \
+ cp -v --update=none "$confDir/dbimport.conf.dist" "$confDir/dbimport.conf"
echo "Done"
;;