Las_3000-modpack/updateMods.sh
2025-08-18 14:34:22 +02:00

43 lines
1.1 KiB
Bash

#!/bin/bash
cd "$(dirname "$0")" || exit 1
echo "Iniciando"
# Check if git is installed
if ! command -v git >/dev/null 2>&1; then
echo "Git no está instalado"
echo "Instálalo desde https://git-scm.com/downloads"
exit 1
fi
# If not already a git repo, initialize and fetch
if [ ! -d ".git" ]; then
echo "Git no esta inicializado"
git init
git remote add origin http://127.0.0.1:11001/SFKao/Las_3000-modpack.git
git fetch
git checkout -t origin/server -f
fi
echo "Bajando..."
# Fetch and pull updates
if ! git fetch --progress || ! git pull --rebase --autostash --progress; then
echo "Han habido errores actualizando, contactar con SFKao"
exit 1
fi
# === Sync datapacks ===
SOURCE="./datapacks"
TARGET="./world/datapacks"
if [ -d "$SOURCE" ]; then
echo "Sincronizando datapacks..."
mkdir -p "$TARGET"
rm -rf "$TARGET"/*
cp -r "$SOURCE"/* "$TARGET"/
echo "Datapacks copiados en $TARGET"
else
echo "No se encontró la carpeta $SOURCE"
fi
# Equivalent to pause (wait for user input before closing)
read -rp "Presiona Enter para salir..."