Skip to content

Commit c39aa07

Browse files
authored
Merge pull request #67 from spartokos99/sparto-branch
added updater bash and show loaded config
2 parents 1ff55d2 + 8f99c2e commit c39aa07

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

src/config.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ Config LoadConfig(const std::string &filename) {
329329
try {
330330
const auto data = toml::parse(file);
331331
current_config = filename;
332+
333+
logging::Info("config loaded: {}", std::string(path));
334+
335+
332336
return Config::from_toml(*data.as_table());
333337
} catch (toml::parse_error &) {
334338
logging::Warning("config file invalid, loading defaults");

updater.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
REPO_DIR="."
4+
APP_PATH="$REPO_DIR/build/deadlocked"
5+
BUILD_SCRIPT="$REPO_DIR/build.sh"
6+
7+
# Define colors
8+
GREEN="\033[1;32m"
9+
YELLOW="\033[1;33m"
10+
RED="\033[1;31m"
11+
BLUE="\033[1;34m"
12+
NC="\033[0m" # No Color
13+
14+
print_step() {
15+
echo -e "${BLUE}$1${NC}"
16+
}
17+
18+
print_success() {
19+
echo -e "${GREEN}$1${NC}"
20+
}
21+
22+
print_warning() {
23+
echo -e "${YELLOW}$1${NC}"
24+
}
25+
26+
print_error() {
27+
echo -e "${RED}$1${NC}"
28+
}
29+
30+
echo ""
31+
print_step "Starting Deadlocked updater..."
32+
33+
cd "$REPO_DIR" || {
34+
print_error "Repo directory not found!"
35+
exit 1
36+
}
37+
38+
print_step "Checking for updates..."
39+
git fetch
40+
41+
LOCAL_HASH=$(git rev-parse HEAD)
42+
REMOTE_HASH=$(git rev-parse @{u})
43+
44+
echo ""
45+
print_step "Local Hash: $LOCAL_HASH"
46+
print_step "Remote Hash: $REMOTE_HASH"
47+
echo ""
48+
49+
if [ "$LOCAL_HASH" != "$REMOTE_HASH" ]; then
50+
print_step "Updates found. Pulling latest changes..."
51+
git pull --recurse-submodules
52+
53+
print_step "Recompiling project..."
54+
if bash "$BUILD_SCRIPT"; then
55+
print_success "Compilation completed successfully."
56+
else
57+
print_error "Compilation failed!"
58+
exit 1
59+
fi
60+
else
61+
print_success "No updates found. Skipping compilation."
62+
fi
63+
64+
echo ""
65+
print_step "Launching Deadlocked..."
66+
echo ""
67+
68+
"$APP_PATH"

0 commit comments

Comments
 (0)