deemix-docker/root/etc/cont-init.d/20-download
2021-06-28 23:09:55 +02:00

39 lines
1.3 KiB
Plaintext

#!/usr/bin/with-contenv bash
# download and unpack
echo "[cont-init.d] Downloading and unpacking"
if [ ! -f "/deemix/server.py" ]; then
echo "[cont-init.d] First start, cloning repo"
if [[ "${DEEZUI}" == "true" ]]; then
echo "[cont-init.d] Using Deezloader UI"
git clone https://git.fuwafuwa.moe/RemixDev/deemix-pyweb.git /deemix
git clone https://git.fuwafuwa.moe/RemixDev/deezloader-deemix.git /deemix/webui
touch /deemix/updated
else
echo "[cont-init.d] Using Deemix UI"
git clone --recurse-submodules https://git.fuwafuwa.moe/RemixDev/deemix-pyweb.git /deemix
touch /deemix/updated
fi
else
cd /deemix
localv=$(git rev-parse HEAD)
remotev=$(git ls-remote https://git.fuwafuwa.moe/RemixDev/deemix-pyweb.git refs/heads/main | cut -c1-40)
if [ $localv = $remotev ]; then
echo -e "[cont-init.d] Latest Version. No update needed"
else
echo -e "[cont-init.d] Newer Version. Updating"
if [[ "${DEEZUI}" == "true" ]]; then
echo "[cont-init.d] Using Deezloader UI"
git pull
cd /deemix/webui
git pull
touch /deemix/updated
else
echo "[cont-init.d] Using Deemix UI"
git pull --recurse-submodules
touch /deemix/updated
fi
fi
fi