mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-02-07 16:53:47 +02:00
Install custom symbols. Fixes #2492
This commit is contained in:
parent
f2bb785037
commit
2516b1952c
@ -74,6 +74,7 @@ class Controller:
|
|||||||
|
|
||||||
log.info("Controller is starting")
|
log.info("Controller is starting")
|
||||||
await self._install_base_configs()
|
await self._install_base_configs()
|
||||||
|
await self._install_custom_symbols()
|
||||||
installed_disks = await self._install_builtin_disks()
|
installed_disks = await self._install_builtin_disks()
|
||||||
if installed_disks:
|
if installed_disks:
|
||||||
await update_disk_checksums(installed_disks)
|
await update_disk_checksums(installed_disks)
|
||||||
@ -371,6 +372,19 @@ class Controller:
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.error(f"Could not install disk files to {dst_path}: {e}")
|
log.error(f"Could not install disk files to {dst_path}: {e}")
|
||||||
|
|
||||||
|
async def _install_custom_symbols(self):
|
||||||
|
"""
|
||||||
|
At startup we copy custom symbols to the user location to allow
|
||||||
|
them to use with appliances
|
||||||
|
"""
|
||||||
|
|
||||||
|
dst_path = self.symbols.symbols_path()
|
||||||
|
log.info(f"Installing custom symbols in '{dst_path}'")
|
||||||
|
try:
|
||||||
|
return await Controller.install_resource_files(dst_path, "custom_symbols", upgrade_resources=False)
|
||||||
|
except OSError as e:
|
||||||
|
log.error(f"Could not install custom symbols to {dst_path}: {e}")
|
||||||
|
|
||||||
def images_path(self):
|
def images_path(self):
|
||||||
"""
|
"""
|
||||||
Get the image storage directory
|
Get the image storage directory
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
Symbols
|
|
||||||
*******
|
|
||||||
|
|
||||||
This directory contains symbols that you can use in GNS3.
|
|
||||||
|
|
||||||
Rules
|
|
||||||
=====
|
|
||||||
|
|
||||||
* All symbols must be a SVG file
|
|
||||||
* A file named symbol.txt should exist and contains the symbol licence
|
|
||||||
* Try to keep the file size small
|
|
||||||
* The recommended maximum width and height is 70px, please see how to resize a SVG below
|
|
||||||
|
|
||||||
|
|
||||||
Resize a SVG
|
|
||||||
============
|
|
||||||
|
|
||||||
It is possible to resize a SVG file using a software like Inkscape or any
|
|
||||||
other editor that works for SVG images.
|
|
||||||
|
|
||||||
Alternatively, you could use ImageMagick (with rsvg support) on Mac OS and Linux
|
|
||||||
|
|
||||||
Example to install ImageMagick on Mac using Homebrew:
|
|
||||||
|
|
||||||
```
|
|
||||||
brew install imagemagick --with-librsvg
|
|
||||||
```
|
|
||||||
|
|
||||||
Example to install ImageMagick on Debian or Ubuntu:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt-get install imagemagick
|
|
||||||
```
|
|
||||||
|
|
||||||
Example to resize to a width and height of 70px:
|
|
||||||
|
|
||||||
```
|
|
||||||
convert -background none symbols/firefox.svg -resize x70 firefox.svg
|
|
||||||
```
|
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 GNS3 Technologies Inc.
|
# Copyright (C) 2016 GNS3 Technologies Inc.
|
||||||
#
|
#
|
||||||
@ -21,10 +21,15 @@
|
|||||||
|
|
||||||
rm gns3server/appliances/*
|
rm gns3server/appliances/*
|
||||||
rmdir gns3server/appliances
|
rmdir gns3server/appliances
|
||||||
|
rm gns3server/custom_symbols/*
|
||||||
|
rmdir gns3server/custom_symbols
|
||||||
rm -Rf /tmp/gns3-registry
|
rm -Rf /tmp/gns3-registry
|
||||||
|
|
||||||
git clone https://github.com/GNS3/gns3-registry.git /tmp/gns3-registry
|
git clone https://github.com/GNS3/gns3-registry.git /tmp/gns3-registry
|
||||||
mv /tmp/gns3-registry/appliances gns3server/appliances
|
mv /tmp/gns3-registry/appliances gns3server/appliances
|
||||||
|
mv /tmp/gns3-registry/symbols gns3server/custom_symbols
|
||||||
|
rm gns3server/custom_symbols/*.{txt,rst,md}
|
||||||
|
|
||||||
git add gns3server/appliances/*
|
git add gns3server/appliances/*
|
||||||
|
git add gns3server/custom_symbols/*
|
||||||
git commit -m "Sync appliances"
|
git commit -m "Sync appliances"
|
||||||
|
Loading…
Reference in New Issue
Block a user