mirror of
https://github.com/frappe/bench.git
synced 2024-11-13 16:56:33 +00:00
Merge branch 'vjFaLk-setup-fonts' into develop
This commit is contained in:
commit
82accf7f2a
@ -47,9 +47,8 @@ def check_uid():
|
||||
sys.exit(1)
|
||||
|
||||
def cmd_requires_root():
|
||||
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt'):
|
||||
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers', 'lets-encrypt', 'fonts'):
|
||||
return True
|
||||
#Changed > to >=, unsure if will cause the apolcaypse
|
||||
if len(sys.argv) >= 2 and sys.argv[1] in ('patch', 'renew-lets-encrypt', 'disable-production'):
|
||||
return True
|
||||
|
||||
|
@ -37,6 +37,13 @@ def setup_redis():
|
||||
generate_config('.')
|
||||
|
||||
|
||||
@click.command('fonts')
|
||||
def setup_fonts():
|
||||
"Add frappe fonts to system"
|
||||
from bench.config.fonts import setup_fonts
|
||||
setup_fonts()
|
||||
|
||||
|
||||
@click.command('production')
|
||||
@click.argument('user')
|
||||
def setup_production(user):
|
||||
@ -106,3 +113,4 @@ setup.add_command(setup_env)
|
||||
setup.add_command(setup_procfile)
|
||||
setup.add_command(setup_socketio)
|
||||
setup.add_command(setup_config)
|
||||
setup.add_command(setup_fonts)
|
||||
|
17
bench/config/fonts.py
Normal file
17
bench/config/fonts.py
Normal file
@ -0,0 +1,17 @@
|
||||
import os, shutil
|
||||
from bench.utils import exec_cmd
|
||||
|
||||
def setup_fonts():
|
||||
fonts_path = os.path.join('/tmp', 'fonts')
|
||||
|
||||
exec_cmd("git clone https://github.com/frappe/fonts.git", cwd='/tmp')
|
||||
os.rename('/usr/share/fonts', '/usr/share/fonts_backup')
|
||||
os.rename('/etc/fonts', '/etc/fonts_backup')
|
||||
os.rename(os.path.join(fonts_path, 'usr_share_fonts'), '/usr/share/fonts')
|
||||
os.rename(os.path.join(fonts_path, 'etc_fonts'), '/etc/fonts')
|
||||
shutil.rmtree(fonts_path)
|
||||
exec_cmd("fc-cache -fv")
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user