Creality-Helper-Script/scripts/octoapp_companion.sh

66 lines
1.7 KiB
Bash
Raw Normal View History

2024-03-30 15:19:23 +01:00
#!/bin/sh
set -e
2024-03-30 18:32:37 +01:00
function octoapp_companion_message(){
2024-03-30 15:19:23 +01:00
top_line
title 'OctoApp Companion' "${yellow}"
inner_line
hr
2024-03-30 18:32:37 +01:00
echo -e "${cyan}OctoApp Companion allows you to control your printer from ${white}"
echo -e "${cyan}OctoApp and get notifications for your prints. ${white}"
2024-03-30 15:19:23 +01:00
hr
bottom_line
}
2024-03-30 18:32:37 +01:00
function install_octoapp_companion(){
octoapp_companion_message
2024-03-30 15:19:23 +01:00
local yn
while true; do
install_msg "OctoApp Companion" yn
case "${yn}" in
Y|y)
echo -e "${white}"
2024-03-30 18:32:37 +01:00
if [ -d "$OCTOAPP_COMPANION_FOLDER" ]; then
2024-03-30 15:19:23 +01:00
echo -e "Info: OctoApp Companion is already installed. Download skipped."
else
echo -e "Info: Downloading OctoApp Companion..."
git config --global http.sslVerify false
2024-03-30 18:39:28 +01:00
git clone "$OCTOAPP_COMPANION_URL" "$OCTOAPP_COMPANION_FOLDER"
2024-03-30 15:19:23 +01:00
fi
echo -e "Info: Running OctoApp Companion installer..."
2024-03-30 18:32:37 +01:00
cd "$OCTOAPP_COMPANION_FOLDER"
2024-03-30 15:19:23 +01:00
sh ./install.sh
ok_msg "OctoApp Companion has been installed successfully!"
return;;
N|n)
error_msg "Installation canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}
2024-03-30 18:32:37 +01:00
function remove_octoapp_companion(){
octoapp_companion_message
2024-03-30 15:19:23 +01:00
local yn
while true; do
remove_msg "OctoApp Companion" yn
case "${yn}" in
Y|y)
echo -e "${white}"
2024-03-30 18:32:37 +01:00
echo -e "Info: Running OctoApp Companion uninstaller..."
cd "$OCTOAPP_COMPANION_FOLDER"
sh ./uninstall.sh
2024-03-31 23:35:16 +02:00
rm -f /root/update-OctoApp.sh
2024-03-30 15:19:23 +01:00
ok_msg "OctoApp Companion has been removed successfully!"
return;;
N|n)
error_msg "Deletion canceled!"
return;;
*)
error_msg "Please select a correct choice!";;
esac
done
}