aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/Perms.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/share/Perms.py b/share/Perms.py
index 60d52f7..7120467 100755
--- a/share/Perms.py
+++ b/share/Perms.py
@@ -182,12 +182,46 @@ def chmod(f, newperm):
if __name__ == '__main__':
import sys
+ import Config
+ import getopt
+
+ _interactive = sys.stdin.isatty()
- initlog('msec')
+ # process the options
+ try:
+ (opt, args) = getopt.getopt(sys.argv[1:], 'o:',
+ ['option'])
+ except getopt.error:
+ error(_('Invalid option. Use %s (-o var=<val>...) ([0-5])') % sys.argv[0])
+ sys.exit(1)
+
+ for o in opt:
+ if o[0] == '-o' or o[0] == '--option':
+ pair = string.split(o[1], '=')
+ if len(pair) != 2:
+ error(_('Invalid option format %s %s: use -o var=<val>') % (o[0], o[1]))
+ sys.exit(1)
+ else:
+ print 'setting', pair[0], pair[1]
+ Config.set_config(pair[0], pair[1])
+
+ # initlog must be done after processing the option because we can change
+ # the way to report log with options...
+ if _interactive:
+ import syslog
+
+ initlog('msec', syslog.LOG_LOCAL1)
+ else:
+ initlog('msec')
+
+ _interactive and log(_('Fixing owners and permissions of files and directories'))
- for p in sys.argv[1:]:
+ # process the files
+ for p in args:
+ _interactive and log(_('Reading data from %s') % p)
fix_perms(p)
+ # do the modifications
act()
# Perms.py ends here