Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 1440e6242361df72f40b4f39d1d05c10 > files > 37

elektra-0.7.0-3.fc13.x86_64.rpm

#!/bin/sh
# update-backend

# This Tool helps you to select another
# backend. Its in a very pre-alpha state,
# dont use it.

# Author: Markus Raab
# Licence: BSD

PATH="/bin"

DEBUG=echo
TMPFILE="/tmp/$$.kdb.xml"

if [ ! "$1" ]
then
	echo "Usage: $0 backend"
	exit 1
fi

if [ "$UID" != 0 ]
then
	echo "Only root can run this script"
	exit 2
fi

if [ ! -f "/lib/libelektra-$1.so" ]
then
	echo "Choosen backend not available"
	exit 3
fi

kdb export > "$TMPFILE"

if [ "$?" != 0 ]
then
	echo "Exporting was not possible"
	exit 4
fi

$DEBUG rm -f "/lib/libelektra-default.so"
$DEBUG ln -s "/lib/libelektra-$1.so" "/lib/libelektra-default.so"

kdb import < "$TMPFILE"

if [ "$?" != 0 ]
then
	echo "Warning: Import Configuration was not possible!"
	echo "Check $TMPFILE to fix the problem."
	exit 5
fi

$DEBUG rm "$TMPFILE"

echo "Installed new backend $1 successfully!"