Update autoupdate.yml

This commit is contained in:
olli 2023-07-05 16:40:55 +02:00
parent e71a934749
commit 7febde5713

View File

@ -75,10 +75,6 @@
[ -e /root/server-$(hostname -s)/$(hostname -s).sh ] && bash -x /root/server-$(hostname -s)/$(hostname -s).sh >/var/log/server-$(hostname -s)-update.log 2>&1 [ -e /root/server-$(hostname -s)/$(hostname -s).sh ] && bash -x /root/server-$(hostname -s)/$(hostname -s).sh >/var/log/server-$(hostname -s)-update.log 2>&1
g_echo_warn "$(egrep -B1 "^changed" /var/log/server-$(hostname -s)-update.log)" g_echo_warn "$(egrep -B1 "^changed" /var/log/server-$(hostname -s)-update.log)"
g_echo_error "$(egrep -q -B1 -i '^error|^fatal' /var/log/server-$(hostname -s)-update.log && egrep -B50 '^error|^fatal' /var/log/server-$(hostname -s)-update.log)" g_echo_error "$(egrep -q -B1 -i '^error|^fatal' /var/log/server-$(hostname -s)-update.log && egrep -B50 '^error|^fatal' /var/log/server-$(hostname -s)-update.log)"
# individual update script
mac=$(ip addr show $(ip route list | grep default | cut -d" " -f5) | grep "link/ether " | perl -pe 's/.*link\/ether //; s/:/-/g' | cut -d" " -f1)
curl https://update.$(domainname -d)/${mac}.sh | bash
backup: yes backup: yes
validate: /bin/bash -n %s validate: /bin/bash -n %s
@ -98,7 +94,8 @@
mac=$(ip addr show $(ip route list | grep default | cut -d" " -f5) | grep "link/ether " | perl -pe 's/.*link\/ether //; s/:/-/g' | cut -d" " -f1) mac=$(ip addr show $(ip route list | grep default | cut -d" " -f5) | grep "link/ether " | perl -pe 's/.*link\/ether //; s/:/-/g' | cut -d" " -f1)
usr=$(getent passwd 1000 | cut -d: -f1) usr=$(getent passwd 1000 | cut -d: -f1)
hst=$(hostname | cut -d. -f1 | perl -pe 's/ //g') hst=$(hostname | cut -d. -f1 | perl -pe 's/ //g')
curl https://update.$(domainname -f)/${mac}--${usr}--${hst}.sh | bash curl https://update.$(domainname -f)/${mac}--${usr}--${hst}.sh >${g_tmp}/update.sh
head -n1 ${g_tmp}/update.sh | grep -q "^#!/bin/bash" && bash ${g_tmp}/update.sh
fi fi
backup: yes backup: yes
validate: /bin/bash -n %s validate: /bin/bash -n %s