From 2d4732ba071553e71246ae4b872ac645ba40d400 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 2 Oct 2015 14:52:15 +0200 Subject: [PATCH] Custom symbol support (registry part) Proposal for the symbol support: * We can specify a symbol in the appliance via the symbol field (gui will fallback to default symbol if not internet available) * Contributor should provide the licence for the symbol Fix #5 --- README.rst | 6 +- appliances/microcore-linux.gns3a | 3 +- check.py | 15 +- symbols/README.rst | 11 + symbols/linux_guest.svg | 1919 ++++++++++++++++++++++++++++++ symbols/linux_guest.txt | 10 + 6 files changed, 1961 insertions(+), 3 deletions(-) create mode 100644 symbols/README.rst create mode 100755 symbols/linux_guest.svg create mode 100644 symbols/linux_guest.txt diff --git a/README.rst b/README.rst index 20ae77b..6291065 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,11 @@ GNS3-registry :target: https://travis-ci.org/GNS3/gns3-registry This is the GNS3 registry where user can share -appliances configurations. +appliances configurations and symbols. + +Add a new symbol +################ +Look for examples in the symbols directory. Add a new appliance diff --git a/appliances/microcore-linux.gns3a b/appliances/microcore-linux.gns3a index 856d4fd..64ffd5e 100644 --- a/appliances/microcore-linux.gns3a +++ b/appliances/microcore-linux.gns3a @@ -12,7 +12,8 @@ "maintainer": "GNS3 Team", "maintainer_email": "developers@gns3.net", "usage": "Login is tc. sudo work without password", - + "symbol": "linux_guest.svg", + "qemu": { "adapter_type": "e1000", "adapters": 1, diff --git a/check.py b/check.py index 8a19209..cbc42cc 100644 --- a/check.py +++ b/check.py @@ -18,7 +18,7 @@ import os import jsonschema import json - +import sys def check_schema(appliance): with open('schemas/appliance.json') as f: @@ -29,10 +29,23 @@ def check_schema(appliance): jsonschema.validate(appliance_json, schema) +def check_symbol(symbol): + licence_file = os.path.join('symbols', symbol.replace('.svg', '.txt')) + if not os.path.exists(licence_file): + print("Missing licence {} for {}".format(licence_file, symbol)) + sys.exit(1) + + def main(): + print("=> Check appliances") for appliance in os.listdir('appliances'): print('Check {}'.format(appliance)) check_schema(appliance) + print("=> Check symbols") + for symbol in os.listdir('symbols'): + if symbol.endswith('.svg'): + print('Check {}'.format(symbol)) + check_symbol(symbol) if __name__ == '__main__': main() diff --git a/symbols/README.rst b/symbols/README.rst new file mode 100644 index 0000000..ab5d7d9 --- /dev/null +++ b/symbols/README.rst @@ -0,0 +1,11 @@ +Symbols +******* + +This directory contain symbols that you can import in GNS3. + +Rules +===== + +* All symbols must be provided as a SVG file +* A file named symbol.txt should exist and contain symbol licence +* Try top keep a small file size diff --git a/symbols/linux_guest.svg b/symbols/linux_guest.svg new file mode 100755 index 0000000..3106987 --- /dev/null +++ b/symbols/linux_guest.svg @@ -0,0 +1,1919 @@ + + + + + + + + Etiquette Icons + + + + hash + + hardware + computer + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + + Andy Fitzsimon + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/symbols/linux_guest.txt b/symbols/linux_guest.txt new file mode 100644 index 0000000..e8b5a5b --- /dev/null +++ b/symbols/linux_guest.txt @@ -0,0 +1,10 @@ +Tux: +https://commons.wikimedia.org/wiki/File:NewTux.svg +(c) Larry Ewing, Simon Budig und Anja Gerwinsk +© The copyright holder of this file, Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted. +Attribution: Larry Ewing + +This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This work is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See version 2 and version 3 of the GNU General Public License for more details. + +Computer Background: +Public Domain Computer from GNS3