-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSU-List.sh
More file actions
executable file
·64 lines (50 loc) · 1.6 KB
/
Copy pathPSU-List.sh
File metadata and controls
executable file
·64 lines (50 loc) · 1.6 KB
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
#!/bin/zsh --no-rcs
set -x
# PSU-List.sh by: Trevor Sysock
dialog_command(){
# $1 is the command you want to send to your running dialog
echo "$@" >> /var/tmp/dialog.log
sleep .1
}
# Open our dialog window with options from our JSON
/usr/local/bin/dialog \
--jsonfile PSU-List.json &
sleep 1
# List of display names on our window
displayNames=(
"Verifying Information"
"Uploading Data"
"Processing Response"
)
# Stop the progressbar bounce
dialog_command "progress: 1"
# Total progress bar progression
totalProgress=0
# The number of items in our list
numberOfItems="${#displayNames[@]}"
# The number of items in our list divided by 100 progress steps
progressIncrement=$(( 100 / numberOfItems ))
sleep 1
# Iterate through each name on the list
for displayName in ${displayNames[@]}; do
# Start the status text
dialog_command "listitem: title: ${displayName}, statustext : ..."
# Make our progress bar go vroom
progress=0
until [ $progress -gt 100 ]; do
dialog_command "listitem: title: ${displayName}, progress: $progress"
progress=$(( progress + 6 ))
done
# Clear our status text
dialog_command "listitem: title: ${displayName}, statustext : "
# Add the green checkmark
dialog_command "listitem: title: ${displayName}, status: success"
count=$(( count + 1 ))
totalProgress=$(( progressIncrement + totalProgress ))
dialog_command "progress: ${totalProgress}"
done
# Finish the progress bar
dialog_command "progress: 100"
# Change the button text and enable it
dialog_command "button1text: Dismiss"
dialog_command "button1: enable"