Update and rename stirlingpdf.sh to stirling-pdf.sh

- Rename sh file
- Switch update from git to relaese
This commit is contained in:
tteckster 2024-01-08 08:00:05 -05:00 committed by GitHub
parent e1247b6d0b
commit 95a9467ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -18,7 +18,7 @@ EOF
} }
header_info header_info
echo -e "Loading..." echo -e "Loading..."
APP="StirlingPDF" APP="Stirling-PDF"
var_disk="8" var_disk="8"
var_cpu="2" var_cpu="2"
var_ram="2048" var_ram="2048"
@ -55,19 +55,20 @@ header_info
if [[ ! -d /opt/Stirling-PDF ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/Stirling-PDF ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating ${APP}" msg_info "Updating ${APP}"
systemctl stop stirlingpdf systemctl stop stirlingpdf
git clone https://github.com/Stirling-Tools/Stirling-PDF.git RELEASE=$(curl -s https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
cd Stirling-PDF wget -q https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz
tar -xzf v$RELEASE.tar.gz
cd Stirling-PDF-$RELEASE
chmod +x ./gradlew chmod +x ./gradlew
./gradlew build ./gradlew build &>/dev/null
cp -r ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ cp -r ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/
cp -r scripts /opt/Stirling-PDF/ cp -r scripts /opt/Stirling-PDF/
cd ~ cd ~
rm -rf Stirling-PDF rm -rf Stirling-PDF-$RELEASE v$RELEASE.tar.gz
latest_version=$(ls -1 /opt/Stirling-PDF/Stirling-PDF-*.jar | sort -V | tail -n 1) latest_version=$(ls -1 /opt/Stirling-PDF/Stirling-PDF-*.jar | sort -V | tail -n 1)
ln -sf "$latest_version" /opt/Stirling-PDF/Stirling-PDF.jar ln -sf "$latest_version" /opt/Stirling-PDF/Stirling-PDF.jar
new_version=$(echo "$latest_version" | grep -oP '(?<=Stirling-PDF-)\d+(\.\d+)+(?=\.jar)')
systemctl start stirlingpdf systemctl start stirlingpdf
msg_ok "Updated ${APP} to v$new_version" msg_ok "Updated ${APP} to v$RELEASE"
exit exit
} }