Commit cb946dca authored by Richard Hughes's avatar Richard Hughes
Browse files

Add a plugin to disable updates when running on a Fedora LiveUSB image

parent f25e062a
......@@ -158,6 +158,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_external-appstream.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fedora-distro-upgrades.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fedora-tagger-usage.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fedora-liveusb.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_flatpak-system.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_flatpak-user.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fwupd.so
......
......@@ -42,6 +42,7 @@ plugin_LTLIBRARIES = \
libgs_plugin_hardcoded-popular.la \
libgs_plugin_hardcoded-featured.la \
libgs_plugin_fedora-distro-upgrades.la \
libgs_plugin_fedora-liveusb.la \
libgs_plugin_provenance.la \
libgs_plugin_provenance-license.la \
libgs_plugin_repos.la \
......@@ -161,6 +162,11 @@ libgs_plugin_fedora_distro_upgrades_la_LIBADD = $(GS_PLUGIN_LIBS) $(JSON_GLIB_LI
libgs_plugin_fedora_distro_upgrades_la_LDFLAGS = -module -avoid-version
libgs_plugin_fedora_distro_upgrades_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(JSON_GLIB_CFLAGS) $(WARN_CFLAGS)
libgs_plugin_fedora_liveusb_la_SOURCES = gs-plugin-fedora-liveusb.c
libgs_plugin_fedora_liveusb_la_LIBADD = $(GS_PLUGIN_LIBS) $(JSON_GLIB_LIBS) $(SOUP_LIBS)
libgs_plugin_fedora_liveusb_la_LDFLAGS = -module -avoid-version
libgs_plugin_fedora_liveusb_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(JSON_GLIB_CFLAGS) $(WARN_CFLAGS)
if HAVE_GUDEV
libgs_plugin_modalias_la_SOURCES = gs-plugin-modalias.c
libgs_plugin_modalias_la_LIBADD = $(GS_PLUGIN_LIBS) $(GUDEV_LIBS)
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2016 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <config.h>
#include <gnome-software.h>
void
gs_plugin_initialize (GsPlugin *plugin)
{
if (!gs_plugin_check_distro_id (plugin, "fedora"))
gs_plugin_set_enabled (plugin, FALSE);
}
gboolean
gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
g_autofree gchar *data = NULL;
if (!g_file_get_contents ("/proc/cmdline", &data, NULL, error)) {
g_prefix_error (error, "failed to get kernel command line: ");
return FALSE;
}
g_debug ("kernel command line: %s", data);
if (g_strstr_len (data, -1, "root=live") != NULL)
gs_plugin_set_allow_updates (plugin, FALSE);
return TRUE;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment