File: yum-updatesd.py

package info (click to toggle)
yum 3.4.3-2~bpo7+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 5,568 kB
  • sloc: python: 31,746; sh: 892; makefile: 254
file content (25 lines) | stat: -rwxr-xr-x 683 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
import sys, os
import optparse

parser = optparse.OptionParser()
parser.add_option("-f", "--no-fork", action="store_true", default=False, dest="nofork")
parser.add_option("-r", "--remote-shutdown", action="store_true", default=False, dest="remoteshutdown")    
(options, args) = parser.parse_args()

if not options.nofork:
    if os.fork():
        sys.exit()
    fd = os.open("/dev/null", os.O_RDWR)
    os.dup2(fd, 0)
    os.dup2(fd, 1)
    os.dup2(fd, 2)
    os.close(fd)

sys.path.insert(0, '/usr/share/yum-cli')
try:
    import yumupd
    yumupd.main(options)
except KeyboardInterrupt, e:
    print >> sys.stderr, "\n\nExiting on user cancel."
    sys.exit(1)