| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #!/bin/bash
- # info: remove file manager functionality from Hestia Control Panel
- # options: [FULL]
- # labels: hestia
- #
- # example: v-delete-sys-filemanager
- #
- # The function removes the File Manager and its entry points
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- MODE=$1
- FORCE=$2
- # Includes
- # shellcheck source=/etc/hestiacp/hestia.conf
- source /etc/hestiacp/hestia.conf
- # shellcheck source=/usr/local/hestia/func/main.sh
- source $HESTIA/func/main.sh
- # load config file
- source_conf "$HESTIA/conf/hestia.conf"
- FM_INSTALL_DIR="$HESTIA/web/fm"
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking root permissions
- if [ "x$(id -u)" != 'x0' ]; then
- echo "Error: Script can be run executed only by root"
- exit 10
- fi
- # Ensure that $HESTIA (/usr/local/hestia/) and other variables are valid.
- if [ -z "$HESTIA" ]; then
- HESTIA="/usr/local/hestia"
- fi
- if [ -z "$HOMEDIR" ] || [ -z "$HESTIA_INSTALL_DIR" ]; then
- echo "Error: Hestia environment vars not present"
- exit 2
- fi
- # Perform verification if read-only mode is enabled
- check_hestia_demo_mode
- # Check if File Manager components are installed
- if [ "$FORCE" != "yes" ] && [ ! -e "$FM_INSTALL_DIR" ]; then
- echo "ERROR: File Manager components are not installed."
- exit 1
- fi
- if [ "$FORCE" != "yes" ] && [ "$FILE_MANGER" = "false" ]; then
- echo "ERROR: File Manager is not enabled."
- exit 1
- fi
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- rm --recursive --force "$FM_INSTALL_DIR"
- $BIN/v-change-sys-config-value 'FILE_MANAGER' 'false'
- if [ "$MODE" != "quiet" ]; then
- echo "File Manager has been removed from the system."
- fi
- #----------------------------------------------------------#
- # Logging #
- #----------------------------------------------------------#
- $BIN/v-log-action "system" "Info" "Plugins" "File Manager disabled."
- log_event "$OK" "$ARGUMENTS"
|