From c60749a8f4f42ef0c32cf7020c8bf4cc3d2aec42 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 28 Apr 2021 18:01:42 -0300 Subject: Initial commit --- init.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ install_manaplus.sh | 7 +++++ pull.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100755 init.sh create mode 100755 install_manaplus.sh create mode 100755 pull.sh diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..06624b7 --- /dev/null +++ b/init.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +export LANG=C +export GROUP=themanaworld +export ALTER=evolved + +CMD="$1" +PROTO="git@gitlab.com:" +if [[ -z "${CMD}" ]]; then + export CMD="default" +fi + +STR=$(git remote -v|grep "https://") +if [[ -n "${STR}" ]]; then + export PROTO="https://gitlab.com/" +fi + +CLONECMD="git clone --origin upstream" +CLONE1="${CLONECMD} ${PROTO}${GROUP}${ALTER}" +CLONE2="${CLONECMD} ${PROTO}${GROUP}" + +if [[ "${CMD}" == "all" || "${CMD}" == "default" ]]; then + ${CLONE1}/clientdata.git client-data + ${CLONE1}/hercules.git server-code + ${CLONE1}/serverdata.git server-data + ${CLONE1}/evol-tools.git tools + ${CLONE1}/evol-hercules.git server-code/src/evol + cd server-code/src/evol ; cd ../../.. + ln -s server-code/src/evol server-plugin +elif [[ "${CMD}" == "server" ]]; then + ${CLONE1}/hercules.git server-code + ${CLONE1}/serverdata.git server-data + ${CLONE1}/evol-hercules.git server-code/src/evol + cd server-code/src/evol ; cd ../../.. + ${CLONE1}/evol-tools.git tools + ln -s server-code/src/evol server-plugin +elif [[ "${CMD}" == "client" ]]; then + ${CLONE1}/clientdata.git client-data + ${CLONE1}/evol-tools.git tools +#elif [[ "${CMD}" == "music" ]]; then +# ${CLONE1}/evol-music.git music +elif [[ "${CMD}" == "local" ]]; then + ${CLONE1}/hercules.git server-code + ${CLONE1}/serverdata.git server-data + ${CLONE1}/evol-hercules.git server-code/src/evol + cd server-code/src/evol ; cd ../../.. + ${CLONE1}/evol-tools.git tools + ln -s server-code/src/evol server-plugin +elif [[ "${CMD}" == "tools" ]]; then + ${CLONE1}/evol-tools.git tools +elif [[ "${CMD}" == "plugin" ]]; then + ${CLONE1}/evol-hercules.git server-code/src/evol + cd server-code/src/evol ; cd ../../.. + ln -s server-code/src/evol server-plugin +#elif [[ "${CMD}" == "docs" ]]; then +# ${CLONE1}/Docs.git docs +# ${CLONE1}/Docs.wiki.git wiki +elif [[ "${CMD}" == "manaplus" ]]; then + ${CLONE2}/manaplus/manaplus.git manaplus +#elif [[ "${CMD}" == "media" ]]; then +# ${CLONE1}/art.git art +#elif [[ "${CMD}" == "mods" ]]; then +# ${CLONE1}/mods.git client-data/mods +elif [[ "${CMD}" == "update" ]]; then + ${CLONE1}/hercules.git server-code + ${CLONE1}/evol-hercules.git server-code/src/evol + cd server-code/src/evol ; cd ../../.. + ln -s server-code/src/evol server-plugin +fi + +#if [[ "${CMD}" == "all" ]]; then +# ${CLONE1}/evol-music.git music +# ${CLONE1}/mods.git client-data/mods +# ln -s music/music client-data/ +# ${CLONE2}manaplus/manaplus.git manaplus +#fi diff --git a/install_manaplus.sh b/install_manaplus.sh new file mode 100755 index 0000000..d8b57c2 --- /dev/null +++ b/install_manaplus.sh @@ -0,0 +1,7 @@ +sudo apt-get install -y git g++ gcc xsel make autoconf automake autopoint gettext libxml2-dev libcurl4-gnutls-dev libpng-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev gdb valgrind netcat-openbsd procps zlibc +git clone https://gitlab.com/themanaworld/manaplus/manaplus.git manaplus +cd manaplus +autoreconf -i +./configure -q +make -s +sudo make install diff --git a/pull.sh b/pull.sh new file mode 100755 index 0000000..f90a1cb --- /dev/null +++ b/pull.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +export LANG=C + +function status { + if [ ! -d "$1" ]; then + return + fi + DIR=$(pwd) + cd "$1" + echo "$2 ($(git symbolic-ref --short -q HEAD)):" + if [[ "${CMD}" == "more" ]]; then + git last + fi + + if [[ "${CMD}" == "force" ]]; then + git pull --commit --no-edit + cd "$DIR" + return + fi + STR=$(git diff --name-only) + STR2=$(git status|grep "Your branch is ahead")$(git status|grep -E "have diverged") + STR3=$(git status -s -uno) + if [[ -n "${STR}${STR2}${STR3}" ]]; then + echo -e "\e[1;31mCant pull because changes not pushed\e[0m" + else + git pull + fi + cd "$DIR" +} + +function status2 { + if [ ! -d "$1" ]; then + return + fi + DIR=$(pwd) + cd "$1" + STR=$(git diff --name-only) + STR2=$(git status|grep "Your branch is ahead") + STR3=$(git status -s -uno) + echo "$2 ($(git symbolic-ref --short -q HEAD)):" + if [[ -n "${STR}${STR2}${STR3}" ]]; then + echo -e "\e[1;31mCant pull because changes not pushed\e[0m" + else + git pull --no-commit + git fetch upstream #origin + export BRANCH=$(git rev-parse --abbrev-ref HEAD) + git reset --hard "origin/${BRANCH}" + fi + cd "$DIR" +} + +CMD="$1" +if [[ -z "${CMD}" ]]; then + export CMD="normal" +fi + +status . evol-all +status client-data client-data +status2 server-code server-code +status server-data server-data +status tools tools +status server-code/src/evol evol-hercules +#status music music +status manaplus manaplus +#status docs docs +#status art art +#status wiki wiki -- cgit v1.2.3-60-g2f50