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

Support symlinks for developing #8434

Open
fsackur opened this issue Mar 13, 2025 · 3 comments
Open

Support symlinks for developing #8434

fsackur opened this issue Mar 13, 2025 · 3 comments
Labels
support Community support

Comments

@fsackur
Copy link

fsackur commented Mar 13, 2025

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

I'm developing a plugin. But it's important to me to have a low-friction workflow.

I have started by installing from ISO, then I have symlinked content from my git repo into /usr/. This lets me dev on a live system without endlessly running sync commands.

Templating fails:

# sudo service configd restart
Stopping configd...done
Starting configd.

# sudo configctl template reload OPNsense/OpenApi
ERR

This is because my symlinked template folder is not picked up by os.walk in Template.list_modules() - https://github.com/opnsense/core/blob/c9b8f41/src/opnsense/service/modules/template.py#L122

Describe the solution you like

Describe alternatives you considered

  • rsync files from git into /usr/ (I will probably mess up and overwrite my index several times)
  • hard links (I am not easily able to distinguish them to clean up)
  • put the entire /usr/local/opnsense into git and unfuck it in the repo before PR (extra work)
  • build opnsense from source (not otherwise necessary for my use case)

Additional context

symlink script

# TODO:
# - accept arguments for plugin name
# - calculate the git repo folder from $0

if [[ ! -d "/app" ]] ; then
ln -s /usr/local/opnsense/mvc/app /app # convenience
fi

for folder in "controllers" "models" "views"; do
if [[ ! -d "/app/$folder/OPNsense/OpenApi" ]] ; then
pushd "/app/$folder/OPNsense"
ln -s "/gitroot/opnsense/plugins/devel/openapi/src/opnsense/mvc/app/$folder/OPNsense/OpenApi"
popd
fi
done

if [[ ! -d "/usr/local/opnsense/service/templates/OPNsense/OpenApi" ]] ; then
pushd /usr/local/opnsense/service/templates/OPNsense/
ln -s "/gitroot/opnsense/plugins/devel/openapi/src/opnsense/service/templates/OPNsense/OpenApi"
popd
fi

if [[ ! -f "/usr/local/opnsense/service/conf/actions.d/actions_openapi.conf" ]] ; then
pushd /usr/local/opnsense/service/conf/actions.d/
ln -s "/gitroot/opnsense/plugins/devel/openapi/src/opnsense/service/conf/actions.d/actions_openapi.conf"
popd
fi

if [[ ! -f "/usr/local/opnsense/scripts/OPNsense/OpenApi" ]] ; then
pushd /usr/local/opnsense/scripts/OPNsense
ln -s "/gitroot/opnsense/plugins/devel/openapi/src/opnsense/scripts/" OpenApi
popd
fi

@AdSchellevis
Copy link
Member

Different people use different workflows, but if supporting symlinks eases yours, I don't mind having a look at a PR, there isn't a strict reason to not support them as far as I know.

@fichtner fichtner added the support Community support label Mar 13, 2025
@fichtner
Copy link
Member

IMO "make install" and "make collect" are as powerful as they get for development as long as you adhere to a core and plugin structure. Symlinks will create other problems, e.g. when numerous scripts test -f or -d.

@fsackur
Copy link
Author

fsackur commented Mar 14, 2025

I appreciate the feedback and the welcome you have offered. Maybe it's not a good idea to PR. Any other dev that finds this issue can follow my footsteps.

Happy to close this issue - I guess it will be closed for inactivity if no-one else weighs in.

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

No branches or pull requests

3 participants