Hello community,
here is the log from the commit of package transactional-update for
openSUSE:Factory checked in at 2020-08-05 20:25:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/transactional-update (Old)
and /work/SRC/openSUSE:Factory/.transactional-update.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "transactional-update"
Wed Aug 5 20:25:53 2020 rev:57 rq:823772 version:2.23
Changes:
--------
---
/work/SRC/openSUSE:Factory/transactional-update/transactional-update.changes
2020-07-29 17:15:59.964339031 +0200
+++
/work/SRC/openSUSE:Factory/.transactional-update.new.3592/transactional-update.changes
2020-08-05 20:25:56.595017046 +0200
@@ -1,0 +2,10 @@
+Fri Jul 31 16:11:04 UTC 2020 - Ignaz Forster <[email protected]>
+
+- Version 2.23
+ - Add "run" command to be able to execute a single command in a new snapshot
+ - Add "--drop-if-no-change" option to discard snapshots if no changes were
+ perfomed (BETA, required for Salt integration)
+ - Removed previous CaaSP Salt support (gh#openSUSE/transactional-update#33)
+ - Avoid "file not found" message on systems without /var subvol
+
+-------------------------------------------------------------------
Old:
----
transactional-update-2.22.tar.gz
New:
----
transactional-update-2.23.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ transactional-update.spec ++++++
--- /var/tmp/diff_new_pack.YBSbQX/_old 2020-08-05 20:25:57.763017416 +0200
+++ /var/tmp/diff_new_pack.YBSbQX/_new 2020-08-05 20:25:57.763017416 +0200
@@ -17,7 +17,7 @@
Name: transactional-update
-Version: 2.22
+Version: 2.23
Release: 0
Summary: Transactional Updates with btrfs and snapshots
License: GPL-2.0-or-later
++++++ transactional-update-2.22.tar.gz -> transactional-update-2.23.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/transactional-update-2.22/NEWS
new/transactional-update-2.23/NEWS
--- old/transactional-update-2.22/NEWS 2020-06-23 16:51:24.000000000 +0200
+++ new/transactional-update-2.23/NEWS 2020-07-31 18:08:35.000000000 +0200
@@ -2,6 +2,13 @@
Copyright (C) 2016-2019 Thorsten Kukuk et al.
+Version 2.23
+* Add "run" command to be able to execute a single command in a new snapshot
+* Add "--drop-if-no-change" option to discard snapshots if no changes were
+ perfomed (BETA, required for Salt integration)
+* Removed previous CaaSP Salt support
+* Avoid "file not found" message on systems without /var subvol
+
Version 2.22
* Use pkgconf to determine installation paths
* Enable SSL connections in update shell [boo#1149131]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/transactional-update-2.22/configure.ac
new/transactional-update-2.23/configure.ac
--- old/transactional-update-2.22/configure.ac 2020-06-23 16:51:24.000000000
+0200
+++ new/transactional-update-2.23/configure.ac 2020-07-31 18:08:35.000000000
+0200
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(transactional-update, 2.22)
+AC_INIT(transactional-update, 2.23)
AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr)
@@ -15,12 +15,10 @@
PKG_CHECK_VAR([UDEVDIR], [udev], [udevdir], [],
[AC_MSG_ERROR([Could not determine value for 'udevdir' - is the
'udev.pc' file installed?])])
-ISSUEDIR=${exec_prefix}/issue.d
UDEVRULESDIR=${UDEVDIR}/rules.d
LOGROTATEDDIR=${sysconfdir}/logrotate.d
AC_SUBST(TMPFILESDIR)
-AC_SUBST(ISSUEDIR)
AC_SUBST(UDEVRULESDIR)
AC_SUBST(SYSTEMDDIR)
AC_SUBST(DRACUTDIR)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/transactional-update-2.22/man/transactional-update.8.xml
new/transactional-update-2.23/man/transactional-update.8.xml
--- old/transactional-update-2.22/man/transactional-update.8.xml
2020-06-23 16:51:24.000000000 +0200
+++ new/transactional-update-2.23/man/transactional-update.8.xml
2020-07-31 18:08:35.000000000 +0200
@@ -226,6 +226,21 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>run</option> <replaceable>cmd</replaceable></term>
+ <listitem>
+ <para>
+ Execute the the command <replaceable>cmd</replaceable> inside
+ a new snapshot. By default this snaphot will remain, but if
+ <option>--drop-if-no-chage</option> is set, the new snapshot
+ will be dropped if there is no change in the file system.
+ </para>
+ <para>
+ This command consumes all the remaining parameters, so should
+ be placed the in the last position.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>shell</option></term>
<listitem>
<para>
@@ -420,6 +435,14 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--drop-if-no-change</option></term>
+ <term><option>-d</option></term>
+ <listitem>
+ <para>If the action does not produce a change in the underlying
+ file system, the snapshot will be dropped.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--quiet</option></term>
<listitem>
<para>Don't print warnings and informational messages to stdout.</para>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/transactional-update-2.22/man/transactional-update.conf.5.xml
new/transactional-update-2.23/man/transactional-update.conf.5.xml
--- old/transactional-update-2.22/man/transactional-update.conf.5.xml
2020-06-23 16:51:24.000000000 +0200
+++ new/transactional-update-2.23/man/transactional-update.conf.5.xml
2020-07-31 18:08:35.000000000 +0200
@@ -99,15 +99,6 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><literal>salt</literal></term>
- <listitem>
- <para>
- Will create a Salt grain for signaling Velum to reboot the
- system.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term><literal>rebootmgr</literal></term>
<listitem>
<para>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/transactional-update-2.22/sbin/transactional-update.in
new/transactional-update-2.23/sbin/transactional-update.in
--- old/transactional-update-2.22/sbin/transactional-update.in 2020-06-23
16:51:24.000000000 +0200
+++ new/transactional-update-2.23/sbin/transactional-update.in 2020-07-31
18:08:35.000000000 +0200
@@ -37,12 +37,13 @@
DO_ROLLBACK=0
DO_SELF_UPDATE=1
DO_REGISTRATION=0
+DO_RUN=0
REGISTRATION_ARGS=""
ROLLBACK_SNAPSHOT=0
REBOOT_AFTERWARDS=0
REBOOT_METHOD="auto"
+RUN_CMD=""
RUN_SHELL=0
-USE_SALT_GRAINS=0
USE_TELEMETRICS=0
TELEM_PAYLOAD="PACKAGE_NAME=transactional-update\nPACKAGE_VERSION=@VERSION@"
TELEM_CLASS=""
@@ -56,6 +57,8 @@
ZYPPER_AUTO_IMPORT_KEYS=0
ETC_OVERLAY_PATTERN='^[^[:space:]]\+[[:space:]]\+\/etc[[:space:]]\+overlay[[:space:]]\+\([^[:space:]]*,\|\)workdir=\/sysroot\/var\/lib\/overlay\/work-etc[,[:space:]]'
NON_ROOTFS_WHITELIST=("/var/lib/rpm" "/var/lib/systemd/migrated"
"/var/run/zypp.pid")
+DROP_IF_NO_CHANGE=0
+INOTIFY_EXCLUDES=""
# Load config
if [ -r ${SYSTEMCONFFILE} ]; then
@@ -78,6 +81,7 @@
TMPFILE=""
ETC_OVERLAY_DIR=""
ETC_OVERLAY_WORK_DIR=""
+INOTIFY_PID=""
# Create stderr alias for things that shouldn't be logged into logfile
if [ ! -e /proc/$$/fd/4 ]; then
@@ -128,6 +132,7 @@
echo "kdump Regenerate kdump initrd"
echo "shell Open rw shell in new snapshot before
exiting"
echo "reboot Reboot after update"
+ echo "run <cmd> Run a command in a new snapshot"
echo ""
echo "Package Commands:"
echo "Defaults: (i) interactive command; (n) non-interactive command"
@@ -148,6 +153,7 @@
echo "--non-interactive, -n Use non-interactive mode for package
command"
echo "--continue [<number>], -c Use latest or given snapshot as base"
echo "--no-selfupdate Skip checking for newer version"
+ echo "--drop-if-no-change, -d Drop the snapshot if there is no change"
echo "--quiet Don't print warnings and infos to stdout"
echo "--help, -h Display this help and exit"
echo "--version Display version and exit"
@@ -266,20 +272,6 @@
fi
rm -rf "${ETC_OVERLAY_DIR%/*}" |& tee -a ${LOGFILE}
fi
- if [ $USE_SALT_GRAINS -eq 1 ]; then
- if [ -f /etc/salt/grains ]; then
- grep -q tx_update_failed /etc/salt/grains
- if [ $? -ne 0 ]; then
- # Add variable to existing salt grains
- echo "tx_update_failed: true" >> /etc/salt/grains
- else
- # modify variable in existing salt grains
- sed -i -e 's|tx_update_failed:.*|tx_update_failed: true|g'
/etc/salt/grains
- fi
- else
- echo "tx_update_failed: true" > /etc/salt/grains
- fi
- fi
telem_finish $1
log_info "transactional-update finished"
exit $1
@@ -291,6 +283,14 @@
# Unset variable
unset TRANSACTIONAL_UPDATE
+ # Roll back snapshot if no changes were performed
+ if [ -n "${INOTIFY_PID}" ] && sync "${SNAPSHOT_DIR}" && ps -q
${INOTIFY_PID} 2>&1 >/dev/null; then
+ kill ${INOTIFY_PID}
+ log_info "The snapshot does not contain any changed files."
+ INOTIFY_PID=""
+ quit 0
+ fi
+
# Cleanup temporary files
rm -f ${TMPFILE}
@@ -346,34 +346,15 @@
rm -rf ${SNAPSHOT_DIR}/var/cache/*
fi
# Remove temporary mount point
- rmdir --ignore-fail-on-non-empty ${SNAPSHOT_DIR}/var/lib/ca-certificates
+ if [ -e ${SNAPSHOT_DIR}/var/lib/ca-certificates ]; then
+ rmdir --ignore-fail-on-non-empty ${SNAPSHOT_DIR}/var/lib/ca-certificates
+ fi
# systemd-tmpfiles creates directories/files even if /run is no tmpfs:
rm -rf ${SNAPSHOT_DIR}/run/*
# WARNING: /var/spool/ can contain changes through RPM!
rm -rf ${SNAPSHOT_DIR}/var/spool/*
}
-reboot_via_salt() {
- log_info "transactional-update finished - created salt grains"
- if [ -f /etc/salt/grains ]; then
- grep -q tx_update_reboot_needed /etc/salt/grains
- if [ $? -ne 0 ]; then
- # Add variable to existing salt grains
- echo "tx_update_reboot_needed: true" >> /etc/salt/grains
- else
- # modify variable in existing salt grains
- sed -i -e 's|tx_update_reboot_needed:.*|tx_update_reboot_needed:
true|g' /etc/salt/grains
- fi
- else
- echo "tx_update_reboot_needed: true" > /etc/salt/grains
- fi
- # Reset tx_update_failed if exist
- sed -i -e 's|tx_update_failed:.*|tx_update_failed: false|g'
/etc/salt/grains
- TELEM_PAYLOAD="${TELEM_PAYLOAD}\nreboot=salt"
- telem_finish 0
- exit 0
-}
-
reboot_via_rebootmgr() {
/usr/sbin/rebootmgrctl is-active --quiet
if [ $? -eq 0 ]; then
@@ -664,11 +645,18 @@
shift
fi
;;
- salt)
- REBOOT_AFTERWARDS=1
- USE_SALT_GRAINS=1
- REBOOT_METHOD="salt"
+ run)
+ test -z "$TELEM_CLASS" && TELEM_CLASS="shell"
+ DO_RUN=1
shift
+
+ # Collect arguments for run
+ if [ $# -eq 0 ]; then
+ usage 1
+ fi
+
+ RUN_CMD="$@"
+ break
;;
-i|--interactive)
ZYPPER_NONINTERACTIVE=""
@@ -692,6 +680,10 @@
DO_SELF_UPDATE=0
shift
;;
+ -d|--drop-if-no-change)
+ DROP_IF_NO_CHANGE=1
+ shift
+ ;;
--quiet)
VERBOSITY=1
shift
@@ -951,8 +943,8 @@
if [ -n "${ZYPPER_ARG}" -o ${REWRITE_GRUB_CFG} -eq 1 \
-o ${REWRITE_INITRD} -eq 1 -o ${REBUILD_KDUMP_INITRD} -eq 1 \
- -o ${RUN_SHELL} -eq 1 -o ${REWRITE_BOOTLOADER} -eq 1 \
- -o ${DO_REGISTRATION} -eq 1 ]; then
+ -o ${RUN_SHELL} -eq 1 -o ${DO_RUN} -eq 1 \
+ -o ${REWRITE_BOOTLOADER} -eq 1 -o ${DO_REGISTRATION} -eq 1 ]; then
if [ "${DEFAULT_SNAPSHOT_ID}" -ne "${BASE_SNAPSHOT_ID}" ]; then
log_info "WARNING: You are creating a snapshot from a different base
(${BASE_SNAPSHOT_ID}) than the"
@@ -1173,6 +1165,14 @@
mount -o rbind ${SNAPSHOT_DIR} ${MOUNT_DIR}
mount -o bind,ro /.snapshots ${MOUNT_DIR}/.snapshots
+ if [ $DROP_IF_NO_CHANGE -eq 1 ]; then
+ #TODO: Handle directories with special characters (space, newline,
apostrophe etc)
+ for snapmount in `findmnt --noheadings --submounts --target
"${SNAPSHOT_DIR}" --output TARGET --raw | grep "${SNAPSHOT_DIR}"`; do
+ INOTIFY_EXCLUDES="${INOTIFY_EXCLUDES} @${snapmount}"
+ done
+ INOTIFY_PID=$( ( inotifywait -r -e modify -e move -e create -e delete
-e attrib "${SNAPSHOT_DIR}" ${INOTIFY_EXCLUDES} 2>&1 & echo "PID: $!" ) | (
grep -m1 '^PID: ' | cut -d ' ' -f 2 && grep -q "Watches established" ) )
+ fi
+
# Set indicator for RPM pre/post sections to detect whether we run in a
# transactional update
export TRANSACTIONAL_UPDATE=true
@@ -1199,14 +1199,6 @@
TELEM_PAYLOAD="${TELEM_PAYLOAD}\npackages=${NUM_OF_UPDATES}\ndownload_size=${PACKAGE_UPDATES}\nspace-usage=${SIZE_OF_UPDATES}"
if [ "${NUM_OF_UPDATES}" = "0" ] || [ -z "${NUM_OF_UPDATES}" -a
"${PACKAGE_UPDATES}" = "0" -a "${SIZE_OF_UPDATES}" = "0" ]; then
log_info "zypper: nothing to update"
- if [ $USE_SALT_GRAINS -eq 1 ]; then
- log_info "Updating salt grains"
- if [ -f /etc/salt/grains ]; then
- # Reset tx_update_failed if it exists. Could have been
set due to wrong
- # repository configuration or another temporary error
before.
- sed -i -e 's|tx_update_failed:.*|tx_update_failed:
false|g' /etc/salt/grains
- fi
- fi
quit 0
fi
@@ -1284,6 +1276,10 @@
fi
fi
+ if [ ${DO_RUN} -eq 1 ]; then
+ chroot ${MOUNT_DIR} ${RUN_CMD}
+ fi
+
if [ ${RUN_SHELL} -eq 1 ]; then
echo "Opening chroot in snapshot ${SNAPSHOT_ID}, continue with 'exit'"
env PS1="transactional update # " chroot ${MOUNT_DIR} bash 2>&4
@@ -1374,9 +1370,6 @@
kured)
reboot_via_kured
;;
- salt)
- reboot_via_salt
- ;;
rebootmgr)
reboot_via_rebootmgr
;;