-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-menu.sh
executable file
·139 lines (118 loc) · 4 KB
/
main-menu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
clear
######here all the variables#######################################################################################
apps="git curl dialog" #add here your application
ohmyzsh="https://raw.githubusercontent.com/Mr-Phil1/Linux/master/install-zsh.sh" #path to my zsh install script
zshconfig="https://raw.githubusercontent.com/Mr-Phil1/Linux/master/zsh-conf.sh" #path to my .zshrc config
ydl="https://raw.githubusercontent.com/Mr-Phil1/Linux/master/install-ydl.sh" #path to the youtube-dl install Script
dlna="https://raw.githubusercontent.com/Mr-Phil1/Linux/master/install-dlna.sh" #path to my my minidlna install script
h=${20} # box height default 10
w=${50} # box width default 41
####################################################################################################################
#this is the auto-install routine
if ! dpkg -s $apps >/dev/null 2>&1; then
sudo apt-get install $apps -y
fi
# utilitymenu.sh - A sample shell script to display menus on screen
# Store menu options selected by the user
INPUT=/tmp/menu.sh.$$
# Storage file for displaying cal and date command output
OUTPUT=/tmp/output.sh.$$
# get text editor or fall back to vi_editor
vi_editor=${EDITOR-nano}
# trap and delete temp files
trap "rm $OUTPUT; rm $INPUT; exit" SIGHUP SIGINT SIGTERM
#
# Purpose - display output using msgbox
# $1 -> set msgbox height
# $2 -> set msgbox width
# $3 -> set msgbox title
#
function display_output() {
local h=${1-20} # box height default 10
local w=${2-41} # box width default 41
local t=${3-Output} # box title
dialog --backtitle "Linux Shell Script Tutorial" --title "${t}" --clear --msgbox "$(<$OUTPUT)" ${h} ${w}
}
function show_zsh() {
sh -c "$(curl -fsSL $ohmyzsh)"
}
function show_update() {
clear &&
echo "Es werden nun die aktuellsten Updates geholt und installiert." &&
sudo apt-get update -y >/dev/null &&
# echo "Hier ist einen Liste der zu updateten Programmen" &&
dialog --prgbox "Hier ist einen Liste der zu updateten Programmen" "sudo apt list --upgradable" ${h} ${w} &&
# sudo apt list --upgradable &&
sudo apt-get upgrade -y >/dev/null &&
echo "Die Update sind nun fertig gestellt!" &&
clear
}
function show_neofetch() {
sudo apt install neofetch -y
}
function show_remove() {
sudo apt purge zsh -y
sudo rm -r ${HOME}/.oh-my-zsh
}
function show_ydl() {
if ! dpkg -s python ffmpeg >/dev/null 2>&1; then
sudo apt-get install python ffmpeg -y
fi
sudo sh -c "$(curl -fsSL ${ydl})"
}
function show_dlna() {
./install-dlna.sh
}
function show_neo() {
nano ${HOME}/.config/neofetch/config.conf
}
function show_config() {
sh -c "$(curl -fsSL ${zshconfig})"
nano ${HOME}/.zshrc
}
function show_editor() {
nano ${HOME}/.zshrc
}
#
# set infinite loop
#
while true; do
### display main menu ###
dialog --clear --backtitle "Mr. Phil Install Menu" \
--title "[ M A I N - M E N U ]" \
--menu "You can use the UP/DOWN arrow keys, the first \n\
letter of the choice as a hot key.
Choose the TASK" 15 50 4 \
Update "Update the system" \
ZSH "Install ZSH + Oh-My-ZSH" \
Neofetch "Install Neofetch" \
Remove "Remove ZSH + Oh-My-ZSH" \
Youtube-dl "Install YT-dl (python + ffmpeg)" \
miniDLNA "Install the miniDLNA Service" \
Add "Add my .zshrc config" \
Editor "Edit the .zshrc" \
Neo "Edit the neofetch config" \
Close "Exit to the shell" 2>"${INPUT}"
menuitem=$(<"${INPUT}")
# make decsion
case $menuitem in
Update) show_update ;;
ZSH) show_zsh ;;
Neofetch) show_neofetch ;;
Remove) show_remove ;;
Youtube-dl) show_ydl ;;
miniDLNA) show_dlna ;;
Add) show_config ;;
Editor) show_editor ;;
Neo) show_neo ;;
Close)
clear
echo "Auf Wiedersehen"
break
;;
esac
done
# if temp files found, delete em
[ -f $OUTPUT ] && rm $OUTPUT
[ -f $INPUT ] && rm $INPUT