Would you like to react to this message? Create an account in a few clicks or log in to continue.

  • Post new topic
  • Reply to topic

General Update Notifier

nobody
nobody


Posts : 47
Join date : 2024-05-12
Location : Finland

General Update Notifier Empty General Update Notifier

Post by nobody 24th May 2024, 1:00 pm

Make a /opt/UPDATE folder

Code:
sudo mkdir -p /opt/UPDATE

..... Copy files b.txt  PHASE2  update-check to /opt/UPDATE

Code:
sudo cp b.txt  PHASE2 UPDATE update-check /opt/UPDATE

..... Add update check to root crontab like

Code:
sudo crontab -e

... add a line

Code:
@reboot cd /opt/UPDATE && sleep 60 && ./update-check

.... for User crontab

Code:
crontab -e

... add a line

Code:
@reboot cd /opt/UPDATE && sleep 180 && ./PHASE2

..... If there has no updates, nothing appears, but if there has updates PHASE2 launches update process.

Code:
sudo chown $USER:root /opt/UPDATE/UPDATE

##########################################################

Files:

b.txt

Code:
apt list

PHASE2

Code:
#!/bin/bash
# RJP 16.6.2023
A=$(grep -o 'apt list' /tmp/a.txt)
B=$(grep -o 'apt list' /tmp/b.txt)
export DISPLAY=:0.0
if [ "$A" = "$B" ]
then
cd /opt/UPDATE && ./UPDATE
else
sleep 5
fi

UPDATE

Code:
#!/bin/bash
#
# RJP 16.6.2023
#
#!/bin/bash
LIST=$(apt-get --simulate upgrade)
#
export DISPLAY=:0.0
echo "$LIST" | yad --list --title "Search Results" --width=1000 --height=500 --text "INFORMATION" --column "AVAILABLE UPDATES" --button=OK:1
yad --text="Would you like to install updates?" --title="UPDATER"
if [ $? = 0 ];
then
x-terminal-emulator -e /bin/bash -c "sudo apt update && sudo apt upgrade && yad --center --borders=5 --width=400 --text-align=center --button=OK:1 --title='System up to date' --buttons-layout=center"
else
yad --text-align=center --title "INFORMATION" --width=400 --text "No updates available" --column "No updates available" --button=OK:1
fi

update-check

Code:
#!/bin/bash
## RJP 16.6.2023
## check updates every 600 minutes
for (( ; ; ))
do
cp /opt/UPDATE/b.txt /tmp
chmod 644 /tmp/b.txt
apt update > /tmp/a.txt
chmod 644 /tmp/a.txt
sleep 36000
done

Scripts must set executable.

Code:
chmod +x PHASE2
chmod +x UPDATE
chmod +x update-check

https://puolanka.info/goto/update-notifier/general-update-notifier/
  • Post new topic
  • Reply to topic

Current date/time is 29th June 2024, 6:21 am