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

Implement system-upgrade plugin #1209

Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dnf5-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ add_subdirectory("config-manager_plugin")
add_subdirectory("copr_plugin")
add_subdirectory("needs_restarting_plugin")
add_subdirectory("repoclosure_plugin")
add_subdirectory("system_upgrade_plugin")
2 changes: 1 addition & 1 deletion dnf5-plugins/needs_restarting_plugin/needs_restarting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ class NeedsRestartingCommand : public Command {

} // namespace dnf5

#endif // DNF5_COMMANDS_CHANGELOG_HPP
#endif // DNF5_COMMANDS_NEEDS_RESTARTING_HPP
21 changes: 21 additions & 0 deletions dnf5-plugins/system_upgrade_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set(SYSTEMD_UNIT_DIR /usr/lib/systemd/system)

# set gettext domain for translations
add_definitions(-DGETTEXT_DOMAIN=\"dnf5_cmd_system_upgrade\")

file(GLOB SYSTEM_UPGRADE_SOURCES *.cpp)
add_library(system_upgrade_cmd_plugin MODULE ${SYSTEM_UPGRADE_SOURCES})

# disable the 'lib' prefix in order to create system_upgrade_cmd_plugin.so
set_target_properties(system_upgrade_cmd_plugin PROPERTIES PREFIX "")

pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++)

target_link_libraries(system_upgrade_cmd_plugin PRIVATE dnf5 libdnf5 libdnf5-cli ${SDBUS_CPP_LIBRARIES})

install(FILES "dnf5-system-upgrade.service" DESTINATION ${SYSTEMD_UNIT_DIR})
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${SYSTEMD_UNIT_DIR}/dnf5-system-upgrade.service
${SYSTEMD_UNIT_DIR}/system-update.target.wants/dnf5-system-upgrade.service)"
)
install(TARGETS system_upgrade_cmd_plugin LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/plugins/)
20 changes: 20 additions & 0 deletions dnf5-plugins/system_upgrade_plugin/dnf5-system-upgrade.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=System Upgrade using DNF 5
ConditionPathExists=/system-update
Documentation=https://www.freedesktop.org/wiki/Software/systemd/SystemUpdates

DefaultDependencies=no
Requires=sysinit.target
After=sysinit.target systemd-journald.socket system-update-pre.target
Before=poweroff.target reboot.target shutdown.target system-update.target
OnFailure=dnf-system-upgrade-cleanup.service

[Service]
# We are done when the script exits, not before
Type=oneshot
# Upgrade output goes to journal and on-screen.
StandardOutput=journal+console
ExecStart=/usr/bin/dnf5 system-upgrade upgrade

[Install]
WantedBy=system-update.target
Loading
Loading