-
Notifications
You must be signed in to change notification settings - Fork 7
/
rxfetch
executable file
·128 lines (107 loc) · 3.41 KB
/
rxfetch
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
#!/usr/bin/env bash
magenta="\033[1;35m"
green="\033[1;32m"
white="\033[1;37m"
blue="\033[1;34m"
red="\033[1;31m"
black="\033[1;40;30m"
yellow="\033[1;33m"
cyan="\033[1;36m"
reset="\033[0m"
bgyellow="\033[1;43;33m"
bgwhite="\033[1;47;37m"
c0=${reset}
c1=${magenta}
c2=${green}
c3=${white}
c4=${blue}
c5=${red}
c6=${yellow}
c7=${cyan}
c8=${black}
c9=${bgyellow}
c10=${bgwhite}
function getCodeName() {
codename="$(getprop ro.product.board)"
}
function getClientBase() {
client_base="$(getprop ro.com.google.clientidbase)"
}
function getModel() {
model="$(getprop ro.product.brand) $(getprop ro.product.model)"
}
function getDistro() {
os="$(uname -o) $(uname -m)"
}
function getKernel() {
kernel="$(uname -r)"
}
function getTotalPackages() {
package_manager="$(which {apt,dpkg} 2>/dev/null | grep -v "not found" | awk -F/ 'NR==1{print $NF}')"
case "${package_manager}" in
"apt" )
packages=$(apt list --installed 2>/dev/null | wc -l)
;;
"dpkg" )
packages=$(dpkg-query -l | wc -l)
;;
"" )
packages="Unknown"
;;
esac
}
function getShell() {
shell="$(basename $SHELL)"
}
function getUptime() {
uptime="$(uptime --pretty | sed 's/up//')"
}
function getMemoryUsage() {
#memory="$(free --mega | sed -n -E '2s/^[^0-9]*([0-9]+) *([0-9]+).*/'"${space}"'\2 \/ \1MB/p')"
_MEM="Mem:"
_GREP_ONE_ROW="$(free --mega | grep "${_MEM}")"
_TOTAL="$(echo ${_GREP_ONE_ROW} | awk '{print $2}')"
_USED="$(echo ${_GREP_ONE_ROW} | awk '{print $3}')"
memory="${_USED}MB / ${_TOTAL}MB"
}
function getDiskUsage() {
_MOUNTED_ON="/data"
_GREP_ONE_ROW="$(df -h | grep ${_MOUNTED_ON})"
_SIZE="$(echo ${_GREP_ONE_ROW} | awk '{print $2}')"
_USED="$(echo ${_GREP_ONE_ROW} | awk '{print $3}')"
_AVAIL="$(echo ${_GREP_ONE_ROW} | awk '{print $4}')"
_USE="$(echo ${_GREP_ONE_ROW} | awk '{print $5}' | sed 's/%//')"
_MOUNTED="$(echo ${_GREP_ONE_ROW} | awk '{print $6}')"
storage="${_USED}B / ${_SIZE}B = ${_AVAIL}B (${_USE}%)"
}
function main() {
getCodeName
getClientBase
getModel
getDistro
getKernel
getTotalPackages
getShell
getUptime
getMemoryUsage
getDiskUsage
}
main
echo -e "\n\n"
echo -e " ┏━━━━━━━━━━━━━━━━━━━━━━┓"
echo -e " ┃ ${c1}r${c2}x${c7}f${c4}e${c5}t${c6}${c7}c${c1}h${c0} ${c5}${c0} ${c6}${c0} ${c7}${c0} ┃ ${codename}${c5}@${c0}${client_base}"
echo -e " ┣━━━━━━━━━━━━━━━━━━━━━━┫"
echo -e " ┃ ┃ ${c1}phone${c0} ${model}"
echo -e " ┃ ${c3}•${c8}_${c3}•${c0} ┃ ${c2}os${c0} ${os}"
echo -e " ┃ ${c8}${c0}${c9}oo${c0}${c8}|${c0} ┃ ${c7}ker${c0} ${kernel}"
echo -e " ┃ ${c8}/${c0}${c10} ${c0}${c8}'\'${c0} ┃ ${c4}pkgs${c0} ${packages}"
echo -e " ┃ ${c9}(${c0}${c8}\_;/${c0}${c9})${c0} ┃ ${c5}sh${c0} ${shell}"
echo -e " ┃ ┃ ${c6}up${c0} ${uptime}"
echo -e " ┃ android ${c1}${c0} termux ┃ ${c1}ram${c0} ${memory}"
echo -e " ┃ ┃ ${c2}disk${c0} ${storage}"
echo -e " ┗━━━━━━━━━━━━━━━━━━━━━━┛ ${c1}━━━${c2}━━━${c3}━━━${c4}━━━${c5}━━━${c6}━━━${c7}━━━"
echo -e "\n\n"
#echo -e " •_• "
#echo -e " oo| "
#echo -e " / '\'"
#echo -e " (\_;/)"