| | 2 | |
|---|
| | 3 | ######################################## |
|---|
| | 4 | ## <summary> |
|---|
| | 5 | ## Create a file type used for init scripts. |
|---|
| | 6 | ## </summary> |
|---|
| | 7 | ## <desc> |
|---|
| | 8 | ## <p> |
|---|
| | 9 | ## Create a file type used for init scripts. |
|---|
| | 10 | ## Can not be used in conjunction with |
|---|
| | 11 | ## init_script_domain(). |
|---|
| | 12 | ## </p> |
|---|
| | 13 | ## </desc> |
|---|
| | 14 | ## <param name="script_file"> |
|---|
| | 15 | ## <summary> |
|---|
| | 16 | ## Type of the script file used as an entry point to this domain. |
|---|
| | 17 | ## </summary> |
|---|
| | 18 | ## </param> |
|---|
| | 19 | # |
|---|
| | 20 | interface(`init_script_file',` |
|---|
| | 21 | gen_require(` |
|---|
| | 22 | type initrc_t; |
|---|
| | 23 | attribute init_script_file_type, init_run_all_scripts_domain; |
|---|
| | 24 | ') |
|---|
| | 25 | |
|---|
| | 26 | typeattribute $1 init_script_file_type; |
|---|
| | 27 | |
|---|
| | 28 | domain_entry_file(initrc_t, $1) |
|---|
| | 29 | |
|---|
| | 30 | domtrans_pattern(init_run_all_scripts_domain, $1, initrc_t) |
|---|
| | 31 | ') |
|---|
| | 32 | |
|---|
| | 33 | ######################################## |
|---|
| | 34 | ## <summary> |
|---|
| | 35 | ## Create a domain used for init scripts. |
|---|
| | 36 | ## </summary> |
|---|
| | 37 | ## <desc> |
|---|
| | 38 | ## <p> |
|---|
| | 39 | ## Create a domain used for init scripts. |
|---|
| | 40 | ## Can not be used in conjunction with |
|---|
| | 41 | ## init_script_file(). |
|---|
| | 42 | ## </p> |
|---|
| | 43 | ## </desc> |
|---|
| | 44 | ## <param name="domain"> |
|---|
| | 45 | ## <summary> |
|---|
| | 46 | ## Type to be used as an init script domain. |
|---|
| | 47 | ## </summary> |
|---|
| | 48 | ## </param> |
|---|
| | 49 | ## <param name="script_file"> |
|---|
| | 50 | ## <summary> |
|---|
| | 51 | ## Type of the script file used as an entry point to this domain. |
|---|
| | 52 | ## </summary> |
|---|
| | 53 | ## </param> |
|---|
| | 54 | # |
|---|
| | 55 | interface(`init_script_domain',` |
|---|
| | 56 | gen_require(` |
|---|
| | 57 | attribute init_script_domain_type, init_script_file_type; |
|---|
| | 58 | attribute init_run_all_scripts_domain; |
|---|
| | 59 | ') |
|---|
| | 60 | |
|---|
| | 61 | typeattribute $1 init_script_domain_type; |
|---|
| | 62 | typeattribute $2 init_script_file_type; |
|---|
| | 63 | |
|---|
| | 64 | domain_type($1) |
|---|
| | 65 | domain_entry_file($1, $2) |
|---|
| | 66 | |
|---|
| | 67 | domtrans_pattern(init_run_all_scripts_domain, $2, $1) |
|---|
| | 68 | ') |
|---|
| | 807 | ') |
|---|
| | 808 | |
|---|
| | 809 | ######################################## |
|---|
| | 810 | ## <summary> |
|---|
| | 811 | ## Get the attribute of all init script entrypoint files. |
|---|
| | 812 | ## </summary> |
|---|
| | 813 | ## <param name="domain"> |
|---|
| | 814 | ## <summary> |
|---|
| | 815 | ## Domain allowed access. |
|---|
| | 816 | ## </summary> |
|---|
| | 817 | ## </param> |
|---|
| | 818 | # |
|---|
| | 819 | interface(`init_getattr_all_script_files',` |
|---|
| | 820 | gen_require(` |
|---|
| | 821 | attribute init_script_file_type; |
|---|
| | 822 | ') |
|---|
| | 823 | |
|---|
| | 824 | files_list_etc($1) |
|---|
| | 825 | allow $1 init_script_file_type:file getattr; |
|---|
| | 826 | ') |
|---|
| | 827 | |
|---|
| | 828 | ######################################## |
|---|
| | 829 | ## <summary> |
|---|
| | 830 | ## Read all init script files. |
|---|
| | 831 | ## </summary> |
|---|
| | 832 | ## <param name="domain"> |
|---|
| | 833 | ## <summary> |
|---|
| | 834 | ## Domain allowed access. |
|---|
| | 835 | ## </summary> |
|---|
| | 836 | ## </param> |
|---|
| | 837 | # |
|---|
| | 838 | interface(`init_read_all_script_files',` |
|---|
| | 839 | gen_require(` |
|---|
| | 840 | attribute init_script_file_type; |
|---|
| | 841 | ') |
|---|
| | 842 | |
|---|
| | 843 | files_search_etc($1) |
|---|
| | 844 | allow $1 init_script_file_type:file read_file_perms; |
|---|
| | 845 | ') |
|---|
| | 846 | |
|---|
| | 847 | ######################################## |
|---|
| | 848 | ## <summary> |
|---|
| | 849 | ## Execute all init scripts in the caller domain. |
|---|
| | 850 | ## </summary> |
|---|
| | 851 | ## <param name="domain"> |
|---|
| | 852 | ## <summary> |
|---|
| | 853 | ## Domain allowed access. |
|---|
| | 854 | ## </summary> |
|---|
| | 855 | ## </param> |
|---|
| | 856 | # |
|---|
| | 857 | interface(`init_exec_all_script_files',` |
|---|
| | 858 | gen_require(` |
|---|
| | 859 | attribute init_script_file_type; |
|---|
| | 860 | ') |
|---|
| | 861 | |
|---|
| | 862 | files_list_etc($1) |
|---|
| | 863 | can_exec($1, init_script_file_type) |
|---|