mudur_module.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. --- calamares-2.2.orig/src/modules/mudur/main.py 1970-01-01 02:00:00.000000000 +0200
  2. +++ calamares-2.2/src/modules/mudur/main.py 2016-05-27 21:36:09.787035345 +0300
  3. @@ -0,0 +1,64 @@
  4. +#!/usr/bin/env python3
  5. +# -*- coding: utf-8 -*-
  6. +#
  7. +# === This file is part of Calamares - <http://github.com/calamares> ===
  8. +#
  9. +# Copyright 2014, Anke Boersma <demm@kaosx.us>
  10. +# Copyright 2015, Philip Müller <philm@manjaro.org>
  11. +#
  12. +# Calamares is free software: you can redistribute it and/or modify
  13. +# it under the terms of the GNU General Public License as published by
  14. +# the Free Software Foundation, either version 3 of the License, or
  15. +# (at your option) any later version.
  16. +#
  17. +# Calamares is distributed in the hope that it will be useful,
  18. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. +# GNU General Public License for more details.
  21. +#
  22. +# You should have received a copy of the GNU General Public License
  23. +# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
  24. +
  25. +import os
  26. +import shutil
  27. +
  28. +import libcalamares
  29. +
  30. +
  31. +
  32. +def run():
  33. +
  34. + install_path = libcalamares.globalstorage.value("rootMountPoint")
  35. +
  36. +
  37. + path = os.path.join(install_path, "etc/locale.conf")
  38. +
  39. + mloc = open(path,"r")
  40. +
  41. + languages = mloc.readline(2)
  42. +
  43. +
  44. + mudur_file_path = os.path.join(install_path, "etc/conf.d/mudur")
  45. + lines = []
  46. + for l in open(mudur_file_path, "r").readlines():
  47. + if l.strip().startswith('language=') or l.strip().startswith('# language='):
  48. + if languages == "pt":
  49. + l = 'language="pt_BR"\n'
  50. + else:
  51. + l = 'language="%s"\n' % languages
  52. + lines.append(l)
  53. +
  54. + open(mudur_file_path, "w").writelines(lines)
  55. +
  56. + if os.path.exists(os.path.join(install_path, "etc/sudoers")):
  57. + os.unlink(os.path.join(install_path, "etc/sudoers"))
  58. +
  59. +
  60. + source = os.path.join(install_path, "etc/sudoers.orig")
  61. + target = os.path.join(install_path, "etc/sudoers")
  62. +
  63. + shutil.copy(source, target)
  64. +
  65. + libcalamares.utils.target_env_call(['chmod', '440', '/etc/sudoers'])
  66. +
  67. + return None
  68. --- calamares-2.2.orig/src/modules/mudur/module.desc 1970-01-01 02:00:00.000000000 +0200
  69. +++ calamares-2.2/src/modules/mudur/module.desc 2016-05-18 10:22:05.000000000 +0300
  70. @@ -0,0 +1,5 @@
  71. +---
  72. +type: "job"
  73. +name: "mudur"
  74. +interface: "python"
  75. +script: "main.py"