1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-19 17:42:32 +01:00

Use git clone instead of svn on swag mod

This commit is contained in:
Marius 2024-02-18 19:25:49 +01:00
parent db94193163
commit 536a882a26
8 changed files with 30 additions and 34 deletions

View File

@ -4,19 +4,6 @@ echo '-------------------------'
echo '| SWAG theme.park Mod |' echo '| SWAG theme.park Mod |'
echo '-------------------------' echo '-------------------------'
if ! [[ -x "$(command -v svn)" ]]; then
echo '--------------------------'
echo '| Installing svn package |'
echo '--------------------------'
if [ -x "$(command -v apk)" ]; then
apk update && \
apk add --no-cache subversion
elif [ -x "$(command -v apt-get)" ]; then
apt-get update && \
apt-get install -y subversion
fi
fi
# Display variables for troubleshooting # Display variables for troubleshooting
echo -e "Variables set:\\n\ echo -e "Variables set:\\n\
'TP_BRANCH'=${TP_BRANCH}\\n" 'TP_BRANCH'=${TP_BRANCH}\\n"
@ -41,7 +28,7 @@ fi
mkdir -p /config/www/themepark mkdir -p /config/www/themepark
SHA_RELEASE=$(curl -sL "https://api.github.com/repos/gilbn/theme.park/commits/${TP_BRANCH}" | jq -r '.sha'); SHA_RELEASE=$(curl -sL "https://api.github.com/repos/themepark-dev/theme.park/commits/${TP_BRANCH}" | jq -r '.sha');
if [[ ! -f "/config/www/themepark/sha.txt" ]]; then if [[ ! -f "/config/www/themepark/sha.txt" ]]; then
SHA="" SHA=""
else else
@ -50,13 +37,21 @@ fi
# Downloading fresh webui files from source. # Downloading fresh webui files from source.
if [[ $SHA != $SHA_RELEASE ]]; then if [[ $SHA != $SHA_RELEASE ]]; then
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
echo "| Downloading latest files from ${TP_BRANCH} branch |" echo "| Cloning latest files from ${TP_BRANCH} branch |"
echo "-----------------------------------------------------"
rm -rf /tmp/themepark
git clone --depth 1 --quiet --branch ${TP_BRANCH} https://github.com/themepark-dev/theme.park.git /tmp/themepark
echo "-----------------------------------------------------"
echo "| Copying files to /config/www/themepark |"
echo "-----------------------------------------------------"
cp -a /tmp/themepark/css /config/www/themepark/css
cp -a /tmp/themepark/resources /config/www/themepark/resources
cp -a /tmp/themepark/themes.json /config/www/themepark
cp -a /tmp/themepark/index.html /config/www/themepark
rm -rf /tmp/themepark
echo "-----------------------------------------------------"
echo '| Clone and copy finished |'
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/css" /config/www/themepark/css
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/resources" /config/www/themepark/resources
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/themes.json" /config/www/themepark
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/index.html" /config/www/themepark
printf '\nDownload finished\n\n'
fi fi
cat <<< "$SHA_RELEASE" > "/config/www/themepark/sha.txt" cat <<< "$SHA_RELEASE" > "/config/www/themepark/sha.txt"

View File

@ -1,5 +0,0 @@
#!/usr/bin/with-contenv bash
if ! [[ -x "$(command -v svn)" ]]; then
echo "subversion" >> /mod-repo-packages-to-install.list
fi

View File

@ -1 +0,0 @@
/etc/s6-overlay/s6-rc.d/init-mod-themepark-add-package/run

View File

@ -28,7 +28,7 @@ fi
mkdir -p /config/www/themepark mkdir -p /config/www/themepark
SHA_RELEASE=$(curl -sL "https://api.github.com/repos/gilbn/theme.park/commits/${TP_BRANCH}" | jq -r '.sha'); SHA_RELEASE=$(curl -sL "https://api.github.com/repos/themepark-dev/theme.park/commits/${TP_BRANCH}" | jq -r '.sha');
if [[ ! -f "/config/www/themepark/sha.txt" ]]; then if [[ ! -f "/config/www/themepark/sha.txt" ]]; then
SHA="" SHA=""
else else
@ -37,13 +37,21 @@ fi
# Downloading fresh webui files from source. # Downloading fresh webui files from source.
if [[ $SHA != $SHA_RELEASE ]]; then if [[ $SHA != $SHA_RELEASE ]]; then
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
echo "| Downloading latest files from ${TP_BRANCH} branch |" echo "| Cloning latest files from ${TP_BRANCH} branch |"
echo "-----------------------------------------------------"
rm -rf /tmp/themepark
git clone --depth 1 --quiet --branch ${TP_BRANCH} https://github.com/themepark-dev/theme.park.git /tmp/themepark
echo "-----------------------------------------------------"
echo "| Copying files to /config/www/themepark |"
echo "-----------------------------------------------------"
cp -a /tmp/themepark/css /config/www/themepark/css
cp -a /tmp/themepark/resources /config/www/themepark/resources
cp -a /tmp/themepark/themes.json /config/www/themepark
cp -a /tmp/themepark/index.html /config/www/themepark
rm -rf /tmp/themepark
echo "-----------------------------------------------------"
echo '| Clone and copy finished |'
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/css" /config/www/themepark/css
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/resources" /config/www/themepark/resources
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/themes.json" /config/www/themepark
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/index.html" /config/www/themepark
printf '\nDownload finished\n\n'
fi fi
cat <<< "$SHA_RELEASE" > "/config/www/themepark/sha.txt" cat <<< "$SHA_RELEASE" > "/config/www/themepark/sha.txt"