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

realtek-poe: build default config from board.json #25551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hurricos
Copy link
Contributor

Maintainer: me
Compile tested: (not yet)
Run tested: (not yet)

This adjustment makes a compromise between those that would prefer not to complicate the realtek-poe.git source repository and those who want to have PoE work out-of-the-box on Realtek switches -- see realtek-poe.git, commit 2df137ee457155 ("realtek-poe/openwrt: Generate config from board.json")

Switches previously booted with OpenWrt will have an /etc/config/poe file already present, and thus the uci-default shall not take effect.

@Hurricos
Copy link
Contributor Author

@howels @mrnuke @blogic

$(INSTALL_BIN) $(PKG_BUILD_DIR)/realtek-poe $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/init.d/poe $(1)/etc/init.d/
$(INSTALL_CONF) $(PKG_BUILD_DIR)/files/etc/config/poe $(1)/etc/config/
$(CP) ./files/etc/uci-defaults/30-poe $(1)/etc/uci-defaults/30-poe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use some sort of INSTALL_ macro, so that the file is installed with the correct permissions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled the behavior from libreswan, but yeah, there are certainly newer changesets showing the use of the INSTALL_BIN macro -- e.g. commit 3219c50.

Adjusting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with the push of bb0fb2b.

This adjustment makes a compromise between those that would prefer not
to complicate the realtek-poe.git source repository and those who want
to have PoE work out-of-the-box on Realtek switches -- see
realtek-poe.git, commit 2df137ee457155 ("realtek-poe/openwrt: Generate
config from board.json")

Switches previously booted with OpenWrt will have an /etc/config/poe
file already present, and thus the uci-default shall not take effect.

Signed-off-by: Martin Kennedy <[email protected]>
@Hurricos Hurricos force-pushed the realtek-poe-add_config_to_packages branch from 6d9ff0f to bb0fb2b Compare December 13, 2024 22:02
$(INSTALL_BIN) $(PKG_BUILD_DIR)/realtek-poe $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/init.d/poe $(1)/etc/init.d/
$(INSTALL_CONF) $(PKG_BUILD_DIR)/files/etc/config/poe $(1)/etc/config/
$(INSTALL_BIN) ./files/etc/uci-defaults/30-poe $(1)/etc/uci-defaults/30-poe
endef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The poe-common package also added a section to mark the config file as such. I don't quite remember what this means in terms of behaviour on upgrades etc, and I can't really find much documentation either.

define Package/poe-common/conffiles
/etc/config/poe
endef

From the opkg code, I think this results in detecting that the file exists and has been "modified" (created), thus doing The Right Thing (creating backup etc.) on package upgrades. I think the old package would just blindly replace the edited poe config file on upgrades. The uci-defaults script would do the same though, and won't touch the file if it already exists.

Hopefully this also means the config file is put in the config backup automatically on system upgrades, but you may have to check this.

@BKPepe
Copy link
Member

BKPepe commented Dec 14, 2024

Don't forget to bump PKG_RELEASE.

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

Successfully merging this pull request may close these issues.

5 participants