-
Notifications
You must be signed in to change notification settings - Fork 4
/
raspi-info-update
45 lines (40 loc) · 2.35 KB
/
raspi-info-update
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
#!/bin/bash
#################################################################################
# _ _ __ #
# _ __ __ _ ___ _ __ (_) (_)_ __ / _| ___ #
# | '__/ _` / __| '_ \| |_____| | '_ \| |_ / _ \ #
# | | | (_| \__ \ |_) | |_____| | | | | _| (_) | #
# |_| \__,_|___/ .__/|_| |_|_| |_|_| \___/ #
# |_| #
# #
# #
# MIT License #
# Copyright (c) 2019-2024 Massimo Pissarello #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the "Software"), to deal #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# The above copyright notice and this permission notice shall be included in #
# all copies or substantial portions of the Software. #
# #
#################################################################################
RI=raspi-info
UPVER=$(curl -sSfL https://raw.githubusercontent.com/mapi68/$RI/master/version)
install() {
echo -e '\e[1;33m'"Installing latest version $UPVER of $RI..."
echo -e '\e[0m'
wget -nv -P /tmp/ https://github.com/mapi68/"$RI"/raw/master/"$RI"_latest.deb
sudo apt install -qq -y /tmp/"$RI"_latest.deb; rm /tmp/"$RI"_latest.deb
}
if [[ ! -f /usr/bin/$RI ]]; then
echo -e '\e[1;33m'"$RI is not installed in your Raspberry Pi"
echo -e '\e[0m'
exit 1
elif VER=$(dpkg -s $RI | grep '^Version:' | awk '/:/ {print $2}')
[[ "$VER" -ge "$UPVER" ]]; then
echo -e '\e[1;32m'"You have latest version $UPVER of $RI: no need update"
echo -e '\e[0m'
else install
fi