rework some popups (#1554)
This commit is contained in:
Родитель
f28af0807a
Коммит
6b352abc90
|
@ -20,14 +20,16 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if Smtp Relay was already configured
|
||||
print_text_in_color "$ICyan" "Checking if an SMTP Relay is already installed and/or configured..."
|
||||
if [ -f /etc/msmtprc ]
|
||||
if ! [ -f /etc/msmtprc ]
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
apt-get purge msmtp -y
|
||||
apt-get purge msmtp-mta -y
|
||||
|
@ -38,9 +40,7 @@ then
|
|||
rm -f /var/log/msmtp
|
||||
echo "" > /etc/aliases
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup
|
||||
else
|
||||
print_text_in_color "$ICyan" "Installing SMTP Relay..."
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install needed tools
|
||||
|
|
|
@ -19,14 +19,16 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if adminer is already installed
|
||||
print_text_in_color "$ICyan" "Checking if Adminer is already installed..."
|
||||
if is_this_installed adminer
|
||||
if ! is_this_installed adminer
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
check_external_ip # Check that the script can see the external IP (apache fails otherwise)
|
||||
a2disconf adminer.conf
|
||||
|
@ -35,9 +37,7 @@ then
|
|||
check_command apt-get purge adminer -y
|
||||
restart_webserver
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup
|
||||
else
|
||||
print_text_in_color "$ICyan" "Installing and securing Adminer..."
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Check that the script can see the external IP (apache fails otherwise)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# shellcheck disable=2034,2059
|
||||
true
|
||||
SCRIPT_NAME="Bitwarden Mail Configuration"
|
||||
SCRIPT_EXPLAINER="This script lets you configure your mailserver settings for Bitwarden."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
|
||||
|
@ -37,7 +38,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
msg_box "This script lets you configure your mailserver settings for Bitwarden."
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
if ! yesno_box_yes "Do you want to continue?"
|
||||
then
|
||||
exit
|
||||
|
|
|
@ -21,18 +21,20 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Needs 1 GB alone
|
||||
ram_check 3 "ClamAV"
|
||||
cpu_check 2 "ClamAV"
|
||||
|
||||
# Check if webmin is already installed
|
||||
print_text_in_color "$ICyan" "Checking if ClamAV is already installed..."
|
||||
if is_this_installed clamav-daemon || is_this_installed clamav || is_this_installed clamav-freshclam
|
||||
if ! is_this_installed clamav-daemon && ! is_this_installed clamav && ! is_this_installed clamav-freshclam
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
apt purge clamav-daemon -y
|
||||
apt purge clamav-freshclam -y
|
||||
|
@ -47,9 +49,7 @@ then
|
|||
nextcloud_occ_no_check app:remove files_antivirus
|
||||
fi
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup
|
||||
else
|
||||
print_text_in_color "$ICyan" "Installing ClamAV..."
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install needed tools
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
# shellcheck disable=2034,2059
|
||||
true
|
||||
SCRIPT_NAME="SMB Mount"
|
||||
SCRIPT_EXPLAINER="This script automates mounting SMB-shares locally in your \
|
||||
system and adds them automatically as external storage to your Nextcloud."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
|
||||
|
@ -35,12 +37,14 @@ Recommended is MAX_COUNT=16, because not all menus work reliably with a higher c
|
|||
exit
|
||||
fi
|
||||
|
||||
# Inform the user
|
||||
msg_box "This script automates mounting SMB-shares locally in your \
|
||||
system and adds them automatically as external storage to your Nextcloud."
|
||||
if ! yesno_box_yes "Do you want to proceed with this script?"
|
||||
# Show explainer
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Show install_popup
|
||||
if ! is_this_installed cifs-utils
|
||||
then
|
||||
exit 1
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Needed for DFS-shares to work
|
||||
|
|
|
@ -24,21 +24,21 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if webmin is already installed
|
||||
print_text_in_color "$ICyan" "Checking if Webmin is already installed..."
|
||||
if is_this_installed webmin
|
||||
if ! is_this_installed webmin
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
check_command apt-get purge webmin -y
|
||||
rm -rf /etc/apt/sources.list.d/webmin.list
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup
|
||||
else
|
||||
print_text_in_color "$ICyan" "Installing Webmin..."
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install packages for Webmin
|
||||
|
|
73
lib.sh
73
lib.sh
|
@ -279,33 +279,78 @@ input_box_flow() {
|
|||
echo "$RESULT"
|
||||
}
|
||||
|
||||
explainer_popup() {
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
if ! yesno_box_yes "Do you want to proceed with this script?"
|
||||
install_popup() {
|
||||
if yesno_box_yes "Do you want to install $1?"
|
||||
then
|
||||
exit 1
|
||||
print_text_in_color "$ICyan" "Installing $1..."
|
||||
else
|
||||
if [ -z "$2" ] || [ "$2" = "exit" ]
|
||||
then
|
||||
exit 1
|
||||
elif [ "$2" = "sleep" ]
|
||||
then
|
||||
sleep 1
|
||||
elif [ "$2" = "return" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reinstall_remove_menu() {
|
||||
choice=$(whiptail --title "$TITLE" --menu \
|
||||
"It seems like $SCRIPT_NAME is already installed.\nChoose what you want to do.
|
||||
REINSTALL_REMOVE=$(whiptail --title "$TITLE" --menu \
|
||||
"It seems like $1 is already installed.\nChoose what you want to do.
|
||||
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Reinstall $SCRIPT_NAME" "" \
|
||||
"Uninstall $SCRIPT_NAME" "" 3>&1 1>&2 2>&3)
|
||||
if [ -z "$choice" ]
|
||||
"Reinstall" "$1" \
|
||||
"Uninstall" "$1" 3>&1 1>&2 2>&3)
|
||||
if [ "$REINSTALL_REMOVE" = "Reinstall" ]
|
||||
then
|
||||
exit 1
|
||||
print_text_in_color "$ICyan" "Reinstalling $1..."
|
||||
elif [ "$REINSTALL_REMOVE" = "Uninstall" ]
|
||||
then
|
||||
print_text_in_color "$ICyan" "Uninstalling $1..."
|
||||
elif [ -z "$REINSTALL_REMOVE" ]
|
||||
then
|
||||
if [ -z "$2" ] || [ "$2" = "exit" ]
|
||||
then
|
||||
exit 1
|
||||
elif [ "$2" = "sleep" ]
|
||||
then
|
||||
sleep 1
|
||||
elif [ "$2" = "return" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
removal_popup() {
|
||||
if [ "$choice" = "Uninstall $SCRIPT_NAME" ]
|
||||
if [ "$REINSTALL_REMOVE" = "Uninstall" ]
|
||||
then
|
||||
msg_box "$SCRIPT_NAME was successfully uninstalled."
|
||||
exit
|
||||
msg_box "$1 was successfully uninstalled."
|
||||
if [ -z "$2" ] || [ "$2" = "exit" ]
|
||||
then
|
||||
exit 1
|
||||
elif [ "$2" = "sleep" ]
|
||||
then
|
||||
sleep 1
|
||||
elif [ "$2" = "return" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$REINSTALL_REMOVE" = "Reinstall" ]
|
||||
then
|
||||
print_text_in_color "$ICyan" "Reinstalling $1..."
|
||||
else
|
||||
print_text_in_color "$ICyan" "Reinstalling $SCRIPT_NAME..."
|
||||
msg_box "It seems like neither Uninstall nor Reinstall is chosen, \
|
||||
something is wrong here. Please report this to $ISSUES"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,16 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if it is already configured
|
||||
if grep -q "^#Geoip-block" /etc/apache2/apache2.conf
|
||||
if ! grep -q "^#Geoip-block" /etc/apache2/apache2.conf
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
if is_this_installed jq
|
||||
then
|
||||
|
@ -41,9 +44,7 @@ then
|
|||
sed -i "/^#Geoip-block-start/,/^#Geoip-block-end/d" /etc/apache2/apache2.conf
|
||||
check_command systemctl restart apache2
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup
|
||||
else
|
||||
print_text_in_color "$ICyan" "Installing Geoblock..."
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install needed tools
|
||||
|
@ -179,4 +180,4 @@ check_command systemctl restart apache2
|
|||
|
||||
msg_box "Geoblock was successfully configured"
|
||||
|
||||
exit
|
||||
exit
|
||||
|
|
|
@ -22,11 +22,14 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if already installed
|
||||
if pihole &>/dev/null
|
||||
if ! pihole &>/dev/null
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Choose to uninstall
|
||||
if ! yesno_box_no "It seems like Pi-hole is already installed.
|
||||
Do you want to uninstall Pi-hole and reset all its settings?"
|
||||
|
|
|
@ -22,11 +22,14 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if already installed
|
||||
if pivpn &>/dev/null
|
||||
if ! pivpn &>/dev/null
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Choose to uninstall
|
||||
if ! yesno_box_no "It seems like PiVPN is already installed.
|
||||
Do you want to uninstall PiVPN and reset all its settings?
|
||||
|
|
|
@ -21,11 +21,14 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if already installed
|
||||
if is_this_installed plexmediaserver
|
||||
if ! is_this_installed plexmediaserver
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
msg_box "It seems like PLEX Media Server is already installed.
|
||||
|
||||
If you want to delete PLEX Media Server and it's data to be able \
|
||||
|
|
|
@ -21,11 +21,14 @@ debug_mode
|
|||
root_check
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if xrdp is installed
|
||||
if ! is_this_installed xrdp
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
|
||||
# Don't run this script as root user, because we will need the account
|
||||
if [ -z "$UNIXUSER" ]
|
||||
then
|
||||
|
@ -55,7 +58,7 @@ If you have already installed a desktop environment, you will not need to instal
|
|||
adduser xrdp ssl-cert
|
||||
|
||||
# Make sure that you don't get prompted with a password request after login
|
||||
cat << DESKTOP_CONF >> /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
|
||||
cat << DESKTOP_CONF > /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
|
||||
[Allow Package Management all Users]
|
||||
Identity=unix-user:*
|
||||
Action=org.freedesktop.packagekit.system-sources-refresh
|
||||
|
@ -172,6 +175,29 @@ install_remove_packet() {
|
|||
}
|
||||
|
||||
case "$choice" in
|
||||
*"XRDP"*)
|
||||
SUBTITLE="XRDP"
|
||||
msg_box "This option will uninstall XRDP and all other desktop applications from this list \
|
||||
as well as the gnome desktop." "$SUBTITLE"
|
||||
if yesno_box_no "Do you want to do this?" "$SUBTITLE"
|
||||
then
|
||||
APPS=(firefox gedit makemkv-oss makemkv-bin nautilus sound-juicer vlc \
|
||||
gnome-shell-extension-dash-to-panel gnome-session xrdp)
|
||||
for app in "${APPS[@]}"
|
||||
do
|
||||
if is_this_installed "$app"
|
||||
then
|
||||
apt purge "$app" -y
|
||||
fi
|
||||
done
|
||||
apt autoremove -y
|
||||
add-apt-repository --remove ppa:heyarje/makemkv-beta -y
|
||||
apt update -q4 & spinner_loading
|
||||
rm -f /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
|
||||
msg_box "XRDP and all desktop applications were successfully uninstalled." "$SUBTITLE"
|
||||
exit
|
||||
fi
|
||||
;;&
|
||||
*"Firefox"*)
|
||||
install_remove_packet firefox Firefox
|
||||
;;&
|
||||
|
@ -215,27 +241,6 @@ We will need to add a 3rd party repository to install it which can set your serv
|
|||
*"VLC"*)
|
||||
install_remove_packet vlc VLC
|
||||
;;&
|
||||
*"XRDP"*)
|
||||
SUBTITLE="XRDP"
|
||||
msg_box "This option will uninstall XRDP and all other desktop applications from this list \
|
||||
as well as the gnome desktop." "$SUBTITLE"
|
||||
if yesno_box_no "Do you want to do this?" "$SUBTITLE"
|
||||
then
|
||||
APPS=(firefox gedit makemkv-oss makemkv-bin nautilus sound-juicer vlc \
|
||||
gnome-shell-extension-dash-to-panel gnome-session xrdp)
|
||||
for app in "${APPS[@]}"
|
||||
do
|
||||
if is_this_installed "$app"
|
||||
then
|
||||
apt purge "$app" -y
|
||||
fi
|
||||
done
|
||||
apt autoremove -y
|
||||
add-apt-repository --remove ppa:heyarje/makemkv-beta -y
|
||||
apt update -q4 & spinner_loading
|
||||
msg_box "XRDP and all desktop applications were successfully uninstalled." "$SUBTITLE"
|
||||
fi
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -44,7 +44,14 @@ then
|
|||
fi
|
||||
|
||||
# Show explainer
|
||||
explainer_popup
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Show install_popup
|
||||
if ! is_this_installed samba
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Find mounts
|
||||
DIRECTORIES=$(find /mnt/ -mindepth 1 -maxdepth 2 -type d | grep -v "/mnt/ncdata")
|
||||
|
|
Загрузка…
Ссылка в новой задаче