projects
/
clearscm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2db463a
)
Updated update system
author
Andrew DeFaria
<Andrew@DeFaria.com>
Sat, 15 May 2021 00:54:46 +0000
(17:54 -0700)
committer
Andrew DeFaria
<Andrew@DeFaria.com>
Sat, 15 May 2021 00:54:46 +0000
(17:54 -0700)
bin/update-system
patch
|
blob
|
history
diff --git
a/bin/update-system
b/bin/update-system
index
e589671
..
864edf0
100755
(executable)
--- a/
bin/update-system
+++ b/
bin/update-system
@@
-6,16
+6,26
@@
tmpfile=/tmp/update-system.list
apt-get update -y > /dev/null 2>&1
apt-get update -y > /dev/null 2>&1
-apt
-gt list --upgradeable > $tmpfile
+apt
list --upgradeable > $tmpfile 2> /dev/null
uptodate=$(grep -v "^Listing" $tmpfile | wc -l)
if [ $uptodate -ne 0 ]; then
cat $tmpfile >> $logfile && rm $tmpfile
uptodate=$(grep -v "^Listing" $tmpfile | wc -l)
if [ $uptodate -ne 0 ]; then
cat $tmpfile >> $logfile && rm $tmpfile
- apt-get upgrade -y >> /dev/null 2>&1
- apt-get autoremove -y >> /dev/null 2>&1
+ apt-get upgrade -y >> $tmpfile
+
+ held_back=$(grep "kept back" $tmpfile | wc -l)
+
+ if [ $held_back -ne 0 ]; then
+ echo "$(date): $HOSTNAME not updated - packages held back" >> $logfile
- echo "$(date): Updated $HOSTNAME" >> $logfile
+ cat $tmpfile >> $logfile && rm $tmpfile
+ else
+ rm $tmpfile
+ echo "$(date): Updated $HOSTNAME" >> $logfile
+ fi
+
+ apt-get autoremove -y >> /dev/null 2>&1
else
rm $tmpfile
else
rm $tmpfile