Adding nanorc

This commit is contained in:
VirtuBox
2019-11-02 15:53:39 +01:00
parent 23be601c11
commit 77bcba6484
3 changed files with 16 additions and 3 deletions

View File

@@ -467,11 +467,11 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting packages variable for nanorc")
apt_packages = apt_packages + ['nano']
packages = [
['https://github.com/scopatz/nanorc/archive/master.tar.gz',
['https://github.com/scopatz/'
'nanorc/archive/master.tar.gz',
'/var/lib/wo/tmp/nanorc.tar.gz',
'nanorc']]
# UTILS
if pargs.utils:
Log.debug(self, "Setting packages variable for utils")

View File

@@ -1436,6 +1436,19 @@ def post_pref(self, apt_packages, packages, upgrade=False):
WOFileUtils.chmod(
self, "/usr/local/sbin/update-ngxblocker", 0o700)
if any('/var/lib/wo/tmp/nanorc.tar.gz' == x[1]
for x in packages):
WOExtract.extract(self, '/var/lib/wo/tmp/nanorc.tar.gz',
'/var/lib/wo/tmp/')
WOFileUtils.mvfile(self, '/var/lib/wo/tmp/nanorc-master',
'/usr/share/nano-syntax-highlighting')
if os.path.exists('/etc/nanorc'):
Log.debug(
self, 'including nano syntax highlighting to /etc/nanorc')
WOFileUtils.textappend(
self, '/etc/nanorc', 'include /usr/share/'
'nano-syntax-highlighting/*.nanorc')
def pre_stack(self):
"""Inital server configuration and tweak"""

View File

@@ -368,4 +368,4 @@ class WOFileUtils():
final_file.write('{0}'.format(content))
except IOError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to write content in {0}".format(path))
Log.error(self, "Unable to append content in {0}".format(path))