####For future me.####

copy latest refpolicy in refpolicy directory.

just run this command 

$./comment_optional_policy.sh

it will comment optional policy and make files anew in segatex-version/refpolicy/policy/modules/files.

now you copy segatex-version/refpolicy/policy/modules/files to segatex-version/policy/

then you install segatex anew.
this means refpolicy files are successfully replaced in the /usr/share/segatex, so, you should first install your latest version. 
##################delete this line
read sqlrefpolicy_howto and do what it says
##################end delete this line

1
make all.if file by catting all .if files.
You may do this in policy directory where all .if files reside.
do this
for example, if you downloaded segatex in your home directory,

$ ~/segatex-version/policy/*.if > ~/segatex-version

2
first break all the .if files in /usr/share/segatex/raw_if_files by breakif.sh
$su
#cd /usr/share/segatex/raw_if_files
#./breakif.sh 

3

cd /usr/share/segatex/raw_if_files
# sqlite3 sqlrefpolicy.db
# sqlite> .show
# sqlite> create table layer_if_file_interface_name_target_domain_object_class_permissions (no integer primary key,layer varchar(30),if_file varchar(100),interface_name varchar(200),target_domain varchar(200),object_class varchar(200),permissions varchar(2000));
# sqlite> .table
# sqlite> .exit
#
# 4
#
#  copy ./admin/sqlrefpolicy_prepare.sh files to /usr/share/segatex/raw_if_files
#
#  5
#
#  # setenforce 0
#
#  excecute scripts.
#  needs editing some on last file.
after excecuting 7 sh files, you will get sqlrefpolicy.db in /usr/share/segatex/raw_if_files.
#
#  # setenforce 1
#
#######################explanation######################################################
you should run 7prepare scripts before you go on breaking .te and .if files.
##you need to setenforce 0 when you run the script, so, you had better disconnect your network.
after excecuting 7 sh files, you will get sqlrefpolicy.db.
##setenforce 1 and connect your network.
########################################################################################

then you should copy sqlrefpolicy.db to segatex-version directory and make .tar file one more time.

release new segatex version.

you can now break .te or .if files successfully.
