-
Notifications
You must be signed in to change notification settings - Fork 0
/
cottonfetch.sh
301 lines (276 loc) · 12.1 KB
/
cottonfetch.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#!/usr/bin/env bash
if [[ $* == *--help ]]; then
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo
echo "cottonfetch v1.4"
echo "created by @plasmacotton"
echo
echo "special thanks to:"
echo "• lilliana.raquel (discord)"
echo "• ._peachfuz (discord)"
echo "• devereo_bassico (discord)"
echo "• fernozzle.xml (discord) for being an awesome and supporting person :D"
echo "• Mikel (stackoverflow)"
echo "• Dave Dopson (stackoverflow)"
echo
echo "you can alias cottonfetch to a command you can use anywhere by cd'ing into the location of it and running the following:"
echo "echo \"alias \\\"cottonfetch\\\"=\\\"bash $SCRIPTDIR/cottonfetch\\\"\""" >> ~/.bashrc"
echo
echo "THE ALIAS BREAKS WHEN THE FILE LOCATION CHANGES!!! RE-RUN THE COMMAND WITH THE NEW DIRECTORY WHEN YOU WANT TO MOVE IT!!!"
echo
echo "thank you for using cottonfetch <3"
echo
else
LINE1=""
LINE2=""
LINE3=""
LINE4=""
LINE5=""
LINE6=""
LINE7=""
LINE8=""
LINE9=""
MSGN=`echo $(($RANDOM % 5))`
# thanks devereo_bassico !!
case $MSGN in
1) MSG="LLA LIAH FARCOTTON!!!" ;;
2) MSG="olleh!" ;;
3) MSG="JOIN THE COTTON CULT!!!" ;;
4) MSG="i esu cottonfetch wtb" ;;
*) MSG="sknaht rof gnisu cottonfetch!" ;;
esac
# thanks Mikel !
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
DISTRO=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release
DISTRO=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
DISTRO=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
...
elif [ -f /etc/redhat-release ]; then
...
else
DISTRO=$(uname -s)
VER=$(uname -r)
fi
if test -d /bedrock; then
DISTRO='Bedrock'
VER=''
fi
# this is what cottonfetch detects, very advanced, i know
OS=`uname -o`
KERNEL=`uname`
KERNELVER=`uname -r`
ARCH=`uname -m`
HOST=`uname -n`
USERNAME=`whoami`
TEMP=`free -m | grep "Mem"`
TEMP2="${TEMP//"Mem:"}"
# sorry FreeBSD users!! you sadly have to see your RAM in bytes for now :(
if [[ "$DISTRO" == 'FreeBSD' ]]; then
RAM=`echo $((`sysctl -n vm.stats.vm.v_page_count` * `sysctl -n hw.pagesize`)) |`
RAMUSED=`echo $(((`sysctl -n vm.stats.vm.v_page_count` - `sysctl -n vm.stats.vm.v_free_count`) * `sysctl -n hw.pagesize`))`
else
RAM=`echo $TEMP2 | awk '{print $1}'`
RAMUSED=`echo $TEMP2 | awk '{print $2}'`
fi
TEMP3=`cat /proc/cpuinfo | grep "model name" | sort | uniq`
TEMP4="${TEMP3//"model name"}"
CPU=`echo $TEMP4 | awk '{print $2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "$10}'`
TEMP5=`glxinfo | grep "Device"`
TEMP6="${TEMP5//"Device:"}"
GPU=`echo "${TEMP6%%(*}"`
if [[ "$GPU" == '' ]]; then
GPU="Command glxinfo not found! Install the package \"mesa-utils\"!!!"
fi
if [[ "$CPU" == '' ]]; then
CPU="CPU Info on BSD is in development. If you see this on linux, something may or may be wrong. (/proc/cpuinfo not found!)"
fi
# aaand here are the distro logos!
# MAKE SURE TO REPLACE SPACES WITH WHITESPACE ASCII CHARACTERS FOR IT WILL BREAK!!!
if [[ "$DISTRO" == 'NixOS' ]]; then
LINE1='⠀⠀⠀⠸⣿⡄⠀⢻⣷⣠⣿⠇⠀⠀⠀ '
LINE2='⠀⢀⣶⣶⣿⣿⣶⣶⡿⣿⡏⠀⣠⡀⠀ '
LINE3='⠀⠀⠀⢠⣶⠆ ⠹⣷⣴⣿⠃⠀ '
LINE4='⢾⣿⣿⣿⣏ ⣹⣿⣿⣿⡷ '
LINE5='⠀⢠⣿⠟⣿⣆ ⠰⠿⠃⠀⠀⠀ '
LINE6='⠀⠈⠋⠀⣸⣿⣿⠿⠿⣿⣿⠿⠟⠁⠀ '
LINE7='⠀⠀⠀⢰⣿⠋⢿⣧⠀⠘⣿⡆⠀⠀⠀ '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Debian GNU/Linux' ]]; then
LINE1='⠀⠀⣠⣶⠿⠶⠶⣤⣄⠀ '
LINE2='⢀⡾⠋⠀⠀⠀⠀⠈⢻⡧ '
LINE3='⣾⠁⠀⠀⠌⠁⠈⠀⠈⡇ '
LINE4='⣏⠀⠀⢀⡄⠀⠀⠀⣰⠃ '
LINE5='⢹⡄⠀⠀⠙⠲⠒⠊⠁⠀ '
LINE6='⠀⢻⡀ '
LINE7=' ⠀⠙⠦⣀⠀⠀⠀⠀⠀ '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Arch Linux' ]]; then
LINE1=' '
LINE2='⠀⠀⠀⠀⢰⣆⠀⠀⠀⠀ '
LINE3='⠀⠀⠀⢠⣿⣿⡄⠀⠀⠀ '
LINE4='⠀⠀⢠⣿⣿⣿⣿⡄⠀⠀ '
LINE5='⠀⣠⣿⣿⠁⠈⣿⣿⣆⠀ '
LINE6='⡰⠟⠋⠉⠀⠀⠉⠙⠻⢆ '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Gentoo' ]]; then
LINE1=' '
LINE2='⠀⢠⣴⣶⣶⣦⣄⢀⠀⠀ '
LINE3='⢀⠿⣿⣯⣐⣆⣿⣷⣕⠄ '
LINE4='⠀⠉⣒⣽⣿⣿⣿⡿⢏⠔ '
LINE5='⠀⣾⣿⣿⣿⠿⣋⠔⠉⠀ '
LINE6='⠡⣝⣫⡭⠖⠋⠁⠀⠀⠀ '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'EndeavourOS' ]]; then # my (plasmacotton) distro of choice
LINE1=' '
LINE2='⠀⠀⠀⠀⢠⣾⣦⡀⠀⠀ '
LINE3='⠀⠀⢀⣴⣿⣿⣿⣿⣄⠀ '
LINE4='⢀⣴⣿⣿⣿⣿⣿⣿⣿⣆ '
LINE5='⠈⠽⠿⠿⠿⠿⠿⠿⠟⠋ '
LINE6=' '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Bedrock' ]]; then
LINE1=' '
LINE2='⣀⣀⠀ '
LINE3='⢧⠀⢱⡀ '
LINE4=' ⢦⠀⠈⠉⠉⠉⢦⠀'
LINE5=' ⢆⠀⠐⠒⠀⢨ '
LINE6=' ⠘⠦⠤⠤⠤⠃ '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$OS" == 'Android' ]]; then
LINE1='⠀⠀⠀⠀⢂⣀⣀⣀⡐⠀⠀⠀⠀ '
LINE2='⠀⠀⢀⣴⣟⣿⣿⣿⣻⣦⡀⠀⠀ '
LINE3='⢀⣀⢘⣛⣛⣛⣛⣛⣛⣛⡃⣀⡀ '
LINE4='⢸⣿⢸⣿⣿⣿⣿⣿⣿⣿⡇⣿⡇ '
LINE5='⢸⣿⢸⣿⣿⣿⣿⣿⣿⣿⡇⣿⡇ '
LINE6='⠘⠛⢸⣿⣿⣿⣿⣿⣿⣿⡇⠛⠃ '
LINE7='⠀⠀⠈⠉⣿⣿⠉⣿⣿⠉⠁⠀⠀ '
LINE8='⠀⠀⠀⠀⠻⠟⠀⠻⠟⠀⠀⠀⠀ '
LINE9=' '
elif [[ "$DISTRO" == 'Ubuntu' ]]; then
LINE1=' '
LINE2='⠀⠀⠀⠀⢀⣠⣄⢴⡶⠀⠀'
LINE3='⠀⠀⢀⣾⡆⠛⠛⠳⣶⡀⠀'
LINE4='⠀⢾⡷⣿⠀⠀⠀⠀⣉⡁⠀'
LINE5='⠀⠀⠈⢿⠇⣤⣤⡴⠿⠁⠀'
LINE6='⠀⠀⠀⠀⠈⠙⠋⠺⠷⠀⠀'
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Fedora Linux' ]]; then
LINE1=' '
LINE2='⠀⣠⣴⣾⣿⣿⣷⣦⣄⠀ '
LINE3='⣰⣿⣿⣿⡏⢡⣄⢹⣿⣆ '
LINE4='⣿⣿⠟⣛⡇⢘⣻⣿⣿⣿ '
LINE5='⣿⣇⠸⡿⠇⣼⣿⣿⣿⠏ '
LINE6='⢿⣿⣷⣶⣾⣿⡿⠟⠋⠀ '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'KaOS' ]]; then # do people know this distro exists?
LINE1=' '
LINE2='⠀⠀⢀⠀⠀⣀⣄⡀⠀⠀'
LINE3='⠀⢸⣿⢀⡾⠟⠋⠀⠀⠀'
LINE4='⠀⠘⣿⣾⣶⣶⣶⣤⡀⠀'
LINE5='⠀⠀⠘⠀⠘⡿⣎⣫⠇⠀'
LINE6='⠀⠀⠀⠀⠀⠀⠉⠁⠀⠀'
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Oreon' ]]; then
LINE1=' '
LINE2=' ⣴⣶⣶⣶⣶⣶⣦⠀ '
LINE3=' ⣼⡿⠋ ⠙⢿⣧⠀ '
LINE4='⢀⣾⣿⠀⠀⠀⠀⠀⠀⠀⣿⣷⡀⠀'
LINE5=' ⢿⣿⠀⠀⠀⠀⠀⠀⠀⣿⡿⠁⠀'
LINE6=' ⢻⣷⣄ ⣠⣾⡟⠀ '
LINE7=' ⠻⠿⠿⠿⠿⠿⠟⠀ '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Void' ]]; then
LINE1=' '
LINE2='⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'
LINE3='⠀⠀⠐⠟⠛⠻⣶⡄⠀⠀'
LINE4='⠀⣿⠀⢠⣶⡄⠈⣿⡄⠀'
LINE5='⠘⣿⡀⠘⠿⠃⠀⣿⠃⠀'
LINE6='⠀⠘⠿⣦⣤⣴⠄⠀⠀⠀'
LINE7='⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Solus' ]]; then
LINE1=' '
LINE2='⠀⢀⣤⠖⡛⠛⠛⠶⣤⡀⠀ '
LINE3='⢠⠟⠀⣸⣷⡀⠀⠀⠈⢻⡄⠀'
LINE4='⡿⠀⣰⣿⣿⡇⣦⡠⣄⡀⣿⠀'
LINE5='⣷⠰⠿⠿⠿⡇⣿⠿⠜⡁⣿⠀'
LINE6='⠘⣦⠲⢶⣶⣶⣶⡾⢋⣼⠃⠀'
LINE7='⠀⠈⠛⠦⣬⣭⣤⠴⠛⠁⠀⠀'
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'Red Hat Enterprise Linux' ]]; then
LINE1=' '
LINE2=' '
LINE3='⠀⠀⢠⣿⣶⣿⣶⣄⠀⠀ '
LINE4='⣠⣤⠘⢿⣿⣿⣿⣿⡀⠀ '
LINE5='⠻⣿⣷⣤⣈⣉⣉⣉⣼⣦ '
LINE6='⠀⠈⠙⠻⠿⢿⣿⣿⡿⠟ '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == '*openSUSE*' ]]; then
LINE1=' '
LINE2=' '
LINE3='⠀⣠⣶⣿⣿⣿⣷⣾⣶⣦ '
LINE4='⡼⣻⣛⢿⡿⢿⣿⠿⠾⠙ '
LINE5='⠳⣕⡼⠈⠀⠀⠙⠀⠀⠀ '
LINE6=' openSUSE '
LINE7=' '
LINE8=' '
LINE9=' '
elif [[ "$DISTRO" == 'FreeBSD' ]]; then
LINE1=' '
LINE2='⢿⣷⢆⣤⣶⣶⣶⡶⣦⣴⣾⡿ '
LINE3='⠈⣵⣿⣿⣿⣿⣿⣷⣿⣿⡿⡁ '
LINE4='⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿ '
LINE5='⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃ '
LINE6='⠀⠀⠙⠻⢿⣿⣿⣿⠿⠋⠁⠀ '
LINE7=' '
LINE8=' '
LINE9=' '
else
notify-send "Hey there! Seems like we didn't find your distribution logo. You can help add it in by contacting @plasmacotton on Discord!"
fi
# THIS IS THE PART IT PRINTS OUT!!! THIS IS WHAT YOU WANT TO EDIT IF YOU WANT TO CUSTOMIZE IT!!
echo
echo $LINE1"┌────"$USERNAME"@"$HOST"────"
echo $LINE2"│ OS:" $OS "("$DISTRO")"
echo $LINE3"│ Kernel:" $KERNEL", version" $KERNELVER
echo $LINE4"│ Architecture:" $ARCH
echo $LINE5"│ RAM:" $RAMUSED"/"$RAM"MB"
echo $LINE6"│ CPU:" $CPU
echo $LINE7"│ GPU:" $GPU
echo $LINE8"│"
echo $LINE9"│"
echo $LINE9"│ "$MSG
echo
fi