34 lines
856 B
Bash
34 lines
856 B
Bash
|
#! /bin/sh
|
||
|
#
|
||
|
# install.sh
|
||
|
# Because writing this logic in Ansible is kinda dumb
|
||
|
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
||
|
#
|
||
|
# Distributed under terms of the MIT license.
|
||
|
#
|
||
|
|
||
|
set -e
|
||
|
|
||
|
# Get to our magic dir
|
||
|
export MINECRAFT_DIR="/var/minecraft/{{ mcname }}"
|
||
|
cd "$MINECRAFT_DIR" || exit 50
|
||
|
|
||
|
# If the mods and config directories exist, we don't need to do anything
|
||
|
# We make the inference here because the previous step of the playbook removed them
|
||
|
if [ -d "mods" ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
# MultiMC packs are organized as such:
|
||
|
# ./Pack Name/.minecraft/{mods,configs,etc.}
|
||
|
# ./Pack Name/minecraft/{mods,configs,etc.}
|
||
|
# I'm going to elect not to support the latter just for the sake of my sanity
|
||
|
packdir="$(find -type d -iname ".minecraft" | head -n 1)"
|
||
|
if ! [ -d "$packdir" ]; then
|
||
|
exit 51
|
||
|
fi
|
||
|
# Just move the shit out 4head
|
||
|
mv "$packdir"/* .
|
||
|
exit 0
|
||
|
|