The officially official Devuan Forum!

You are not logged in.

#51 2019-09-18 21:38:27

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

There you go being all reasonable'n stuff...  big_smile

Thanks fsr! I'll stick with just Synaptic.

One last question (anyone's input is welcome)...for the "Would you like to update your system now?" window...

Would the words plus icons...or...just the words alone be preferable on the buttons?

Thanks!


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#52 2019-09-18 21:49:41

Ron
Member
Registered: 2018-04-22
Posts: 474  

Re: [MiyoLinux] Update on the Update Notifier

So is the updater now ready for prime time?

Offline

#53 2019-09-18 22:09:15

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Ron wrote:

So is the updater now ready for prime time?

I'll upload it later tonight and post here when  it can be downloaded. smile

Thanks Ron.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#54 2019-09-18 22:40:30

golinux
Administrator
Registered: 2016-11-25
Posts: 3,137  

Re: [MiyoLinux] Update on the Update Notifier

If I were to use it  . . . the lighter the better.  Nags even for good things should be minimal.  I demand it in my world.

Offline

#55 2019-09-19 04:26:48

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

golinux wrote:

If I were to use it  . . . the lighter the better.  Nags even for good things should be minimal.  I demand it in my world.

smile

That's one of the nice things about it...it's not running constantly in the background. It only runs when told to by the script. I haven't checked it with top or htop, but I have noticed that when it does run, the RAM usage showing in my conky only goes up about 10 MBs for a few seconds (while it checks for updates) then the RAM drops right back down. wink


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#56 2019-09-19 04:46:14

golinux
Administrator
Registered: 2016-11-25
Posts: 3,137  

Re: [MiyoLinux] Update on the Update Notifier

Actually, I was not speaking about light on resources but unobtrusive visually.  wink  That's one honkin' humongous popup!  This is not in any way to suggest you change a thing.  I was just messin' with you a bit . . .  big_smile  It's a brilliant execution of a function that many will find useful.

Offline

#57 2019-09-19 04:51:08

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Oh.

LOL! tongue

That last picture with the 4 buttons? That's no longer an option. wink

Actually, I'm waiting to hear back from someone about something. So...I'm still working on it. I probably won't get it uploaded tonight like I said that I would.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#58 2019-09-20 09:11:22

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Hi everyone. I'm sorry...I was going to upload the update notifier today, but my internet has been having a nervous-jerkdown. It won't stay connected for over a minute or two.  neutral

I'll try again tomorrow.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#59 2019-09-21 09:28:56

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Okay! Connection issues are better today but still going in and out. tongue  At least I was able to get the Update Notifier(s) uploaded!

Actually, the connection issues proved beneficial and gave me the time and opportunity to make some executive decisions...which I hope are explained well enough in the quote from the readme file below. wink  Instead of offering only one version, I'm offering three versions.

Update Notifier downloads are available here...

https://sourceforge.net/projects/miyoli … -Notifier/

ATTENTION: IF YOU HAVE INSTALLED A PREVIOUS VERSION OF THE MIYOLINUX UPDATE NOTIFIER, YOU WILL NEED TO REMOVE IT BEFORE INSTALLING ONE OF THE NEW VERSIONS.

********************

PLEASE NOTE THAT THERE ARE 3 VERSIONS AVAILABLE

In keeping with the MiyoLinux philosophy of allowing the user to decide what goes on their system, I am providing 3 versions of the Update Notifier so that the user can choose the one that they prefer. smile  The available versions are...

miyolinux-update-notifier_2.1_all.deb
miyolinux-update-notifier_2.1.1_all.deb
miyolinux-update-notifier_2.1.2_all.deb

The differences are explained at the bottom of this file.

********************

After installation, log out (or reboot) for the Update Notifier to begin working.

********************

Some window manager users may need to manually add the following line to their autostart file...

/usr/share/update-notifier/update-notifier.py

********************

On minimal systems, if desktop notifications are not appearing, you may choose to install one of the following...

notification-daemon (see note)
xfce4-notifyd
dunst

NOTE: if you install notification-daemon, you may need to add the following line to your autostart...

/usr/lib/notification-daemon/notification-daemon

********************

After installation, you can view the README file in /usr/share/doc/miyolinux-update-notifier/ for more information.

********************

THE DIFFERENCES BETWEEN THE VERSIONS...

miyolinux-update-notifier_2.1_all.deb
miyolinux-update-notifier_2.1.1_all.deb
miyolinux-update-notifier_2.1.2_all.deb

Version 2.1 - When you click the icon in the system tray, it will open a window asking if you want to update your system now. There are three buttons to choose from...

"Show Updates" will show the available updates in a notification window.

"Yes" will close the window and open an Authentication window. After entering your password, the Synaptic Package Manager will open (See Synaptic's usage in Version 2.1.1).

"No" will close the window.

Version 2.1.1 - When you click the icon in the system tray, it will open an Authentication window. After entering your password, the Synaptic Package Manager will open and show the available updates. Click "Mark" to automatically perform the upgrade. Click "Cancel" to not install the updates and close Synaptic.

Version 2.1.2 - When you click the icon in the system tray, it will open an Authentication window. After entering your password, a modified xterm will open. It will show the available updates in the terminal, and the user can then choose whether to install the updates or not. Choosing Y (or just hit Enter on your keyboard) will automatically perform the upgrades, and xterm will automatically close when the upgrades are complete. Choosing n will not install the updates and close xterm.

NOTE: Version 2.1.2 is considered a testing version. While it has performed flawlessly for me on multiple computers (using both ASCII and Beowulf), there may be some systems in which xterm may not work correctly. If it doesn't work, remove this version, and try one of the other two which uses Synaptic. smile

********************

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Last edited by MiyoLinux (2019-09-21 10:31:51)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#60 2019-11-03 20:46:01

stanz
Member
From: Northern Earth ~ Brrrr
Registered: 2018-01-14
Posts: 162  

Re: [MiyoLinux] Update on the Update Notifier

MiyoLinux wrote:

One last question (anyone's input is welcome)...for the "Would you like to update your system now?" window...
Would the words plus icons...or...just the words alone be preferable on the buttons?

Nice!! I'll take both..
And this is Easy to tweak..but I'm torn between:
Pop-quiz 'user', you have updates waiting on your input...whata ya do? hmm
and
So, ya don't wanna update now? "I'll be back!" yikes

on to finding matching icons! tongue

As always MiyoLinux...nice addition to your builds ~ for the users 'ease of use'!!
Allot of time and effort...I hope you remember to eat and visit family often. lol

asta


miyoisomix.i2p

Offline

#61 2020-03-25 00:02:14

stanz
Member
From: Northern Earth ~ Brrrr
Registered: 2018-01-14
Posts: 162  

Re: [MiyoLinux] Update on the Update Notifier

Allot of time and effort...I hope you remember to eat and visit family often. lol

and I hope you did!!

How would I tweak your notifer to just check once at login?
Thx in advance...  smile


miyoisomix.i2p

Offline

#62 2020-03-25 06:48:02

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

stanz wrote:
MiyoLinux wrote:

One last question (anyone's input is welcome)...for the "Would you like to update your system now?" window...
Would the words plus icons...or...just the words alone be preferable on the buttons?

Nice!! I'll take both..
And this is Easy to tweak..but I'm torn between:
Pop-quiz 'user', you have updates waiting on your input...whata ya do? hmm
and
So, ya don't wanna update now? "I'll be back!" yikes

on to finding matching icons! tongue

As always MiyoLinux...nice addition to your builds ~ for the users 'ease of use'!!
Allot of time and effort...I hope you remember to eat and visit family often. lol

asta

How did I never see this message? LOL!

DOOOO IT!!!

  big_smile  There's usually some face icons in the "emotes" folder of each icon theme.

stanz wrote:

and I hope you did!!

How would I tweak your notifer to just check once at login?
Thx in advance...  smile

Just so happens I tweaked mine to do just that. Which update-notifier are you using? I only use the one that just opens xterm when you click the icon in the system tray. If you're using another one, I'd have to investigate n'stuff.

Be aware...this is a miyo-hack. I'm not a scriptographer. tongue  ...but it stinkin' works. wink  Just read all of this before you go hackin' on the scripts in case you don't wanna do it. hmm

If you're using the same one I am, you need to edit 2 scripts as root.

1. Open /usr/share/update-notifier/update-notifier.py with your text editor.

Change the amount of time in line # 36. I changed mine to the number 90 (which is 1 1/2 minutes after startup reaching the desktop). Anyway, that line in the script now looks like this...

interval = 90,

Save and close the file.

2. Open /usr/bin/miyo-update-sync with your text editor.

Here's where the miyo-hackism comes into play tongue  ...edit that script to look like this...

#!/bin/bash
/usr/bin/apt-get update; while sleep 270; do pkill -9 -f update-notifier.py; done

Save and close the file.

NOTE: That 270 gives the update notifier enough time to sync the repositories once, but it will then kill the update-notifier.py before it runs again. At least, that's how it works on my system. Hack it if you have to! tongue

Log out and log back in for it to take effect.

AND BAM!

It will only sync the repos (check for updates) and run the update notifier once after system startup. big_smile

Be aware though...this is a hack. If you don't catch the notification in the system tray within a few minutes of reaching the desktop, it won't appear again until the next time you logout/login or reboot...because if there are updates, and there's the icon in the system tray...that pkill command will kill it also.

Cause that's the way I roll baby!

Last edited by MiyoLinux (2020-03-25 06:53:43)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#63 2020-03-25 08:57:45

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

...and if you're like me and running ceres  yikes

...add this to your .Xresources file so that xterm will have a scroll bar so that you can scroll through to see all of the updates available when there's a ton of them. LOL! tongue

xterm*scrollBar: true
xterm*rightScrollBar: true

I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#64 2020-03-26 19:12:43

stanz
Member
From: Northern Earth ~ Brrrr
Registered: 2018-01-14
Posts: 162  

Re: [MiyoLinux] Update on the Update Notifier

I got the - 2.1.2_all.deb
Thx for posting the adjustment...I'm starting the mini-p2p-mimo-3.0 build now,
and will post when I get to your updater tweaks! smile

Awesome....jus` awesome!


miyoisomix.i2p

Offline

#65 2020-03-26 20:17:47

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

If you want a little more time...

You know...in case you log in, and you get distracted by a cat chasing a moose or something...you can make the number (270) in the second script larger.

It will still only sync the repos one time, but it will give the notifier a longer time to live in the system tray before the pkill command does its business. wink


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#66 2020-05-28 08:53:04

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

There are new versions of the update notifier now available if anyone is interested. There are still 3 versions available.

What has changed?

The update notifier now checks for updates within the first few minutes at system startup. It will then check for updates once every 8 hours thereafter. Since Devuan is mainly meant to be a stable system, I believe that since people leave their computers on for different amounts of time...to check at system startup and once every 8 hours thereafter was a good compromise. The update notifier will not work on Ceres thanks to Debian removing pertinent packages...back to the drawing board on future versions! tongue

If you decide to install this, please read the readme.txt file on Sourceforge for valuable information.

https://sourceforge.net/projects/miyoli … -Notifier/


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#67 2021-11-07 13:59:00

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

I finally got around to making a new update notifier. It still functions as before; however, I wrote some simple bash scripts to do everything. I haven't made it into a .deb package yet; it's in a .zip file with instructions on where to put the scripts, the icon, and what to add to your autostart.

As before, clicking the icon in the system tray will open an Authentication window. Enter your password, and xterm will open to perform the updates.

With this one, if you missed the desktop notification, you can hover your mouse over the icon in the system tray, and it will show the number of updates available and list them also. (Shown in the screenshot below)

If anyone would like to try it, it can be downloaded from...

EDIT: See the next post for downloads

2021-11-07-081537-1366x768-scrot_orig.png

Last edited by MiyoLinux (2021-11-10 00:56:34)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#68 2021-11-10 01:03:16

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Downloads:
Sourceforge: https://sourceforge.net/projects/miyoli … fier/2021/
OSDN: https://osdn.net/projects/miyolinux/releases/76259

I edited (heavily) the previous post, because I made a boo-boo with the update notifier that I didn't catch. sad tongue
I've made a new .zip file with the corrections (download links above), but if you've already installed the update notifier on (or before) November 09, 2021, you can watch this video to see how to fix it...

https://youtu.be/nlfXTmt74Hs

...or you can just do the following to fix it...

1. Comment out or remove the following lines from your autostart...

/usr/local/bin/updates-sync

/usr/local/bin/updates-sync2

2. As root, create the following files in /etc/cron.d/

(you can name them anything you want)

In the first file, put the following command...

@reboot root /usr/local/bin/updates-sync

In the second file, put the following command...

@reboot root /usr/local/bin/updates-sync2

3. Reboot your computer.

If you install this new "fixed" version...  tongue

I made this notifier to use mainly on my Devuan Ceres system (MiyoLinux Rolling). That's why I have it only doing an apt-get upgrade instead of an apt-get dist-upgrade. That's also the reason for the 6 hour check intervals.

The Update Notifier will check for updates approximately 4 minutes after computer startup. Thereafter, it will check every 6 hours. If updates are available, it will show a desktop notification and an icon in the system tray. Clicking the icon in the system tray will open an authentication window to enter your password. After entering your password, xterm will open and perform the updates. See information after the instructions if you want to change some things in the scripts.

Dependencies:

bash
yad
policykit-1-gnome (or another polkit)
xfce4-notifyd  (or dunst, notification-daemon, etc. if you want desktop notifications)
xterm (unless you want to change the terminal that is used)

Instructions:

PERFORM STEPS 1-4 AS ROOT!!!

1. Move all of the scripts into /usr/local/bin/

2. Make sure their permissions are set to allow anyone to run them.

3. Move the 2 text files (updates-sync-cron and updates-sync2-cron) into /etc/cron.d/

MAKE SURE TO CHANGE THE OWNER AND GROUP (OF THOSE TWO TEXT FILES) FROM "YOUR NAME" TO "ROOT" IF YOU UNZIPPED THE FILE AS A REGULAR USER!!!

4. Move the updates.svg icon into /usr/share/images/

5. Add the following lines to your autostart...

/usr/local/bin/updater-first-run 

/usr/local/bin/updater-six-hours

6. Reboot
_________________________________

If you don't want the desktop notification pop-up window...
As root, open the update-notifier2 script with a text editor, enable line numbers, and comment out lines 7 and 9.

Hovering your mouse over the system tray icon will give you the same information as the desktop notification.
_________________________________

If you use this on a stable system and want to use dist-upgrade...
As root, open the updates-yes script with a text editor, and change apt-get upgrade to apt-get dist-upgrade

Also, while that same script is open in your text editor...if you want to use a terminal other than xterm, replace...
xterm -fa mono -fs 12 with your terminal of choice.

...'cause that's the way I roll baby! tongue

Last edited by MiyoLinux (2021-11-12 03:25:41)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#69 2021-11-19 22:31:23

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Okay...

I've been working some more on the new iterations of the update notifier that use bash scripts instead of python. I've cut down on the number of scripts needed. tongue

I have three versions. Two versions that use Xterm (or Synaptic) to upgrade stable systems. Both of those use dist-uprade in order to upgrade "stable" systems.

(You can edit one script to use whichever terminal you want if you don't want to use xterm)

The third version is just a notifier for testing or unstable systems. It will notify you when updates are available; however, you will need to do updates manually after being notified. It's left up to the user whether to upgrade or dist-upgrade.

When I have finished testing them, I'll post new download links here.

Last edited by MiyoLinux (2021-11-19 23:16:52)


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#70 2021-11-25 12:49:49

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Okay...all three versions are now available if anyone is interested.

Each version will give a desktop notification and a notification in the system tray. Instructions are included with each version for installation and editing the script(s) if desired.

Each version will check for updates 2-3 minutes after system startup; thereafter, it will check every 6 hours. I chose 6 hours, because I'm running ceres, and Debian unstable provides updates every 6 hours. However, this can be changed in the script called notifier-six-hours.sh and in the updates-sync2-cron file.

1. Basic Update Notifier - it's just an update notifier; nothing else...and my preferred version. tongue  It will notify you if updates are available, but the user will have to manually install them via a terminal or synaptic. Click the icon in the system tray to make it disappear.

2. Synaptic Update Notifier - click the icon in the system tray, enter your password, and synaptic will open to upgrade your system. Instructions are included to allow the user to choose whether to have synaptic's main window show (along with the floating windows) during upgrades or to only show the floating windows.

3. Xterm Update Notifier - click the icon in the system tray, enter your password, and xterm will open to perform upgrades. Instructions are included if you want to use a different terminal.

Available for download from...

OSDN: https://osdn.net/projects/miyolinux/releases/76259

Sourceforge: https://sourceforge.net/projects/miyoli … fier/2021/

If you live in the US, Happy Thanksgiving! smile


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#71 2021-11-26 05:04:00

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,409  

Re: [MiyoLinux] Update on the Update Notifier

Thanks for bashing the notifier into chimaera and later. I downloaded and tried the basic. At first I thought it wasn't working, but it was doing exactly what it's supposed to do - don't notify me if there aren't any updates. On a system that has upgrades pending, it did show me the list.

I did change a few things. I put the icon in /usr/share/pixmaps, because /usr/share/images didn't exist. And I combined update-notifier.sh and update-notifier2.sh into one script with a slightly different test.

If/when you package this, there should be a way to include all three in one package. I'm thinking something like a file in /etc/default to set COMMAND= where $COMMAND determines what happens when you click on the icon. (OK, I just added that below.)

Also, if anyone is wondering what that bell icon in xfce is supposed to do, here's how to get it to work:
https://forum.xfce.org/viewtopic.php?pid=62989#p62989

My modified script:

#!/bin/bash

source /etc/default/update-notifier

list=$(apt-get -s dist-upgrade | awk '/^Inst/ { print $2 }')

count=$(echo "$list" | wc -l)

if [ -n "$list" ] ; then

	notify-send --expire-time=20000 --icon="/usr/share/pixmaps/updates.svg" \
"Available updates: $count

$list"

	yad --notification \
		--image="/usr/share/pixmaps/updates.svg" \
		--icon-size=22 \
		--command="$COMMAND" \
		--text="Available updates: $count
	_____________________
	
$list"

fi

exit 0

Offline

#72 2021-11-26 05:44:29

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

fsr!!! I'd like to see what you've done with everything if you get a chance! smile

In fact, I almost contacted you to see if you would look over the notifier scripts to see if you had any advice or improvements, but I didn't want to bother you, because I know how busy you are.

Thanks fsr!


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#73 2021-11-26 13:56:09

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,409  

Re: [MiyoLinux] Update on the Update Notifier

Here are the main changes. I also changed calls for update-notifier.sh to update-notifier2.sh instead. I'm too lazy to see which files they were in. It makes more sense to change the name of the script (drop the "2" since there's only one of them.)

Note the change in the she-bang. We may get stuck with usr-merge in the not too distant future, and /bin/bash will go away. It won't go far, but using '/usr/bin/env bash' will survive the change.

/etc/default/update-notifier

# Set the default action for clicking on the notification icon.
# Valid choices: 
# "none" to only see a list of available upgrades.
# "terminal" to run the upgrade in a terminal
# "gui" to run the upgrade in synaptic package manager.

FRONTEND="terminal"

# Change the terminal if you don't have xterm.
# End your terminal command with the option that runs a command inside the terminal.
# Example:
# TERMINAL_COMMAND="/usr/bin/xfce4-terminal"
# TERMINAL_OPTIONS="-e"

TERMINAL_COMMAND="/usr/bin/xterm"
TERMINAL_OPTIONS="-fa mono -fs 12 -e"

/usr/local/bin/upgrade.sh

#!/usr/bin/env bash

source /etc/default/update-notifier

killall yad

if [ "$FRONTEND" = terminal ] ; then
	pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "${TERMINAL_COMMAND} ${TERMINAL_OPTIONS}" 'apt-get dist-upgrade'
elif [ "$FRONTEND" = gui ] ; then
	synaptic-pkexec --dist-upgrade-mode --non-interactive
fi

exit 0

/usr/local/bin/update-notifier2.sh

#!/usr/bin/env bash

list=$(apt-get -s dist-upgrade | awk '/^Inst/ { print $2 }')

count=$(echo "$list" | wc -l)

if [ -n "$list" ] ; then

	notify-send --expire-time=20000 --icon="/usr/share/pixmaps/updates.svg" \
"Available updates: $count

$list"

	yad --notification \
		--image="/usr/share/pixmaps/updates.svg" \
		--icon-size=22 \
		--command="/usr/local/bin/upgrade.sh" \
		--text="Available updates: $count
	_____________________
	
$list" &

fi

exit 0

Offline

#74 2021-11-26 14:36:51

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: [MiyoLinux] Update on the Update Notifier

Ahhh!

So, if any names for updates are detected, it will notify you. Nice!

I don't know why I didn't combine the two script into one...I guess I was having a brain-fart that day? LOL! tongue

I'm guessing the user would have to set the "frontend" that they want to use?

Thanks for the clue about changing the shebang; I wasn't aware of the possibility of what may happen with bash.

Thanks fsr!


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#75 2021-11-26 14:50:03

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,409  

Re: [MiyoLinux] Update on the Update Notifier

couple more changes. I'll go back and edit my previous post.

Yes, the user sets the frontend (and terminal if they want) in /etc/default/update-notifier.

+	pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "${TERMINAL_COMMAND} ${TERMINAL_OPTIONS}" 'apt-get dist-upgrade'
# Example:
# TERMINAL_COMMAND="/usr/bin/xfce4-terminal"
# TERMINAL_OPTIONS="-e"

TERMINAL_COMMAND="/usr/bin/xterm"
TERMINAL_OPTIONS="-fa mono -fs 12 -e"

One more thing...
If/when we package this for devuan, the executables should be in /usr/bin/ instead of /usr/local/bin.

Offline

Board footer