app: Define a special exit code for no changes (77)
Used by upgrade and deploy to allow scripts to test for changes.
This commit is contained in:
parent
a555af0050
commit
1c01141e0c
@ -103,6 +103,12 @@ Boston, MA 02111-1307, USA.
|
|||||||
any changes to take
|
any changes to take
|
||||||
effect.</para>
|
effect.</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In addition to exit status 0 for success and 1 for error, this
|
||||||
|
command also uses exit status 77 to indicate that no upgrade is
|
||||||
|
available.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<command>--reboot</command> or <command>-r </command> to initiate a reboot after upgrade is prepared.
|
<command>--reboot</command> or <command>-r </command> to initiate a reboot after upgrade is prepared.
|
||||||
</para>
|
</para>
|
||||||
@ -162,6 +168,12 @@ Boston, MA 02111-1307, USA.
|
|||||||
its SHA256 checksum, or by its "version" metadata value.
|
its SHA256 checksum, or by its "version" metadata value.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In addition to exit status 0 for success and 1 for error, this
|
||||||
|
command also uses exit status 77 to indicate that no deployment
|
||||||
|
change occurred.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<option>--reboot</option> or <option>-r</option> to initiate a
|
<option>--reboot</option> or <option>-r</option> to initiate a
|
||||||
reboot after the downloaded tree is prepared.
|
reboot after the downloaded tree is prepared.
|
||||||
|
@ -145,12 +145,24 @@ rpmostree_builtin_deploy (int argc,
|
|||||||
error))
|
error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (g_variant_n_children (result) == 0)
|
||||||
|
{
|
||||||
|
exit_status = RPM_OSTREE_EXIT_UNCHANGED;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
rpmostree_print_package_diffs (result);
|
rpmostree_print_package_diffs (result);
|
||||||
}
|
}
|
||||||
else if (!opt_reboot && default_deployment != NULL)
|
else if (!opt_reboot)
|
||||||
{
|
{
|
||||||
const char *sysroot_path;
|
const char *sysroot_path;
|
||||||
|
|
||||||
|
if (default_deployment == NULL)
|
||||||
|
{
|
||||||
|
exit_status = RPM_OSTREE_EXIT_UNCHANGED;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
|
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
|
||||||
|
|
||||||
if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path,
|
if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path,
|
||||||
|
@ -141,28 +141,32 @@ rpmostree_builtin_upgrade (int argc,
|
|||||||
error))
|
error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rpmostree_print_package_diffs (result);
|
if (g_variant_n_children (result) == 0)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* nothing changed */
|
|
||||||
if (default_deployment == NULL)
|
|
||||||
{
|
{
|
||||||
|
exit_status = RPM_OSTREE_EXIT_UNCHANGED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!opt_reboot)
|
|
||||||
|
rpmostree_print_package_diffs (result);
|
||||||
|
}
|
||||||
|
else if (!opt_reboot)
|
||||||
|
{
|
||||||
|
const char *sysroot_path;
|
||||||
|
|
||||||
|
if (default_deployment == NULL)
|
||||||
{
|
{
|
||||||
const char *sysroot_path;
|
exit_status = RPM_OSTREE_EXIT_UNCHANGED;
|
||||||
|
goto out;
|
||||||
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
|
|
||||||
|
|
||||||
if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path,
|
|
||||||
cancellable,
|
|
||||||
error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
g_print ("Run \"systemctl reboot\" to start a reboot\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
|
||||||
|
|
||||||
|
if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path,
|
||||||
|
cancellable,
|
||||||
|
error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
g_print ("Run \"systemctl reboot\" to start a reboot\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_status = EXIT_SUCCESS;
|
exit_status = EXIT_SUCCESS;
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
/* Exit code for no change after pulling commits.
|
||||||
|
* Use alongside EXIT_SUCCESS and EXIT_FAILURE. */
|
||||||
|
#define RPM_OSTREE_EXIT_UNCHANGED (77)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RPM_OSTREE_BUILTIN_FLAG_NONE = 0,
|
RPM_OSTREE_BUILTIN_FLAG_NONE = 0,
|
||||||
RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD = 1 << 0
|
RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD = 1 << 0
|
||||||
|
Loading…
Reference in New Issue
Block a user