core, memory: use XDG recommended paths as the defaults for the config and local directories
This commit is contained in:
parent
90fc3d78e0
commit
3075585d9d
1 changed files with 56 additions and 17 deletions
12
src/sat.sh
12
src/sat.sh
|
|
@ -19,31 +19,29 @@ PYTHON='python'
|
|||
|
||||
#We use python to parse config files
|
||||
eval `"$PYTHON" << PYTHONEND
|
||||
from sat.core.constants import Const
|
||||
from ConfigParser import SafeConfigParser
|
||||
from os.path import expanduser, join
|
||||
import sys
|
||||
|
||||
config = SafeConfigParser(defaults={'local_dir':'~/.sat',
|
||||
'pid_dir':'/tmp',
|
||||
'log_dir':'%(local_dir)s'})
|
||||
config = SafeConfigParser(defaults=Const.DEFAULT_CONFIG)
|
||||
try:
|
||||
config.read(map(expanduser, ['/etc/sat.conf', '~/sat.conf', '~/.sat.conf', 'sat.conf', '.sat.conf']))
|
||||
config.read(Const.CONFIG_FILES)
|
||||
except:
|
||||
print ("echo \"/!\\ Can't read main config ! Please check the syntax\";")
|
||||
print ("exit 1")
|
||||
sys.exit()
|
||||
|
||||
env=[]
|
||||
env.append("LOCAL_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'local_dir')),''))
|
||||
env.append("PID_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),''))
|
||||
env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'pid_dir')),''))
|
||||
env.append("LOG_DIR='%s'" % join(expanduser(config.get('DEFAULT', 'log_dir')),''))
|
||||
|
||||
print ";".join(env)
|
||||
PYTHONEND
|
||||
`
|
||||
|
||||
PID_FILE="$PID_DIR$NAME.pid"
|
||||
LOG_FILE="$LOCAL_DIR$NAME.log"
|
||||
LOG_FILE="$LOG_DIR$NAME.log"
|
||||
DAEMON="n"
|
||||
MAIN_OPTIONS="-${DAEMON}oy"
|
||||
TAP_PATH="./"
|
||||
|
|
|
|||
Loading…
Reference in a new issue