Dateien nach "start-scripts" hochladen

This commit is contained in:
2024-06-30 11:53:56 +02:00
parent 96f35c31f8
commit 6417daab21

View File

@@ -0,0 +1,51 @@
#!/bin/bash
DATA_DIR=/opt/LibreWolf
LAT_V="$(wget -qO- https://gitlab.com/api/v4/projects/24386000/releases/ | jq '.[]' | jq -r '.name' | head -1 | sed 's/v*//')"
CUR_V="$(find ${DATA_DIR}/ -maxdepth 1 -type f -name "LibreWolf_*" | rev | cut -d '_' -f3 | rev)"
if [ -z ${LAT_V} ]; then
echo "Couldn't get latest version from LibreWolf!"
if [ -z ${CUR_V} ]; then
echo "No current version from LibreWolf found, start failed!"
exit 1
else
echo "Setting current installed version to latest version!"
LAT_V="${CUR_V}"
fi
fi
if [ ! -d ${DATA_DIR} ]; then
mkdir -p ${DATA_DIR}
fi
rm -f ${DATA_DIR}/LibreWolf-*.tar.xz
if [ -z "${CUR_V}" ]; then
echo "LibreWolf not found, downloading and installing ${LAT_V}..."
cd ${DATA_DIR}
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage "https://gitlab.com/api/v4/projects/24386000/packages/generic/librewolf/${LAT_V}/LibreWolf.x86_64.AppImage" ; then
echo "Successfully downloaded LibreWolf ${LAT_V}"
else
echo "Something went wrong, can't download LibreWolf ${LAT_V}!"
rm -f ${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage
exit 1
fi
elif [ "${CUR_V}" != "${LAT_V}" ]; then
echo "Version missmatch, installed ${CUR_V}, downloading and installing v${LAT_V}..."
cd ${DATA_DIR}
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage "https://github.com/LibreWolf-Games-Launcher/LibreWolfGamesLauncher/releases/download/v${LAT_V}/LibreWolf-${LAT_V}.tar.xz" ; then
echo "Successfully downloaded LibreWolf ${LAT_V}"
else
echo "Something went wrong, can't download LibreWolf ${LAT_V} continuing with ${CUR_V}!"
rm -r ${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage
LAT_V="${CUR_V}"
fi
elif [ "${CUR_V}" == "${LAT_V}" ]; then
echo "LibreWolf ${CUR_V} up-to-date"
fi
echo "Starting LibreWolf ${LAT_V}"
chmod +x ${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage
${DATA_DIR}/LibreWolf_${LAT_V}_86_64.AppImage "$@"