-
Notifications
You must be signed in to change notification settings - Fork 8
/
hda-update
executable file
·42 lines (37 loc) · 1.19 KB
/
hda-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
#!/bin/bash
# Periodic updates of the HDA and Amahi software
exec >> /var/log/hda-updates.log 2>&1
if ! grep -q yes /var/cache/hda-ctl.cache
then
echo "===================================================="
echo "system not installed yet at time `date`"
echo "===================================================="
exit 0;
fi
# fix for stronger passwords in mariadb https://bugs.amahi.org/issues/2263
if [ -e /etc/my.cnf.d/cracklib_password_check.cnf ]
then
rm -f /etc/my.cnf.d/cracklib_password_check.cnf
systemctl try-restart mariadb
echo "===================================================="
echo "Work-around for cracklib mariadb https://bugs.amahi.org/issues/2263 applied"
echo "===================================================="
fi
# three attempts
for i in 1 2 3; do
echo "===================================================="
sleep=`expr $RANDOM % 180`;
echo "starting at `date`"
echo "first, sleep $sleep seconds to avoid contentions"
sleep $sleep;
date=`date`;
echo "hda update attempt #$i @ $date"
if grep -q Ubuntu /proc/version
then
apt-get update
apt-get -y install '^hda-.*' '^amahi-.*'
else
dnf -y install 'hda-*'
dnf -y update 'hda-*' 'amahi-*' && exit 0
fi
done