From 0483497c7f832e304e606f2c87afafd4c282f9f7 Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Tue, 1 Jun 2010 17:58:19 +0200 Subject: [PATCH] tuned-adm: removed '-p' option --- tuned-adm | 36 ++++++------------------------------ tuned_adm.py | 6 +----- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/tuned-adm b/tuned-adm index 15489d2..72a040c 100755 --- a/tuned-adm +++ b/tuned-adm @@ -24,47 +24,28 @@ import os import sys import locale -import getopt def usage(): print """ -Usage: tuned-adm [-p ] [-h] [args] -Options: - -p directory with profiles - -h, --help show this help message and exit +Usage: tuned-adm commands: help show this help message and exit list list all available and active profiles active show current active profile off switch off all tunning - profile switch to given profile + profile switch to given profile """ if __name__ == "__main__": - - profile_dir = "/etc/tune-profiles/" - - try: - opts, args = getopt.getopt(sys.argv[1:], "hp:", ["help"]) - except getopt.error, e: - print >>sys.stderr, "Error parsing command-line arguments: %s" % e - usage() - sys.exit(1) - - for (opt, val) in opts: - if opt in ['-h', "--help"]: - usage() - sys.exit(0) - if opt in ['-p']: - profile_dir = val + args = sys.argv[1:] if len(args) < 1: - print >>sys.stderr, ("Missing arguments.") + print >>sys.stderr, "Missing arguments." usage() sys.exit(1) - if args[0] == "help": + if args[0] in [ "help", "--help", "-h" ]: usage() sys.exit(0) @@ -73,10 +54,5 @@ if __name__ == "__main__": sys.path.insert(0, TUNEDDIR) from tuned_adm import tuned_adm - - tuned_adm.init(profile_dir) - if (tuned_adm.run(args)): - usage() - sys.exit(1) - + tuned_adm.run(args) diff --git a/tuned_adm.py b/tuned_adm.py index fe30773..6768bad 100644 --- a/tuned_adm.py +++ b/tuned_adm.py @@ -23,11 +23,7 @@ import glob class Tuned_adm: - def __init__(self): - self.profile_dir = None - self.active_file = None - - def init(self, profile_dir): + def __init__(self, profile_dir = "/etc/tune-profiles"): self.profile_dir = os.path.normpath(profile_dir) self.active_file = os.path.join(profile_dir, "active-profile")