├── LICENSE
├── README.md
└── androfetch
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Im Geek
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # androfetch
2 |
3 | [](https://github.com/imegeek)
4 | [](https://github.com/imegeek)
5 | [](https://github.com/imegeek)
6 |
7 |
8 | > Screenshots :
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | > Installation :
18 | ```bash
19 | git clone https://github.com/imegeek/androfetch
20 | cd androfetch
21 | ```
22 |
23 | > Usage :
24 | + $ bash androfetch
25 | + $ bash androfetch --color
26 | + $ bash androfetch --nocolor
27 |
28 | > Get help :
29 | + $ bash androfetch -h
30 |
--------------------------------------------------------------------------------
/androfetch:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash
2 |
3 | # Author : Im Geek
4 | # Created : 2020-30-DEC
5 | # androfetch + MIT LICENSE (Open Source)
6 | # Script follows here:
7 |
8 | command -v lolcat &> /dev/null || { apt update; apt upgrade -y; gem install lolcat;}
9 |
10 | col1=$"\e[0;1;38;5;46m"
11 | col2=$"\e[0;1m"
12 | col3=$"\e[0m"
13 |
14 | distro=$(uname -o | grep -o "Android")
15 | shell=$(printf "$SHELL" | cut -c 37- | head -n1)
16 |
17 | wait() {
18 | sleep 0
19 | }
20 |
21 | device() {
22 | printf "`getprop ro.product.manufacturer` %s"
23 | printf "`getprop ro.product.model` %s"
24 | printf "(`getprop ro.product.device`)%s \n"
25 | }
26 |
27 | uptotime() {
28 | boot=$(date -d"$(uptime -s)" +%s)
29 | now=$(date +%s)
30 | s=$((now - boot))
31 |
32 | d="$((s / 60 / 60 / 24)) days"
33 | h="$((s / 60 / 60 % 24)) hours"
34 | m="$((s / 60 % 60)) minute"
35 |
36 | ((${d/ *} == 1)) && d=${d/s}
37 | ((${h/ *} == 1)) && h=${h/s}
38 | ((${m/ *} == 1)) && m=${m/s}
39 |
40 | ((${d/ *} == 0)) && unset d
41 | ((${h/ *} == 0)) && unset h
42 | ((${m/ *} == 0)) && unset m
43 |
44 | uptime=${d:+$d, }${h:+$h, }$m
45 | uptime=${uptime%', '}
46 | uptime=${uptime:-$s secs}
47 | printf "$uptime%s\n"
48 | }
49 |
50 |
51 | cpu() {
52 | core=`awk -F': ' '/^Processor/ {P=$2} /^CPU architecture/ {H=$2} END {print H != "" ? H : P}' /proc/cpuinfo`
53 | cpu0=`awk -F': ' '/^Processor/ {P=$2} /^Hardware/ {H=$2} END {print H != "" ? H : P}' /proc/cpuinfo`
54 | printf "${cpu0}"
55 | printf " (${core})%s\n"
56 | }
57 |
58 | mem() {
59 | ram=$(free -b | awk 'NR==2{print $2"-"$7}')
60 | usedram=$((ram / 1024 / 1024))
61 | totalram=$((${ram//-*} / 1024 / 1024))
62 | ram="${usedram}MiB / ${totalram}MiB" ; printf "$ram"
63 | }
64 |
65 | android() {
66 | printf " %s\n";wait
67 | printf " ╲ ▁▂▂▂▁ ╱%s\n";wait
68 | printf " ▄███████▄%s\n";wait
69 | printf " ▄██ ███ ██▄%s\n";wait
70 | printf " ▄███████████▄%s\n";wait
71 | printf " ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄%s\n";wait
72 | printf " ██ █████████████ ██%s\n";wait
73 | printf " ██ █████████████ ██%s\n";wait
74 | printf " ██ █████████████ ██%s\n";wait
75 | printf " ██ █████████████ ██%s\n";wait
76 | printf " █████████████%s\n";wait
77 | printf " ███████████%s\n";wait
78 | printf " ██ ██%s\n";wait
79 | printf " ██ ██%s\n";wait
80 | printf " %s\n";wait
81 | }
82 | system() {
83 | printf "${col2}%s";wait
84 | printf " Username : `whoami`@`hostname`%s\n" ;wait
85 | printf " Device : ";device ;wait
86 | printf " Version : "`uname -o` ;printf " ";getprop ro.build.version.release ;wait
87 | printf " Basebrand : ";getprop ro.baseband ;wait
88 | printf " Packages : `dpkg -l | wc -l` (pkg)%s\n" ;wait
89 | printf " Shell : $shell%s\n";wait
90 | printf " Rom : ";getprop ro.build.display.id ;wait
91 | printf " Arch : ";uname -m ;wait
92 | printf " Karnel : ";uname -r ;wait
93 | printf " Uptime : ";uptotime ;wait
94 | printf " Cpu : ";cpu ;wait
95 | printf " Ram : `mem`%s\n";wait
96 | printf " %s\n";wait
97 | }
98 |
99 | system1() {
100 | printf "${col2}%s";wait
101 | printf " ${col1}Username :${col2} `whoami`@`hostname`%s\n" ;wait
102 | printf " ${col1}Device :${col2} ";device ;wait
103 | printf " ${col1}Version :${col2} "`uname -o` ;printf " ";getprop ro.build.version.release ;wait
104 | printf " ${col1}Basebrand :${col2} ";getprop ro.baseband ;wait
105 | printf " ${col1}Packages :${col2} `dpkg -l | wc -l` (pkg)%s\n" ;wait
106 | printf " ${col1}Shell :${col2} $shell%s\n";wait
107 | printf " ${col1}Rom :${col2} ";getprop ro.build.display.id ;wait
108 | printf " ${col1}Arch :${col2} ";uname -m ;wait
109 | printf " ${col1}Karnel :${col2} ";uname -r ;wait
110 | printf " ${col1}Uptime :${col2} ";uptotime ;wait
111 | printf " ${col1}Cpu :${col2} ";cpu ;wait
112 | printf " ${col1}Ram :${col2} `mem`%s\n";wait
113 | printf " ${col1} ${col2} %s\n";wait
114 | }
115 |
116 | android+system() { android ; system ;}
117 |
118 | if [[ $distro == *'Android'* ]]; then
119 |
120 | if [[ "$1" == "--nocolor" ]];then
121 | printf "${col2}"
122 | sleep 0.2
123 | android
124 | system
125 | exit
126 |
127 | elif [[ "$1" == "--color" ]];then
128 | printf "${col2}"
129 | android+system | lolcat -a -t -s 100 -d 1
130 | exit
131 |
132 | elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]];then
133 | printf "
134 | androfetch command:
135 | --nocolor Show androfetch without colors
136 | --color Show androfetch with RGB colors
137 | "
138 | exit
139 | fi
140 |
141 | printf "${col1}"
142 | android
143 | system1
144 | exit
145 | fi
146 |
--------------------------------------------------------------------------------