Make a /opt/UPDATE folder
..... Copy files b.txt PHASE2 update-check to /opt/UPDATE
..... Add update check to root crontab like
... add a line
.... for User crontab
... add a line
..... If there has no updates, nothing appears, but if there has updates PHASE2 launches update process.
##########################################################
Files:
b.txt
PHASE2
UPDATE
update-check
Scripts must set executable.
https://puolanka.info/goto/update-notifier/general-update-notifier/
- 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/