MiyoLinux wrote:Okay, I've worked on the package, and this is the only warning that I'm getting...
W: miyo-update-notifier: binary-without-manpage usr/bin/show-updates
So, my question is...
Is this detrimental to whether the package can be trusted by people who may want to use it?
I don't think so, no. Man pages are nice but hardly essential for a script which has no options.
For scripts that do have options you can use the help2man package to generate a simple man page without having to actually write one yourself.
I would test your package but I use unattended-upgrades and I don't run the notification daemon, sorry.
It looks like it should work though, FWIW.
EDIT: if you wanted to add a man page then include it at (for example) debian/show-updates.1 and then add a file at debian/miyo-update-notifier.manpages with a line listing the location of the man page:
debian/show-updates.1
The page will then be placed correctly by dpkg-buildpackage.
That command should be listed under section 1 of the man pages, man man gives an overview of these in the DESCRIPTIONS section:
man man wrote:The table below shows the section numbers of the manual followed by the types of pages they
contain.1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
Thank you HoaS!
I want to be like you when I grow up!
It works; I tested it before I uploaded it. It works perfectly. I think that I'll let it stand "as-is" for now. Thank you so much for your help...I learned a few things from what you posted.
EDITED TO CORRECT A WORD...
]]>Okay, I've worked on the package, and this is the only warning that I'm getting...
W: miyo-update-notifier: binary-without-manpage usr/bin/show-updates
So, my question is...
Is this detrimental to whether the package can be trusted by people who may want to use it?
I don't think so, no. Man pages are nice but hardly essential for a script which has no options.
For scripts that do have options you can use the help2man package to generate a simple man page without having to actually write one yourself.
I would test your package but I use unattended-upgrades and I don't run the notification daemon, sorry.
It looks like it should work though, FWIW.
EDIT: if you wanted to add a man page then include it at (for example) debian/show-updates.1 and then add a file at debian/miyo-update-notifier.manpages with a line listing the location of the man page:
debian/show-updates.1
The page will then be placed correctly by dpkg-buildpackage.
That command should be listed under section 1 of the man pages, man man gives an overview of these in the DESCRIPTIONS section:
The table below shows the section numbers of the manual followed by the types of pages they
contain.1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
MiyoLinux wrote:....now where did I put that chmod?
I think you'd need to look for it in Lost + Found
(sorry, couldn't resist!)
LOLOL!!! Good one!
Okay, I've worked on the package, and this is the only warning that I'm getting...
W: miyo-update-notifier: binary-without-manpage usr/bin/show-updates
So, my question is...
Is this detrimental to whether the package can be trusted by people who may want to use it? Good grief...going in and fixing the issues caused other issues that caused me to have to fix other issues in order to fix the original issues...
I've looked at the man folder on my system to try and get some clue, but there are so many sub-folders, I'm not sure where to begin to put a man-page for the notifier!
Goodgrief'amightyIt'salmostasthoughDebianhassometypeofstandardsthattheywanttobemetforsomereasonStinkin'hotdogwithoutrelishandI'mabouttohaveanervous-jerkdownandmightymorphinpowerrangers!!!
If anyone is willing to test it again, it is version 1.1, and it can be downloaded from...
]]>....now where did I put that chmod?
I think you'd need to look for it in Lost + Found
(sorry, couldn't resist!)
]]>Thank you so much HoaS!
....now where did I put that chmod?
]]>
Lintian has some comments about your .deb package:
E485:~$ lintian --no-tag-display-limit miyo-update-notifier_1.0_all.deb
E: miyo-update-notifier: changelog-file-missing-in-native-package
E: miyo-update-notifier: file-in-etc-not-marked-as-conffile etc/cron.d/update_notifier
E: miyo-update-notifier: file-in-etc-not-marked-as-conffile etc/xdg/autostart/update-notifier.desktop
E: miyo-update-notifier: no-copyright-file
W: miyo-update-notifier: description-synopsis-starts-with-article
W: miyo-update-notifier: description-too-long
E: miyo-update-notifier: extended-description-is-empty
E: miyo-update-notifier: maintainer-address-missing MiyoLinux
W: miyo-update-notifier: essential-no-not-needed
W: miyo-update-notifier: no-section-field
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/cron.d/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/cron.d/update_notifier 1000/1002
E: miyo-update-notifier: bad-permissions-for-etc-cron.d-script etc/cron.d/update_notifier 0755 != 0644
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/xdg/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/xdg/autostart/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid etc/xdg/autostart/update-notifier.desktop 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/bin/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/bin/show-updates 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/share/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/share/update-notifier/ 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/share/update-notifier/update-notifier.py 1000/1002
E: miyo-update-notifier: wrong-file-owner-uid-or-gid usr/share/update-notifier/updates.svg 1000/1002
W: miyo-update-notifier: binary-without-manpage usr/bin/show-updates
E: miyo-update-notifier: python-script-but-no-python-dep usr/share/update-notifier/update-notifier.py #!python
W: miyo-update-notifier: executable-not-elf-or-script etc/xdg/autostart/update-notifier.desktop
W: miyo-update-notifier: executable-not-elf-or-script etc/cron.d/update_notifier
W: miyo-update-notifier: executable-not-elf-or-script usr/share/update-notifier/updates.svg
E485:~1$
So I think you need to correct the ownership & permissions for the various files, make the desktop file & .svg non-executable, add a debian/copyright file (GPL ftw!) and debian/conffiles[1] listing the cron & autostart entries.
For the description try this in debian/control:
Description: basic update notifier
A basic update notifier that checks for updates every four hours.
.
When updates are available, a notification and icon will appear in the system
tray and on the desktop. Clicking the icon in the system tray will present a
notification on the desktop that tells what updates are available.
.
The user will still need to upgrade their system via the terminal or Synaptic.
HTH
EDIT: corrected typo in the description.
]]>I've created a .deb package for the update notifier that has been discussed here...
It's a simple notifier that checks for updates every 4 hours. When updates are available, a desktop notification will appear as well as a system tray notification. If you click on the icon in the system tray, a notification window will open that presents the updates that are available (thanks fsr!). Please be aware that you will still have to update manually through your terminal or Synaptic...it's just a notifier. I chose this route, because I wanted the user to be able to decide if they wanted to install the updates "now" or "later".
Also, please be aware that if you're using an obscure window manager (such as i3), you will need to add the update-notifier.py to your autostart file. The update-notifier.py will be found in /usr/share/update-notifier/
I would appreciate anyone who is willing to test it for me. After installing it, you will need to at least log out and log in for it to start working.
It can be downloaded from...
]]>#!/bin/sh
NAME=`basename $0`
LIST=`pgrep $NAME`
# Sometimes this process is not killed
# when you log out of the DE so kill
# any leftovers
for ITEM in $LIST
do
if [ $ITEM -ne $$ ] ; then
# I suppose you cannot kill other people's processes
# ....unless you are root
/bin/kill $ITEM
fi
done
# at KDE start wait 30 secs
sleep 30
while true
do
NUM=$(aptitude search "~U" | wc -l)
if [ $NUM -eq 1 ] ; then
notify-send -t 590000 "There is $NUM update" &
fi
if [ $NUM -gt 1 ] ; then
notify-send -t 590000 "There are $NUM updates" &
fi
sleep 600
done
This could eventually be enhanced to display a list of updates as shown in previous posts and an icon.
If I recall correctly notify-send cannot launch an application by clicking on the notification dialog or at least
I was not able to find a way do so.
Just my 2 cents.
]]>If anyone is interested:
[0] https://askubuntu.com/questions/690769/ … 750#752750
[1] https://github.com/sneetsher/mysystemin … -service.c
#!/usr/bin/env python3
################################################################################
# Configuration Section Begins Here #
################################################################################
config = dict(
# The title to be shown on the pop-up and the icon tooltip.
title = "Updates Available",
# The message to be shown in the pop-up.
message = "There are updates available to install.",
# Icon to use in the system tray and pop-up.
icon = "/usr/share/update-notifier/updates.svg",
# Frequency to check for available updates.
#interval = 900, # 15 minutes
#interval = 14400, # 4 hours
interval = 3600, # 1 hour
# Command to run to check for available updates, and the expected status
# code that indicates updates are available.
check = "/usr/bin/apt-get -s dist-upgrade | /bin/grep -c '^Inst '",
)
################################################################################
# Configuration Section Ends Here #
################################################################################
try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, GLib, Gtk
gi.require_version('AyatanaAppIndicator3', '0.1')
from gi.repository import AyatanaAppIndicator3 as appindicator
import sys
import subprocess
from time import time
from random import random
except ImportError:
print("Failed to import Gio, GLib, Gtk or AyatanaAppIndicator3 or other helpers")
raise NotImplementedError
# hide tray icon from application
def on_action_hide(action, parameter):
global tray
tray.set_status(appindicator.IndicatorStatus.PASSIVE)
# hide tray icon from app indicator
def on_menu_hide(menu_item):
global tray
tray.set_status(appindicator.IndicatorStatus.PASSIVE)
def on_connect_changed(indicator, connected):
global app
if (connected == False):
print('packages missing: ayatana-indicator-application and mate-indicator-applet for MATE not installed (other DEs may have similar indicator-applet package for ayatana indicators)')
app.quit()
# app indicator tray icon
def tray_icon():
global config
tray = appindicator.Indicator.new('update.notifier.tray', config['icon'],
appindicator.IndicatorCategory.SYSTEM_SERVICES)
tray.set_title(config['title'])
tray.connect('connection-changed', on_connect_changed)
# minimalistic menu for tray
menu = Gtk.Menu()
item_hide = Gtk.MenuItem.new_with_label('Hide')
item_hide.connect('activate', on_menu_hide)
menu.append(item_hide)
menu.show_all()
tray.set_menu(menu)
tray.set_secondary_activate_target(item_hide)
return tray
def query_update():
global app, tray, config, next_check
# keep application running
app.hold()
if (int(time()) >= next_check):
status = subprocess.getoutput(config['check'])
# Updates?
if (status != "0"):
# show tray icon
tray.set_status(appindicator.IndicatorStatus.ACTIVE)
# show notification popup
icon = Gio.Icon.new_for_string(config['icon'])
notifier = Gio.Notification.new(config['title'])
notifier.set_body(config['message'])
notifier.set_default_action('app.hide')
notifier.set_icon(icon)
app.send_notification('update-notifier-popup', notifier)
next_check = next_check + config['interval'] + int(random() * 300)
# keep application running
app.release()
return GLib.SOURCE_CONTINUE;
# + 200 for cron job to run at boot
next_check = int(time()) + 200 + int(random() * 300)
# service to run only one instance and allow to functioning as-is
app = Gio.Application.new('update.notifier.app', Gio.ApplicationFlags.IS_SERVICE)
# have a globally accessible tray instance
tray = None
try:
if (app.register() == True):
# keep application running
app.hold()
# application hide action
action_hide = Gio.SimpleAction.new('hide')
action_hide.connect('activate', on_action_hide)
app.add_action(action_hide)
# keep application running
app.set_inactivity_timeout(180000)
# hidden tray icon
tray = tray_icon()
source_id = GLib.timeout_add_seconds(60, query_update)
# keep application running
app.release()
app.run(sys.argv)
GLib.source_remove(source_id)
except GLib.Error as e:
print('Failed to register service: {0} ({1})'.format(e.message, e.code))
# vim:expandtab
I set my update interval to one hour.
$ cat /etc/cron.d/update_notifier
@reboot root /etc/cron.hourly/update_notifier
$ cat /etc/cron.hourly/update_notifier
#!/bin/sh
# wait up to 180 seconds to run apt-get
MAILTO=""
test -x /usr/bin/apt-get || exit 0
/usr/bin/python3 -c 'import random; import time; time.sleep(random.random() * 180)' \
&& /usr/bin/apt-get update
$ cat /usr/share/update-notifier/update-notifier.py
#!/usr/bin/env python3
################################################################################
# Configuration Section Begins Here #
################################################################################
c = dict(
# The title to be shown on the pop-up and the icon tooltip.
title = "Updates Available",
# The message to be shown in the pop-up.
message = "There are updates available to install.",
# Icon to use in the system tray and pop-up.
icon = "/usr/share/update-notifier/updates.svg",
# Frequency to check for available updates.
#interval = 900, # 15 minutes
#interval = 14400, # 4 hours
interval = 3600, # 1 hour
# Command to run to check for available updates, and the expected status
# code that indicates updates are available.
check = "/usr/bin/apt-get -s dist-upgrade | /bin/grep -c '^Inst '",
)
################################################################################
# Configuration Section Ends Here #
################################################################################
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, GLib
import subprocess
from time import time
from random import random
def on_activate(data):
'''do nothing'''
def main_loop():
global next_check
if (int(time()) >= next_check):
status = subprocess.getoutput(c['check'])
# Updates?
if (status != "0"):
global app
icon = Gio.Icon.new_for_string(c['icon'])
notifier = Gio.Notification.new(c['title'])
notifier.set_body(c['message'])
notifier.set_icon(icon)
app.send_notification('update.popup', notifier)
next_check = next_check + c['interval'] + int(random() * 300)
return GLib.SOURCE_CONTINUE;
# + 200 for cron job to run after boot
next_check = int(time()) + 200 + int(random() * 300)
# service to run only one instance and allow to functioning as-is
app = Gio.Application.new('update.notifier', Gio.ApplicationFlags.IS_SERVICE)
# either notification action or app activate signal
app.connect('activate', on_activate)
try:
if (app.register() == True):
source_id = GLib.timeout_add_seconds(60, main_loop)
GLib.MainLoop().run()
GLib.source_remove(source_id)
except GLib.Error as e:
print('Failed to register service: {0} ({1})'.format(e.message, e.code))
# vim:expandtab
I have followed the instructions for Update Notifier, now I am waiting for some updates to see how it works.
If I understood right, update-notifier.py starts at boot time, but does the first apt-get update after 4 hours; or I am wrong and it does the first apt-get update at boot time, and then every 4 hours? If the first is correct, could something be added, so there is an apt-get update 2-3 or 5 minutes after boot time?
I also have a problem after installing pk-update-icon and unattended-upgrades, before I found Update Notifier in this thread. Now I have uninstalled pk-update-icon and unattended-upgrades, but in Synaptic, when I click Settings>Repositories, the repositories window does not pop-up, but a "Repositories Changed" window appears. Now I can only use /etc/apt/sources.list to manage repositories.
Can someone help here, or I should better open another thread?
Chris
]]>No, the mail is delivered every time a root cron job is done...
Sorry for raising confusion. XD But I learned something. :-)
I also learned something. I have no mail. So, what you pointed out is good for me to know.
I didn't see it as confusion.
]]>I don't know...perhaps the mail only goes out once a day?
Regarding the location of the log...I'm on my phone, so I'm doing this from memory...
I don't remember the actual name of the cron log file...but it's located in /var/log/ and it has "cron" in the name.
EDITED: Of all things, it's called cron.log LOLOLOL!
If it's not already there, check to see if cron is commented out in the rsyslog.conf file...found in /etc/rsyslog.conf.
I think you may have to reboot after uncommenting cron in the rsyslog.conf file for it to show up in /var/log.
No, the mail is delivered every time a root cron job is done... But you ARE right in the end. Last night I was sleepy and I deleted the mail before I checked it, and then commented basing myself on loose observation. Today I was brighter, and I checked the mail and when the various messages were sent: 15:00 and 18:00 h, for now.... and my laptop was on since about 13:00, So it's obvious I was in error. :-D Sorry for raising confusion. XD But I learned something. :-)
]]>