Skip to content

Commit

Permalink
Merge branch '4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
laenion committed Mar 22, 2022
2 parents 92fc42a + 28b730d commit 4cb495b
Show file tree
Hide file tree
Showing 38 changed files with 1,254 additions and 213 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ test-driver
test-suite.log
check-output.*
tukit.pc
tukitd
sbin/transactional-update
src/transactional-update
systemd/transactional-update.service
systemd/transactional-update-cleanup.service
man/transactional-update.8
man/transactional-update.service.8
man/transactional-update.timer.8
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
AUTOMAKE_OPTIONS = 1.6 foreign check-news dist-xz
#
SUBDIRS = lib tukit sbin man systemd logrotate dracut doc etc
SUBDIRS = lib tukit dbus sbin man systemd logrotate dracut doc etc

CLEANFILES = *~ tukit.pc

Expand Down
31 changes: 31 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@ transactional-update NEWS -- history of user-visible changes.

Copyright (C) 2016-2021 Thorsten Kukuk, Ignaz Forster et al.

Version 4.0.0~rc2
* Fix missing prompt in "shell" command [bsc#1196580]
* Add output of tukit commands to log file
* Fix compilation error with GCC12 [boo#1194876]
* Fixed (non-critical) security review comments [boo#1196149]
* Fixed selfupdate
* Code cleanup

Version 4.0.0~rc1
This release is API, but not ABI compatible with previous releases;
existing applications will have to be recompiled against this new
version.
Major features:
* Introduces a D-Bus service to access the libtukit API via the
org.opensuse.tukit.Transaction interface
* Introduces a C binding via libtukit.h.
Other changes:
* t-u: Rework --quiet handling to make sure no output is shown even in
error cases; this is necessary for automation, e.g. with Salt.
[gh#openSUSE/transactional-update#73]
* tukit: Allow storing command output into variable by introducing a new
optional parameter for "execute" and "callExt".
* Replace multiple and non-standalone occurenses of {} in "callExt"
argument.
* Split transactional-update.timer into transactional-update.timer
and transactional-update-cleanup.timer; the later will clean up
old snapshots even when the system does not do automatic updates.
* tukit: Remove legacy alias "setDiscard" for "setDiscardIfUnchanged".
* Throw exception if snapshot is not found.
* Fix various compiler warnings

Version 3.6.2
* Bind mount root file system snapshot on itself, this makes the
temporary directory in /tmp unnecessary; also fixes [boo#1188110]
Expand Down
48 changes: 33 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(transactional-update, 3.6.2)
AC_INIT(transactional-update, 4.0.0~rc2)
# Increase on any interface change and reset revision
LIBTOOL_CURRENT=3
LIBTOOL_CURRENT=4
# Increase or reset on any VERSION update
LIBTOOL_REVISION=7
LIBTOOL_REVISION=0
# Increase if interface change is backwards compatible, reset otherwise
LIBTOOL_AGE=3
LIBTOOL_AGE=0
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_FILES([tukit.pc])
Expand All @@ -25,15 +25,23 @@ PKG_CHECK_VAR([DRACUTDIR], [dracut], [dracutmodulesdir], [],
[AC_MSG_ERROR([Could not determine value for 'dracutmodulesdir' - is the 'dracut.pc' file installed?])])
PKG_CHECK_VAR([UDEVDIR], [udev], [udevdir], [],
[AC_MSG_ERROR([Could not determine value for 'udevdir' - is the 'udev.pc' file installed?])])
PKG_CHECK_VAR([DBUSDATADIR], [dbus-1], [datadir], [],
[AC_MSG_ERROR([Could not determine value for 'datadir' - is the 'dbus-1.pc' file installed?])])
PKG_CHECK_VAR([DBUSSYSTEMBUSSERVICEDIR], [dbus-1], [system_bus_services_dir], [],
[AC_MSG_ERROR([Could not determine value for 'system_bus_services_dir' - is the 'dbus-1.pc' file installed?])])

UDEVRULESDIR=${UDEVDIR}/rules.d
LOGROTATEDDIR=${sysconfdir}/logrotate.d
DBUSCONFDIR=${DBUSDATADIR}/dbus-1/system.d

AC_SUBST(TMPFILESDIR)
AC_SUBST(UDEVRULESDIR)
AC_SUBST(SYSTEMDDIR)
AC_SUBST(SYSTEMDSYSTEMCONFDIR)
AC_SUBST(DRACUTDIR)
AC_SUBST(LOGROTATEDDIR)
AC_SUBST(DBUSCONFDIR)
AC_SUBST(DBUSSYSTEMBUSSERVICEDIR)

AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_17(, mandatory)
Expand All @@ -47,11 +55,20 @@ PKG_CHECK_MODULES([SELINUX], [libselinux])
PKG_CHECK_MODULES([LIBMOUNT], [mount])
PKG_CHECK_MODULES([LIBRPM], [rpm >= 4.15], AC_DEFINE([HAVE_RPMDBCOOKIE]),
[PKG_CHECK_MODULES([LIBRPM], [rpm])])
PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd])

AC_ARG_WITH([doc],
[AS_HELP_STRING([--with-doc], [Build documentation])], ,
[enable_man=yes])

dnl
dnl Checking for pthread support
dnl
m4_ifdef([AX_PTHREAD],
[AX_PTHREAD],
[AC_MSG_ERROR([Missing macro AX_PTHREAD: please install
autoconf-archive to enable pthreads checks.])])

dnl
dnl Check for xsltproc
dnl
Expand All @@ -65,6 +82,17 @@ JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.3//EN],
[DocBook XML DTD V4.3], [], enable_man=no)
JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
[DocBook XSL Stylesheets], [], enable_man=no)
AC_PATH_PROG([BROWSER], [w3m])
if test ! -z "$BROWSER"; then
BROWSER="$BROWSER -T text/html -dump"
else
AC_PATH_PROG([BROWSER], [elinks])
if test ! -z "$BROWSER"; then
BROWSER="$BROWSER -no-numbering -no-references -dump"
else
enable_man=no
fi
fi

m4_ifdef([AX_PYTHON_MODULE],
[AX_PYTHON_MODULE([lxml])],
Expand All @@ -80,16 +108,6 @@ AS_IF([test "x$enable_man" = "xno" -a "x$with_doc" != "xno"],
AM_CONDITIONAL(ENABLE_REGENERATE_MAN,
test "x$enable_man" != "xno" -a "x$with_doc" != "xno")

AC_PATH_PROG([BROWSER], [w3m])
if test ! -z "$BROWSER"; then
BROWSER="$BROWSER -T text/html -dump"
else
AC_PATH_PROG([BROWSER], [links])
if test ! -z "$BROWSER"; then
BROWSER="$BROWSER -no-numbering -no-references -dump"
fi
fi

AC_OUTPUT([Makefile lib/Makefile tukit/Makefile sbin/Makefile man/Makefile \
systemd/Makefile logrotate/Makefile dracut/Makefile doc/Makefile \
etc/Makefile sbin/transactional-update])
etc/Makefile dbus/Makefile sbin/transactional-update])
16 changes: 16 additions & 0 deletions dbus/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2020 Ignaz Forster <[email protected]>
#

sbin_PROGRAMS = tukitd
tukitd_SOURCES = tukitd.c
tukitd_CPPFLAGS = -I $(top_srcdir)/lib $(LIBSYSTEMD_CFLAGS) $(PTHREAD_CFLAGS)
tukitd_LDFLAGS = $(top_builddir)/lib/libtukit.la $(LIBSYSTEMD_LIBS) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
dbusconfdir = @DBUSCONFDIR@
dbusconf_DATA = org.opensuse.tukit.conf
dbussystembusservicedir = @DBUSSYSTEMBUSSERVICEDIR@
dbussystembusservice_DATA = tukitd.d-bus.service
systemdsystemunitdir = @SYSTEMDDIR@
systemdsystemunit_DATA = tukitd.service

EXTRA_DIST = $(DATA)
114 changes: 114 additions & 0 deletions dbus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Tukit DBUS Service
The tukitd service provides an DBUS interface which supports the same functionality as
the command line interface "tukit".

## Starting/Stopping Servive
### Starting
The service will be started automatically with the first DBUS call, e.g.
> busctl introspect org.opensuse.tukit /org/opensuse/tukit/Transaction
The status can also be checked via
> systemctl start tukitd.service
### Stopping
This `systemctl` call stops the service:
> systemctl stop tukitd.service
## DBUS API
The following sections describe each call which is available via DBUS.
The command line program `busctl` can be used for demonstrating the API calls
and showing the results.

### Transaction

#### open
Creates a new transaction and returns its unique ID.

Parameter:
* base - Snapshot ID (string), "active" or "default". Base can be "active" to base the
snapshot on the currently running system, "default" to the current default snapshot as a base
(which may or may not be identical to "active") or any specific existing snapshot id.
If base is not set (emtpy string) "active" will be used as the default.

Return value:
* unique ID (string)

Signal:
* TransactionOpened

`busctl` example:

> busctl call org.opensuse.tukit /org/opensuse/tukit/Transaction org.opensuse.tukit.Transaction open "s" "default"
### call
Executes the given command from within the transaction's **chroot environment**, resuming the
transaction with the given ID; returns the exit status and the result of the given command.
In case of errors the snapshot will not be deleted.

Parameter:
* unique ID (string)
* command (string)

Return value:
None

Signal:
* CommandExecuted - As this may be a long running operation, the results of the command are
returned via signal only.

`busctl` example:

* call `ls` in open transaction with ID `536`:
> busctl call org.opensuse.tukit /org/opensuse/tukit/Transaction org.opensuse.tukit.Transaction call "ss" "536" "bash -c 'ls'"
The returned signal can be monitored by:
> busctl --system --match "path\_namespace='/org/opensuse/tukit'" monitor
### callext
Executes the given command. The command is **not** executed in a **chroot environment**, but instead runs
in the current system, replacing '{}' with the mount directory of the given snapshot.
In case of errors the snapshot will not be deleted.

Parameter:
* unique ID (string)
* command (string)

Return value:
None

Signal:
* CommandExecuted - As this may be a long running operation, the results of the command are
returned via signal only.

`busctl` example:

* copy file from active system into transaction with ID `536`:
> busctl call org.opensuse.tukit /org/opensuse/tukit/Transaction org.opensuse.tukit.Transaction callext "ss" "536" "bash -c 'mv /tmp/mylib {}/usr/lib'"
The returned signal can be monitored by:
> busctl --system --match "path\_namespace='/org/opensuse/tukit'" monitor
### close
Closes the given transaction and sets the snapshot as the new default snapshot.

Parameter:
* unique ID (string)

Return value:
* return integer; 0 on success

`busctl` Example:

> busctl call org.opensuse.tukit /org/opensuse/tukit/Transaction org.opensuse.tukit.Transaction close "s" "420"
### abort
Deletes the given snapshot.

Parameter:
* unique ID (string)

Return value:
* return integer; 0 on success

`busctl` Example:

> busctl call org.opensuse.tukit /org/opensuse/tukit/Transaction org.opensuse.tukit.Transaction abort "s" "420"
8 changes: 8 additions & 0 deletions dbus/org.opensuse.tukit.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.opensuse.tukit"/>
<allow send_destination="org.opensuse.tukit" send_interface="org.opensuse.tukit.Transaction"/>
<allow send_destination="org.opensuse.tukit" send_interface="org.freedesktop.DBus.Introspectable"/>
</policy>
</busconfig>
Loading

0 comments on commit 4cb495b

Please sign in to comment.