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

WIP: Initial fan2go package release 0.9.0. #6456

Closed
wants to merge 1 commit into from

Conversation

dongfengweixiao
Copy link

Description

Hi everyone, this is my first attempt at creating a package for the Synology system.

During the process, I encountered many issues. I have managed to resolve some of them.

Q1: The command install -m 644 $(GO_SRC_DIR)/fan2go.yaml $(STAGING_INSTALL_PREFIX)/etc/fan2go/fan2go.yaml.example is used to copy the example configuration file from the source code to /etc/fan2go/fan2go.yaml.example. As this configuration file is a sample, users need to customize it to their requirements. After installing the software package, what are some effective ways for ordinary users to copy this file and make the necessary modifications to rename it as fan2go.yaml?

Q2: The command is executed as /usr/bin/fan2go -c /etc/fan2go/fan2go.yaml --no-style. How can I ensure that this command runs when the “Start” button is clicked (in fact, I’m unsure how to correctly specify the path to fan2go after the package installation)? Additionally, when the “Stop” button is clicked, what is the method to stop the command?

Checklist

  • Build rule all-supported completed successfully
  • New installation of package completed successfully
  • Package upgrade completed successfully (Manually install the package again)
  • Package functionality was tested
  • Any needed documentation is updated/created

Type of change

  • Bug fix
  • New Package
  • Package update
  • Includes small framework changes
  • This change requires a documentation update (e.g. Wiki)

@hgy59
Copy link
Contributor

hgy59 commented Feb 17, 2025

@th0ma7 #6437 has broken the build of non python packages.

This one is a pure go package, withtout python dependencies.
The build worked before update to current master (i.e. without changes of #6437)

===>  Installing for fan2go
find /github/workspace/spk/fan2go/work-x64-7.1/install//var/packages/fan2go/target/../ \! -type d -printf '%P\n' | sed 's?^target/??g' | sort > /github/workspace/spk/fan2go/work-x64-7.1/fan2go.plist.tmp
install -m 755 -d /github/workspace/spk/fan2go/work-x64-7.1/install/var/packages/fan2go/target/bin
install -m 755 /github/workspace/spk/fan2go/work-x64-7.1/fan2go-0.9.0/fan2go /github/workspace/spk/fan2go/work-x64-7.1/install/var/packages/fan2go/target/bin/fan2go
install -m 755 -d /github/workspace/spk/fan2go/work-x64-7.1/install/var/packages/fan2go/target/etc/fan2go
install -m 644 /github/workspace/spk/fan2go/work-x64-7.1/fan2go-0.9.0/fan2go.yaml /github/workspace/spk/fan2go/work-x64-7.1/install/var/packages/fan2go/target/etc/fan2go/fan2go.yaml.example
find /github/workspace/spk/fan2go/work-x64-7.1/install//var/packages/fan2go/target/..// \! -type d -printf '%P\n' | sed 's?^target/??g' | sort | \
  diff /github/workspace/spk/fan2go/work-x64-7.1/fan2go.plist.tmp -  | grep '>' | sed 's?> ??g' > /github/workspace/spk/fan2go/work-x64-7.1/fan2go.plist
make[3]: Leaving directory '/github/workspace/cross/fan2go'
===>  Processing wheel for fan2go
make[2]: *** [../../mk/spksrc.wheel-install.mk:72: install_python_wheel] Error 1
make[2]: Leaving directory '/github/workspace/spk/fan2go'
make[1]: *** [../../mk/spksrc.supported.mk:74: build-arch-x64-7.1] Error 1
make[1]: Leaving directory '/github/workspace/spk/fan2go'
make: Leaving directory '/github/workspace/spk/fan2go'

@th0ma7
Copy link
Contributor

th0ma7 commented Feb 17, 2025

This adds to @mreid-tt info provided earlier. I'll look at it tonight and hopefully will be able to work on a fix in no time 🤞.

@hgy59
Copy link
Contributor

hgy59 commented Feb 17, 2025

@dongfengweixiao Suggestions to answer your questions Q1 and Q2

  • please install the file fan2go.yaml.example to the folder $(STAGING_INSTALL_PREFIX_VAR) instead of $(STAGING_INSTALL_PREFIX)/etc/fan2go
    the var folder is handled by the generic installation code of spksrc packages (and etc folder is not available on DSM < 7)
  • you have to provide a real fan2go.yaml file and install it to the var folder. This is provided in the spk/fan2go and not in the cross/fan2go build
    • create spk/fan2go/src/fan2go.yml
    • adjust the yml file with spk package specific configuration: dbPath: "/var/packages/fan2go/var/fan2go.db"
    • update to ports in the yml file (ports are predefined and not customizable be the user and must be unique over all synocommunity and synology packages) (only needed if related functions are enabled: statistics, api, profiling)
    • didn't find any configuration of the log file
    • may be there are other diskstation specific default values to set?
  • you have to create a service-setup.sh file to define the SERVICE_COMMAND to run the service with at least a command line argument for the config file (e.g. $(SYNOPKG_PKGDEST/bin/fan2go -c $(SYNOPKG_PKGVAR)/fan2go.yaml --no-style)
  • add SERVICE_SETUP = src/service-setup.sh to spk/fan2go/Makefile
  • and add SERVICE_USER = auto
  • if the package provides a web page on a specific port add: SERVICE_PORT = {webpageport}

To chose free ports for a package please use the wiki pages Ports by Synology and Ports by SynoCommunity packages and finally add your package in the later.

If it is not possible to provide a general-purpose configuration, consider adding an installation wizard for customization.

@hgy59 hgy59 added the new-package PR/WIP for a new package label Feb 17, 2025
@dongfengweixiao dongfengweixiao force-pushed the fan2go branch 2 times, most recently from 19ad964 to 380c643 Compare February 18, 2025 05:17
@dongfengweixiao
Copy link
Author

It seems that directly using the built-in fan2go.yaml is not a good idea because the hardware configuration of each device is different. Currently, fan2go cannot provide a unified configuration for use. Users need to execute the command fan2go detect and create their own configuration file based on its output, which may require reminding users in some way during the package installation process.

Additionally, there is a bigger issue: writing to hwmon requires root privileges, and I don't know how to obtain them.

@dongfengweixiao
Copy link
Author

It seems that directly using the built-in fan2go.yaml is not a good idea because the hardware configuration of each device is different. Currently, fan2go cannot provide a unified configuration for use. Users need to execute the command fan2go detect and create their own configuration file based on its output, which may require reminding users in some way during the package installation process.

Additionally, there is a bigger issue: writing to hwmon requires root privileges, and I don't know how to obtain them.

create a new group named hwmon and use udev manage it maybe a good idea, let me try it!

@th0ma7
Copy link
Contributor

th0ma7 commented Feb 18, 2025

Have a look at the Synology package development guide, there may be howto with regards to udev.

Otherwise i recall i did something in the synocli-kernel package where, using a script, i would push new rule files into the udev directory, probably using a symbolic link or similar. Although such option requires root and documenting howto in the wiki as root access is not feasible unless called manuelly using sudo or other means.

@dongfengweixiao
Copy link
Author

Have a look at the Synology package development guide, there may be howto with regards to udev.

Otherwise i recall i did something in the synocli-kernel package where, using a script, i would push new rule files into the udev directory, probably using a symbolic link or similar. Although such option requires root and documenting howto in the wiki as root access is not feasible unless called manuelly using sudo or other means.

Yes, I tested the relevant code and was unable to copy the rules file to the udev directory and execute udevadm control --reload-rules during package installation or program startup.

@dongfengweixiao
Copy link
Author

dongfengweixiao commented Feb 19, 2025

Is it permissible to invoke SimplePermissionManager within the spksrc repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-package PR/WIP for a new package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants