Darryl L. Pierce
2009-Apr-08 19:33 UTC
[Ovirt-devel] [PATCH node] Provide a wrapper script for ovirt_store_config.
Files can be persisted using the persist command. Files can be unpersisted using the unpersist command. Both scripts are located in /usr/sbin. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- Makefile.am | 2 ++ ovirt-node.spec.in | 4 ++++ scripts/persist | 37 +++++++++++++++++++++++++++++++++++++ scripts/unpersist | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 0 deletions(-) create mode 100755 scripts/persist create mode 100755 scripts/unpersist diff --git a/Makefile.am b/Makefile.am index d60abe9..57eceb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,8 @@ EXTRA_DIST = \ scripts/ovirt-functions \ scripts/ovirt-install-node-stateful \ scripts/ovirt-install-node-stateless \ + scripts/persist \ + scripts/unpersist \ scripts/ovirt-post \ scripts/ovirt-process-config \ scripts/ovirt-uninstall-node-stateful \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 75fb56f..1a73066 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -158,6 +158,8 @@ cd - %{__install} -D -m0755 scripts/ovirt-install-node-stateful %{buildroot}%{_sbindir} %{__install} -D -m0755 scripts/ovirt-install-node-stateless %{buildroot}%{_sbindir} %{__install} -D -m0755 scripts/ovirt-uninstall-node-stateful %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir} %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir} %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake @@ -312,6 +314,8 @@ fi %{_sbindir}/ovirt-install-node-stateless %{_sbindir}/gptsync %{_sbindir}/showpart +%{_sbindir}/persist +%{_sbindir}/unpersist %{_initrddir}/ovirt-early %{_initrddir}/ovirt-firstboot %{_initrddir}/ovirt diff --git a/scripts/persist b/scripts/persist new file mode 100755 index 0000000..85a022e --- /dev/null +++ b/scripts/persist @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (C) 2009, Red Hat, Inc. +# Written by Darryl L. Pierce <dpierce at redhat.com> +# +# 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; version 2 of the License. +# +# 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. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. +# +# Convenience wrapper to give access to the ovirt_store_config +# function in /etc/init.d/ovirt-functions + +. /etc/init.d/ovirt-functions + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +help() { printf "Usage: $ME FILE ...\n +Copies the specified file to /config and then bindmounts it back at it's original location. +The file is stored with its full path detail.\n\n" >&2; exit 1; +} +die() { warn "$*"; help; exit 1; } + +if [ $# -eq 0 ]; then die "You need to specify at least one file."; fi + +ovirt_store_config $* + diff --git a/scripts/unpersist b/scripts/unpersist new file mode 100755 index 0000000..cef0d36 --- /dev/null +++ b/scripts/unpersist @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Copyright (C) 2009, Red Hat, Inc. +# Written by Darryl L. Pierce <dpierce at redhat.com> +# +# 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; version 2 of the License. +# +# 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. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. +# +# Convenience wrapper to give access to the ovirt_store_config +# function in /etc/init.d/ovirt-functions + +. /etc/init.d/ovirt-functions + +ME=$(basename "$0") +warn() { printf '%s: %s\n' "$ME" "$*" >&2; } +help() { printf "Usage: $ME FILE ...\n +Unpersists a previous persisted file, removing it from /config. +The file is restored to its original location.\n\n" >&2; exit 1; +} +die() { warn "$*"; help; exit 1; } + +if [ $# -eq 0 ]; then die "You need to specify at least one file."; fi + +unmount_config $* + -- 1.6.0.6