Commit b997905c authored by Kirill Smelkov's avatar Kirill Smelkov

X Handy script to set or show partition IPv6 address in slapproxy settings

parent 23ec2a4b
#!/bin/bash -e
# set or show partition IPv6 address in slapproxy settings
die() {
echo "$*" 1>&2
exit 1
}
usage() {
die "Usage: slapproxy-slappart-ipv6 <proxy.db> <slappart> [<ipv6>]"
}
test $# -ge 2 || usage
proxydb=$1
slappart=$2
ipv6=$3
# slappart_get_ipv6 <slappart> -> ipv6
slappart_get_ipv6() {
sqlite3 $proxydb \
"SELECT address FROM partition_network11 WHERE netmask='ffff:ffff:ffff::' AND partition_reference='$1' ;"
}
# slappart_set_ipv6 <slappart> <ipv6>
slappart_set_ipv6() {
sqlite3 $proxydb \
"UPDATE partition_network11 SET address='$2' WHERE netmask = 'ffff:ffff:ffff::' AND partition_reference='$1' ;"
}
ipv6_old=`slappart_get_ipv6 $slappart`
if test -n "$ipv6"; then
slappart_set_ipv6 $slappart $ipv6
ipv6_new=`slappart_get_ipv6 $slappart`
test $ipv6 = $ipv6_new || die "assert: $ipv6 = $ipv6_new"
echo -e "$slappart:\t$ipv6_old\t-> $ipv6_new"
else
echo -e "$slappart:\t$ipv6_old"
fi
Markdown is supported
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