Change MOTD upgrades processing

This commit is contained in:
zador-blood-stained 2017-04-01 13:28:23 +03:00
parent 0d24d96bc7
commit e29c7e939a
2 changed files with 15 additions and 1 deletions

View File

@ -82,7 +82,6 @@ create_board_package()
rm -f /etc/update-motd.d/00-header /etc/update-motd.d/10-help-text
if [ -f "/boot/bin/$BOARD.bin" ] && [ ! -f "/boot/script.bin" ]; then ln -sf bin/$BOARD.bin /boot/script.bin >/dev/null 2>&1 || cp /boot/bin/$BOARD.bin /boot/script.bin; fi
rm -f /usr/local/bin/h3disp /usr/local/bin/h3consumption
ln -sf /usr/lib/armbian/apt-updates /etc/cron.daily/apt-updates
[ ! -f /etc/default/armbian-motd ] && cp /usr/lib/armbian/armbian-motd.default /etc/default/armbian-motd
exit 0
EOF
@ -243,6 +242,12 @@ create_board_package()
MOTD_DISABLE=""
EOF
mkdir -p $destination/etc/cron.d/
cat <<-EOF > $destination/etc/cron.d/armbian-updates
@reboot root /usr/lib/armbian/apt-updates
@daily root /usr/lib/armbian/apt-updates
EOF
# setting window title for remote sessions
install -m 755 $SRC/lib/scripts/ssh-title.sh $destination/etc/profile.d/ssh-title.sh

View File

@ -26,6 +26,15 @@ import apt_pkg
import time
import os
import os.path as path
import fcntl
lock_file = '/var/run/armbian-motd-updates.lock'
fp = open(lock_file, 'w')
try:
fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
# another instance is running
sys.exit(0)
myfile = "/var/cache/apt/archives/updates.number"