mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
migrate midnight commander to its own script (#1588)
This commit is contained in:
parent
7a1e000298
commit
e7e44cae0c
76
apps/midnight-commander.sh
Normal file
76
apps/midnight-commander.sh
Normal file
@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
|
||||
# Copyright © 2020 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
SCRIPT_NAME="Midnight Commander"
|
||||
SCRIPT_EXPLAINER="The Midnight Commander is a directory browsing and file manipulation program \
|
||||
that provides a flexible, powerful, and convenient set of file and directory operations.
|
||||
It is capable of running in either a console or an xterm under X11.
|
||||
Its basic operation is easily mastered by the novice while providing a rich feature set and extensive customization."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
# 0 = OFF
|
||||
DEBUG=0
|
||||
debug_mode
|
||||
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
# Show explainer
|
||||
msg_box "$SCRIPT_EXPLAINER"
|
||||
|
||||
# Check if webmin is already installed
|
||||
if ! is_this_installed mc
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
apt purge mc -y
|
||||
apt autoremove -y
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install mc
|
||||
check_command apt install mc -y
|
||||
|
||||
# Show successful installation
|
||||
msg_box "Midnight Commander was successfully installed.
|
||||
You can launch it by running 'mc' in the CLI."
|
||||
|
||||
# Allow to install a dark theme
|
||||
if ! yesno_box_yes "Do you want to install a dark theme for Midnight Commander?"
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Install dark theme
|
||||
print_text_in_color "$ICyan" "Installing dark theme for Midnight Commander..."
|
||||
USER_HOMES=$(find /home -mindepth 1 -maxdepth 1 -type d)
|
||||
mapfile -t USER_HOMES <<< "$USER_HOMES"
|
||||
USER_HOMES+=(/root)
|
||||
for user_home in "${USER_HOMES[@]}"
|
||||
do
|
||||
mkdir -p "$user_home/.config/mc"
|
||||
cat << MC_INI > "$user_home/.config/mc/ini"
|
||||
[Colors]
|
||||
base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:\
|
||||
menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:\
|
||||
dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:\
|
||||
device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black
|
||||
MC_INI
|
||||
done
|
||||
|
||||
# Inform the user
|
||||
msg_box "The dark theme was successfully applied to Midnight Commander.
|
||||
Now try out Midnight Commander by running 'mc' in the CLI."
|
||||
exit
|
||||
@ -79,42 +79,8 @@ case "$choice" in
|
||||
run_script APP bpytop
|
||||
;;&
|
||||
*"Midnight Commander"*)
|
||||
SUBTITLE="Midnight Commander"
|
||||
msg_box "Midnight Commander is a file manager that can be used in your CLI." "$SUBTITLE"
|
||||
if is_this_installed mc
|
||||
then
|
||||
if yesno_box_yes "It seems like Midnight Commander is already installed.\nDo you want to uninstall it?" "$SUBTITLE"
|
||||
then
|
||||
print_text_in_color "$ICyan" "Uninstalling Midnight Commander..."
|
||||
apt purge mc -y
|
||||
apt autoremove -y
|
||||
msg_box "Midnight Commander was successfully uninstalled." "$SUBTITLE"
|
||||
fi
|
||||
elif yesno_box_yes "Do you want to install Midnight Commander?" "$SUBTITLE"
|
||||
then
|
||||
print_text_in_color "$ICyan" "Installing Midnight Commander..."
|
||||
check_command install_if_not mc
|
||||
msg_box "Midnight Commander was successfully installed.\nYou can launch it by running 'mc' in the CLI." "$SUBTITLE"
|
||||
if yesno_box_yes "Do you want to install a dark theme for Midnight Commander?" "$SUBTITLE"
|
||||
then
|
||||
print_text_in_color "$ICyan" "Installing dark Theme for Midnight Commander..."
|
||||
USER_HOMES=$(find /home -mindepth 1 -maxdepth 1 -type d)
|
||||
mapfile -t USER_HOMES <<< "$USER_HOMES"
|
||||
USER_HOMES+=(/root)
|
||||
THEME="linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:\
|
||||
menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:\
|
||||
dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:\
|
||||
device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black"
|
||||
for user_home in "${USER_HOMES[@]}"
|
||||
do
|
||||
if [ -f "$user_home"/.config/mc/ini ]
|
||||
then
|
||||
sed -i "s|^base_color=|base_color=$THEME|" "$user_home"/.config/mc/ini
|
||||
fi
|
||||
done
|
||||
msg_box "The theme was successfully applied to Midnight Commander."
|
||||
fi
|
||||
fi
|
||||
print_text_in_color "$ICyan" "Downloading the Midnight Commander script..."
|
||||
run_script APP midnight-commander
|
||||
;;&
|
||||
*"FullTextSearch"*)
|
||||
print_text_in_color "$ICyan" "Downloading the FullTextSearch script..."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user