installing deprecated mods carefully
This commit is contained in:
parent
c57d701656
commit
f093a47b66
19
install.sh
19
install.sh
|
@ -53,11 +53,28 @@ is_game () {
|
|||
|
||||
# 1 = mod id
|
||||
download_and_install_mod () {
|
||||
#Parse mod name
|
||||
oIFS="$IFS"
|
||||
IFS=$'/'
|
||||
read -r -a modid <<< "$1"
|
||||
IFS="$oIFS"
|
||||
modauthor="${modid[0]}"
|
||||
modname="${modid[1]}"
|
||||
|
||||
mod_url=$(curl --silent -X GET "$API_URL/packages/${1}/" | jq ".url" | tr -d '"')
|
||||
mod_file="${mods_path}/mod.zip"
|
||||
mod_file="${mods_path}/${modname}.zip"
|
||||
echo "Writing to ${mod_file} content from url ${mod_url}"
|
||||
wget -O "${mod_file}" "${mod_url}"
|
||||
unzip -l "${mod_file}" | grep -q mod.conf
|
||||
if [[ "$?" == "0" ]]; then # mod.conf found, this is a normal mod
|
||||
unzip -oq "${mod_file}" -d "${mods_path}"
|
||||
else # mod.conf not found, mod is deprecated
|
||||
echo "Warning! mod ${modname} is deprecated!"
|
||||
deprecated_mod_path="${mods_path}/${modname}"
|
||||
echo "Installing it to ${deprecated_mod_path}"
|
||||
mkdir -p "${deprecated_mod_path}"
|
||||
unzip -oq "${mod_file}" -d "${deprecated_mod_path}"
|
||||
fi
|
||||
rm "${mod_file}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue