/usr/share/checkbox/scripts/optical_detect is in checkbox 0.13.7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 26 27 28 29 | #!/usr/bin/python
import os
import re
import sys
def main(args):
line_pattern = r"\s*(\d+)\s+dev='([^']+)'" \
"\s+([wr-]{6})\s:\s'([^']+)'\s'([^']+)'"
line_regex = re.compile(line_pattern)
count = 0
command = "wodim --devices"
for line in os.popen(command).readlines():
match = re.match(line_regex, line)
if match:
count += 1
print match.group(4), match.group(5)
if not count:
print "None."
return 1
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
|