#! /bin/sh

if [ "$1" = "--version" ]
then
cat << EOF
ccs-savepolicy 1.8.0

Copyright (C) 2005-2010 NTT DATA CORPORATION.

This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
EOF
elif [ "$1" = "--help" ]
then
cat << EOF
Usage: ccs-savepolicy [{-e|-d|-p|-m|-s|policy_dir} [remote_ip:remote_port]]

This program saves TOMOYO Linux's policy from kernel into files.

policy_dir : Use policy_dir rather than /etc/ccs/ directory.

remote_ip:remote_port : Read from ccs-editpolicy-agent listening at remote_ip:remote_port rather than /proc/ccs/ directory.

-e : Print /proc/ccs/exception_policy to stdout.

-d : Print /proc/ccs/domain_policy to stdout.

-p : Print /proc/ccs/profile to stdout.

-m : Print /proc/ccs/manager to stdout.

-s : Print /proc/ccs/stat to stdout.

Examples:

# ccs-savepolicy
 Save exception_policy.conf domain_policy.conf profile.conf and manager.conf .

# ccs-savepolicy -e
 Print /proc/ccs/exception_policy .

# ccs-savepolicy /etc/ccs/192.168.1.1/ 192.168.1.1:10000
 Receive policy from 192.168.1.1:10000 and save into /etc/ccs/192.168.1.1/ directory.

EOF
else
cat << EOF | help2man -i - -N -s 8 -n "Save TOMOYO Linux's policy" $0 | gzip -9 > man8/ccs-savepolicy.8.gz
[SEE ALSO]

 ccs-loadpolicy (8)
 ccs-editpolicy-agent (8)

[AUTHORS]

 penguin-kernel _at_ I-love.SAKURA.ne.jp

EOF
fi
exit 0
