forked from swizzin/swizzin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a79210e
commit 6015bac
Showing
1 changed file
with
12 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,21 @@ | ||
#!/bin/bash | ||
# LazyLibrarian remove script for swizzin | ||
# Author: Aethaeran | ||
|
||
########################################################################## | ||
# Import Sources | ||
########################################################################## | ||
|
||
. /etc/swizzin/sources/functions/utils | ||
|
||
########################################################################## | ||
# Variables | ||
########################################################################## | ||
# Author: Aethaeran 2021 | ||
# GPLv3 | ||
|
||
app_name="lazylibrarian" | ||
pretty_name="LazyLibrarian" | ||
app_dir="/opt/$app_name" | ||
master=$(_get_master_username) | ||
config_dir="/home/$master/.config/$app_name" | ||
venv_dir="/opt/.venv/$app_name" | ||
user="$(swizdb get $app_name/owner)" | ||
|
||
########################################################################## | ||
# Main | ||
########################################################################## | ||
rm -rf "/opt/.venv/$app_name" | ||
rm -rf "/opt/$app_name" | ||
rm -rf "/home/$user/.config/$app_name" | ||
|
||
if [[ -e "$venv_dir" ]]; then | ||
echo_progress_start "Removing $pretty_name venv..." | ||
# shellcheck disable=2154 # log variable is inherited from box itself. | ||
rm -rv "$venv_dir" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name venv_dir didn't exist." | ||
fi | ||
|
||
if [[ -e "$app_dir" ]]; then | ||
echo_progress_start "Removing $pretty_name installation..." | ||
# shellcheck disable=2154 # log variable is inherited from box itself. | ||
rm -rv "$app_dir" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name app_dir didn't exist." | ||
fi | ||
systemctl disable --now "$app_name" --quiet | ||
rm -rf "/etc/systemd/system/$app_name.service" | ||
|
||
if [[ -e "$config_dir" ]]; then | ||
echo_progress_start "Removing $pretty_name configuration..." | ||
rm -rv "$config_dir" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name config_dir didn't exist." | ||
if [[ -f /install/.nginx.lock ]]; then | ||
rm -rf "/etc/nginx/apps/$app_name.conf" | ||
systemctl reload nginx | ||
fi | ||
|
||
if [[ -e "/etc/systemd/system/$app_name.service" ]]; then | ||
echo_progress_start "Removing $pretty_name systemd service..." | ||
if [[ $(systemctl is-active "$app_name") == "active" ]]; then | ||
systemctl stop "$app_name" --quiet | ||
fi | ||
if [[ $(systemctl is-enabled "$app_name") == "enabled" ]]; then | ||
systemctl disable "$app_name" --quiet | ||
fi | ||
rm -v "/etc/systemd/system/$app_name.service" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name systemd service didn't exist." | ||
fi | ||
|
||
if [[ -e "/etc/nginx/apps/$app_name.conf" ]]; then | ||
echo_progress_start "Removing $pretty_name nginx configuration..." | ||
rm -v "/etc/nginx/apps/$app_name.conf" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name nginx configuration didn't exist." | ||
fi | ||
|
||
if [[ -e "/install/.$app_name.lock" ]]; then | ||
echo_progress_start "Removing $pretty_name lock..." | ||
rm -v "/install/.$app_name.lock" >> "$log" 2>&1 | ||
echo_progress_done | ||
else | ||
echo_info "$pretty_name lock didn't exist." | ||
fi | ||
rm "/install/.$app_name.lock" |