forked from MichaIng/DietPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dietpi-launcher
executable file
·112 lines (99 loc) · 3.87 KB
/
dietpi-launcher
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
#!/bin/bash
{
#////////////////////////////////////
# DietPi Launcher
#
#////////////////////////////////////
# Created by Daniel Knight / [email protected] / dietpi.com
#
#////////////////////////////////////
#
# Info:
# - Location: /boot/dietpi/dietpi-launcher
# - Whiptail menu with list of most DietPi programs
#
#////////////////////////////////////
# Import DietPi-Globals --------------------------------------------------------------
. /boot/dietpi/func/dietpi-globals
readonly G_PROGRAM_NAME='DietPi-Launcher'
G_CHECK_ROOT_USER
# Import DietPi-Globals --------------------------------------------------------------
#/////////////////////////////////////////////////////////////////////////////////////
# MENUS
#/////////////////////////////////////////////////////////////////////////////////////
LAST_SELECTED_ITEM='DietPi-Config'
Menu_Main()
{
G_WHIP_MENU_ARRAY=(
'' '●─ Install Optimized Software '
'DietPi-Software' ': Install optimised ready-to-run software'
'' '●─ Configuration '
'DietPi-Config' ': Feature rich config tool for your device'
'DietPi-Drive_Manager' ': Setup and control multiple external drives'
'DietPi-AutoStart' ': Choose what software runs after boot'
'DietPi-Services' ': Service and process tool control'
'DietPi-LED_control' ': Adjust board LED triggers'
'DietPi-Cron' ': Modify the start times of cron jobs'
'DietPi-JustBoom' ': Launch EQ and MPD audio options menu'
'DietPi-CloudShell' ': Adjust update rate, scene settings and more'
'' '●─ DietPi Updates '
'DietPi-Update' ': Keep your DietPi system up to date'
'' '●─ Backups / Sync '
'DietPi-Backup' ': Backup and restore your DietPi system'
'DietPi-Sync' ': Duplicate (sync) one directory to another'
'' '●─ Maintenance '
'DietPi-Explorer' ': File explorer and manager'
'DietPi-Cleaner' ': Remove unwanted junk from your system'
'' '●─ Misc '
'DietPi-CPUinfo' ': Displays CPU temp, frequencies, type etc.'
'DietPi-LetsEncrypt' ': Frontend for Lets Encrypt, free SSL certs'
'DietPi-VPN' ': GUI to setup a VPN connection'
'DietPi-DDNS' ': Manage domains for your dynamic IP'
'DietPi-Survey' ': Join or leave our usage program, or view upload file'
'DietPi-BugReport' ': Found a bug? Let us know!'
'DietPi-MorseCode' ': Converts and outputs a text file to morsecode'
)
G_WHIP_DEFAULT_ITEM=$LAST_SELECTED_ITEM
G_WHIP_BUTTON_CANCEL_TEXT='Exit'
if G_WHIP_MENU 'Please select a program to run:'
then
[[ $G_WHIP_RETURNED_VALUE ]] || return
LAST_SELECTED_ITEM=$G_WHIP_RETURNED_VALUE
# Convert to lowercase
local command=${G_WHIP_RETURNED_VALUE,,} error=0
# Run
if [[ -f '/boot/dietpi/'$command ]]
then
"/boot/dietpi/$command" || error=1
# - different location
elif [[ -f '/boot/dietpi/misc/'$command ]]
then
"/boot/dietpi/misc/$command" || error=1
# - different location
elif [[ -f '/boot/dietpi/func/'$command ]]
then
"/boot/dietpi/func/$command" || error=1
else
G_DIETPI-NOTIFY 1 "The chosen program $G_WHIP_RETURNED_VALUE could not be found on your system."
read -rp " - Press any key to return to $G_PROGRAM_NAME..."
return
fi
# Wait for user input
[[ $error == 1 || $command == 'dietpi-cpuinfo' || $command == 'dietpi-update' || $command == 'dietpi-morsecode' ]] && read -rp " - Press any key to return to $G_PROGRAM_NAME..."
else
G_WHIP_SIZE_X_MAX=50
G_WHIP_YESNO "Exit $G_PROGRAM_NAME?" && exit 0
fi
}
#/////////////////////////////////////////////////////////////////////////////////////
# Main Loop
#/////////////////////////////////////////////////////////////////////////////////////
while :
do
G_TERM_CLEAR
Menu_Main
done
#-------------------------------------------------------------------------------------
exit
#-------------------------------------------------------------------------------------
}