diff --git a/makeboarddeb.sh b/makeboarddeb.sh index 8a7cdbbafc..92437ae723 100644 --- a/makeboarddeb.sh +++ b/makeboarddeb.sh @@ -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 diff --git a/scripts/apt-updates b/scripts/apt-updates index f079c6e9b4..84a27350a8 100644 --- a/scripts/apt-updates +++ b/scripts/apt-updates @@ -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"