This repository has been archived by the owner on Apr 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathload.sh
85 lines (71 loc) · 2.09 KB
/
load.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
#!/usr/bin/env bash
###############################################################
### Anarchy Linux Install Script
### load.sh
###
### Copyright (C) 2017 Dylan Schacht
###
### By: Dylan Schacht (deadhead)
### Email: [email protected]
### Webpage: https://anarchylinux.org
###
### Any questions, comments, or bug reports may be sent to above
### email address. Enjoy, and keep on using Arch.
###
### License: GPL v2.0
###############################################################
# Shellcheck disable warning about variables being referenced but not assigned.
# shellcheck disable=2154
cal_rate() {
case "${connection_rate}" in
KB/s)
down_sec=$(echo "${download_size}*1024/${connection_speed}" | bc) ;;
MB/s)
down_sec=$(echo "${download_size}/${connection_speed}" | bc) ;;
*)
down_sec="1" ;;
esac
down=$(echo "${down_sec}/100+${cpu_sleep}" | bc)
down_min=$(echo "${down}*100/60" | bc)
if ! (<<<"${down}" grep "^[1-9]" &> /dev/null); then
down=3
down_min=5
fi
export down down_min
source "${lang_file}"
}
load() {
{ int="1"
while ps | grep "${pid}" &> /dev/null
do
sleep "${pri}"
echo "${int}"
if [ "${int}" -lt "100" ]; then
int=$((int+1))
fi
done
echo 100
sleep 1
} | dialog --gauge "${msg}" 9 79 0
}
load_log() {
{ int=1
pos=1
pri=$((pri*2))
while ps | grep "${pid}" &> /dev/null
do
sleep 0.5
if [[ "${pos}" -eq "${pri}" ]] && [[ "${int}" -lt "100" ]]; then
pos=0
int=$((int+1))
fi
log_msg=$(tail -1 "${log}" | sed 's/.pkg.tar.xz//')
echo "${int}"
echo -e "XXX${msg} \n \Z1> \Z2${log_msg}\Zn\nXXX"
pos=$((pos+1))
done
echo 100
sleep 1
} | dialog --gauge "${msg}" 10 79 0
}
# vim: ai:ts=4:sw=4:et