pamac-classic/pamac-refresh.py

27 lines
542 B
Python
Raw Normal View History

2013-09-26 13:02:07 -03:00
#! /usr/bin/pkexec /usr/bin/python3
2013-03-31 14:31:33 -03:00
# -*- coding:utf-8 -*-
2013-03-18 07:07:58 -03:00
2013-09-29 06:49:42 -03:00
from time import sleep
2013-09-26 13:02:07 -03:00
from pamac import common, config
2013-03-18 07:07:58 -03:00
if not common.pid_file_exists():
2013-09-29 06:49:42 -03:00
common.write_pid_file()
2013-09-26 13:02:07 -03:00
print('refreshing')
handle = config.handle()
for db in handle.get_syncdbs():
try:
t = handle.init_transaction()
db.update(force = False)
t.release()
except:
try:
t.release()
except:
pass
print('refreshing {} failed'.format(db.name))
break
else:
print('refreshing {} succeeded'.format(db.name))
2013-09-29 06:49:42 -03:00
sleep(1)
common.rm_pid_file()