Update the update.sh script regarding the issue #29

This commit is contained in:
Félix Aime 2020-12-29 09:19:12 +01:00
parent c89fa5508e
commit 42727f5eec

View File

@ -4,28 +4,44 @@ if [[ $EUID -ne 0 ]]; then
exit 1 exit 1
fi fi
# Clone the current repo. if [ $PWD = "/usr/share/tinycheck" ]; then
echo "[+] Cloning the current repository to /tmp/" echo "[+] Cloning the current repository to /tmp/"
cd /tmp/ && git clone https://github.com/KasperskyLab/TinyCheck rm -rf /tmp/tinycheck/ &> /dev/null
cd /tmp/ && git clone https://github.com/KasperskyLab/tinycheck
cd /tmp/tinycheck && bash update.sh
elif [ $PWD = "/tmp/tinycheck" ]; then
# Deleteing the current folders. echo "[+] Saving current backend's SSL configuration in /tmp/"
echo "[+] Deleting the current TinyCheck folders" mv /usr/share/tinycheck/server/backend/*.pem /tmp/
rm -rf /usr/share/tinycheck/app/
rm -rf /usr/share/tinycheck/server/
rm -rf /usr/share/tinycheck/analysis/
# Copying the folders. echo "[+] Deleting the current TinyCheck folders and files."
echo "[+] Copying the new version" rm -rf /usr/share/tinycheck/app/
cd /tmp/TinyCheck && cp -R app/ /usr/share/tinycheck/app/ rm -rf /usr/share/tinycheck/server/
cd /tmp/TinyCheck && cp -R server/ /usr/share/tinycheck/server/ rm -rf /usr/share/tinycheck/analysis/
cd /tmp/TinyCheck && cp -R analysis/ /usr/share/tinycheck/analysis/ rm /usr/share/tinycheck/update.sh
rm /usr/share/tinycheck/kiosk.sh
# Installing possible new dependencies. echo "[+] Copying the new TinyCheck version"
echo "[+] Checking new Python dependencies" cp -R app/ /usr/share/tinycheck/app/
cd /tmp/TinyCheck && python3 -m pip install -r assets/requirements.txt cp -R server/ /usr/share/tinycheck/server/
cp -R analysis/ /usr/share/tinycheck/analysis/
cp update.sh /usr/share/tinycheck/update.sh
cp kiosk.sh /usr/share/tinycheck/kiosk.sh
# Back to the VueJS projects and reinstalling all the stuff echo "[+] Retoring the backend's SSL configuration from /tmp/"
echo "[+] Building new interfaces..." mv /tmp/*.pem /usr/share/tinycheck/server/backend/
cd /usr/share/tinycheck/app/frontend/ && npm install && npm run build
cd /usr/share/tinycheck/app/backend/ && npm install && npm run build echo "[+] Checking possible new Python dependencies"
echo "[+] TinyCheck updated!" python3 -m pip install -r assets/requirements.txt
echo "[+] Building new interfaces..."
cd /usr/share/tinycheck/app/frontend/ && npm install && npm run build
cd /usr/share/tinycheck/app/backend/ && npm install && npm run build
echo "[+] Restarting services"
service tinycheck-backend restart
service tinycheck-frontend restart
service tinycheck-watchers restart
echo "[+] TinyCheck updated!"
fi