summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-08-14 23:32:18 +0200
committermathieui <mathieui@mathieui.net>2015-08-14 23:32:18 +0200
commit1ce31d927d2a88c52645577033924ef30db0de6d (patch)
treea32394eeb235152ad8f3fe4d4e15f4a9e1acd32c /src/config.py
parenta1bf66ce07fe3891bf2385d27ab7d864b1f34667 (diff)
downloadpoezio-1ce31d927d2a88c52645577033924ef30db0de6d.tar.gz
poezio-1ce31d927d2a88c52645577033924ef30db0de6d.tar.bz2
poezio-1ce31d927d2a88c52645577033924ef30db0de6d.tar.xz
poezio-1ce31d927d2a88c52645577033924ef30db0de6d.zip
Make sure the default config copy is writeable
(benefits nixos and possibly other distributions’ packaging)
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/config.py b/src/config.py
index 701bfaad..6f9ef20b 100644
--- a/src/config.py
+++ b/src/config.py
@@ -14,6 +14,7 @@ DEFSECTION = "Poezio"
import logging.config
import os
+import stat
import sys
import pkg_resources
@@ -563,6 +564,14 @@ def run_cmdline_args(CONFIG_PATH):
copy2(default, options.filename)
elif path.isfile(other):
copy2(other, options.filename)
+
+ # Inside the nixstore and possibly other distributions, the reference
+ # file is readonly, so is the copy.
+ # Make it writable by the user who just created it.
+ if os.path.exists(options.filename):
+ os.chmod(options.filename,
+ os.stat(options.filename).st_mode | stat.S_IWUSR)
+
global firstrun
firstrun = True