#!/bin/bash
pacman -Syup | grep http:// | wc -l > /tmp/updateCount
and added a cron entry to root for it
@reboot $HOME/Launchers/updateCount
0,30 * * * * $HOME/Launchers/updateCount
then I added the count to my conky time bash script (non-related lines omitted)
...
updatestmp=$tmpfolder/time-updates
...
updatecount=$(cat $updatestmp)
...
# check if there are updates
if [ -f /var/run/reboot-required ]; then
# we need to reboot, report to conky
echo "\${color6}Restart required."
elif [ "$updatecount" = 0 ] ; then
# no updates, report to conky
echo "\${color7}System up to date."
elif [ "$updatecount" = 1 ] ; then
# updates, report to conky
echo "\${color5}$updatecount \${color6}New Update Available\${color5}!"
else
# updates, report to conky
echo "\${color5}$updatecount \${color6}New Updates Available\${color5}!"
fi
...
so i got it working had to edit the widget a bit to get it to count right.
anyway ill paste the widget here in case anyone else wants something like it
-- Pacman Widget
pacwidget = wibox.widget.textbox()
pacwidget_t = awful.tooltip({ objects = { pacwidget},})
vicious.register(pacwidget, vicious.widgets.pkg,
function(widget,args)
local io = { popen = io.popen }
local s = io.popen("pacman -Qu -b /path/to/checkupdates/database")
local str = ''
local i = 0
for line in s:lines() do
str = str .. line .. "\n"
i = i + 1
end
pacwidget_t:set_text(str)
s:close()
return "☭: " .. i .. " "
end, 1800, "Arch")
it does require vicious but instead of using the normal pacman -Qu it now uses checkupdates
-- edit --
it does check every hour the 1800 is that setting it to half hour would make it 900
thank you all again for helping me to get this working
i did after all use a cron job as i found checkupdates inside the rc.lua causes the system to hang. ive updated the widget to apply to the cron job
]]>$ echo "$(checkupdates|wc -l)+$(cower -u|wc -l)"|bc -l warning: moc-svn [ignored] 2526-1 -> 2536-1 12
We need to send potential warnings from cower to /dev/null
Ahh, I had never seen warnings from cower before, but that does make sense. Well done!
I might actually use it :-)
I'm glad I could be the spark of your inspiration
All the best,
-HG
]]>i had just started using moc... loving it and been working on a good theme for it
beats banshee and mp3blaster was givin me issues
]]>jasonwryan wrote:Cool. It is perfectly safe to run checkupdates from a cron job (I have mine run @hourly). I also run cower -u and aurphan -a regularly so I know what needs updating or adopting.
On this note, just a quick idea if you want to know how many packages on your system need to be updated (and you have cower and bc installed), then here's a quick function to use:
lsupd () { echo "$(checkupdates|wc -l)+$(cower -u|wc -l)"|bc -l }
All the best,
-HG
$ echo "$(checkupdates|wc -l)+$(cower -u|wc -l)"|bc -l
warning: moc-svn [ignored] 2526-1 -> 2536-1
12
We need to send potential warnings from cower to /dev/null
$ (checkupdates; cower -u 2>/dev/null) | wc -l
12
I might actually use it :-)
]]>VanillaFunk wrote:also im im correct even running checkupdates from cron
and then 'pacman -Qu' from the widget wouldnt change the results i was having in first placeNot sure what you mean.
'checkupdates' doesn't touch the regular pacman sync db, it uses a "fake" one, so 'pacman -Qu' can be outdated.
the widget generates a list of packages from the output of pacman -Qu
but since pacman -Qu doesnt print the output from the repositories then
i will use checkupdates in its place
without pasting the whole widgets code here ... the widget pastes the output as a tooltip so if i use the checkupdates it will still generate the list of packages as -Qu would except these will be from the repository instead of from my local machine
hope that made more sense
]]>also im im correct even running checkupdates from cron
and then 'pacman -Qu' from the widget wouldnt change the results i was having in first place
Not sure what you mean.
'checkupdates' doesn't touch the regular pacman sync db, it uses a "fake" one, so 'pacman -Qu' can be outdated.
but yea either way...
ty guys for the help
Cool. It is perfectly safe to run checkupdates from a cron job (I have mine run @hourly). I also run cower -u and aurphan -a regularly so I know what needs updating or adopting.
On this note, just a quick idea if you want to know how many packages on your system need to be updated (and you have cower and bc installed), then here's a quick function to use:
lsupd () {
echo "$(checkupdates|wc -l)+$(cower -u|wc -l)"|bc -l
}
All the best,
-HG
]]>thanks for all the info i see the issue with running -Sy now and setting up the checkupdates bit that you advised. thank you all for the help ill go mark this as solved since regardless the topic is just not something that should be done
]]>VanillaFunk, next time please start with https://bbs.archlinux.org/viewtopic.php … 8#p1344858 instead of https://bbs.archlinux.org/viewtopic.php … 1#p1344841 or post both i.e. the actual problem and the solution you came up with.
]]>/usr/bin/checkupdates --help
]]>-- i think mayhaps i am not asking correctly --
]]>