Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic detection and uploading of firmware based on device arch #2

Open
CoMMyz opened this issue Jul 31, 2023 · 1 comment
Open

Comments

@CoMMyz
Copy link

CoMMyz commented Jul 31, 2023

Hi,

This tool is amazing and works lovely. Is there any plugin ready that can upload the firmware/config found in a specific folder based on architecture ?

Thank you!

@uedvt359
Copy link
Collaborator

sorry for the late reply, something like this should do the trick. at least for arm64 and arm(32), the info.arch contains exactly the strings that are part of the default file names from mikrotik (other architectures may need a dict lookup). of course you can also load this from a local directory, not just over http.

let me know if this work for you!

config.ini:

[pynetinstall]
plugin=dvt:DVTPlugin
ros_version=7.11
default_config=config.rsc

dvt.py:

from urllib.parse import quote

class DVTPlugin:
    def __init__(self, config):
        self.ros_version = config["pynetinstall"]["ros_version"]
        self.default_config = config["pynetinstall"]["default_config"]

    def get_files(self, info):
        mac = info.mac.hex(':').upper()
        model = quote(info.model)
        arch = info.arch

        firmware = f"https://download.mikrotik.com/routeros/{self.ros_version}/routeros-{self.ros_version}-{arch}.npk"

        return firmware, self.default_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants