Skip to content

Commit 83a15a6

Browse files
committed
Exit if /usr/local/var/localize/include already exists
Closes #545
1 parent e9294ba commit 83a15a6

File tree

1 file changed

+8
-4
lines changed
  • overlays/uzip/localize/files/usr/local/sbin

1 file changed

+8
-4
lines changed

overlays/uzip/localize/files/usr/local/sbin/localize

+8-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939

4040
import os, sys, subprocess
4141

42+
include_file_path = "/usr/local/var/localize/include"
43+
if os.path.isfile(include_file_path):
44+
print(include_file_path, "exists. Exiting.")
45+
exit(0)
46+
4247
got_hint = False
4348

4449
if os.geteuid() != 0:
@@ -176,12 +181,11 @@ run(["tzsetup", timezone])
176181

177182
# Write a shell file that can be sourced at session startup time to export
178183
# the environment variables
179-
target_file = "/usr/local/var/localize/include"
180-
os.makedirs(os.path.dirname(target_file), exist_ok=True)
181-
f = open(target_file, "w+")
184+
os.makedirs(os.path.dirname(include_file_path), exist_ok=True)
185+
f = open(include_file_path, "w+")
182186
f.write(template.replace("%locale%", locale).replace("%timezone%", timezone))
183187
f.close()
184-
print("--> Wrote", target_file)
188+
print("--> Wrote", include_file_path)
185189

186190
# It looks like this:
187191
# LANG="de_DE.UTF-8"

0 commit comments

Comments
 (0)