/home/fresvfqn/.cagefs/tmp/phpAdDdia
ELF>�@�'@8@@@@hh��� hh h � �� � �����  ���DDS�td���  P�td�
�
�
<<Q�tdR�tdhh h ��/lib64/ld-linux-x86-64.so.2GNU�GNUGNUz�(:#�������LB)�9�� L7i� aE"� R"0   >@  libc.so.6exitfeofstrstrfseek__fprintf_chkstdoutfclosestderrfwritefread__cxa_finalizefopen64__libc_start_mainGLIBC_2.3.4GLIBC_2.2.5_ITM_deregisterTMCloneTable__gmon_start___ITM_registerTMCloneTableti	{ui	�h �p �x x � � � � � 
   @  � � � � � � 	� 
� � 
� ��H��H�� H��t��H����5R �%S ��h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h	��Q�������%� D���%� D���%� D���%� D���%� D���%� D���%} D���%u D���%m D���%e D��AUATUH��SH�����VH�~H�5��f���H��H���H����H�=� ����H����1�1�H���<����=u 0tjH�-l �@f.�H�ٺ�H������H��t(H�
 H�¾H������H��tH��������t�H�����H��1�[]A\A]À= 7u��=� 0u��=� 7�w����=� 0�j����=� 1�]���L�%� 1�M���(H�5L������H����H��H��
�>�����u.1�H��H���M���H�ٺL��
�� ��H��u�H��L�-b �����uTH����������H�ٺ�L���F ���H�������1����uBH��A�H9�u��u0H��1�1�H��������L)�1�H��H�l
H������n���H�tH��1�����S���H�MH�=� �H�����H���2�����h���H�MH��H�=v �1��j�����@���H�H����@��1�I��^H��H���PTL�FH�
�H�=X����� �H�=� H�� H9�tH�� H��t	�����H�=� H�5� H)�H��H��H��?H�H�tH�u H��t��fD�����=� u+UH�=R H��tH�=� ����d����� ]������w������AWI��AVI��AUA��ATL�%l UH�-l SL)�H�����H��t1��L��L��D��A��H��H9�u�H��[]A\A]A^A_�ff.������H��H���Usage: %s <file>
rCannot open file '%s'
Read error from file '%s'
TRAILER!!!;<`���p���������0���X ��������8zRx����/D$4���FJw�?:*3$"\p����<t����|F�B�A �D(�D0�
(C ABBAD�(���eF�E�E �E(�H0�H8�G@n8A0A(B BBB�P�����x 
X
h p ���o0�X
�p � �	���o���o����o�o����o� 0@P`p�����GA$3a1GA$3p1113p	U
GA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA*p	�GA*GOW*�GA$3a1 e
GA*�U
GA*GOW*
GA*FORTIFYGA+GLIBCXX_ASSERTIONSskipcpio-049-237.git20250603.el8_10.x86_64.debug�n��7zXZ�ִF!t/���R]?�E�h=��ڊ�2N�	 s���_>i���`��Sժ��u;f�i�h����H���~|a��Qq�
��qiO�����
.�w ��,�>����u�O�|��p�����'�e�����(�#k������@J�����.�4Z�D��O��;%L�n-Кv��:�®zo���o)@�|W.}[�`�-�c��eux��u���aY���s %M3���Q�ke/f�S�����>HF8
[2-�n��gZ� Hnj�7�Ք��\������=��1�#+?��-|�Fg�u͡<Ç�*����C׾4��>b��_�
kM�.U|��'&�ib�[T	H�
�r�����f��id�=�9�K!��vko���
�4!�]��M�´�>�9�:T��<�����@�
^����4‡��U����;{��j_����v�mO^Ж�Y{_F��@
��&�8�)E�oi2�/�v�B�x�A=3U��vSA��[�ޗ�tMX�㔟���>Xɩ~	SgE�doP�}�
���V�~��Ig��.���ʍD�]4��b�CN�	�v�J�C2\��t��Ȓ}u�_
����s�U�n����Ƙ��@mb��:%��<��$�ӷׁu�JZa�*�dC�g	�S`��̉���l��:ˤC��r&��')�YU�.�t�Uտ�%��l,[�۠�vj�{��[�PR�dh������D����`�pJ=��Ni2�@�w���0��ˤT�ث����6��J�t��#>8x~�k|8�u.�������1��U�B����8�M*f�{�pp�6L%��YH#�3Y�m�5�M��F[�'��ǦJ:��g�YZ.shstrtab.interp.note.gnu.property.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.init_array.fini_array.data.rel.ro.dynamic.got.data.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata���� &�� 4$G���o00(QXX�Y���a���o��"n���o��0}  ��B���  ������p	p	��X
X

�h
h
U��
�
<��h h�p p�x x�� ���p p��       H 
h ` � �"8/�"�x&>ELF>P>@0 @8@! @@@������� ��!�!p	x �
�
!�
!     DD��!�!S�td  P�td4�4�4�ddQ�tdR�td��!�!P	P	/lib64/ld-linux-x86-64.so.2GNU�GNUGNU��ݻ�WEr��E�G}�ŀqWj jl�bA��Pv�2���������rc8D7�x� �?�K��!�%�g�#>>Y�	 L�j�F�9 ����7�".����I��
�T=.`��xE��T��g	�i��n������i�S0~S(���$�*�! !K !�(!\0!libkmod.so.2__gmon_start___ITM_deregisterTMCloneTable_ITM_registerTMCloneTablekmod_module_get_modulekmod_module_dependency_symbol_get_symbolkmod_get_dirnamekmod_unrefkmod_module_new_from_loadedkmod_module_new_from_lookupkmod_module_get_namekmod_module_get_softdepskmod_list_nextkmod_module_info_get_keykmod_module_unref_listkmod_module_get_infokmod_module_info_free_listkmod_module_get_dependency_symbolskmod_module_unrefkmod_module_get_dependencieskmod_module_dependency_symbols_free_listkmod_module_get_pathkmod_module_new_from_pathkmod_module_info_get_valuekmod_module_symbol_get_symbolkmod_newlibgcc_s.so.1_Unwind_Resume__gcc_personality_v0libc.so.6__xpg_basenamestrcpy__printf_chkfopenstrncmpoptindregexec__open64_2putsforkfutimes__stack_chk_fail__lxstatunlinkmkdirreallocabort_exitmemchrstrpbrkpopengetpidstrspnstrdupfts_closeisattyfeofsymlinkexeclpfgetscallocstrlenwritevstrstrstrcspn__errno_locationmemcmpstrndup__fprintf_chkfchownfts_readmemcpyfclose__vsnprintf_chkstrtoulmallocumaskrealpath__ctype_b_locgetenvfts_setregcompoptargioctl__snprintf_chkgetopt_longpcloseusleep__getdelimgeteuidwaitpidstrchrprogram_invocation_short_nameqsort__cxa_finalizesyscallfts_open__xstatunamestrcmpstrerror__asprintf_chk__libc_start_mainstpcpysysconffree__prognameGCC_3.0GCC_3.3.1GLIBC_2.14GLIBC_2.4GLIBC_2.7GLIBC_2.3GLIBC_2.8GLIBC_2.3.4GLIBC_2.2.5LIBKMOD_22LIBKMOD_5	
p0P&yVa_&	^�����hii
	sii
}ii
�ii
�ti	�ui	�"�&
��j��!0?�!�>�!�!�!��!�� !S�@!�`!
��!��!��!"��!+�!4� !8�@!?�`!D��!P��!W��!g��!y�	!�� 	!��@	!A�`	!���	!���	!���	!��
!9�
!E� 
!J�@
!=�H
!N�P
!T�X
!Y�`
!]�h
!e�p
!l�x
!��!�!�!#�!*�!1! !k(!l0!m�!�!�!�!�!�!�!�!	�!
�!�!
!

!
!
! 
!(
!0
!8
!@
!H
!P
!X
!`
!h
!p
!x
!�
!�
! �
!!�
!"�
!$�
!%�
!&�
!'�
!(�
!)�
!+�
!,�
!-�
!.�
!/�
!0!1!2!3!4 !5(!60!78!8@!9H!:P!;X!<`!=h!>p!?x!@�!A�!B�!C�!D�!E�!F�!G�!H�!I�!J�!K�!L�!M�!N�!O�!P!Q!R!S!T !U(!V0!W8!X@!YH!ZP![X!\`!]h!^p!_x!`�!a�!b�!c�!d�!e�!f�!g�!h�!i��H��H�y� H��t��H����52� �%3� ��h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h	��Q������h
��A������h��1������h��!������h
��������h��������h������h�������h��������h�������h�������h�������h�������h�������h��q������h��a������h��Q������h��A������h��1������h��!������h��������h��������h������h �������h!��������h"�������h#�������h$�������h%�������h&�������h'��q������h(��a������h)��Q������h*��A������h+��1������h,��!������h-��������h.��������h/������h0�������h1��������h2�������h3�������h4�������h5�������h6�������h7��q������h8��a������h9��Q������h:��A������h;��1������h<��!������h=��������h>��������h?������h@�������hA��������hB�������hC�������hD�������hE�������hF�������hG��q������hH��a������hI��Q������hJ��A������hK��1������hL��!������hM��������hN��������hO������hP�������hQ��������hR�������hS�������hT�������hU�������hV�������hW��q������hX��a������hY��Q������hZ��A������h[��1������h\��!������h]��������h^��������h_������h`�������ha��������hb�������hc��������%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%}� D���%u� D���%m� D���%e� D���%]� D���%U� D���%M� D���%E� D���%=� D���%5� D���%-� D���%%� D���%� D���%� D���%
� D���%� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%}� D���%u� D���%m� D���%e� D���%]� D���%U� D���%M� D���%E� D���%=� D���%5� D���%-� D���%%� D���%� D���%� D���%
� D���%� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� D���%}� D���%u� D���%m� D���%e� D���%]� D���%U� D���%M� D���%E� D���%=� D���%5� D���%-� D���%%� D���%� D���%� D���%
� D���%� D���%�� D���%�� D���%�� D���%�� D���%�� D���%�� DE1�H�|$H��t�.���M��tL�����M��tL���D���H���,�����H������H����H�|$H��t������L�����H�����H�|$����H�����H���?���H�<$�f���H��������H����1�H��H������D���H�����8���H�����H�����HDž����H����������L���H���������H�������L�����L���A�������詁A���tD��蛁L���p���A������I����HDž��������K���H�E�E1�E1�L��H�E����H�}��{���L���s���L���k���H�}��b���H�E�I��H�}��R���H��tH�����L��H�}��9���H�������H����H�E�E1�E1��H�E�E1�E1��u���H�E�E1�E1��b���D��躀�H�E�E1�E1��E�����I���n���1��g���H�}����H�}����L�����H�}����H������H��(������H�� ���H��t���H�����1�H�}�H��t���H�}�H��t���H��tH�����H�E�H��tH������L�����1����I����1����I�����I���1�H�}�H��t�K���H�}�H��t�=���H��tH���0���L���H���1���1���1���1��1��1��1��1��H�}�H��t�
���I��1����I�����I��1����I���1��v���1��o���1��h���1��a���1��Z���1��S���1��L���1��E���1��>���1��7���1��0���1��)���1��"������H��H����������H����������H���������L������H���_���HDžP���H��P�������H������H��t����H��@���H��t�H���3����E1�L�����H������H��t�������H������H���HDžP����HDžP����HDžP����s���HDžP����c���HDžP����S���E1��0���L������#���H������H�������]����	���HDžP�������E1��B���E1��:���L�����H���H���1�H�����H���6���fD��AWAVAUATI��U��SH��(dH�%(H�D$1��t���,1��%g�i�=�� ����eL�5�SL�-�SL��L����S�=`� H�� tQH�==� 1��v���H��H����	H�D$H�\$�H����H�=�� 1�H���ZH��u�1���H�=�����H��H���I��L���1���H�
>�H�5&���"dH��H�5C��o�H�� �2���H��� H���L�;�CH�5�H��������j1�H�����H�Y� H����H���@���L��L����RL��L��H��� ��RH�=�� H��� �H���H�=�� ��H��� H��tP�v�H��H����A��H�=�� 1������H�=�� H�5����H�� H���;Lc-�� E�uL��A9�}EJ��H�5�� M�<H�$I�?�����u"A�EH�$9���A�M9�u
��I�DI�)݀=N� �,$���=<� ���=2� ��$��������I���/O�4�O�d�L���h���H�����
�� ��� L��L��A��@��t<�=�� u@PH�
���KM��AVL����1�H�5����aZY�=�� ��1���c�������H�L$dH3%(���H��([]A\A]A^A_�H�=����H�+� H�����8��H������H�
� H�����L���H�
g�1��H�5H����?aH�=(� H��t����@H����H�=i� ��YH��u��
DH����H�=Y� ��YH��u��
DH���p�H�=1� �YH��u�H�=(� �SQH�=� �GQH�=� �;QH�=<� �/�H�=� ��fH�=� ��f���O�$�E1�1��J���
� �� L��A�H��I���`L��������t
�=�� �A��I��D94$�5���M�$�X�1�L���H�
͝H�5���_M�,$�/L����L��H���e�����H�D$H��t�L�|$1��
I����M�/M����M��`�1�L�+�H�
Y�H�5���_�
� L��L���� A��v��u�M��c�1�L��H�
�H�56��7_�n���M�$�q�1�L�D�H�
ܜ�H�5��_����H�|$�Te���I�ٺ�L���H�
ߝH�5DŽ���^����K�4����9�����H�==� 1�H��1�O�,�E1��H��H��H��H���VM�uI�H�=�� L���QH��tL��H���?��t$L�����H�=�� H��H���OL���i!�A��I��D9<$�7���M�e�1���H�5�L�{�M��H�
՛�]H�5�� L����H���[���M���Z���D������L�
1� �L�
�H�
��H�5�����]�\���L���H�$H���\���L�<$1�L�-f��
I����I�/H����AQM��I��H�
��AV�<H�5>�1���8]AZA�A[�
�� ��� L��H���%�Å�u�VL�؆�I��AVH�
���?1�H�5���\_AX�d���H�<$�2c����L�a�1���H�
��H�5���\����H�L�
�H�
����H�5s�1��r\����L�4�H�
`���H�5C��D\��zL�s�H�
7������H�������H��������H��������1�I��^H��H���PTL���H�
/�H�=�����R� �H�=�� H��� H9�tH�>� H��t	�����H�=i� H�5b� H)�H��H��H��?H�H�tH�� H��t��fD�����==� u+UH�=�� H��tH�=�� �I��d����� ]������w����H��t;SH����H��H��u�*�H��H��t�</H�B�u�|�/t�H��[�f�1��1�[�f�AW1ҾAVAUATUSH��HH�<$H�|$ dH�%(H��$81�H�i�H�D$H�D$ H�D$(�y�H��I�����H���bH�L$L�t$0H�L$fDH�xp�H�D$H�5���€����H�x(H�5���I��H���[H�¾L����H���bL��
H����������!�%����t������D�H�JHDщ��H��L)��"H���|0
u�D0H�T$H�<$L����H�\$����H��tc�H���0�H��I�����H�����L��H���r�H�=�� H��H���JH�|$H���c�H��H��u�H�|$H��t���L���d�L����H�������H�<$H�t$�E�����L�d$L�l$L��M����DH�D$L����H��H���$�H���<�H�=�� H��H��H����IH����H�<$L��H����H�\$���H��t_fDH��� �H��H�����H�����H�=�� H��H���{IH���S�H�|$H���V�H��H��u�H�|$H��t���H�|$L���2�I��H���&���H�|$��M��tL�����1�H��$8dH3%(��H��H[]A\A]A^A_�@H�|$H��������m�����H�\$H��H���^����^���f.�H���X���H���K�������L���H�
'��H�5(}�1��"W��� �:�������H������H������H������H�����������H����ff.��H��� SH�5����1��I��H���������fDATI��U��SH� �H��dH�%(H��$�1�fDE1�H�
�� L���H�_|�u�������D=���Hc�H�>����� �H�=�� H�55|�aH�~� �H�=�� ��H�y� ���� �H��$�dH3%(��H�Đ[]A\��W� �L���H�=�{��1���J� �-���H�5f� �	H�=
� �E����}�`� ����H�5:� �	H�=^� �������6� ������� ������� ������ ������ ������ ������ ���H�5�� �	H�=*� ��������� �a����\� �U���H�5�� �	H�=r� �m�������� �)���H�5b� �	H�=�� �A����=�Z� ���H�=6� ���H��� ������ ����H�=� ���H��� ���H�=�� ���=�� u!�=�� t
H�=y� t��� 9�tn��tj�����H�=z��H��H���JI��L��y1���H�
��H�5�y��SH�5�yH���_H�� �1����L��yH�
q�1���H�5]y��YS����H��H���t�H������H��� ����L�
� L�����H�
��H�5y1��R��E���L�
�� L�J���H�
֑��L�
�� L�.���H�
���L�
�� L�چ��H�
���L�
u� L�����H�
���k����L��1���H�
c�H�5Vx�WR���ff.�f�AVAUATUSL��$���H��H�$L9�u�H�� dH�%(H��$@1�H��H��I��H�D$��H��H����H������1�H��I���D���I��H����L���W�I�UL�DH9�v+A�8/u%J�T-H��f�H���z�/uI��H9�u�1�H�|$L��H��w�#�����H�|$�D$�����H�w��1�fD��/��H����H��V���u�D�E���}H�sD��E1�f���/��H����I��V���u��MA8��D1�E1��:u</��H����I����u�I9�s;L��1�f.�H���D.L�P�D.H9�vI9��@H��B�D/��E1ҐI������@�QHc��</�.���&��Hc�����H����t��/u�H��I9�u���H�|$M9�woH�|$f�1�M��t
B�D/I�rLc�B�������/���AL)�H�L�7f.�A�T����L�H����t��/u�I����M9�v�B�D�-�H��L����H���
�H�|$��H��H��$@dH3<%(�H�� @[]A\A]A^�fDL������I��I��M9������H����I9��������H��E1���H���g���M���1�L���H�
4�H�5�t��NH���`�H���.���D�1�E1�E�������E1�E1�����E1�E1�H��������D��e���L��tH�
Ȍ1���H�5Tt��PN���������H���,�DSH���7AH��1�H��t
H��������[�ff.�AWAVAUATUSH��H�`� dH�%(H��$�1�H�$H�D$H���H�H���5H��L�l$L�t$I��L�%t�)fDH�t$L���^H����H�H���}1�I��L��L���������H�t$L�������t�L�L$L��s1�H�
݊�H�5s��MH�|$���H�D$H���y���f�H�$L�%{sH��t>H�H��t2H���*I��M��PH�
y�H�5�r1���LXZH��u�H�$H��$�dH3%(H��uFH�ĸ[]A\A]A^A_�1��ԿL��r1��H�
�H�5Or�PL����������=4� SH��u�=(� uR�[�E1�1�1�H��H�=�� ������u�I�ٺ�L���H�
��H�5�q��K1�[�E1�1�1�H��H�=�� �����t�I�ٺ��1�L��H�
a�H�5�q�K1�[��UH�0rH���SH��H�
� dH�%(H�D$1�H��H�$�������H�<$H�5r����H��H��tHH��H��1�H��q���H���o��H�<$���H�D$dH3%(u:H��[]��L�$�M�1�L�9�H�
�H�5�p�J��g��L�)qH�
ɉ1��FH�5�p��J�������H������H��������fD��SH��H��H�=>� 1�H�q��+����x[�DH���5�� I��1��YL��H�
��H�5�o�IXZ[�f�UI��H��AWE��L��pAVAUATI���SH��0H�����������q�����H�
 �dH�%(H�E�1�VH�5�oHDž���IH�=� XL��Z�@���A�ń��%E��tH�����H�=�� ��������L�����L��L��������>������IH��������H��H����	H�=Z� H��H���?:H�����1�H����H�Ko��9/��L�H�
Z� 1��{������	H����L���o����������H�����8H�������{���H��H���[�H������H�޿��#�����������A��t
���������(�����%�=@�2=�����It'��������=�� tH�����1�L���3D�����L�uo1�H�
D���H�5�m��GH������M��1�L�XoH�
����H�5�m�G�=� _AXt�=� uH����������=� L����Dž����H��0���L��������h��H���%�=��R�L��1��c����������5��H�����L��1����:��A�Ņ���������Ǿ	�@1��k������������P�����L���D��������tK��P��������D��������t4����M��L�4nH�
�������H�5Nl��JFH��x���D��H���HDž����HDž���H���H�E�H�������������D�����Z^D���R^�DA�����D�����L����t��(�����������L��lH�
�1���H�5�k��E1�E1�H�����H�������D��H�]�dH3%(��H�e�[A\A]A^A_]�f.�M��t�1�L��zH�
��H�5k�E1�A��D�I�R���L��zH�
j�1���H�5�j���DL���A��1��E����L�����L��k1�H�
!��yH�5�j��D����fDH������I�ك8��L��kH�
߂1���H�5Sj��ODH���������H����H��H��������H������A�1ɺ�H��������������`H������������D�����L�������������� �*\f.��{��A�Dž��VL������H�������8��1�L��D�������x�D����L��k1�H�
���KH�5Vi��RCD����D����uH�=*� tL������E����1�L��jH�
��H�5i�C����f�I��L��i1���H�
`�H�5�h���B���f�L���h��H�=� H��H���4����L��iH�
�1���H�5�h��BHDž����H������A��������L����L��i1�H�
����H�57h��3BH���������A�����f.�1�L���&��I��H���������E��1�H��H�������aL��L���:��A�Dž��[H����L���������1�H�
2� HDž��H����A�}/H��g���M�D1��(������L����H����L���
�H��I��H�����1�AV��L��hH�
�H�5g��AH�����A[L��X�r������H������~��H�����r���=�� ��L���]���E����Dž�����������umH��M��L��v�DAVH�
�~�H�5f�@XZ���M����1�L��gH�
�~H�5Of�P@A��p���DH��M��L��v1�AVH�
H~�GH�5f��@XZ���f.�L���(������DL����L�"g1�H�
I~��H�5�e��?��(���H����@�΀�5��A������I�ٺ��1�L��uH�
�}H�5se�t?��A�����M����1�L��fH�
�}H�5:e�;?���������W�f���H�����1�L���e
�;���H��L�����1�L��fAVH�
c}��H�5�d���>AYAZ�������L�AeH�
9}1���H�5�d��>������!H�5�d�1��>�8���L��dH�
�|1���H�5`d��\>������u@VH�5FfL�
fjL�qtH��H�
fAVH�fAT���H�� ����QH�5f1�L�
�ejL��eH��H�
�eAVH��eAT���H�� ����	���������I���+����I���0����������I���@����I���'����I���M����I�����������������I���2����I��������|�����u�����j����I���������U�����L�����C�����:����I��������%����I�����ff.�UH��AWAVAUATSH��XH�}��dH�%(H�E�1�H�E�H�E��2��H�E�H����H�}�H�5�d�5��H��H���H�M�1�H�}��H��d�������H�}�H�5;e�F��H��H�E��E�H�E�H�E�H�E�@H���P������H�u�H�}�H�ٺ
���H��~�L�M����1�L�AdH�
 zH�5�a��;H�E�H�5�rH��I���n��H���H�5dL���V��H���-H�5dL���>��H���H�5dL���&��H����H�5dL�����H����H�5dL�����H����H�5dL������H����H�5dL������H����H�5�� L�����I��H����H�5�cL������/H��ID�H������I��H������������<
��L�����
tH������u��L�����A�1�1�H��H��I��H�E��p�E����=H���u�M���ZL�oqH�
xx�1�H�5$`�%:XZL�}�H�5CcL������H��t!�@A�1�1�L��L������ZH�}��q��L���y��H��H�E��M��I��H���!H���Y��H��I���.��I��H���BH���:��H��I�����H�E�H����H�����H�E�H����H�}�L���a��L���I���
H�=}bL�e�H���H�}�����ME�� ��1�H�5ScH��L��1��*VA�1�1�H��H��I�������:H�5bL�����H����@A�1�1�L��L���������L�M����1�L��aH�
�vH�5�^�8�M����1�L��bH�
�vH�5h^�i8�E�DH�}�����H��tH���*��H�}������E�H�]�dH3%(��H�e�[A\A]A^A_]�@L�M��\�1�L�aH�
:vH�5�]��7����f�E1�L���e��H�}��\��L���T��L���L��H�}��C���M�M�����E1�H�E�E1��L�M��f�1�L��`H�
�uH�5e]�f7�w����E1�H�E��s���H�}��1����A�ą�x<H�u�����������QH�E��8#ƀ�u�x!txD���bO����X��H�}���؉E��x������;����؉E�����L���9���M�麌�1�L��_H�
�tH�5�\�6���L�h�@A�Ƅ����z��H�I����I��I�E�����DA u�I�EL��u�f.�H��H���t�DA t��M��L�K^1�H�
gt���H�5\�6E1��1�L��L�����E���u$D���=NH�}��d������*����؉E���M�麻�1�L��]H�
�sH�5�[�5�L���a���L�\H�
�s1���H�5l[��h5�����	�����B��������������������,���������I���L���������I�����������������I�������������������������I�����ff.�f�UH��AWAVI��AUI��ATSH��H��8dH�%(H�E�1��"��L��I��H�E����H�E�I��H�E�M���7H���.H���6��H�5�]H��I���K����M����H�E�L��J�\;B�8���H�}�I��L��A�H�~]1���������1�H�}�I��L��H�W]��������H���u�L�M��9L�9]H�
�q�1�H�5�Y�3H�u�H�}�A�1�XZ1���H�}�1����H�}�����L������H�}�������H�M�dH3%(�&H�e�[A\A]A^A_]�H�^\L��H���f���H�[\L��H���T���H�Z\L��H���B���H�V\L��H���0���L�u�L��J�\;C�>���H�}�I��L��A�H�/\1���h������1�H�}�I��L��H�\��C���������L��XH�
�p1��5H�5YX��U2�&L��XH�
mp1��#H�51X��-2��s��1���������L��XH�
)p1��)H�5�W���1�L�YXH�
p1��/H�5�W��1���H�����UH��AWAVH�� ���AUATSH���H�����dH�%(H�E�1�HDž ��������Å��<L�� ���M���wL��0����@H�� ���L���y���I��H����L�����H�ǹ	H�5�Z�����u�L������I��I��L��Z1�H�
�n���H�5�V��0H�P� H���%H�;�Dž�������L��(����{f.�H��(���A�1�1�H���������H��(�����u.I����L�!Z�H�
knH�5NV�O0H��(�������H����H�;�1�M��H��VL��HDž(���H���������&H��(���L���������D���L��(���L�^V1�H�
�m��H�5�U��/�c���f���������Z���H���������H��M��L�g��PH�
�mH�5nU1���h/XZ�����1�H�� ���H��t���H�M�dH3%(����H�e�[A\A]A^A_]������H�����I�����H��I��1���AWL�RfH�
m�H�5�T��.^_�1��L�LUH�
�l1���H�5�T��.�����U����H�������H�����ff.�f�UH��AWAVAUATSH��HdH�%(H�E�1�H���_H�E�I��I��E1�H�E�H�E�L�=K� H�E��L�����H��H�E��̿��H��H���pH�=a� H����������H�=R� H��������BH�}��Y����=ʣ tE1�1�1�H��L���~������H�57� 1�1�H��A�H���A��H�� H�E����H��I��L�GW�PH�
YkH�5\S1��H�E�H�E��F-H�}�Y^���H�}����H��H�����A�ƅ���H�}�H��t���H�}�H��t���H��tH���ӿ��H�}�H��t����L��L������I��H�������H�M�dH3%(D����H�e�[A\A]A^A_]�f�H�E�H��t�H���f�H��I��L�:d�PH�
ejH�5hR1���b,XZ�h���H�U�H�u�H�}�臾��A�ƅ�� ���H�}����H�}�A�����E��DD����H�}�A�����H���7����0����-���E1��"���蛿����I�������I���5�����4����I�������I��������I���������������@UH��AWAVAUATI��SH��(dH�%(H�E�1�H�E�H�E��ؼ���=I� H�����=� ��L�����H��H����H�=x� H����������H�=i� H����������1�E1�H�}�H��t�ƽ��H�}�H��t踽��H��tH��諽��H�M�dH3%(D����H�e�[A\A]A^A_]�fDH�=� H���a�����N���I�ٺ)�1�L�kbH�
iH�5_P�`*�b���H����������=;� H�E����=%� ��H��� H��I��L��SH�
�h�<�H�H�5�OP1���)H�5o� XA�1�ZH��1�H�����A�ƅ����=e� �1ۀ=U� �����L���!���I��L��S1��CH�
1hH�5|O��x)1��}����H�u�L���$������<H�E��=J� I���?H����L�5�� �fDH�}�L���d���I��H���L��耻��E1�1�1�H��L��I��軹����u�L���o���H��I��1���AUL�(aH�
ag�H�5�N�(_H�}�AXH��t蟼���I�ٺ8�1�L�BaH�
3gH�5~N�(1�A��~���f�E1�1�1�H��H�=o� �������
���I�ٺ$�1�L�`H�
�fH�5(N�)(�+���@L�9`H�
�f1���H�5�M��'H�E��=� I����M�������L��������L���H���I��L�xQ1��@H�
XfH�5�M��'L�����L������H��H������A�ƅ������H�U�H�u�L��詹��A�ƅ��j���H�}�����H�}�A������E��AE�A���F���f.�H�E�I��M���x���L�������k���H�E�I�ǀ=�� ����M���K���L�5|� �f.�H�}�L������I��H��t�L���4���E1�1�1�H��L��I���o�����u�L���#���H��I��1���AUL�_H�
e�H�5sL�t&H�}�Y^H���?����P����5���1�A������W���A������L����=3� ����������ٹ����I��颾����I���ɾ����I�������I��鹾����I��鱾����I��驾����I��顾����I��陾����I��鑾����H��鉾����I�������I��� �����I��闾����I��钾�����}������`�����I���{�����I���v�����I���q�����I���l�����I���g�����I���b�����I���]�����I���X�����I���S�����I���U����UH��AWAVI��1�AUA��ATSH��H�=]� dH�%(H�E�1�HDžx����~���H��I���3���H�5�NH��H���Q���H��t
H)�H�
� �=� �1E����A�E�L��h���I�D�E1�H��H���H������H��`���H��x���H��X���H��h���L�oN1�H�
�b��H�5
J�L��$H��</��<=��H�5�NH��HDž�����6;����H�5�NH���;����H���O���H��D�H��`���H��L���&������L������M��ut�="� �?	�=� ��������L��賵����H�M�dH3%(�7H�e�[A\A]A^A_]�1�H��H���H��H��H��H��D��@������*f�H��������L��AE��+���I��H���ZL��觷��H��I���<���L��A����E��y��=\� u��=R� uLH��h�����L��MH�
paH�5�H�L�1��z"��=� ���=
� ��H������H������)������H�=kL�x���H���H�5(KH����I��H������H�������DL���@�������L��H������H��t�H��L���
H����������!�%����t�I�������D�H�JHDщ�@�H��H)�t�H��������
uƄ����I�ٺ��1�L�LZH�
M`H�5`G�a!H�����H�=�� H��H���L���������?���L��菵�����H�5*LH���{8���\����f���H��X���H��L��HDž�����������H��x����]���H���u���I��H���1H��`���H��L���G���H��x������ٲ��HDžx�������L������M�����=&� ���=� �H��h���ASM��L��JH�
2_���0H�59F1��8 AYAZ��H��h�����L�$YH�
�^H�5F�L�1���=�� ��E1�L���w���H������H��t趲��H��h���H��h���H9�H��������1��X���I�ٺ��1�L��JH�
v^H�5�E��'���H������H��t�T���A���t�E��t��=� �A��w���L�K�$�1�L��IH�
^HDž����H�5EHDž����HDž�����H��h���H��� H������H��I�H�H��L�@1�萰������H��h���H��H������H�`I�H�L�@1��]�������H��h���H��H������H�9I�H�L�@1��*�������H������H������1ҾHDž����H������H������H������H������H�������*���H��H��@���蛱��I�Ń�M����fA�}bHDž������A�EbM�M(��f���;L��HH�
�\1��JH�5�C��I�u(H��X���L��膲�����\H��x�������H������H��P���H���H��`���H��P���L�����H��x���A���u���HDžx���E���5L������M��u&��H��������L��AE��K���I��H����L���DZ��H��I���\�L��A������E��y��=|� u��=r� ��L��P���L�0G1�H�
�[�yH�5�B���L�cGH�
f[1��GH�5rB��nHDžP���H��P������H������H��t�&���H��@����ʯ��I���-���M�M(�N�1�L�#UH�
�ZH�5B��=�� u�HDžP���H��P����x���H������H��t跮��H��@���tH��@����ѯ��H�������E���H�������9���H�������-����8����=8� �&�=*� u0H��h�����L��TH�
HZH�5[A�L�1��RE1�L���׬��H������H���������I�}(�������<���H��@����L���]���M�M(�C1�L��EH�
�Y�H�5�@���p���I�ٺ��1�L�HTH�
�YH�5�@��R���L������.���I�ٺ��1�L�
TH�
fYH�5y@�zH������H����������M�M(�Y�1�L�~SH�
'YH�5:@�;�.���I�ٺ��1�L�.EH�
�XH�5@�
�H��P���菫��H������H��t�ά��A����DžP��������0H��������P����L��D����I�ĉ�P���H���%L���o���H��I����L����身����y��=&� u��=� �!���M���1�L��CH�
3XH�5F?�G��QL��P����m1�A�u(L��CH�
X�H�5?�XZ�=�� �
������L��P���L�nR1�H�
�W�dH�5�>���뿀=m� ���=_� �d���AVM��L��Q1�SH�
}W�H�5�>���J���L���
���H������H������H��h�����L��QH�
+WH�5>>�L�1��5�>���苫���8��H��@���H��tH������H������蒩��H������膩��H�������z����w���ATM��L�1Q1�SH�
�V�H�5�=��^_����H��h���APM��L��AH�
sV��0H�5=1��~^_���L�^BH�
IV1���H�5U=��Q�*����=� t
����H��h�����L�OBH�
�UH�5=�L�1��	��貪��L�t=H�
�U1��.H�5�<�����"���L�D=H�
�U1��(H�5�<����L�=H�
|U1��4H�5�<�����H�������H���ׯ�����˯����H�������H���(�����H���Ű����H��������H���ѯ����H���(�����H���)�����H���*�����H���.����������H���)�����H���-�����H���)�����H���*�����齯����H���8�����H���3�����H���/���f.�D�����f���1�H9��������B��ff.�H��H��twH����H�N H�F(H��tAH�A(H�F(H��t=H�H H�NH�FH��tH�AH�FH��t&H�H�G ��tk���G H���H�GH��u�H�O���H�L�(���H�
�T��H�5�SH�=�@�A�H�
�T��H�5�SH�=�X�!�H�
�T��H�5�SH�=�S��H��H��tH������H�D�(H�H�FH�VH�H��tH�rH�0H�GH�F H�F(H��t$H���H�p �G H�wtkH���fDH���H�w���H�
�S��H�5SH�=�?�Yf�H�
�S��H�5�RH�=�W�1�H�
�S��H�5�RH�=�R��H�
yS��H�5�RH�=�R���H�
YS��H�5{RH�=�R���ATUSH�H��t$�P�H9�sz�JH��H�r�HH�[]A\�@�H��I���*H��1�H�|H��H!�H�G�H��H��耣��H��t�I�$�X���@H�I�$�f.�ɸ��Bȉ��ff.��ATUSH��tG��H��I��H�\�(H��u�#H�[H��tL��H�;�U��u�H��[]A\�f�1�H��[]A\�fDH�
IR�(H�5[QH�=;>��USH��H��tuH��H����H��H�>�UH��Hi�H�Ή�H�� )����H������)�)Љ������}$tH�r� H�k� H�H��[]ÐH��H��[]�2���f�H�
�Q��H�5�PH�=�=��H�
�Q��H�5�PH�=�U���SH�wH��H��tH���(���H�sH��u�{$tH�� H�� H�[�fDH��[駢���������t��H���������u������鷤�����ATUH��SH���=*A�Ą���H�k� H����H�H�X� H�zH��1�H�HǂH��H)��� ���H�H��H����B HD�H����H��H�BHD�H�BH��H�*H�ZD�b$[]A\�@� H�=܇ ����H��H���k���1�[H��]A\�f��� ����H��H���k���1��А��SH��H��t3H�?t
1�[�f�H��H������H�H��u��[�fDH�
�O��H�5�NH�=�;����H��t����f��ff.�@��H��tGUSH��H��H�wH��t"H�nH���	���H��tH��謠��H�sH��u�H��H��[]���D�ff.�@��H��t/SH�wH��H��tf.�H�����H�sH��u�[�D����AUATUSH��H����I��H��H��I��A�UL���Hi�H�ډ�H�� )��������)�)�H��Ɖ�����H��t!L9`����E�H��[]A\A]�DA�}$t9H�5҅ H��tmH�H�Å H�.��L��L�f���H���[]A\A]�f��0膞��H��H��u˸���H�
�M�6H�5�LH�=�9�A��0H�=\� �_���H���f.���ATUSH��tkH��H��H��I��UH���Hi�H�щ�H�� )��������)�H��)ȉ����H��tH�L�`1�[]A\�L��H��H��[]A\�n���fDH�
M�VH�53LH�=9�f���H��tgUH��SH��H��H���H�߉�Hi�H�� I�ȉ�D)���D������)�)�H�������H��tH�@H��[]�H��1�[]��1��ff.�f���USH��H��taH��H��H�����Hi�H�ω�H�� )����H������)�)�H������H��t H�hH��H����H��H��[]��1�H��H��[]�@��H����AWAVI��AUI��ATI��H��UH��SH��A�$L����Hi�H�� )��������)�)�H��Ɖ�����I��H��txL��A�$L���Hi�H���H�� )��������)�)�L��Ɖ�������H��u#��L��L�����M�/��L��M�wL�����1�H����[]A\A]A^A_ú��������������H����AWAVI��AUI��ATI��H��UH��SH��A�$L����Hi�H�� )��������)�)�H��Ɖ�����I��H����L��A�$L���Hi�H���H�� )��������)�)�L��Ɖ�����H��tI9�tH��L���'�����L��L�����M�/��L��M�wL�����1�H��[]A\A]A^A_ø�������������H��twATI��UH��H��SH��U��Hi�H�ω�H�� )����H������)�)�L����#���H��tH9XuH��H���}���H��[]A\�D[1�]A\�f�1��ff.�f���H��tgH��tJH�H���tAH��t,H�H H�����H��HD�H�H��tH�H�
H�@��H�GH��u��H�����1�H��tH��f�H��H�
�H��H�5HH�=JH�m
ff.�f���H��tWH��t:H�H��t2H���tH�H(H�H��tH�H�
H�@�DH�GH��u��H�1�H��tH��f�H��H�
%H��H�5�GH�=�G��	ff.�f���H��tgATI��UH��H��SH��UH��Hi�H�� I�ȉ�D)���D������)�)�L����a���H��tH�[H�@]A\�[1�]A\�f�1��ff.�f���H��tH�GH��tH�@�f�1��ff.�f���H��tH�GH��tH��f.�1��ff.�f���H��tH�GH��tH�@�f�1��ff.�f���SH��tH�wH��tH�^���H��[��1�H��[Ð��SH��tH�wH��t
H����H��[�1�H��[�f���H��t�G �1��ff.�f���H��t�G �����fD��f���USH��H��tAH��t-H�^H��H��t!H�SH�3H��������t��xH�[ H��u�1�H��[]�fDH�
�E�vH�5[EH�=;2����AVAUATUSH����I��H����L�vH��M�����I�>M�f �UH��‰�Hi�H�� )��������)�)�I��Ɖ���H��uEI�>A�UL��Hi�H�Ή�H�� )����L�������)�)Љ��!��L��H�����M��M���p���[]A\A]A^��H�
�D��H�5cDH�=C1�f���H����AVI��AUI��ATI��USH����H��A�UL��‰�Hi�H�� )��������)�)�L��Ɖ��2�H����L��A�$L���Hi�H���H�� )��������)�)�L��Ɖ����I��H��t^H�Ɖ�L������L��L�����1�[]A\A]A^�f�1��DH�
�C��H�5cCH�=C0�f����뾸�����f���USH��H��t1H�wH��H�?�"�H��H��tH��H���O�����x+H��H��[]ÐH�
9C��H�5�BH�=�/�A�H��1��F���@��AVAUATI��USH��dH�%(H�D$1��G �xH������H��H��tPI��1�L��H�$L������H��tY�@1�L��L��H�D����Lc�H��H��u�J�D�H�H�L$dH3%(H��uH��[]A\A]A^�fDH����薖��fDAWAVAUATUSH��hdH�%(H�D$X1��=�� ��H��I��L�5CL�-n)��H����H�5�FH��耕��H�\�;��H�5fFH��1��ђ��H��t�H�hD�=x E��x�f�H��L�4$AD$AD$(AD$8I�D$HH�D$H�\$谓���L��D��H�D$L�l$ H�D$(�=���H���L����?�������=�������1�H�L$XdH3%(uH��h[]A\A]A^A_��Z���f.�AWI��AVA��AUI��ATUSH��(H�L$H�l$dH�%(H��$1��Ĕ��L�L$M��H��D� �H�þ����H��D��L��Ƅ$�I���D�#H��$dH3%(uH��([]A\A]A^A_�謔��ff.��UI����H�=�x S1�H��H��Q�R�V��r���H�� ��H��H��x �z� �����a������S�]v ��x
謑����t[�D���9v ����[�������ff.�@���f.����ff.�����;=�u H���~1��f�L��L��H���b���f���H���I���L�L$H��t7)D$P)L$`)T$p)�$�)�$�)�$�)�$�)�$�dH�%(H�D$1�H��$����$(H�D$H�D$ H�D$1�;=Cu �D$0~H�L$dH3%(uH����DH��L��L����������ff.�����t S1ۅ�x��[��3�����t��t ��[þH�=n?���t ��x-L�@H�
�A1��IH�5P?�����D�؉��_����EL��?H�
LAI��H�5?�1�����Ht �\���ff.���PXL��?H���j���f.�PXH�
�@�\H�5�>H�=�>H�����ff.�������9�u��s �@H�����ff.�@��PXL��?H�����f.���H����x��/�=�} H���@H�
!@��H�5$>H�=C>�!����H�
@��H�5>H�=/>�������H���s��x�����u�s 1�H��������} �D����r �D����wHc�H��l H����1��ff.�f���AUL�-sl ATI��H�=V=US1�H��dH�%(H�D$1��D$M��u�`I�|���H��tL���|�����t*H��H��	u�H�t$L���Q��xL�l$�������G�H�T$dH3%(��u2H��[]A\A]ÐH�
�>�%H�5�<H�=�&����������Տ��D��H���#�����x���8���1�H��Ð�����f���SH�=�<����H��tH��H��������xU����H�=�<���H��H��tH���8�����x[�f�I��L��=�[H�
�=H�5	<�1��v���I�ٺ
�1�L�H=H�
�=H�5�;�M����f.����H�6H�?�����UH��SH��H�?H��tH��@裌��H��H�;H��u�H��H��[]鉌��f�1�H�?t�H����H�?u��f��ff.�@��ATUSH��tSH��H��t;H�/I��H��u�#fDH��t"H�+H��tL��H���_�����u�H��[]A\�1�[H��]A\�fDH�
>� H�5=H�=�&�������AUATUSH��H��tmH��H��tUH�/H��t=H��I��貋��I���DH��t2H�+H��tL��L��H���|�����u�H��L�t�H��H��[]A\A]�f�H��1�[H��]A\A]�H�
I=�,H�5n<H�=&�1������H��t�b���f��ff.�@��ATUSH��tkH���{����xH�����I��H��t=H�;H��H��u�Wf.�H��H�;H��H��t=�ˌ��H�EH��u�L�����E1�[]L��A\���螉��H��H��t�I��H�EL��[]A\���H��t���f�1��ff.�f���ATUSH�� dH�%(H�D$1�H���K�o1�H���I����H��$H�N�xH�L$�%fD�ƒ�Hʉ$H�H��t*H�������Nj$��/v�H�T$H�BH�D$H�H��u�H���ʈ��H��H����I�����L��謋��H�H����A�f.��E��/w7�ƒ�HU�EH�:H��t7H���t��i���D��H��H��t]�EA����/v�H�UH�BH�EH�:H��u�J��H�H�t$dH34%(H��uEH�� []A\�fDE1��x����H���(���1���@����H��H��u�1�����D��H���H�t$(H�T$0H�L$8L�D$@L�L$H��t7)D$P)L$`)T$p)�$�)�$�)�$�)�$�)�$�dH�%(H�D$1�H��$�H���$H�D$H�D$ �D$0H�D$����H�T$dH3%(uH�����&���fD��AUATI��USH��H����H��H�����U���H�����K����|H���Ά��I��H��t?H�}H��H��u�]�H��H�}H��H��tD蚉��H�H��u�L��E1����H��L��[]A\A]�f��k���H�H��t�H��I��I�<$H��u�H�H��L��[]A\A]�DH��H��[]A\A]����fD��AVAUATUH��SH����H��I��I���j�����H����H���W����|H���څ��I��H��t8H�}H��H��u�T@H��H�}H��H��t?誈��H�H��u�L������E1�[]L��A\A]A^�L���H�H��t�H��I��I�<$H��u�H�L��[]A\A]A^�@�xH���D���H��H��t�I�����[]A\A]A^������AWAVAUATUSH��(dH�%(H�D$1�H���L�l$L�|$I��H��L��L��H��H�D$�H����1���D��L��L��L��H��D�s�xH��u�{H��藄��I��H��tkL��L��L��H��H�D$�EH����1��!�L��L��L��H����H��tGH�t$H��������I��H��u�L��E1��T���H�L$dH3%(L��uPH��([]A\A]A^A_�f�I��H���H�
�6��H�5�5H�=�����*���L�����̆��ff.����AWAVAUATUSH��(dH�%(H�D$1�H���L�d$L�t$H��H�D$L��L���H����1��
�D��L��L��D�kH���kH��u�{H���*���I��H��tgL��L��H��H�D$�;H����1��fDL��L��H����H��tRH�t$��H��M�|���I�H��u�L��E1����H�L$dH3%(L��uWH��([]A\A]A^A_�f�I�D�H���f�H�
95�H�5�4H�=<�Q���'���L�����\���ff.����USH��H��tQH�5�5����H��H��t.H�������t"��H�,�H�}H��t�?u
���H�EH��H��[]�DH�
y4�.H�5�3H�=�����AWAVAUATUH��SH��H����H��I��藂��I��H����L�mI��1�L��M��u�z�I�<$H��tJ�;H��HE��W���H�I��u�H�{�E���H��H����H��fDL���h���H��H��t?L�mM��t6H��H9�t�H��L���C���H���ο��H��H��tKH��f��H��H��[]A\A]A^A_�A�L�5�0�"����謀��H��H��H��u�1��ff.�f���AUI��ATUSH��H����H��H�������xH���Y���I��H��t:H�;H��H��u�D@H��H�;H��H��t0�+���H�EH��u�L��E1��G�H��L��[]A\A]�f�L�����H�EH��t�H�EH��L��[]A\A]�f�H��[]A\A]����H��L��1�1�[]A\A]����f.���H��tWATUH��SH�H��H��tMH�����pA��H��H��諃��H��t8D��H��A�T$H��H�E1�[]A\��1��D�E1�뻸����UH��H��SH������H��t1H��H��H���\�����xH��[]ÐH�߉D$�����D$H��[]ø���f���H��t�D1��ff.�f���AVI��AUATUSH��tdI��H��tlH�I��H��H��u�D@H��I�$I��H�]H��t+L��H��蠁����u�H��H���@��H�]H��u��I�$[L��]A\A]A^�@H�
�0��H�560H�=���f���UH��SH��H��t'H�7H��tH���	�H�3H��tH��H������H��u�H��H��[]�ff.�f���AWI��AVAUATUSH��H��tpI��H��t~H�I��H��H��u"�QfDI�t2H��H���W~��H�]H��t1L���V~��L��H��H��I���5}����t�H��I�I��H�]H��u�I�H��L��[]A\A]A^A_�@H�
y/��H�5/H�=�������AWAVAUATUSH��H��H��u	H���=H���TH�,3H��E1��H9�v�8A�~u	A�VA����H��H9�u�|3��������H�$H����E1�H9�w8�fDH��H��H�T$H)��-���H�T$H��I�tFH�ZA��H9�vwI��1�H��I)�L���P{��H�$H��D��L�<�H��u�L��H�����I�H��u:H�<$�!�H�$H�$H��[]A\A]A^A_�fDA�����;���DA��E9�t�H�
.�H�5�-H�=�-���H�
�-��H�5�-H�=�-�a��H����[]A\A]A^A_��~����USH��dH�%(H�D$1�H�$H��tq�?H��tiH���@H���|��H�\H��t.�;t)H��H��������y�H�$H��tH����1��DH�$H��tH�T$dH3%(uH��[]�1�1�1�������}��fD��H��t{AUI��ATI��USH��H�/H��tVM��tBI�uL��H��u�4@H��t*H�3H��t"H���}����u�H���[]A\A]�fDI��t	I�,$H��u�H��1�[]A\A]�1��f���SH��H��t!H�?t�h�H�
��H�߉���|��H��[�ff.�f���H��tSH��H�;H��t�3y��H��u�[�����dH�%����H��t�DH�����y��H��~dH�%����H���H�
�/�(H�5f,H�=�,�8����ATUSH��tSH��H��tkH��H��� z���I��H��t&H���z��1�L9�rL)�L��H��H�<�r|������[��]A\�fDH�
/�2H�5�+H�=����H�
�.�3H�5�+H�=�+�����S����y�+�K{�����u���}w����x�[����[�@H�
y.�AH�5g+H�=w+�9�f���ATU��S��z����H��D� �����uD�#[]A\��H�
	.�UH�5+H�='+������AUI��ATA��U�SH���D�P���y��D��L���kz���Å�yE�pz�����u%��uԻ����H����[]A\A]É��K����Fz���H���ۉ�[]A\A]�D����v����x�uĉ߻�������D��H��tH��tH���yz������H����H	���Ð��d�%���t���@S�w������1��x��9����ЍT�d�%�[�ff.���ATUSH��dH�%(H�D$1�H�$H����I��H����H���Oy��1�H��H���H���z��H�$�UH��t=�9u8��uD��H9���A�$H�|$dH3<%(��u|H��[]A\�f.���u�����D����@H�
�+��H�5)H�=����f�H�
�+��H�5�(H�=)�������r�����x��f�����wHc�H��T H����1��ff.�f���AUL�-�T ATI��H�=�(US1�H��dH�%(H�D$1��D$M��u�`I�|���H��tL���|x����t*H��H��u�H�t$L���Q�����xL�l$�������G�H�T$dH3%(��u2H��[]A\A]ÐH�
�*��H�5�'H�=�����������w��D��H��H	���AWAVAUATUH��SH��H����H����I��H��E1��u��I��H��I9�w9O�<4I��gt��I��H��t$L��H��H����x��K�|5L��H����x��C�D=H��L��[]A\A]A^A_�f�H�=G
�w��@H��H��H��[]A\A]A^A_��x���H��[]A\A]A^A_��v��ff.�f���U1�H��SH��H��H��tH���t��H��H��H��H��[]����ff.�f���ATUSH��PH�t$(H�T$0H�L$8L�D$@L�L$HdH�%(H�D$1�H�D$p�$H�D$H�D$ H�D$H���H���/t��H�\$I���/D�ƒ�Hډ$H�:H��t5�t��L��H��H9���Iċ$��/v�H�T$H�:H�BH�D$H��u�I�|$��r��H��H��tnH��H���q��H�L$p�$H�L$H�L$ H�L$�#fD��HL$��H�1�$H��t+H���q���$��/v�H�L$H�1H�QH�T$H��u�DH��H�\$dH3%(u,H��P[]A\�@1���@��&r��H��H��t����$u��@��AVAUATUSH����H��I��L�nI��H���}H����r��J�<(H����q��H���8H��L��H���Zv��I��H�(J�4#H9���H�=O%A��������H��H��H9����H�K��\u��K��x����Hc�H�>����SD�RЉ�A��	��D�R�A���@��A��7��AC�D�SE�Z�D��A��	�E�Z�A�����A����A�JɅ���������H��H��	ʈP��A�����H��H���)����	H��H������� H��H���	����
H��H������
H��H������H��H�������H��H�������H��H������\H��H�����D�[D��A��0D�ڃ�0�����kA��0���0���~��0E��xv��xrA��A��H��H��E	�D	�@�h��L����'H��H���9����"H��H���)����\H���L��[]A\A]A^�f.�E1�[]L��A\A]A^Ð�\H��H���H����DL���`o��H��t�I�������0�'�����\xH��H��f�P����f.�H�
�$�H�5"H�=������A�J��
���A�J�������W����fD��1�����D��AVAUATUSH����I��H����H��H���H�H�5�!H��HD�H����p��H��3@����@��'tUI��L�-�!@��"���@��\��L���p��H��u
I��A�6@��u�L��H)�I�$H��L�u[]A\A]A^�f��SH�sH���u)H��1��Cf.���'���PH�H��tH�Ȁ�\u�x���PH�H��u�H��H)�I�$�9H��H��H��H�M[]A\A]A^�f�A�~�3A�vI�FI��@��� ����?����CH�K���!H��<\tQ<"tfH�B�R��t��\t?��"tH�����u�H��H)�I�4$�8H��H��H�EH��[]A\A]A^��H�Ѐx��H�P�@��u�H��H��H)��@1�H��[]A\A]A^�f.�H�
a"��H�5�H�=�����H�
A"��H�5�H�=�����H�
!"��H�5�H�=��a���H��H��H)����I������H�H���H������H��1�����ff.�f���AUATUSH��H�H��HD߀;tC�?t>I��H��H��H��I���Zn��L��H�H����o��I�EH�H�EH��H��[]A\A]�H��1�H��[]A\A]����G�<	v%�G�<v�G�<w'@���G���@���G��@���G���������f.����G�<w
@���G��D������f���AWI��AVI��AUA��ATL�%�F UH�-�F SL)�H���oc��H��t1��L��L��D��A��H��H9�u�H��[]A\A]A^A_�ff.������H��H���/sys/devicesmodaliasinstall/dracut-install.c2madfhlL:oD:HRp:P:s:S:N:DRACUT_FIRMWARE_PATHDRACUT_FIRMWARE_PATH=%sNo SOURCE argument given%s/%sOut of memory!stat(%s) != 0find_binary(%s) == %s%s/lib/dracut/hostonly-filesa%s
dracut_install('%s', '%s')hash hit items for '%s'ERROR: stat '%s': %m'%s' already existsdest dir '%s' does not existmkdir '%s''%s' install errorlstat '%s': %mln -s '%s' '%s'ERROR: ln -s '%s' '%s': %mdracut_install ret = %dcp '%s' '%s'Failed to chown %s: %m-fL--sparse=auto--reflink=autocp--preserve=mode,timestampscp ret = %d.soScript install: '%s'ERROR: failed to install '%s'ldd %s 2>&1ldd: '%s'Not a valid dynamic programcannot execute binary filenot a dynamic executableloader cannot load itselfnot regular filecannot read headercannot be preloaded=>Lib install: '%s'.so.glibc-hwcaps/lib/fipscheck/lib64/fipscheck/lib/hmaccalc/lib64/hmaccalc%s/.%s.hmac%s/%s.hmachmac cp '%s' '%s')firmwareFirmware %sdracut_install '%s' OKdracut_install '%s' '%s' OKdracut_install '%s' '%s'dracut_install '%s' ERROR/lib/modules/DRACUT_KERNEL_MODALIASESHandle module '%s'Failed to find module '%s' %sERROR: installing module '%s'Handling =%s%s/kernel/%s%s/extra/%s%s/updates/%sSkipping %sIgnoring %sHandling %sFTS ERROR: %m.ko.ko.xz.ko.gzFailed to find module '%s'ERROR: installing '%s'PATH is not setDESTROOTDIROut of memory%s/%d.logresolve_deps('%s')Handle '%s'dracut_install '%s'helpversiondebugverboselddresolvelazyoptionalhostonlyallmodulefipsdestrootdirlogdirmod-filter-pathmod-filter-nopathmod-filter-symbolmod-filter-nosymbolmod-filter-nonamesilentkerneldirfirmwaredirsCould not get list of loaded modules: %m. Switching to non-hostonly mode.Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...
or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST
or: %s -D DESTROOTDIR [OPTION]... -m KERNELMODULE [KERNELMODULE …]

Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.

  KERNELMODULE can have the format:
     <absolute path> with a leading /
     =<kernel subdir>[/<kernel subdir>…] like '=drivers/hid'
     <module name>

  -D --destrootdir  Install all files to DESTROOTDIR as the root
  -a --all          Install all SOURCE arguments to DESTROOTDIR
  -o --optional     If SOURCE does not exist, do not fail
  -d --dir          SOURCE is a directory
  -l --ldd          Also install shebang executables and libraries
  -L --logdir <DIR> Log files, which were installed from the host to <DIR>
  -R --resolvelazy  Only install shebang executables and libraries
                     for all SOURCE files
  -H --hostonly     Mark all SOURCE files as hostonly

  -f --fips         Also install all '.SOURCE.hmac' files

  --module,-m       Install kernel modules, instead of files
  --kerneldir       Specify the kernel module directory
  --firmwaredirs    Specify the firmware directory search path with : separation
  --silent          Don't display error messages for kernel module install
  --modalias        Only generate module list from /sys/devices modalias list
  -o --optional     If kernel module does not exist, do not fail
  -p --mod-filter-path      Filter kernel modules by path regexp
  -P --mod-filter-nopath    Exclude kernel modules by path regexp
  -s --mod-filter-symbol    Filter kernel modules by symbol regexp
  -S --mod-filter-nosymbol  Exclude kernel modules by symbol regexp
  -N --mod-filter-noname    Exclude kernel modules by name regexp

  -v --verbose      Show more output
     --debug        Show debug output
     --version      Show package version
  -h --help         Show this help

Module path filter %s is not a regular expressionModule symbol filter %s is not a regular expressionEnvironment variable DRACUT_FIRMWARE_PATH is not setconvert_abs_rel(): target '%s' directory has no realpath.Path %s matched exclusion filterPath %s matched inclusion filterCould not open '%s' for writing.Could not append '%s' to logfile '%s': %mhash hit items_failed for '%s''%s' already exists, but checking for any depsERROR: failed to create directory '%s'--preserve=mode,xattr,timestampsFailed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps -fL %s %sFailed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %syou do not have execution permissionERROR: failed to install '%s' for '%s'could not get modinfo from '%s': %s
Possible missing firmware %s for kernel module %sdracut_install '%s' '%s' ERRORdracut_install '%s' is excludeddracut_install '%s' not hostonlykmod_module_get_dependency_symbols failedModule %s: symbol %s matched exclusion filterModule %s: symbol %s matched inclusion filterNo symbol or path match for '%s'Adding module '%s' to hostonly module listFailed to lookup modules path '%s': %mFailed to get name for module '%s'3 Failed to lookup alias '%s': %dFailed to lookup alias '%s': %mEnvironment DESTROOTDIR or argument -D is not set!Environment DESTROOTDIR or argument -D is set to '/'!Environment DESTROOTDIR or argument -D is set to '%s': %mCould not open %s for logging: %mERROR: installing '%s' to '%s''q��r��r��r��q��r��r��r��q��r���p��r���p��r���p��sp��r��r��r��r��r��r��r��r��r��r��r��r��r��gp��r��r��[p��r��Op��r���q��r��r��r��Cp��7p��r��+p���o��r��r���o��r��r���o��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r��r���o���o��yo��do��Ho��<o��install_onefind_binaryinstall_allresolve_lazyinstall_dependent_modulesinstall_firmwarecphmac_installlibrary_installresolve_depsconvert_abs_relln_rdracut_installcheck_module_symbolsinstall_modulecheck_module_pathinstall_modulesmodalias_listparse_argvmaindracut_log_cpmark_hostonlyinstall/hashmap.ch->n_entries >= 1!h->iterate_list_headihashmap_copyhashmap_move_onehashmap_movehashmap_mergehashmap_iterate_backwardshashmap_iteratehashmap_replacelink_entryhash_scanhashmap_putunlink_entryremove_entryhashmap_ensure_allocateddracut-install: /dev/consoleinstall/log.c(level & 0x07) == leveltarget >= 0target < _LOG_TARGET_MAXDRACUT_LOG_TARGETDRACUT_LOG_LEVELsafenullFailed to open /dev/console for logging: %sSuccessfully opened /dev/console for logging.Assertion '%s' failed at %s:%u, function %s(). Aborting.Code should not be reached '%s' at %s:%u, function %s(). Aborting.Failed to parse log target %s. Ignoring.Failed to parse log level %s. Ignoring.log_target_from_stringlog_parse_environmentlog_set_targetlog_set_max_levellog_open_consoleinstall/strv.cs || l == 0i == cstrv_parse_nulstrstrv_remove_prefixstrv_removestrv_split_newlinesstrv_split_quotedstrv_splitstrv_find_prefixstrv_findinstall/util.cpostfixfd >= 0close_nointr(fd) == 0ret_uemergstate 	

alertcriterrwarningnoticeinfo(r = sysconf(_SC_PAGESIZE)) > 0������������������������������������������������������������������������������������������������������������������������������������������������ �� �� �� �� �� �� �� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������split_quotedcunescape_length_with_prefixlog_level_from_stringsafe_atouclose_nointr_nofailclose_nointrendswithpage_size;`�,B���|H����N���O���5O���WO��`P����P��	Q��`	:Q���	�Q��
�R���
�S��P�S���
]��|^���\^��\b����b����f���j���k����l���m��<�n���,o���L|��xl����l��� 	����x	�����	,���0
����l�����̣��������ܥ������������0����h����<����L����L��������
̩��$
,���P
l���l
�����
,����
����0,���d�����������HL���`ܰ��x\��������������������L���0l���D����X�������������|���@<����|����,��� |���L̸��pܸ������������������̺������$,���8L���T����pܻ�����������,��������,��� ܽ��D��X,����\����ܾ���|��� ����4<���l\��������������,�������|��$���P,��������D���|�������������Dl���������$���@��\|��x���|�������l��D���\���x����,�����������,����������@���T�������L��,l��D����zRx��X��/D$4�=��PFJw�?:*3$"\�C��@ t0Y��GF�wC�C�CzPLRx��) �P$<Y���{B�I�B �B(�A0�A8�G��
8A0A(B BBBE,zPLRx�]) ��������4I��W;T�\��*H�0l�\��CB�D�C �N��
 AABAP�`���B�B�B �A(�A0�H��Q
DЀ�
0A(A BBBG(zPLRx�u( �Ѐ�����0�H��"u8Ld��"A�`\T`d���B�B�B �B(�A0�A8�G��L�[�A�g
8A0A(B BBBA$��e���H�T
DD
DF,HHf��*�E�P�D0�
AAH zPLRx�]' �0��(�G��"�(Hg��gE�e
FDF jAAX�Pg��
TA�F
B�P���P�A.Q.�.a.
K'.�..Y..t.,zPLRx��& �������4�F����8��s���A�C
M������.s.�
E�RG����8��{����A�C
D��E�F��.Y.M
D��G��+�<,D~��#�A�C
W�����(.C
AS.o.n.4�G��%�<�����|A�C
M�����$.K.�
Jy.[.�zG��g�D�������A�C
H����H��
G�.^..Q.;.T.��G����P<�a�A�C
D��G�M���
A�.y.�.A.H.R.|.h.$��G��C�A������t�8I��/	�F�B�B �B(�D0�C8�D`�hQp`hA`}
8A0A(B BBBAGhOpZhH``hQp[hB`(zPLRx��# �`������0lH��"#(��� $���40����D[
AP�/De
G(l����B�A�A �d
ABE4�����oB�A�A �v
ABCF
ABG4����A�A�D f
AABD
DAGL���IA�x
GD(|���)<����	8P�����F�A�D ��
ABE`
DBJ �X���_E�Q
JY
G�����(�����QJ�A�G oD�A��Ԝ��9J�hF�L	����F�B�A �A(�D0f
(A ABBFr
(F ABBC8\	ȝ���F�A�A �T
ABAJ
ABK4�	,���sJ�D�J B
AADDCAH��0�	t���|E�A�D Y
DAHFDAP
�����O�B�E �E(�G0�D8�D@�
8C0A(B BBBAG������PX
\����O�B�E �E(�G0�D8�D@�
8A0A(B BBBAG������8�
����K�D�G �Q
ABFACBJ����
\����t���d8\���sK�D�G �B
EBAACBJ���T����#h����#|ء��#��/E�[
HF����'E�Z
AF����� ���(�,���oE�A�D }
AAG<$p����F�B�B �A(�A0��
(A BBBHLd0���O�E�E �D(�A0��(A BBBC�����H0�����(��lE�A�D o
DAB@�4����F�B�B �D(�A0�D@�
0A(A BBBGL$
����6B�B�B �B(�A0�A8�D�
8A0A(B BBBAHt
�����B�E�E �E(�A0�A8�G�z
8A0A(B BBBA(�
���OA�M�I(A0F8F@N  �
(���AE�U
FP
HT���$P���8L���.Lh����K��
F h����K�I
DW
A�����EAK�����%AA^���!\���EAK��_HS
E4���-H\
D,H���@D���T@���#8h\����F�I�K �A(�F@w
(A ABBB��'HV
B �����E�H
CP
Z�����$�����7A�D�D dDA ����!84����F�A�A �A
ABDC
DBGLp����F�B�A �A(�D0V
(D ABBCD
(C DBBA�T���4�`����F�A�A �b
AEHaABȪ��0 Ԫ���F�A�A �D@9
 AABGT0����K��
AXpԬ���F�B�D �A(�D0|
(D ABBJi
(D ABBFG(A ABB\�h����F�B�B �A(�D0�{
(A EBBDl
(A BBBEa(A BBBH,���dF�B�B �B(�A0�A8�D`
8A0A(B BBBCHx,���dF�B�B �B(�A0�A8�D`�
8A0A(B BBBJ(�P���E�A�D K
DAFH�����#F�B�B �B(�A0�D8�D@�
8D0A(B BBBDl<�����F�E�A �A(�D0l
(D ABBJ]
(D ABBJD
(A ABBFD(H ABB4����yK�A�D �EABH���H ���4�P���NA�G�D0`
AABT
AAAh���<0t����F�E�B �A(�A0�j
(D BBBE$p��CE�D�D pDAH�����F�E�B �B(�A0�A8�D@y
8D0A(B BBBE`������F�B�B �B(�A0�A8�GP�
8A0A(B BBBGd8K0A(B BBB(H�����E�A�D0�
AAALt@����K�E�D �A(�D0}
(F ABBGS(C ABBA���������3E�m�����)J�ZD������X\\
A,�����F�A�A �L
CBG Hl���WE�c
HC
E(l����OF�A�C �Z
ABIH�̶���F�E�D �F(�D0|
(C ABBAR
(E ABBF� ���/RN�8���BY�h0l���F�A�A �D0�
 AABKLH���#8`d����F�I�K �A(�F@w
(A ABBB�������R�B�B �B(�A0�D8�D@h8D0A(B BBBJ������P@������D
8G�0A�(B� B�B�B�LD8A�0A�(B� B�B�B�$4P���3E�F�G TGA0\h���|F�A�A �DpC
 AABEL�����*F�B�B �A(�A0�b
(A BBBKD
(A EBBB�����t������F�B�B �A(�A0��
(A BBBCo
(A BBBJ�
(A BBBIn
(A BBBKHl����pF�B�A �A(�D0E
(D ABBDD(F ABB�ܿ��F����D� ���eF�E�E �E(�H0�H8�G@n8A0A(B BBB,H�����@R]���������$�����(��������
4='
P=���}�����S�t�|����������j�{���������������������	��
��
��
�����������������������������[�������������������'w�����~���4������������������	��	��
����������
��
�������Tmh����w����&��$<������3���4�����
��KS�_��������������������%����U^&H7
���3�X�s����������
�����������������������
����
��������
�@���
�	e��
���h|&
\q���=�H���E���v��������������������	��
��
��
����
��
���������������������������������������w��F��W����@������]���/
_�s�����"'E���1����	��
���0?�>�!��h��S�d�
�v�l�R"�o+�H4�a8�m?�fD�DP�LW�pg�Py�s��S��NA���������9�E�J�=�N�T�Y�]�e�l��p�@#
��!�!���oh�
�
��!`	�xh	���o���o����o�o����o&�
!p#�#�#�#�#�#�#�#�#$$ $0$@$P$`$p$�$�$�$�$�$�$�$�$%% %0%@%P%`%p%�%�%�%�%�%�%�%�%&& &0&@&P&`&p&�&�&�&�&�&�&�&�&'' '0'@'P'`'p'�'�'�'�'�'�'�'�'(( (0(@(P(`(p(�(�(�(�(�(�(�(�()) )0)@)P)`)p)�)�)�)����GA$3a1@#>GA$3p1113�/��GA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*GOW*�GA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA$3a1�>%�GA$3p1113Є�GA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA!
GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA*ЄI�GA*GOW*�GA*���GA*GOW*
GA*FORTIFY@?�GA+GLIBCXX_ASSERTIONS
GA*FORTIFYЄ��GA+GLIBCXX_ASSERTIONSdracut-install-049-237.git20250603.el8_10.x86_64.debugZ-�C�7zXZ�ִF!t/��%g	`]?�E�h=��ڊ�2N�c��� }���M���8�9��i�Cu]E7��C�X�:e��5�,�o�=��D���y�֤�	
#s�؈6��ˠYĦ��	��{$s)R�
v8p�o�ׄ����x�OK�������X��>��-�[��Tա�#
y�	b<��י�k���Z�ˁ�F,<0�4�x��m�a�x�a����g7��r��͜<wW��CP��E��]ZRTtS���	(G��
X���M����_�ɩr��YZ/�s��2DH�4iA����009&�y���-�n�������M�
��w+����eAU�l�5��o�nl�z?BX�,�VPw׈�Y��
z�X-5՚1,$�A9��(MSai-P?��0��JJ՝O����)×�����_��]>��%x����1�FC M:���&vpu�S�rF�㰜n�r����c�)#~���q
R����%UU)��R��sS�Vj�Eaۛ3Ct�v��Ir�CqN���ߐ<�������kY���<è�W]�e%�������é�X��戎�A���p԰ ʍ�T�����s}��ސ��԰f�|�.
�h��N �UH�C��bjn� ����&�0��l4���у�{v�
n�:L��"�,eO�X�n�!!�vܲ/
��
"Kg��P��)'(�������������
vN���N�|4�n�R����F3+�ޥs&�P`�d-��l�8��a��p�}A�J��ER�oљҲ
(��x����f�	0��Ep$ؕ�:E�MC��L�i��Ƈ9�v����i(~V��T�7d���	�T��4�5D�g���N�k'��lk��ns j�[S��)���Y,��3,Go��zc�����@>�X�~����*yPvD	H�=����5G��A�=�M�ؼ��8bK(&n��
�S}��GZ���T�T7�=������4��r���md�誎�@[�n\���
��^����wÆr
��s[ˀc��z\pdV��ʱ�#�ZM���`g\?��M�|r���������B�U1��*_�K��p��9{p.)��ǺB+��.鿖2*F��!u����k�;��a�5�@�4�2-�\L�AI�E�.0�#xR�Hc���
�0H��?� �b;[F�+�l�2�����F,6-���loG�-�B���:jQ�f5?�>�3�ú\v~��Ǘ��!;�n�&�yh���Gȯz��_`߼�x��E�8Џw�T�����™a����3<�mLu����,�Yn�V`+���}�O!�XtqŊ��!��s�A��ыV�
W�'	f��ZL001�`��k��U,��ޫ&K��`��HMu��� ��rr�0�Z�1�Ax&cM��ONi�]ޜ�Z{7Yi�d&ƐE6ʸ��!S��/����2��d�}S�'�r���>�z'"������n���i�=�Kz�	��ҍK��Ir�σ�{ΰt���ތ�G]֪GO�
L!�f�^`ܿ�������ދ��H'�cC-o%�6����n�k�@�9�:D���A�N��Qq�0����[.2Fe�F�=�®)�Cx�[��1'Ң�E)6m6߃�E��u���pA���,�A�^�����Dž��"������6�Eå=�RH߷!�f%�ov�wG:`��|p�S44{�7N������u��s�j��X��KI��&��ih��r�خl�'JM5b���lhG89ͣ[~�s�S�j������G#~����3��<~�9\�Y�C�(m�e�	�U}K(��I4��6��TI��l���tDN}M�XT��T���ˊ����I9��֑�
9�j�i]cj@ִT�6�<�0����&!��g��"�:��)'?�C볳a.�Gm1�W���z4s����'��f�=2��J��"�n�����Br�$��4���xƸ��	g����T\�*�M�m6���v⥭��;O��m���&�}�~�Ƙ���Q~C�F�"�'�� �df��XL���}����H!�M�qS-Tݭ���上8�u7%N������)��"�\x�#V		Xdd�34K+f՛M�V���m9
5Z|���!I�x�8jri�ay}`[�[��P;x�Q�d;�jA:K[�����T���ݍ1��<|dӨ���-^F�ӈ��0��:��l�@@�VBQcԙ�p1z�5�Ѩ����?�gV2�C�\��X�!�~��N��� Q�)o<�Q�Hlj���O\)�����o87X�kJ*G#��]���$�̜y�Y��S�
���I�[��j;�\O%� Ыe����^lTf�;69ЍMojg�:(��)��;C��"O��x� w�ɍ���J���ձ�g�YZ.shstrtab.interp.note.gnu.property.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.gcc_except_table.tbss.init_array.fini_array.data.rel.ro.dynamic.got.data.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata�� &   4@@$G���ohh4Q��P
Y�
�
�a���o���n���o���}xxh�B��`	�@#@#�`#`#P��)�)@��/�/%����
�0�0�!�4�4�d�����@������!���!���!���!�� 	�
!�
�!�`!  ! 
 "(a �8�<G8�	�V#!/bin/bash
#
# functions used only by dracut and dracut modules
#
# Copyright 2005-2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C

if [[ "$EUID" = "0" ]]; then
    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
else
    export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
fi

# is_func <command>
# Check whether $1 is a function.
is_func() {
    [[ "$(type -t "$1")" = "function" ]]
}

if ! [[ $dracutbasedir ]]; then
    dracutbasedir=${BASH_SOURCE[0]%/*}
    [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="."
    [[ $dracutbasedir ]] || dracutbasedir="."
    dracutbasedir="$(readlink -f $dracutbasedir)"
fi

if ! is_func dinfo >/dev/null 2>&1; then
    . "$dracutbasedir/dracut-logger.sh"
    dlog_init
fi

if ! [[ $initdir ]]; then
    dfatal "initdir not set"
    exit 1
fi

if ! [[ -d $initdir ]]; then
    mkdir -p "$initdir"
fi

if ! [[ $kernel ]]; then
    kernel=$(uname -r)
    export kernel
fi

srcmods="/lib/modules/$kernel/"

[[ $drivers_dir ]] && {
    if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
        dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
        exit 1
    fi
    srcmods="$drivers_dir"
}
export srcmods

[[ $DRACUT_FIRMWARE_PATH ]] || export DRACUT_FIRMWARE_PATH="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel"

# export standard hookdirs
[[ $hookdirs ]] || {
    hookdirs="cmdline pre-udev pre-trigger netroot "
    hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
    hookdirs+="pre-mount pre-pivot cleanup mount "
    hookdirs+="emergency shutdown-emergency pre-shutdown shutdown "
    export hookdirs
}

DRACUT_LDD=${DRACUT_LDD:-ldd}
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}

. $dracutbasedir/dracut-functions.sh

# Detect lib paths
if ! [[ $libdirs ]] ; then
    if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
        && [[ -d /lib64 ]]; then
        libdirs+=" /lib64"
        [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
    else
        libdirs+=" /lib"
        [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
    fi

    libdirs+=" $(ldconfig_paths)"

    export libdirs
fi

# helper function for check() in module-setup.sh
# to check for required installed binaries
# issues a standardized warning message
require_binaries() {
    local _module_name="${moddir##*/}"
    local _ret=0

    if [[ "$1" = "-m" ]]; then
        _module_name="$2"
        shift 2
    fi

    for cmd in "$@"; do
        if ! find_binary "$cmd" &>/dev/null; then
            dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
            ((_ret++))
        fi
    done
    return $_ret
}

require_any_binary() {
    local _module_name="${moddir##*/}"
    local _ret=1

    if [[ "$1" = "-m" ]]; then
        _module_name="$2"
        shift 2
    fi

    for cmd in "$@"; do
        if find_binary "$cmd" &>/dev/null; then
            _ret=0
            break
        fi
    done

    if (( $_ret != 0 )); then
        dinfo "$_module_name: Could not find any command of '$@'!"
        return 1
    fi

    return 0
}

dracut_need_initqueue() {
    >"$initdir/lib/dracut/need-initqueue"
}

dracut_module_included() {
    [[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
}

dracut_no_switch_root() {
    >"$initdir/lib/dracut/no-switch-root"
}

dracut_module_path() {
    echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
}

if ! [[ $DRACUT_INSTALL ]]; then
    DRACUT_INSTALL=$(find_binary dracut-install)
fi

if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
    DRACUT_INSTALL=$dracutbasedir/dracut-install
elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]]; then
    DRACUT_INSTALL=$dracutbasedir/install/dracut-install
fi

if ! [[ -x $DRACUT_INSTALL ]]; then
    dfatal "dracut-install not found!"
    exit 10
fi

if [[ $hostonly == "-h" ]]; then
    if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
        export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
        $DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
    fi
fi

[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
inst_dir() {
    [[ -e ${initdir}/"$1" ]] && return 0  # already there
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
}

inst() {
    local _hostonly_install
    if [[ "$1" == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}

inst_simple() {
    local _hostonly_install
    if [[ "$1" == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
    [[ -e $1 ]] || return 1  # no source
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
}

inst_symlink() {
    local _hostonly_install
    if [[ "$1" == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
    [[ -L $1 ]] || return 1
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}

inst_multiple() {
    local _ret
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"
    _ret=$?
    (($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
    return $_ret
}

dracut_install() {
    inst_multiple "$@"
}

dracut_instmods() {
    local _silent=0;
    local i;
    [[ $no_kernel = yes ]] && return
    for i in "$@"; do
        [[ $i == "--silent" ]] && _silent=1
    done

    $DRACUT_INSTALL \
        ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
    (($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
}

inst_library() {
    local _hostonly_install
    if [[ "$1" == "-H" ]]; then
        _hostonly_install="-H"
        shift
    fi
    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
    [[ -e $1 ]] || return 1  # no source
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}

inst_binary() {
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
}

inst_script() {
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
    (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
}

inst_fsck_help() {
    local _helper="/run/dracut/fsck/fsck_help_$1.txt"
    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
}

# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
# If hosotnly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
    if [[ $hostonly_mode = "strict" ]]; then
        printf -- "$hostonly"
    else
        printf ""
    fi
}

mark_hostonly() {
    for i in "$@"; do
        echo "$i" >> "$initdir/lib/dracut/hostonly-files"
    done
}

# find symlinks linked to given library file
# $1 = library file
# Function searches for symlinks by stripping version numbers appended to
# library filename, checks if it points to the same target and finally
# prints the list of symlinks to stdout.
#
# Example:
# rev_lib_symlinks libfoo.so.8.1
# output: libfoo.so.8 libfoo.so
# (Only if libfoo.so.8 and libfoo.so exists on host system.)
rev_lib_symlinks() {
    [[ ! $1 ]] && return 0

    local fn="$1" orig="$(readlink -f "$1")" links=''

    [[ ${fn} == *.so.* ]] || return 1

    until [[ ${fn##*.} == so ]]; do
        fn="${fn%.*}"
        [[ -L ${fn} && $(readlink -f "${fn}") == ${orig} ]] && links+=" ${fn}"
    done

    echo "${links}"
}

# attempt to install any programs specified in a udev rule
inst_rule_programs() {
    local _prog _bin

    for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        if [ -x ${udevdir}/$_prog ]; then
            _bin=${udevdir}/$_prog
        elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue;
            }
        fi

        [[ $_bin ]] && inst_binary "$_bin"
    done
    for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        if [ -x ${udevdir}/$_prog ]; then
            _bin=${udevdir}/$_prog
        elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue;
            }
        fi

        [[ $_bin ]] && inst_binary "$_bin"
    done
    for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p' "$1"); do
        _bin=""
        if [ -x ${udevdir}/$_prog ]; then
            _bin=${udevdir}/$_prog
        elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
            _bin=$(find_binary "$_prog") || {
                dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                continue;
            }
        fi

        [[ $_bin ]] && dracut_install "$_bin"
    done
}

# attempt to install any programs specified in a udev rule
inst_rule_group_owner() {
    local i

    for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
        if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
            grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
        fi
    done
    for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
        if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
            grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
        fi
    done
}

inst_rule_initqueue() {
    if grep -q -F initqueue "$1"; then
        dracut_need_initqueue
    fi
}

# udev rules always get installed in the same place, so
# create a function to install them to make life simpler.
inst_rules() {
    local _target=/etc/udev/rules.d _rule _found

    inst_dir "${udevdir}/rules.d"
    inst_dir "$_target"
    for _rule in "$@"; do
        if [ "${_rule#/}" = "$_rule" ]; then
            for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
                [[ -e $r/$_rule ]] || continue
                _found="$r/$_rule"
                inst_rule_programs "$_found"
                inst_rule_group_owner "$_found"
                inst_rule_initqueue "$_found"
                inst_simple "$_found"
            done
        fi
        for r in '' $dracutbasedir/rules.d/; do
            # skip rules without an absolute path
            [[ "${r}$_rule" != /* ]] && continue
            [[ -f ${r}$_rule ]] || continue
            _found="${r}$_rule"
            inst_rule_programs "$_found"
            inst_rule_group_owner "$_found"
            inst_rule_initqueue "$_found"
            inst_simple "$_found" "$_target/${_found##*/}"
        done
        [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
    done
}

inst_rules_wildcard() {
    local _target=/etc/udev/rules.d _rule _found

    inst_dir "${udevdir}/rules.d"
    inst_dir "$_target"
    for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
        [[ -e $_rule ]] || continue
        inst_rule_programs "$_rule"
        inst_rule_group_owner "$_rule"
        inst_rule_initqueue "$_rule"
        inst_simple "$_rule"
        _found=$_rule
    done
    if [[ -n ${hostonly} ]] ; then
        for _rule in ${_target}/$1 ; do
            [[ -f $_rule ]] || continue
            inst_rule_programs "$_rule"
            inst_rule_group_owner "$_rule"
            inst_rule_initqueue "$_rule"
            inst_simple "$_rule"
            _found=$_rule
        done
    fi
    [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
}

# make sure that library links are correct and up to date
build_ld_cache() {
    for f in "$dracutsysrootdir"/etc/ld.so.conf "$dracutsysrootdir"/etc/ld.so.conf.d/*; do
        [[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
    done
    if ! ldconfig -r "$initdir" -f /etc/ld.so.conf; then
        if [[ $EUID == 0 ]]; then
            derror "ldconfig exited ungracefully"
        else
            derror "ldconfig might need uid=0 (root) for chroot()"
        fi
    fi
}

prepare_udev_rules() {
    [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })

    for f in "$@"; do
        f="${initdir}/etc/udev/rules.d/$f"
        [ -e "$f" ] || continue
        while read line || [ -n "$line" ]; do
            if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
                if [ $UDEVVERSION -ge 174 ]; then
                    printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
                else
                    printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
                fi
            elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
                if [ $UDEVVERSION -ge 176 ]; then
                    printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
                else
                    printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
                fi
            else
                echo "$line"
            fi
        done < "${f}" > "${f}.new"
        mv "${f}.new" "$f"
    done
}

# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
inst_hook() {
    if ! [[ -f $3 ]]; then
        dfatal "Cannot install a hook ($3) that does not exist."
        dfatal "Aborting initrd creation."
        exit 1
    elif ! [[ "$hookdirs" == *$1* ]]; then
        dfatal "No such hook type $1. Aborting initrd creation."
        exit 1
    fi
    inst_simple "$3" "/lib/dracut/hooks/${1}/${2}-${3##*/}"
}

# install any of listed files
#
# If first argument is '-d' and second some destination path, first accessible
# source is installed into this path, otherwise it will installed in the same
# path as source.  If none of listed files was installed, function return 1.
# On first successful installation it returns with 0 status.
#
# Example:
#
# inst_any -d /bin/foo /bin/bar /bin/baz
#
# Lets assume that /bin/baz exists, so it will be installed as /bin/foo in
# initramfs.
inst_any() {
    local to f

    [[ $1 = '-d' ]] && to="$2" && shift 2

    for f in "$@"; do
        [[ -e $f ]] || continue
        [[ $to ]] && inst "$f" "$to" && return 0
        inst "$f" && return 0
    done

    return 1
}


# inst_libdir_file [-n <pattern>] <file> [<file>...]
# Install a <file> located on a lib directory to the initramfs image
# -n <pattern> install matching files
inst_libdir_file() {
    local _files
    if [[ "$1" == "-n" ]]; then
        local _pattern=$2
        shift 2
        for _dir in $libdirs; do
            for _i in "$@"; do
                for _f in "$_dir"/$_i; do
                    [[ "$_f" =~ $_pattern ]] || continue
                    [[ -e "$_f" ]] && _files+="$_f "
                done
            done
        done
    else
        for _dir in $libdirs; do
            for _i in "$@"; do
                for _f in "$_dir"/$_i; do
                    [[ -e "$_f" ]] && _files+="$_f "
                done
            done
        done
    fi
    [[ $_files ]] && inst_multiple $_files
}


# install function decompressing the target and handling symlinks
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
#
# Function install targets in the same paths inside overlay but decompressed
# and without extensions (.gz, .bz2).
inst_decompress() {
    local _src _cmd

    for _src in $@
    do
        case ${_src} in
            *.gz) _cmd='gzip -f -d' ;;
            *.bz2) _cmd='bzip2 -d' ;;
            *) return 1 ;;
        esac
        inst_simple ${_src}
        # Decompress with chosen tool.  We assume that tool changes name e.g.
        # from 'name.gz' to 'name'.
        ${_cmd} "${initdir}${_src}"
    done
}

# It's similar to above, but if file is not compressed, performs standard
# install.
# $@ = list of files
inst_opt_decompress() {
    local _src

    for _src in $@; do
        inst_decompress "${_src}" || inst "${_src}"
    done
}

# module_check <dracut module>
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    local _forced=0
    local _hostonly=$hostonly
    [ $# -eq 2 ] && _forced=$2
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we are unconditionally included
        [[ -x $_moddir/check ]] || return 0
        [ $_forced -ne 0 ] && unset hostonly
        $_moddir/check $hostonly
        _ret=$?
    else
        unset check depends cmdline install installkernel
        check() { true; }
        . $_moddir/module-setup.sh
        is_func check || return 0
        [ $_forced -ne 0 ] && unset hostonly
        moddir=$_moddir check $hostonly
        _ret=$?
        unset check depends cmdline install installkernel
    fi
    hostonly=$_hostonly
    return $_ret
}

# module_check_mount <dracut module>
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    mount_needs=1
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we are unconditionally included
        [[ -x $_moddir/check ]] || return 0
        mount_needs=1 $_moddir/check 0
        _ret=$?
    else
        unset check depends cmdline install installkernel
        check() { false; }
        . $_moddir/module-setup.sh
        moddir=$_moddir check 0
        _ret=$?
        unset check depends cmdline install installkernel
    fi
    unset mount_needs
    return $_ret
}

# module_depends <dracut module>
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        # if we do not have a check script, we have no deps
        [[ -x $_moddir/check ]] || return 0
        $_moddir/check -d
        return $?
    else
        unset check depends cmdline install installkernel
        depends() { true; }
        . $_moddir/module-setup.sh
        moddir=$_moddir depends
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_cmdline <dracut module>
# execute the cmdline() function of module-setup.sh of <dracut module>
# or the "cmdline" script, if module-setup.sh is not found
module_cmdline() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        [[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
        return $?
    else
        unset check depends cmdline install installkernel
        cmdline() { true; }
        . $_moddir/module-setup.sh
        moddir=$_moddir cmdline
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_install <dracut module>
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        [[ -x $_moddir/install ]] && . "$_moddir/install"
        return $?
    else
        unset check depends cmdline install installkernel
        install() { true; }
        . $_moddir/module-setup.sh
        moddir=$_moddir install
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# module_installkernel <dracut module>
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    [[ -d $_moddir ]] || return 1
    if [[ ! -f $_moddir/module-setup.sh ]]; then
        [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
        return $?
    else
        unset check depends cmdline install installkernel
        installkernel() { true; }
        . $_moddir/module-setup.sh
        moddir=$_moddir installkernel
        _ret=$?
        unset check depends cmdline install installkernel
        return $_ret
    fi
}

# check_mount <dracut module>
# check_mount checks, if a dracut module is needed for the given
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
    local _mod=$1
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    local _moddep

    [ "${#host_fs_types[@]}" -le 0 ] && return 1

    # If we are already scheduled to be loaded, no need to check again.
    [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
    [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1

    # This should never happen, but...
    [[ -d $_moddir ]] || return 1

    [[ $2 ]] || mods_checked_as_dep+=" $_mod "

    if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
        return 1
    fi

    if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
        module_check_mount $_mod; ret=$?

        # explicit module, so also accept ret=255
        [[ $ret = 0 || $ret = 255 ]] || return 1
    else
        # module not in our list
        if [[ $dracutmodules = all ]]; then
            # check, if we can and should install this module
            module_check_mount $_mod || return 1
        else
            # skip this module
            return 1
        fi
    fi

    for _moddep in $(module_depends $_mod); do
        # handle deps as if they were manually added
        [[ " $dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
            && dracutmodules+=" $_moddep "
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
            && add_dracutmodules+=" $_moddep "
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
            && force_add_dracutmodules+=" $_moddep "
        # if a module we depend on fail, fail also
        if ! check_module $_moddep; then
            derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
            return 1
        fi
    done

    [[ " $mods_to_load " == *\ $_mod\ * ]] || \
        mods_to_load+=" $_mod "

    return 0
}

# check_module <dracut module> [<use_as_dep>]
# check if a dracut module is to be used in the initramfs process
# if <use_as_dep> is set, then the process also keeps track
# that the modules were checked for the dependency tracking process
check_module() {
    local _mod=$1
    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
    local _ret
    local _moddep
    # If we are already scheduled to be loaded, no need to check again.
    [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
    [[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1

    # This should never happen, but...
    [[ -d $_moddir ]] || return 1

    [[ $2 ]] || mods_checked_as_dep+=" $_mod "

    if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
        dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
        return 1
    fi

    if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
        if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
            module_check $_mod 1; ret=$?
        else
            module_check $_mod 0; ret=$?
        fi
        # explicit module, so also accept ret=255
        [[ $ret = 0 || $ret = 255 ]] || return 1
    else
        # module not in our list
        if [[ $dracutmodules = all ]]; then
            # check, if we can and should install this module
            module_check $_mod; ret=$?
            if [[ $ret != 0 ]]; then
                [[ $2 ]] && return 1
                [[ $ret != 255 ]] && return 1
            fi
        else
            # skip this module
            return 1
        fi
    fi

    for _moddep in $(module_depends $_mod); do
        # handle deps as if they were manually added
        [[ " $dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
            && dracutmodules+=" $_moddep "
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
            && add_dracutmodules+=" $_moddep "
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
            && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
            && force_add_dracutmodules+=" $_moddep "
        # if a module we depend on fail, fail also
        if ! check_module $_moddep; then
            derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
            return 1
        fi
    done

    [[ " $mods_to_load " == *\ $_mod\ * ]] || \
        mods_to_load+=" $_mod "

    return 0
}

# for_each_module_dir <func>
# execute "<func> <dracut module> 1"
for_each_module_dir() {
    local _modcheck
    local _mod
    local _moddir
    local _func
    _func=$1
    for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
        [[ -d $_moddir ]] || continue;
        [[ -e $_moddir/install || -e $_moddir/installkernel || \
            -e $_moddir/module-setup.sh ]] || continue
        _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
        $_func $_mod 1
    done

    # Report any missing dracut modules, the user has specified
    _modcheck="$add_dracutmodules $force_add_dracutmodules"
    [[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
    for _mod in $_modcheck; do
        [[ " $mods_to_load " == *\ $_mod\ * ]] && continue

        [[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
            && [[ " $dracutmodules " != *\ $_mod\ * ]] \
            && [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
            && continue

        derror "dracut module '$_mod' cannot be found or installed."
        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
        [[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
        [[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
    done
}

# Install a single kernel module along with any firmware it may require.
# $1 = full path to kernel module to install
install_kmod_with_fw() {
    # no need to go further if the module is already installed

    [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
        && return 0

    if [[ $omit_drivers ]]; then
        local _kmod=${1##*/}
        _kmod=${_kmod%.ko*}
        _kmod=${_kmod/-/_}
        if [[ "$_kmod" =~ $omit_drivers ]]; then
            dinfo "Omitting driver $_kmod"
            return 0
        fi
        if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
            dinfo "Omitting driver $_kmod"
            return 0
        fi
    fi

    if [[ $silent_omit_drivers ]]; then
        local _kmod=${1##*/}
        _kmod=${_kmod%.ko*}
        _kmod=${_kmod/-/_}
        [[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
        [[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
    fi

    inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
    ret=$?
    (($ret != 0)) && return $ret

    local _modname=${1##*/} _fwdir _found _fw
    _modname=${_modname%.ko*}
    for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
        _found=''
        for _fwdir in $fw_dir; do
            [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
            inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
            _found=yes
        done
        if [[ $_found != yes ]]; then
            if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
                dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
                    "\"${_modname}.ko\""
            else
                dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
                    "\"${_modname}.ko\""
            fi
        fi
    done
    return 0
}

# Do something with all the dependencies of a kernel module.
# Note that kernel modules depend on themselves using the technique we use
# $1 = function to call for each dependency we find
#      It will be passed the full path to the found kernel module
# $2 = module to get dependencies for
# rest of args = arguments to modprobe
# _fderr specifies FD passed from surrounding scope
for_each_kmod_dep() {
    local _func=$1 _kmod=$2 _cmd _modpath _options
    shift 2
    modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
        while read _cmd _modpath _options || [ -n "$_cmd" ]; do
            [[ $_cmd = insmod ]] || continue
            $_func ${_modpath} || exit $?
        done
    )
}

dracut_kernel_post() {
    for _f in modules.builtin.bin modules.builtin modules.order; do
        [[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
    done

    # generate module dependencies for the initrd
    if [[ -d $initdir/lib/modules/$kernel ]] && \
        ! depmod -a -b "$initdir" $kernel; then
        dfatal "\"depmod -a $kernel\" failed."
        exit 1
    fi

}

instmods() {
    # instmods [-c [-s]] <kernel module> [<kernel module> ... ]
    # instmods [-c [-s]] <kernel subsystem>
    # install kernel modules along with all their dependencies.
    # <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
    # -c check
    # -s silent
    local _optional="-o"
    local _silent
    local _ret

    [[ $no_kernel = yes ]] && return

    if [[ $1 = '-c' ]]; then
        unset _optional
        shift
    fi
    if [[ $1 = '-s' ]]; then
        _silent=1
        shift
    fi

    if (($# == 0)); then
        read -r -d '' -a args
        set -- "${args[@]}"
    fi

    if (($# == 0)); then
        return 0
    fi

    $DRACUT_INSTALL \
        ${initdir:+-D "$initdir"} \
        ${loginstall:+-L "$loginstall"} \
        ${hostonly:+-H} \
        ${omit_drivers:+-N "$omit_drivers"} \
        ${srcmods:+--kerneldir "$srcmods"} \
        ${_optional:+-o} \
        ${_silent:+--silent} \
        -m "$@"
    _ret=$?

    if (($_ret != 0)) && [[ -z "$_silent" ]]; then
        derror "FAILED: " \
            $DRACUT_INSTALL \
                ${initdir:+-D "$initdir"} \
                ${loginstall:+-L "$loginstall"} \
                ${hostonly:+-H} \
                ${omit_drivers:+-N "$omit_drivers"} \
                ${srcmods:+--kerneldir "$srcmods"} \
                ${_optional:+-o} \
                ${_silent:+--silent} \
                -m "$@"
    fi

    [[ "$optional" ]] && return 0
    return $_ret
}

if [[ "$(ln --help)" == *--relative* ]]; then
    ln_r() {
        ln -sfnr "${initdir}/$1" "${initdir}/$2"
    }
else
    ln_r() {
        local _source=$1
        local _dest=$2
        [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
        ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
    }
fi
#!/bin/bash
#
# logging faciality module for dracut both at build- and boot-time
#
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


__DRACUT_LOGGER__=1


## @brief Logging facility module for dracut both at build- and boot-time.
#
# @section intro Introduction
#
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
# levels:
#   - TRACE (6)
#     The TRACE Level designates finer-grained informational events than the
#     DEBUG.
#   - DEBUG (5)
#     The DEBUG Level designates fine-grained informational events that are most
#     useful to debug an application.
#   - INFO (4)
#     The INFO level designates informational messages that highlight the
#     progress of the application at coarse-grained level.
#   - WARN (3)
#     The WARN level designates potentially harmful situations.
#   - ERROR (2)
#     The ERROR level designates error events that might still allow the
#     application to continue running.
#   - FATAL (1)
#     The FATAL level designates very severe error events that will presumably
#     lead the application to abort.
# Descriptions are borrowed from Log4j documentation:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
#
# @section usage Usage
#
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
# If you're ready with this, you can use following functions which corresponds
# clearly to levels listed in @ref intro Introduction. Here they are:
#   - dtrace()
#   - ddebug()
#   - dinfo()
#   - dwarn()
#   - derror()
#   - dfatal()
# They take all arguments given as a single message to be logged. See dlog()
# function for details how it works. Note that you shouldn't use dlog() by
# yourself. It's wrapped with above functions.
#
# @see dlog_init() dlog()
#
# @section conf Configuration
#
# Logging is controlled by following global variables:
#   - @var stdloglvl - logging level to standard error (console output)
#   - @var sysloglvl - logging level to syslog (by logger command)
#   - @var fileloglvl - logging level to file
#   - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
#   - @var logfile - log file which is used when @var fileloglvl is higher
#   than 0
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
# maximum logging level of those three and indicates that dlog_init() was run.
# @var syslogfacility is set either to 'user' (when building initramfs) or
# 'daemon' (when booting).
#
# Logging level set by the variable means that messages from this logging level
# and above (FATAL is the highest) will be shown. Logging levels may be set
# independently for each destination (stderr, syslog, file, kmsg).
#
# @see dlog_init()


## @brief Initializes dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
# @note This function need to be called before any other from this file.
#
# If any of the variables is not set, this function set it to default:
#   - @var stdloglvl = 4 (info)
#   - @var sysloglvl = 0 (no logging)
#   - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
#   - @var kmsgloglvl = 0 (no logging)
#   set to 0
#
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
# See file doc comment for details.
dlog_init() {
    local __oldumask
    local ret=0; local errmsg
    [ -z "$stdloglvl" ] && stdloglvl=4
    [ -z "$sysloglvl" ] && sysloglvl=0
    [ -z "$kmsgloglvl" ] && kmsgloglvl=0
    # Skip initialization if it's already done.
    [ -n "$maxloglvl" ] && return 0

    if [ -z "$fileloglvl" ]; then
        [ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
    elif (( $fileloglvl > 0 )); then
        if [[ $logfile ]]; then
            __oldumask=$(umask)
            umask 0377
            ! [ -e "$logfile" ] && >"$logfile"
            umask $__oldumask
            if [ -w "$logfile" -a -f "$logfile" ]; then
            # Mark new run in the log file
                echo >>"$logfile"
                if command -v date >/dev/null; then
                    echo "=== $(date) ===" >>"$logfile"
                else
                    echo "===============================================" >>"$logfile"
                fi
                echo >>"$logfile"
            else
            # We cannot log to file, so turn this facility off.
                fileloglvl=0
                ret=1
                errmsg="'$logfile' is not a writable file"
            fi
        fi
    fi

    if (( $UID  != 0 )); then
        kmsgloglvl=0
        sysloglvl=0
    fi

    if (( $sysloglvl > 0 )); then
        if [[ -d /run/systemd/journal ]] \
            && type -P systemd-cat &>/dev/null \
            && systemctl --quiet is-active systemd-journald.socket &>/dev/null \
            && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
            readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
            mkfifo "$_systemdcatfile"
            readonly _dlogfd=15
            systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
            exec 15>"$_systemdcatfile"
        elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
            # We cannot log to syslog, so turn this facility off.
            kmsgloglvl=$sysloglvl
            sysloglvl=0
            ret=1
            errmsg="No '/dev/log' or 'logger' included for syslog logging"
        fi
    fi

    if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
        if [ -n "$dracutbasedir" ]; then
            readonly syslogfacility=user
        else
            readonly syslogfacility=daemon
        fi
        export syslogfacility
    fi

    local lvl; local maxloglvl_l=0
    for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
        (( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
    done
    readonly maxloglvl=$maxloglvl_l
    export maxloglvl


    if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
        unset dtrace
        dtrace() { :; };
    fi

    if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
        unset ddebug
        ddebug() { :; };
    fi

    if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
        unset dinfo
        dinfo() { :; };
    fi

    if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
        unset dwarn
        dwarn() { :; };
        unset dwarning
        dwarning() { :; };
    fi

    if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
        unset derror
        derror() { :; };
    fi

    if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
        unset dfatal
        dfatal() { :; };
    fi

    [ -n "$errmsg" ] && derror "$errmsg"

    return $ret
}

## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes first letter of level name.
_lvl2char() {
    case "$1" in
        1) echo F;;
        2) echo E;;
        3) echo W;;
        4) echo I;;
        5) echo D;;
        6) echo T;;
        *) return 1;;
    esac
}

## @brief Converts numeric level to logger priority defined by POSIX.2.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
    printf $syslogfacility.
    case "$1" in
        1) echo crit;;
        2) echo error;;
        3) echo warning;;
        4) echo info;;
        5) echo debug;;
        6) echo debug;;
        *) return 1;;
    esac
}

## @brief Converts dracut-logger numeric level to syslog log level
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes kernel console numeric log level
#
# Conversion is done as follows:
#
# <tt>
#   none     -> LOG_EMERG (0)
#   none     -> LOG_ALERT (1)
#   FATAL(1) -> LOG_CRIT (2)
#   ERROR(2) -> LOG_ERR (3)
#   WARN(3)  -> LOG_WARNING (4)
#   none     -> LOG_NOTICE (5)
#   INFO(4)  -> LOG_INFO (6)
#   DEBUG(5) -> LOG_DEBUG (7)
#   TRACE(6) /
# </tt>
#
# @see /usr/include/sys/syslog.h
_dlvl2syslvl() {
    local lvl

    case "$1" in
        1) lvl=2;;
        2) lvl=3;;
        3) lvl=4;;
        4) lvl=6;;
        5) lvl=7;;
        6) lvl=7;;
        *) return 1;;
    esac

    [ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
}

## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
# given message with given level (priority).
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This is core logging function which logs given message to standard error, file
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
# The format is following:
#
# <tt>X: some message</tt>
#
# where @c X is the first letter of logging level. See module description for
# details on that.
#
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
# following:
#   - @c FATAL to @c crit
#   - @c ERROR to @c error
#   - @c WARN to @c warning
#   - @c INFO to @c info
#   - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
    local lvl="$1"; shift
    local lvlc=$(_lvl2char "$lvl") || return 0
    local msg="$*"
    local lmsg="$lvlc: $*"

    (( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2

    if (( $lvl <= $sysloglvl )); then
        if [[ "$_dlogfd" ]]; then
            printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
        else
            logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
        fi
    fi

    if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
        echo "$lmsg" >>"$logfile"
    fi

    (( $lvl <= $kmsgloglvl )) && \
        echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}

## @brief Internal helper function for _do_dlog()
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This function calls _do_dlog() either with parameter msg, or if
# none is given, it will read standard input and will use every line as
# a message.
#
# This enables:
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
    [ -z "$maxloglvl" ] && return 0
    (( $1 <= $maxloglvl )) || return 0

    if (( $# > 1 )); then
        _do_dlog "$@"
    else
        while read line || [ -n "$line" ]; do
            _do_dlog "$1" "$line"
        done
    fi
}

## @brief Logs message at TRACE level (6)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dtrace() {
    set +x
    dlog 6 "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief Logs message at DEBUG level (5)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
ddebug() {
    set +x
    dlog 5 "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief Logs message at INFO level (4)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dinfo() {
    set +x
    dlog 4 "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief Logs message at WARN level (3)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarn() {
    set +x
    dlog 3 "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief It's an alias to dwarn() function.
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarning() {
    set +x
    dwarn "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief Logs message at ERROR level (2)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
derror() {
    set +x
    dlog 2 "$@"
    [ -n "$debug" ] && set -x || :
}

## @brief Logs message at FATAL level (1)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dfatal() {
    set +x
    dlog 1 "$@"
    [ -n "$debug" ] && set -x || :
}
DRACUT_VERSION=049-237.git20250603.el8_10
#!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
export LC_MESSAGES=C

# is_func <command>
# Check whether $1 is a function.
is_func() {
    [[ "$(type -t "$1")" = "function" ]]
}


# Generic substring function.  If $2 is in $1, return 0.
strstr() { [[ $1 = *"$2"* ]]; }
# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
strglobin() { [[ $1 = *$2* ]]; }
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
strglob() { [[ $1 = $2 ]]; }
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() { [ "${1%*"$2"}" != "$1" ]; }

# find a binary.  If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
    if [[ -z ${1##/*} ]]; then
        if [[ -x $1 ]] || { [[ "$1" == *.so* ]] && ldd "$1" &>/dev/null; };  then
            printf "%s\n" "$1"
            return 0
        fi
    fi

    type -P "${1##*/}"
}

ldconfig_paths()
{
    ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
}

# Version comparision function.  Assumes Linux style version scheme.
# $1 = version a
# $2 = comparision op (gt, ge, eq, le, lt, ne)
# $3 = version b
vercmp() {
    local _n1=(${1//./ }) _op=$2 _n2=(${3//./ }) _i _res

    for ((_i=0; ; _i++))
    do
        if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
        elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
        elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
        else continue
        fi
        break
    done

    case $_op in
        gt) ((_res == 1));;
        ge) ((_res != 2));;
        eq) ((_res == 0));;
        le) ((_res != 1));;
        lt) ((_res == 2));;
        ne) ((_res != 0));;
    esac
}

# Create all subdirectories for given path without creating the last element.
# $1 = path
mksubdirs() {
    [[ -e ${1%/*} ]] || mkdir -m 0755 -p -- "${1%/*}"
}

# Function prints global variables in format name=value line by line.
# $@ = list of global variables' name
print_vars() {
    local _var _value

    for _var in "$@"
    do
        eval printf -v _value "%s" \""\$$_var"\"
        [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
    done
}

# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
    shopt -q -s extglob
    set -- "${1//+(\/)//}"
    shopt -q -u extglob
    printf "%s\n" "${1%/}"
}

# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
    local __current __absolute __abssize __cursize __newpath
    local -i __i __level

    set -- "$(normalize_path "$1")" "$(normalize_path "$2")"

    # corner case #1 - self looping link
    [[ "$1" == "$2" ]] && { printf "%s\n" "${1##*/}"; return; }

    # corner case #2 - own dir link
    [[ "${1%/*}" == "$2" ]] && { printf ".\n"; return; }

    IFS="/" __current=($1)
    IFS="/" __absolute=($2)

    __abssize=${#__absolute[@]}
    __cursize=${#__current[@]}

    while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]
    do
        (( __level++ ))
        if (( __level > __abssize || __level > __cursize ))
        then
            break
        fi
    done

    for ((__i = __level; __i < __cursize-1; __i++))
    do
        if ((__i > __level))
        then
            __newpath=$__newpath"/"
        fi
        __newpath=$__newpath".."
    done

    for ((__i = __level; __i < __abssize; __i++))
    do
        if [[ -n $__newpath ]]
        then
            __newpath=$__newpath"/"
        fi
        __newpath=$__newpath${__absolute[__i]}
    done

    printf "%s\n" "$__newpath"
}


# get_fs_env <device>
# Get and the ID_FS_TYPE variable from udev for a device.
# Example:
# $ get_fs_env /dev/sda2
# ext4
get_fs_env() {
    local evalstr
    local found

    [[ $1 ]] || return
    unset ID_FS_TYPE
    ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
        | while read line || [ -n "$line" ]; do
            if [[ "$line" == TYPE\=* ]]; then
                printf "%s" "${line#TYPE=}";
                exit 0;
            fi
            done)
    if [[ $ID_FS_TYPE ]]; then
        printf "%s" "$ID_FS_TYPE"
        return 0
    fi
    return 1
}

# get_maj_min <device>
# Prints the major and minor of a device node.
# Example:
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
    local _majmin
    local _out

    if [[ $get_maj_min_cache_file ]]; then
        _out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")"
    fi

    if ! [[ "$_out" ]]; then
    _majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
        _out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
        if [[ $get_maj_min_cache_file ]]; then
            echo "$1 $_out" >> "$get_maj_min_cache_file"
    fi
    fi
    echo -n "$_out"
}

# get_devpath_block <device>
# get the DEVPATH in /sys of a block device
get_devpath_block() {
    local _majmin _i
    _majmin=$(get_maj_min "$1")

    for _i in /sys/block/*/dev /sys/block/*/*/dev; do
        [[ -e "$_i" ]] || continue
        if [[ "$_majmin" == "$(<"$_i")" ]]; then
            printf "%s" "${_i%/dev}"
            return 0
        fi
    done
    return 1
}

# get a persistent path from a device
get_persistent_dev() {
    local i _tmp _dev _pol

    _dev=$(get_maj_min "$1")
    [ -z "$_dev" ] && return

    if [[ -n "$persistent_policy" ]]; then
	_pol="/dev/disk/${persistent_policy}/*"
    else
	_pol=
    fi

    for i in \
        $_pol \
        /dev/mapper/* \
        /dev/disk/by-uuid/* \
        /dev/disk/by-label/* \
        /dev/disk/by-partuuid/* \
        /dev/disk/by-partlabel/* \
        /dev/disk/by-id/* \
        /dev/disk/by-path/* \
        ; do
        [[ -e "$i" ]] || continue
        [[ $i == /dev/mapper/control ]] && continue
        [[ $i == /dev/mapper/mpath* ]] && continue
        _tmp=$(get_maj_min "$i")
        if [ "$_tmp" = "$_dev" ]; then
            printf -- "%s" "$i"
            return
        fi
    done
    printf -- "%s" "$1"
}

expand_persistent_dev() {
    local _dev=$1

    case "$_dev" in
        LABEL=*)
            _dev="/dev/disk/by-label/${_dev#LABEL=}"
            ;;
        UUID=*)
            _dev="${_dev#UUID=}"
            _dev="${_dev,,}"
            _dev="/dev/disk/by-uuid/${_dev}"
            ;;
        PARTUUID=*)
            _dev="${_dev#PARTUUID=}"
            _dev="${_dev,,}"
            _dev="/dev/disk/by-partuuid/${_dev}"
            ;;
        PARTLABEL=*)
            _dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
            ;;
    esac
    printf "%s" "$_dev"
}

shorten_persistent_dev() {
    local _dev="$1"
    case "$_dev" in
        /dev/disk/by-uuid/*)
            printf "%s" "UUID=${_dev##*/}";;
        /dev/disk/by-label/*)
            printf "%s" "LABEL=${_dev##*/}";;
        /dev/disk/by-partuuid/*)
            printf "%s" "PARTUUID=${_dev##*/}";;
        /dev/disk/by-partlabel/*)
            printf "%s" "PARTLABEL=${_dev##*/}";;
        *)
            printf "%s" "$_dev";;
    esac
}

# find_block_device <mountpoint>
# Prints the major and minor number of the block device
# for a given mountpoint.
# Unless $use_fstab is set to "yes" the functions
# uses /proc/self/mountinfo as the primary source of the
# information and only falls back to /etc/fstab, if the mountpoint
# is not found there.
# Example:
# $ find_block_device /usr
# 8:4
find_block_device() {
    local _dev _majmin _find_mpt
    _find_mpt="$1"
    if [[ $use_fstab != yes ]]; then
        [[ -d $_find_mpt/. ]]
        findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
            while read _majmin _dev || [ -n "$_dev" ]; do
                if [[ -b $_dev ]]; then
                    if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
                        _majmin=$(get_maj_min $_dev)
                    fi
                    if [[ $_majmin ]]; then
                        printf "%s\n" "$_majmin"
                    else
                        printf "%s\n" "$_dev"
                    fi
                    return 0
                fi
                if [[ $_dev = *:* ]]; then
                    printf "%s\n" "$_dev"
                    return 0
                fi
            done; return 1; } && return 0
    fi
    # fall back to /etc/fstab

    findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
        while read _majmin _dev || [ -n "$_dev" ]; do
            if ! [[ $_dev ]]; then
                _dev="$_majmin"
                unset _majmin
            fi
            if [[ -b $_dev ]]; then
                [[ $_majmin ]] || _majmin=$(get_maj_min $_dev)
                if [[ $_majmin ]]; then
                    printf "%s\n" "$_majmin"
                else
                    printf "%s\n" "$_dev"
                fi
                return 0
            fi
            if [[ $_dev = *:* ]]; then
                printf "%s\n" "$_dev"
                return 0
            fi
        done; return 1; } && return 0

    return 1
}

# find_mp_fstype <mountpoint>
# Echo the filesystem type for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fstype /;echo
# ext4
find_mp_fstype() {
    local _fs

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
            while read _fs || [ -n "$_fs" ]; do
                [[ $_fs ]] || continue
                [[ $_fs = "autofs" ]] && continue
                printf "%s" "$_fs"
                return 0
            done; return 1; } && return 0
    fi

    findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
        while read _fs || [ -n "$_fs" ]; do
            [[ $_fs ]] || continue
            [[ $_fs = "autofs" ]] && continue
            printf "%s" "$_fs"
            return 0
        done; return 1; } && return 0

    return 1
}

# find_dev_fstype <device>
# Echo the filesystem type for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
    local _find_dev _fs
    _find_dev="$1"
    if ! [[ "$_find_dev" = /dev* ]]; then
        [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
    fi

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
            while read _fs || [ -n "$_fs" ]; do
                [[ $_fs ]] || continue
                [[ $_fs = "autofs" ]] && continue
                printf "%s" "$_fs"
                return 0
            done; return 1; } && return 0
    fi

    findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
        while read _fs || [ -n "$_fs" ]; do
            [[ $_fs ]] || continue
            [[ $_fs = "autofs" ]] && continue
            printf "%s" "$_fs"
            return 0
        done; return 1; } && return 0

    return 1
}

# find_mp_fsopts <mountpoint>
# Echo the filesystem options for a given mountpoint.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_mp_fsopts /;echo
# rw,relatime,discard,data=ordered
find_mp_fsopts() {
    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'OPTIONS' --target "$1" 2>/dev/null && return 0
    fi

    findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1"
}

# find_dev_fsopts <device>
# Echo the filesystem options for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# Example:
# $ find_dev_fsopts /dev/sda2
# rw,relatime,discard,data=ordered
find_dev_fsopts() {
    local _find_dev _opts
    _find_dev="$1"
    if ! [[ "$_find_dev" = /dev* ]]; then
        [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
    fi

    if [[ $use_fstab != yes ]]; then
        findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2>/dev/null && return 0
    fi

    findmnt --fstab -e -v -n -o 'OPTIONS' --source "$_find_dev"
}


# finds the major:minor of the block device backing the root filesystem.
find_root_block_device() { find_block_device /; }

# for_each_host_dev_fs <func>
# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
# in ${host_fs_types[@]}
for_each_host_dev_fs()
{
    local _func="$1"
    local _dev
    local _ret=1

    [[ "${#host_fs_types[@]}" ]] || return 2


    for _dev in "${!host_fs_types[@]}"; do
        $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
    done
    return $_ret
}

host_fs_all()
{
    printf "%s\n" "${host_fs_types[@]}"
}

# Walk all the slave relationships for a given block device.
# Stop when our helper function returns success
# $1 = function to call on every found block device
# $2 = block device in major:minor format
check_block_and_slaves() {
    local _x
    [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
    if ! lvm_internal_dev $2; then "$1" $2 && return; fi
    check_vol_slaves "$@" && return 0
    if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
        check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
    fi
    [[ -d /sys/dev/block/$2/slaves ]] || return 1
    for _x in /sys/dev/block/$2/slaves/*; do
        [[ -f $_x/dev ]] || continue
        [[ $_x/subsystem -ef /sys/class/block ]] || continue
        check_block_and_slaves $1 $(<"$_x/dev") && return 0
    done
    return 1
}

check_block_and_slaves_all() {
    local _x _ret=1
    [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
    if ! lvm_internal_dev $2 && "$1" $2; then
        _ret=0
    fi
    check_vol_slaves_all "$@" && return 0
    if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
        check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
    fi
    [[ -d /sys/dev/block/$2/slaves ]] || return 1
    for _x in /sys/dev/block/$2/slaves/*; do
        [[ -f $_x/dev ]] || continue
        [[ $_x/subsystem -ef /sys/class/block ]] || continue
        check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
    done
    return $_ret
}
# for_each_host_dev_and_slaves <func>
# Execute "<func> <dev>" for every "<dev>" found
# in ${host_devs[@]} and their slaves
for_each_host_dev_and_slaves_all()
{
    local _func="$1"
    local _dev
    local _ret=1

    [[ "${host_devs[@]}" ]] || return 2

    for _dev in "${host_devs[@]}"; do
        [[ -b "$_dev" ]] || continue
        if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
            _ret=0
        fi
    done
    return $_ret
}

for_each_host_dev_and_slaves()
{
    local _func="$1"
    local _dev

    [[ "${host_devs[@]}" ]] || return 2

    for _dev in "${host_devs[@]}"; do
        [[ -b "$_dev" ]] || continue
        check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
    done
    return 1
}

# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
# Logical volumes only have the slave devices they really live on,
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
    local _lv _vg _pv _dm _majmin
    _majmin="$2"
    _lv="/dev/block/$_majmin"
    _dm=/sys/dev/block/$_majmin/dm
    [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || return 1
    _vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
    # strip space
    _vg="${_vg//[[:space:]]/}"
    if [[ $_vg ]]; then
        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
        do
            check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
        done
    fi
    return 1
}

check_vol_slaves_all() {
    local _lv _vg _pv _majmin
    _majmin="$2"
    _lv="/dev/block/$_majmin"
    _dm="/sys/dev/block/$_majmin/dm"
    [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || return 1
    _vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
    # strip space
    _vg="${_vg//[[:space:]]/}"
    if [[ $_vg ]]; then
        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
        do
            check_block_and_slaves_all $1 $(get_maj_min $_pv)
        done
        return 0
    fi
    return 1
}



# fs_get_option <filesystem options> <search for option>
# search for a specific option in a bunch of filesystem options
# and return the value
fs_get_option() {
    local _fsopts=$1
    local _option=$2
    local OLDIFS="$IFS"
    IFS=,
    set -- $_fsopts
    IFS="$OLDIFS"
    while [ $# -gt 0 ]; do
        case $1 in
            $_option=*)
                echo ${1#${_option}=}
                break
        esac
        shift
    done
}

check_kernel_config()
{
    local _config_opt="$1"
    local _config_file
    [[ -f /boot/config-$kernel ]] \
        && _config_file="/boot/config-$kernel"
    [[ -f /lib/modules/$kernel/config ]] \
        && _config_file="/lib/modules/$kernel/config"

    # no kernel config file, so return true
    [[ $_config_file ]] || return 0

    grep -q -F "${_config_opt}=" "$_config_file" && return 0
    return 1
}


# get_cpu_vendor
# Only two values are returned: AMD or Intel
get_cpu_vendor ()
{
    if grep -qE AMD /proc/cpuinfo; then
        printf "AMD"
    fi
    if grep -qE Intel /proc/cpuinfo; then
        printf "Intel"
    fi
}

# get_host_ucode
# Get the hosts' ucode file based on the /proc/cpuinfo
get_ucode_file ()
{
    local family=`grep -E "cpu family" /proc/cpuinfo | head -1 | sed s/.*:\ //`
    local model=`grep -E "model" /proc/cpuinfo |grep -v name | head -1 | sed s/.*:\ //`
    local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`

    if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
        if [[ $family -ge 21 ]]; then
            printf "microcode_amd_fam%xh.bin" $family
        else
            printf "microcode_amd.bin"
        fi
    fi
    if [[ "$(get_cpu_vendor)" == "Intel" ]]; then
        # The /proc/cpuinfo are in decimal.
        printf "%02x-%02x-%02x" ${family} ${model} ${stepping}
    fi
}

# Get currently loaded modules
# sorted, and delimited by newline
get_loaded_kernel_modules ()
{
    local modules=( )
    while read _module _size _used _used_by; do
        modules+=( "$_module" )
    done <<< "$(lsmod | sed -n '1!p')"
    printf '%s\n' "${modules[@]}" | sort
}

# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {
    local dev_dm_dir=/sys/dev/block/$1/dm
    [[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
    local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
    eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
    [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
    [[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}

btrfs_devs() {
    local _mp="$1"
    btrfs device usage "$_mp" \
        | while read _dev _rest; do
        str_starts "$_dev" "/" || continue
        _dev=${_dev%,}
        printf -- "%s\n" "$_dev"
        done
}

# block_is_nbd <maj:min>
# Check whether $1 is an nbd device
block_is_nbd() {
    [[ -b /dev/block/$1 && $1 == 43:* ]]
}

# block_is_iscsi <maj:min>
# Check whether $1 is an nbd device
block_is_iscsi() {
    local _dir
    local _dev=$1
    [[ -L "/sys/dev/block/$_dev" ]] || return
    _dir="$(readlink -f "/sys/dev/block/$_dev")" || return
    until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do
        _dir="$_dir/.."
    done
    [[ -d "$_dir/iscsi_session" ]]
}

# block_is_fcoe <maj:min>
# Check whether $1 is an FCoE device
# Will not work for HBAs that hide the ethernet aspect
# completely and present a pure FC device
block_is_fcoe() {
    local _dir
    local _dev=$1
    [[ -L "/sys/dev/block/$_dev" ]] || return
    _dir="$(readlink -f "/sys/dev/block/$_dev")"
    until [[ -d "$_dir/sys" ]]; do
        _dir="$_dir/.."
        if [[ -d "$_dir/subsystem" ]]; then
            subsystem=$(basename $(readlink $_dir/subsystem))
            [[ $subsystem == "fcoe" ]] && return 0
        fi
    done
    return 1
}

# block_is_netdevice <maj:min>
# Check whether $1 is a net device
block_is_netdevice() {
    block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
}#!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    # Include wired net drivers, excluding wireless
    local _arch=$(uname -m)
    local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open'
    local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
    local _net_drivers

    if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
        dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
    fi

    if [[ $hostonly_mode == 'strict' ]] && [[ -n ${hostonly_nics+x} ]]; then
        for _nic in $hostonly_nics; do
            _net_drivers=$(get_dev_module /sys/class/net/$_nic)
            if ! [[ $_net_drivers ]]; then
                derror "--hostonly-nics contains invalid NIC '$_nic'"
                continue
            fi
            hostonly="" instmods $_net_drivers
        done
        return 0
    fi

    dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net"
    #instmods() will take care of hostonly
    instmods \
        =drivers/net/phy \
        =drivers/net/team \
        =drivers/net/ethernet \
        ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
    hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
}

# called by dracut
install() {
    return 0
}

#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

containers=""
for md in /dev/md[0-9_]*; do
    [ -b "$md" ] || continue
    udevinfo="$(udevadm info --query=env --name=$md)"
    strstr "$udevinfo" "DEVTYPE=partition" && continue
    if strstr "$udevinfo" "MD_LEVEL=container"; then
        containers="$containers $md"
        continue
    fi
    mdadm -S "$md" >/dev/null 2>&1
done

for md in $containers; do
    mdadm -S "$md" >/dev/null 2>&1
done

unset containers udevinfo
#!/bin/sh

if getargbool 0 rd.md.waitclean; then
    type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
    containers=""
    for md in /dev/md[0-9_]*; do
        [ -b "$md" ] || continue
        udevinfo="$(udevadm info --query=env --name=$md)"
        strstr "$udevinfo" "DEVTYPE=partition" && continue
        if strstr "$udevinfo" "MD_LEVEL=container"; then
            containers="$containers $md"
            continue
        fi
        info "Waiting for $md to become clean"
        mdadm -W "$md" >/dev/null 2>&1
    done

    for md in $containers; do
        info "Waiting for $md to become clean"
        mdadm -W "$md" >/dev/null 2>&1
    done

    unset containers udevinfo
fi
SUBSYSTEM!="block", GOTO="md_end"
ACTION!="add|change", GOTO="md_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"

KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"

# partitions have no md/{array_state,metadata_version}
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"

# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"

LABEL="md_ignore_state"

IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
IMPORT BLKID
OPTIONS+="link_priority=100"
OPTIONS+="watch"
OPTIONS+="db_persist"
LABEL="md_end"
#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

for md in /dev/md[0-9_]*; do
    [ -b "$md" ] || continue
    need_shutdown
    break
done
#!/bin/sh

info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
udevproperty rd_NO_MDIMSM=1
#!/bin/sh

_do_md_shutdown() {
    local ret
    local final=$1
    info "Waiting for mdraid devices to be clean."
    mdadm -vv --wait-clean --scan| vinfo
    ret=$?
    info "Disassembling mdraid devices."
    mdadm -vv --stop --scan | vinfo
    ret=$(($ret+$?))
    if [ "x$final" != "x" ]; then
        info "/proc/mdstat:"
        vinfo < /proc/mdstat
    fi
    return $ret
}

if command -v mdadm >/dev/null; then
    _do_md_shutdown $1
else
    :
fi
#!/bin/sh

_do_mdmon_takeover() {
    local ret
    mdmon --takeover --all
    ret=$?
    [ $ret -eq 0 ] && info "Taking over mdmon processes."
    return $ret
}

if command -v mdmon >/dev/null; then
    _do_mdmon_takeover $1
fi
#!/bin/sh
# save state dir for mdmon/mdadm for the real root
[ -d /run/mdadm ] || mkdir -m 0755 /run/mdadm
# backward compat link
# This file causes block devices with Linux RAID (mdadm) signatures to
# automatically cause mdadm to be run.
# See udev(8) for syntax

ACTION!="add|change", GOTO="md_end"
SUBSYSTEM!="block", GOTO="md_end"
ENV{rd_NO_MD}=="?*", GOTO="md_end"
KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
KERNEL=="md*", ACTION!="change", GOTO="md_end"

# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"

ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
GOTO="md_end"

LABEL="md_try"
ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}=="?*", GOTO="md_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}=="?*", GOTO="md_end"

# already done ?
PROGRAM="/bin/sh -c 'for i in $sys/$devpath/holders/md[0-9_]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="md_end"

# for native arrays - array's uuid has to be specified
# for containers - container's uuid has to be specified
# TODO : how to get embedded array's uuid having container's component ?
#
# UUID CHECK

ENV{DEVTYPE}!="partition", \
    RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"

RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/mdraid_start"

#
# Incrementally build the md array; this will automatically assemble
# any eventual containers as well (imsm, ddf)
#
LABEL="md_incremental"

RUN+="/sbin/mdadm -I $env{DEVNAME}"

LABEL="md_end"
#!/bin/sh

info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
udevproperty rd_NO_MDDDF=1
#!/bin/sh

type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh

_md_start() {
    local _udevinfo
    local _path_s
    local _path_d
    local _md="$1"

    _udevinfo="$(udevadm info --query=env --name="${_md}")"
    strstr "$_udevinfo" "MD_LEVEL=container" && continue
    strstr "$_udevinfo" "DEVTYPE=partition" && continue

    _path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
    [ ! -r "$_path_s" ] && continue

    # inactive ?
    [ "$(cat "$_path_s")" != "inactive" ] && continue

    mdadm -R "${_md}" 2>&1 | vinfo

    # still inactive ?
    [ "$(cat "$_path_s")" = "inactive" ] && continue

    _path_d="${_path_s%/*}/degraded"
    [ ! -r "$_path_d" ] && continue
    > $hookdir/initqueue/work
}

_md_force_run() {
    local _md
    local _UUID
    local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
    [ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return

    if [ -n "$_MD_UUID" ]; then
        _MD_UUID=$(str_replace "$_MD_UUID" "-" "")
        _MD_UUID=$(str_replace "$_MD_UUID" ":" "")

        for _md in /dev/md[0-9_]*; do
            [ -b "$_md" ] || continue
            _UUID=$(
                /sbin/mdadm -D --export "$_md" \
                    | while read line || [ -n "$line" ]; do
                    str_starts "$line" "MD_UUID=" || continue
                    printf "%s" "${line#MD_UUID=}"
                done
                )

            [ -z "$_UUID" ] && continue
            _UUID=$(str_replace "$_UUID" ":" "")

            # check if we should handle this device
            strstr " $_MD_UUID " " $_UUID " || continue

            _md_start "${_md}"
        done
    else
        # try to force-run anything not running yet
        for _md in /dev/md[0-9_]*; do
            [ -b "$_md" ] || continue
            _md_start "${_md}"
        done
    fi
}

_md_force_run
#!/bin/bash

# called by dracut
check() {
    local _rootdev
    # No mdadm?  No mdraid support.
    require_binaries mdadm expr || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for dev in "${!host_fs_types[@]}"; do
            [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue

            DEVPATH=$(get_devpath_block "$dev")

            for holder in "$DEVPATH"/holders/*; do
                [[ -e "$holder" ]] || continue
                [[ -e "$holder/md" ]] && return 0
                break
            done

        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo rootfs-block
    return 0
}

# called by dracut
installkernel() {
    instmods =drivers/md
}

# called by dracut
cmdline() {
    local _activated dev line UUID
    declare -A _activated

    for dev in "${!host_fs_types[@]}"; do
        [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue

        UUID=$(
            /sbin/mdadm --examine --export $dev \
                | while read line || [ -n "$line" ]; do
                [[ ${line#MD_UUID=} = $line ]] && continue
                printf "%s" "${line#MD_UUID=} "
            done
        )

        [[ -z "$UUID" ]] && continue

        if ! [[ ${_activated[${UUID}]} ]]; then
            printf "%s" " rd.md.uuid=${UUID}"
            _activated["${UUID}"]=1
        fi

    done
}

# called by dracut
install() {
    local rule rule_path
    inst_multiple cat expr
    inst_multiple -o mdmon
    inst $(command -v partx) /sbin/partx
    inst $(command -v mdadm) /sbin/mdadm

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _raidconf=$(cmdline)
        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
    fi

    # <mdadm-3.3 udev rule
    inst_rules 64-md-raid.rules
    # >=mdadm-3.3 udev rules
    inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
    # remove incremental assembly from stock rules, so they don't shadow
    # 65-md-inc*.rules and its fine-grained controls, or cause other problems
    # when we explicitly don't want certain components to be incrementally
    # assembled
    for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
        rule_path="${initdir}${udevdir}/rules.d/${rule}"
        [ -f "${rule_path}" ] && sed -i -r \
            -e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
            "${rule_path}"
    done

    inst_rules "$moddir/65-md-incremental-imsm.rules"

    inst_rules "$moddir/59-persistent-storage-md.rules"
    prepare_udev_rules 59-persistent-storage-md.rules

    # guard against pre-3.0 mdadm versions, that can't handle containers
    if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
        inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
    fi
    if ! mdadm -Q -e ddf /dev/null >/dev/null 2>&1; then
        inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
    fi

    if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
        if [ -f /etc/mdadm.conf ]; then
            inst -H /etc/mdadm.conf
        else
            [ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
        fi
        if [ -d /etc/mdadm.conf.d ]; then
            local f
            inst_dir /etc/mdadm.conf.d
            for f in /etc/mdadm.conf.d/*.conf; do
                [ -f "$f" ] || continue
                inst -H "$f"
            done
        fi
    fi

    inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
    inst_hook pre-trigger 30 "$moddir/parse-md.sh"
    inst_hook pre-mount 10 "$moddir/mdraid-waitclean.sh"
    inst_hook cleanup 99 "$moddir/mdraid-needshutdown.sh"
    inst_hook shutdown 30 "$moddir/md-shutdown.sh"
    inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
    inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
    if dracut_module_included "systemd"; then
        if [ -e $systemdsystemunitdir/mdmon@.service ]; then
            inst_simple $systemdsystemunitdir/mdmon@.service
        fi
        if [ -e $systemdsystemunitdir/mdadm-last-resort@.service ]; then
            inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
        fi
        if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
            inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
        fi
        if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-grow-continue@.service ]; then
            inst_simple $systemdsystemunitdir/mdadm-grow-continue@.service
        fi
    fi
    inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
    dracut_need_initqueue
}
#!/bin/sh

MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
# normalize the uuid
MD_UUID=$(str_replace "$MD_UUID" "-" "")
MD_UUID=$(str_replace "$MD_UUID" ":" "")

if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md=0: removing MD RAID activation"
    udevproperty rd_NO_MD=1
else
    # rewrite the md rules to only process the specified raid array
    if [ -n "$MD_UUID" ]; then
        for f in /etc/udev/rules.d/65-md-incremental*.rules; do
            [ -e "$f" ] || continue
            while read line || [ -n "$line" ]; do
                if [ "${line%%UUID CHECK}" != "$line" ]; then
                    for uuid in $MD_UUID; do
                        printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8)-$(expr substr $uuid 9 4)-$(expr substr $uuid 13 4)-$(expr substr $uuid 17 4)-$(expr substr $uuid 21 12)"
                    done;
                    printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
                    for uuid in $MD_UUID; do
                        printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
                    done;
                    printf 'GOTO="md_end"\n'
                    printf 'LABEL="md_uuid_ok"\n'
                else
                    echo "$line"
                fi
            done < "${f}" > "${f}.new"
            mv "${f}.new" "$f"
        done
        for uuid in $MD_UUID; do
            uuid="$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
            wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
        done
    fi
fi


if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
    udevproperty rd_MDADMCONF=1
    rm -f -- $hookdir/pre-pivot/*mdraid-cleanup.sh
fi

if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
    rm -f -- /etc/mdadm/mdadm.conf /etc/mdadm.conf
    ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
fi

# noiswmd nodmraid for anaconda / rc.sysinit compatibility
# note nodmraid really means nobiosraid, so we don't want MDIMSM then either
if ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd -n nodmraid; then
    info "no MD RAID for imsm/isw raids"
    udevproperty rd_NO_MDIMSM=1
fi

# same thing with ddf containers
if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
    info "no MD RAID for SNIA ddf raids"
    udevproperty rd_NO_MDDDF=1
fi
#! /bin/sh

KEXEC=/sbin/kexec
standard_kexec_args="-p"

EARLY_KDUMP_INITRD=""
EARLY_KDUMP_KERNEL=""
EARLY_KDUMP_CMDLINE=""
EARLY_KDUMP_KERNELVER=""
EARLY_KEXEC_ARGS=""

. /etc/sysconfig/kdump
. /lib/dracut-lib.sh
. /lib/kdump-lib.sh
. /lib/kdump-logger.sh

#initiate the kdump logger
dlog_init
if [ $? -ne 0 ]; then
        echo "failed to initiate the kdump logger."
        exit 1
fi

prepare_parameters()
{
    EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
    EARLY_KDUMP_KERNEL="/boot/kernel-earlykdump"
    EARLY_KDUMP_INITRD="/boot/initramfs-earlykdump"
}

early_kdump_load()
{
    check_kdump_feasibility
    if [ $? -ne 0 ]; then
        return 1
    fi

    if is_fadump_capable; then
        dwarn "WARNING: early kdump doesn't support fadump."
        return 1
    fi

    check_current_kdump_status
    if [ $? == 0 ]; then
        return 1
    fi

    prepare_parameters

    EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")

    # Here, only output the messages, but do not save these messages
    # to a file because the target disk may not be mounted yet, the
    # earlykdump is too early.
    ddebug "earlykdump: $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
	--command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \
	$EARLY_KDUMP_KERNEL"

    $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
        --command-line="$EARLY_KDUMP_CMDLINE" \
        --initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL
    if [ $? == 0 ]; then
        dinfo "kexec: loaded early-kdump kernel"
        return 0
    else
        derror "kexec: failed to load early-kdump kernel"
        return 1
    fi
}

set_early_kdump()
{
    if getargbool 0 rd.earlykdump; then
        dinfo "early-kdump is enabled."
        early_kdump_load
    else
        dinfo "early-kdump is disabled."
    fi

    return 0
}

set_early_kdump
#!/bin/bash

. /etc/sysconfig/kdump

KDUMP_KERNEL=""
KDUMP_INITRD=""

check() {
    if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\
        || [ -n "${IN_KDUMP}" ]
    then
        return 1
    fi
    return 255
}

depends() {
    echo "base shutdown"
    return 0
}

prepare_kernel_initrd() {
    . /lib/kdump/kdump-lib.sh

    prepare_kdump_bootinfo

    # $kernel is a variable from dracut
    if [ "$KDUMP_KERNELVER" != $kernel ]; then
        dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
            "but the initramfs is generated for kernel version '$kernel'"
    fi
}

install() {
    prepare_kernel_initrd
    if [ ! -f "$KDUMP_KERNEL" ]; then
        derror "Could not find required kernel for earlykdump," \
            "earlykdump will not work!"
        return 1
    fi
    if [ ! -f "$KDUMP_INITRD" ]; then
        derror "Could not find required kdump initramfs for earlykdump," \
            "please ensure kdump initramfs is generated first," \
            "earlykdump will not work!"
        return 1
    fi

    inst_multiple tail find cut dirname hexdump
    inst_simple "/etc/sysconfig/kdump"
    inst_binary "/usr/sbin/kexec"
    inst_binary "/usr/bin/gawk" "/usr/bin/awk"
    inst_binary "/usr/bin/logger" "/usr/bin/logger"
    inst_binary "/usr/bin/printf" "/usr/bin/printf"
    inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
    inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
    inst_hook cmdline 00 "$moddir/early-kdump.sh"
    inst_binary "$KDUMP_KERNEL"
    inst_binary "$KDUMP_INITRD"

    ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump"
    ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump"

    chmod -x "${initdir}/$KDUMP_KERNEL"
}
#!/bin/sh

if test -e /etc/adjtime ; then
    while read line ; do
	if test "$line" = LOCAL ; then
	    hwclock --systz
	fi
    done < /etc/adjtime
fi
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# called by dracut
check() {
    # hwclock does not exist on S390(x), bail out silently then
    local _arch=$(uname -m)
    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1

    [ -e /etc/localtime -a -e /etc/adjtime ] || return 1
    require_binaries /sbin/hwclock || return 1

    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst /usr/share/zoneinfo/UTC
    inst /etc/localtime
    inst /etc/adjtime
    inst_hook pre-trigger 00 "$moddir/warpclock.sh"
    inst /sbin/hwclock
}
#!/bin/sh

# Implement blacklisting for udev-loaded modules

modprobe -b "$@"
SUBSYSTEM!="block", GOTO="ps_end"
ACTION!="add|change", GOTO="ps_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="ps_end"

KERNEL=="cciss[0-9]*", IMPORT BLKID
KERNEL=="nbd[0-9]*", IMPORT BLKID

LABEL="ps_end"
SUBSYSTEM!="block", GOTO="pss_end"
ACTION!="add|change", GOTO="pss_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="pss_end"

ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="do_pss"
KERNEL=="cciss[0-9]*", GOTO="do_pss"
KERNEL=="nbd[0-9]*", GOTO="do_pss"
KERNEL=="md[0-9]*|md_d[0-9]*|md/*", GOTO="do_pss"

GOTO="pss_end"

LABEL="do_pss"
# by-path (parent device path)
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"

# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="pss_end"
#!/bin/bash

# called by dracut
install() {
    local _i

    # Fixme: would be nice if we didn't have to guess, which rules to grab....
    # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
    # of the rules we want so that we just copy those in would be best
    inst_multiple udevadm cat uname blkid
    inst_dir /etc/udev
    inst_multiple -o /etc/udev/udev.conf

    [ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
    for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /sbin/udevd; do
        [ -x "$_i" ] || continue
        inst "$_i"

        if ! [[ -f  ${initdir}${systemdutildir}/systemd-udevd ]]; then
            ln -fs "$_i" ${initdir}${systemdutildir}/systemd-udevd
        fi
        break
    done
    if ! [[ -e ${initdir}${systemdutildir}/systemd-udevd ]]; then
        derror "Cannot find [systemd-]udevd binary!"
        exit 1
    fi

    inst_rules \
        40-redhat.rules \
        50-firmware.rules \
        50-udev.rules \
        50-udev-default.rules \
        55-scsi-sg3_id.rules \
        58-scsi-sg3_symlink.rules \
        59-scsi-sg3_utils.rules \
        60-block.rules \
        60-pcmcia.rules \
        60-persistent-storage.rules \
        61-persistent-storage-edd.rules \
        70-uaccess.rules \
        71-seat.rules \
        73-seat-late.rules \
        75-net-description.rules \
        80-drivers.rules 95-udev-late.rules \
        80-net-name-slot.rules\
        80-net-setup-link.rules \
        95-late.rules \
        "$moddir/59-persistent-storage.rules" \
        "$moddir/61-persistent-storage.rules" \
        ${NULL}

    prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
    # debian udev rules
    inst_rules 91-permissions.rules
    # eudev rules
    inst_rules 80-drivers-modprobe.rules

    if dracut_module_included "systemd"; then
        inst_multiple -o ${systemdutildir}/network/*.link
        [[ $hostonly ]] && inst_multiple -H -o /etc/systemd/network/*.link
    fi

    {
        for i in cdrom tape dialout floppy; do
            if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
                if ! grep "^$i:" /etc/group 2>/dev/null; then
                        case $i in
                            cdrom)   echo "$i:x:11:";;
                            dialout) echo "$i:x:18:";;
                            floppy)  echo "$i:x:19:";;
                            tape)    echo "$i:x:33:";;
                        esac
                fi
            fi
        done
    } >> "$initdir/etc/group"

    inst_multiple -o \
        ${udevdir}/ata_id \
        ${udevdir}/cdrom_id \
        ${udevdir}/create_floppy_devices \
        ${udevdir}/edd_id \
        ${udevdir}/firmware.sh \
        ${udevdir}/firmware \
        ${udevdir}/firmware.agent \
        ${udevdir}/hotplug.functions \
        ${udevdir}/fw_unit_symlinks.sh \
        ${udevdir}/hid2hci \
        ${udevdir}/path_id \
        ${udevdir}/input_id \
        ${udevdir}/scsi_id \
        ${udevdir}/usb_id \
        ${udevdir}/pcmcia-socket-startup \
        ${udevdir}/pcmcia-check-broken-cis

    inst_multiple -o /etc/pcmcia/config.opts

    [ -f /etc/arch-release ] && \
        inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh

    inst_libdir_file "libnss_files*"

}

#!/bin/sh

# FIXME: load selinux policy.  this should really be done after we switchroot

rd_load_policy()
{
    # If SELinux is disabled exit now
    getarg "selinux=0" > /dev/null && return 0

    SELINUX="enforcing"
    [ -e "$NEWROOT/etc/selinux/config" ] && . "$NEWROOT/etc/selinux/config"

    # Check whether SELinux is in permissive mode
    permissive=0
    getarg "enforcing=0" > /dev/null
    if [ $? -eq 0 -o "$SELINUX" = "permissive" ]; then
        permissive=1
    fi

    # Attempt to load SELinux Policy
    if [ -x "$NEWROOT/usr/sbin/load_policy" -o -x "$NEWROOT/sbin/load_policy" ]; then
        local ret=0
        local out
        info "Loading SELinux policy"
        mount -o bind /sys $NEWROOT/sys
        # load_policy does mount /proc and /sys/fs/selinux in
        # libselinux,selinux_init_load_policy()
        if [ -x "$NEWROOT/sbin/load_policy" ]; then
            out=$(LANG=C chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
            ret=$?
            info $out
        else
            out=$(LANG=C chroot "$NEWROOT" /usr/sbin/load_policy -i 2>&1)
            ret=$?
            info $out
        fi
        umount $NEWROOT/sys/fs/selinux
        umount $NEWROOT/sys

        if [ "$SELINUX" = "disabled" ]; then
            return 0;
        fi

        if [ $ret -eq 0 -o $ret -eq 2 ]; then
            # If machine requires a relabel, force to permissive mode
            [ -e "$NEWROOT"/.autorelabel ] && LANG=C /usr/sbin/setenforce 0
            mount --rbind /dev "$NEWROOT/dev"
            LANG=C chroot "$NEWROOT" /sbin/restorecon -R /dev
            umount -R "$NEWROOT/dev"
            return 0
        fi

        warn "Initial SELinux policy load failed."
        if [ $ret -eq 3 -o $permissive -eq 0 ]; then
            warn "Machine in enforcing mode."
            warn "Not continuing"
            emergency_shell -n selinux
            exit 1
        fi
        return 0
    elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then
        warn "Machine in enforcing mode and cannot execute load_policy."
        warn "To disable selinux, add selinux=0 to the kernel command line."
        warn "Not continuing"
        emergency_shell -n selinux
        exit 1
    fi
}

rd_load_policy
#!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
install() {
    inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
    inst_multiple setenforce
}

#!/bin/bash
#
# Copyright 2013 Red Hat, Inc.  All rights reserved.
# Copyright 2013 Harald Hoyer <harald@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

getbyte () {
    local IFS= LC_CTYPE=C res c
    read -r -n 1 -d '' c
    res=$?
    # the single quote in the argument of the printf
    # yields the numeric value of $c (ASCII since LC_CTYPE=C)
    [[ -n $c ]] && c=$(printf '%u' "'$c") || c=0
    printf "$c"
    return $res
}

getword () {
    local b1 b2 val
    b1=$(getbyte) || return 1
    b2=$(getbyte) || return 1
    (( val = b2 * 256 + b1 ))
    echo $val
    return 0
}

# Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0)
uefi_device_path()
{
    local IFS= LC_CTYPE=C res tt len type hextype first
    first=1

    while :; do
        type=$(getbyte) || return 1
        subtype=$(getbyte) || return 1
        len=$(getword) || return 1
        hextype=$(printf "%02x%02x" "$type" "$subtype")
        if [[ $first == 1 ]]; then
            first=0
        elif [[ $hextype != "7fff" ]]; then
            printf "/"
        fi
        case $hextype in
            0101)
                # PCI
                tt=$(getword)
                printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255))
                ;;
            0201)
                # ACPI
                printf "Acpi(0x%x,0x%x)" $(($(getword) + $(getword) * 65536)) $(($(getword) + $(getword) * 65536))
                ;;
            0303)
                # FIBRE
                getword &>/dev/null
                getword &>/dev/null
                printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \
                    $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
                    $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
                    $(( $(getword) + $(getword) * 65536 + 4294967296 * ( $(getword) + $(getword) * 65536 ) ))
                ;;
            030b)
                # MAC
                printf "MAC(%02x%02x%02x%02x%02x%02x," $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
                read -r -N 26  tt || return 1
                printf "0x%x)"  $(getbyte)
                ;;
            0314)
                # VLAN
                printf "VLAN(%d)" $(getword)
                ;;
            7fff)
                # END
                printf "\n"
                return 0
                ;;
            *)
                printf "Unknown(Type:%d SubType:%d len=%d)" "$type" "$subtype" "$len"
                read -r -N $(($len-4))  tt || return 1
                ;;
        esac
    done
}

get_fcoe_boot_mac()
{
    data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data}
    [ -f $data ] || return 1
    local IFS= LC_CTYPE=C tt len type hextype
    first=1

    while :; do
        type=$(getbyte) || return 1
        subtype=$(getbyte) || return 1
        len=$(getword) || return 1
        hextype=$(printf "%02x%02x" "$type" "$subtype")
        case $hextype in
            030b)
                # MAC
                printf "%02x:%02x:%02x:%02x:%02x:%02x" $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
                read -r -N 27  tt || return 1
                ;;
            7fff)
                # END
                return 0
                ;;
            *)
                read -r -N $(($len-4))  tt || return 1
                ;;
        esac
    done < $data
}

get_fcoe_boot_vlan()
{
    data=${1:-/sys/firmware/efi/vars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac/data}
    [ -f $data ] || return 1
    local IFS= LC_CTYPE=C tt len type hextype
    first=1

    while :; do
        type=$(getbyte) || return 1
        subtype=$(getbyte) || return 1
        len=$(getword) || return 1
        hextype=$(printf "%02x%02x" "$type" "$subtype")
        case $hextype in
            0314)
                # VLAN
                printf "%d" $(getword)
                ;;
            7fff)
                # END
                return 0
                ;;
            *)
                read -r -N $(($len-4))  tt || return 1
                ;;
        esac
    done < $data
}
#!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    echo bash
    return 0
}

# called by dracut
install() {
    inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh"
}

#!/bin/sh
# url-lib.sh - functions for handling URLs (file fetching etc.)
#
# Authors:
#   Will Woods <wwoods@redhat.com>

type mkuniqdir >/dev/null 2>&1 || . /lib/dracut-lib.sh

# fetch_url URL [OUTFILE]
#   fetch the given URL to a locally-visible location.
#   if OUTFILE is given, the URL will be fetched to that filename,
#   overwriting it if present.
#   If the URL is something mountable (e.g. nfs://) and no OUTFILE is given,
#   the server will be left mounted until pre-pivot.
#   the return values are as follows:
#   0: success
#   253: unknown error (file missing)
#   254: unhandled URL scheme / protocol
#   255: bad arguments / unparseable URLs
#   other: fetch command failure (whatever curl/mount/etc return)
fetch_url() {
    local url="$1" outloc="$2"
    local handler="$(get_url_handler $url)"
    [ -n "$handler" ] || return 254
    [ -n "$url" ] || return 255
    "$handler" "$url" "$outloc"
}

# get_url_handler URL
#   returns the first HANDLERNAME corresponding to the URL's scheme
get_url_handler() {
    local scheme="${1%%:*}" item=""
    for item in $url_handler_map; do
        [ "$scheme" = "${item%%:*}" ] && echo "${item#*:}" && return 0
    done
    return 1
}

# add_url_handler HANDLERNAME SCHEME [SCHEME...]
#   associate the named handler with the named scheme(s).
add_url_handler() {
    local handler="$1"; shift
    local schemes="$@" scheme=""
    set --
    for scheme in $schemes; do
        [ "$(get_url_handler $scheme)" = "$handler" ] && continue
        set -- "$@" "$scheme:$handler"
    done
    set -- $@ $url_handler_map # add new items to *front* of list
    url_handler_map="$@"
}

### HTTP, HTTPS, FTP #################################################

export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
curl_args="--globoff --location --retry 3 --fail --show-error"
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"

proxy=$(getarg proxy=)
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"

curl_fetch_url() {
    local url="$1" outloc="$2"
    echo "$url" > /proc/self/fd/0
    if [ -n "$outloc" ]; then
        curl $curl_args --output - -- "$url" > "$outloc" || return $?
    else
        local outdir="$(mkuniqdir /tmp curl_fetch_url)"
        ( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
        outloc="$outdir/$(ls -A $outdir)"
    fi
    if ! [ -f "$outloc" ]; then
	    warn "Downloading '$url' failed!"
	    return 253
    fi
    if [ -z "$2" ]; then echo "$outloc" ; fi
}
add_url_handler curl_fetch_url http https ftp tftp

set_http_header() {
    echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
}

### TORRENT ##########################################################

ctorrent_args="-E 0 -e 0"

ctorrent_fetch_url() {
    local url="$1" outloc="$2"
    url=${url#*//}
    torrent_outloc="$outloc.torrent"
    echo "$url" > /proc/self/fd/0
    if [ -n "$outloc" ]; then
        curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
    else
        local outdir="$(mkuniqdir /tmp torrent_fetch_url)"
        ( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
        torrent_outloc="$outdir/$(ls -A $outdir)"
        outloc=${torrent_outloc%.*}
    fi
    if ! [ -f "$torrent_outloc" ]; then
        warn "Downloading '$url' failed!"
        return 253
    fi
    ctorrent $ctorrent_args -s $outloc $torrent_outloc >&2
    if ! [ -f "$outloc" ]; then
        warn "Torrent download of '$url' failed!"
        return 253
    fi
    if [ -z "$2" ]; then echo "$outloc" ; fi
}

command -v ctorrent >/dev/null \
    && add_url_handler ctorrent_fetch_url torrent

### NFS ##############################################################

[ -e /lib/nfs-lib.sh ] && . /lib/nfs-lib.sh

nfs_already_mounted() {
    local server="$1" path="$2" localdir="" s="" p=""
    cat /proc/mounts | while read src mnt rest || [ -n "$src" ]; do
        splitsep ":" "$src" s p
        if [ "$server" = "$s" ]; then
            if [ "$path" = "$p" ]; then
                echo $mnt
            elif str_starts "$path" "$p"; then
                echo $mnt/${path#$p/}
            fi
        fi
    done
}

nfs_fetch_url() {
    local url="$1" outloc="$2" nfs="" server="" path="" options=""
    nfs_to_var "$url" || return 255
    local filepath="${path%/*}" filename="${path##*/}" mntdir=""

    # skip mount if server:/filepath is already mounted
    mntdir=$(nfs_already_mounted "$server" "$path")
    if [ -z "$mntdir" ]; then
        local mntdir="$(mkuniqdir /run nfs_mnt)"
        mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
        # lazy unmount during pre-pivot hook
        inst_hook --hook pre-pivot --name 99url-lib-umount-nfs-"$(basename "$mntdir")" umount -l -- "$mntdir"
    fi

    if [ -z "$outloc" ]; then
        outloc="$mntdir/$filename"
    else
        cp -f -- "$mntdir/$filename" "$outloc" || return $?
    fi
    [ -f "$outloc" ] || return 253
    if [ -z "$2" ]; then echo "$outloc" ; fi
}
command -v nfs_to_var >/dev/null && add_url_handler nfs_fetch_url nfs nfs4
#!/bin/bash
# module-setup for url-lib

# called by dracut
check() {
    require_binaries curl || return 1
    return 255
}

# called by dracut
depends() {
    echo network
    return 0
}

# called by dracut
install() {
    local _dir _crt _found _lib _nssckbi _p11roots _p11root _p11item
    inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
    inst_multiple -o ctorrent
    inst_multiple curl
    # also install libs for curl https
    inst_libdir_file "libnsspem.so*"
    inst_libdir_file "libnsssysinit.so*"
    inst_libdir_file "libsoftokn3.so*"
    inst_libdir_file "libsqlite3.so*"

    for _dir in $libdirs; do
	[[ -d $_dir ]] || continue
        for _lib in $_dir/libcurl.so.*; do
	    [[ -e $_lib ]] || continue
            [[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
            _crt=$(grep -F --binary-files=text -z .crt $_lib)
            [[ $_crt ]] || continue
            [[ $_crt == /*/* ]] || continue
            if ! inst "$_crt"; then
                dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
                continue
            fi
            _found=1
        done
    done
    # If we found no cert bundle files referenced in libcurl but we
    # *did* find a mention of libnssckbi (checked above), install it.
    # If its truly NSS libnssckbi, it includes its own trust bundle,
    # but if it's really p11-kit-trust.so, we need to find the dirs
    # where it will look for a trust bundle and install them too.
    if ! [[ $_found ]] && [[ $_nssckbi ]] ; then
        _found=1
        inst_libdir_file "libnssckbi.so*" || _found=
        for _dir in $libdirs; do
            [[ -e $_dir/libnssckbi.so ]] || continue
            # this looks for directory-ish strings in the file
            for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
                # the string can be a :-separated list of dirs
                for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
                    # check if it's actually a directory (there are
                    # several false positives in the results)
                    [[ -d "$_p11root" ]] || continue
                    # check if it has some specific subdirs that all
                    # p11-kit trust dirs have
                    [[ -d "${_p11root}/anchors" ]] || continue
                    [[ -d "${_p11root}/blacklist" ]] || continue
                    # so now we know it's really a p11-kit trust dir;
                    # install everything in it
                    for _p11item in $(find "$_p11root") ; do
                        if ! inst "$_p11item" ; then
                            dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
                            continue
                        fi
                    done
                done
            done
        done
    fi
    [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle or libnssckbi.so; HTTPS won't work."
}

#!/bin/sh
#
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
#
# without $2 means this is for real netroot case
# or it is for manually bring up network ie. for kdump scp vmcore
PATH=/usr/sbin:/usr/bin:/sbin:/bin

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh

# Huh? No $1?
[ -z "$1" ] && exit 1

# $netif reads easier than $1
netif=$1

# loopback is always handled the same way
if [ "$netif" = "lo" ] ; then
    ip link set lo up
    ip addr add 127.0.0.1/8 dev lo
    exit 0
fi

# Run dhclient
do_dhcp() {
    # dhclient-script will mark the netif up and generate the online
    # event for nfsroot
    # XXX add -V vendor class and option parsing per kernel

    local _COUNT=0
    local _timeout=$(getargs rd.net.timeout.dhcp=)
    local _DHCPRETRY=$(getargs rd.net.dhcp.retry=)
    _DHCPRETRY=${_DHCPRETRY:-1}

    [ -e /tmp/dhclient.$netif.pid ] && return 0

    if ! iface_has_carrier $netif; then
        warn "No carrier detected on interface $netif"
        return 1
    fi

    if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
        mkdir -p /run/NetworkManager/conf.d
        echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
        echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
    fi

    while [ $_COUNT -lt $_DHCPRETRY ]; do
        info "Starting dhcp for interface $netif"
        dhclient "$@" \
                 ${_timeout:+--timeout $_timeout} \
                 -q \
                 -1 \
                 -cf /etc/dhclient.conf \
                 -pf /tmp/dhclient.$netif.pid \
                 -lf /tmp/dhclient.$netif.lease \
                 $netif \
            && return 0
        _COUNT=$(($_COUNT+1))
        [ $_COUNT -lt $_DHCPRETRY ] && sleep 1
    done
    warn "dhcp for interface $netif failed"
    # nuke those files since we failed; we might retry dhcp again if it's e.g.
    # `ip=dhcp,dhcp6` and we check for the PID file at the top
    rm -f /tmp/dhclient.$netif.{pid,lease}
    return 1
}

load_ipv6() {
    [ -d /proc/sys/net/ipv6 ] && return
    modprobe ipv6
    i=0
    while [ ! -d /proc/sys/net/ipv6 ]; do
        i=$(($i+1))
        [ $i -gt 10 ] && break
        sleep 0.1
    done
}

do_ipv6auto() {
    local ret
    load_ipv6
    echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
    echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
    echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
    linkup $netif
    wait_for_ipv6_auto $netif
    ret=$?

    [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname

    return $ret
}

# Handle static ip configuration
do_static() {
    strglobin $ip '*:*:*' && load_ipv6

    if ! iface_has_carrier "$netif"; then
        warn "No carrier detected on interface $netif"
        return 1
    elif ! linkup "$netif"; then
        warn "Could not bring interface $netif up!"
        return 1
    fi

    ip route get "$ip" 2>/dev/null | {
        read a rest
        if [ "$a" = "local" ]; then
            warn "Not assigning $ip to interface $netif, cause it is already assigned!"
            return 1
        fi
        return 0
    } || return 1

    [ -n "$macaddr" ] && ip link set address $macaddr dev $netif
    [ -n "$mtu" ] && ip link set mtu $mtu dev $netif
    if strglobin $ip '*:*:*'; then
        # note no ip addr flush for ipv6
        ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
        echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
        echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
        echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
        wait_for_ipv6_dad $netif
    else
        if [ -z "$srv" ]; then
            if command -v arping2 >/dev/null; then
                if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
                    warn "Duplicate address detected for $ip for interface $netif."
                    return 1
                fi
            else
                if ! arping -f -q -D -c 2 -I $netif $ip ; then
                    warn "Duplicate address detected for $ip for interface $netif."
                    return 1
                fi
            fi
        fi
        ip addr flush dev $netif
        ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
    fi

    [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
    [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname

    return 0
}

get_vid() {
    case "$1" in
    vlan*)
        echo ${1#vlan}
        ;;
    *.*)
        echo ${1##*.}
        ;;
    esac
}

# check, if we need VLAN's for this interface
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
    unset DO_VLAN
    NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
    modprobe -b -q 8021q

    for i in /tmp/vlan.*.${netif}; do
        [ -e "$i" ] || continue
        unset vlanname
        unset phydevice
        . "$i"
        if [ -n "$vlanname" ]; then
            linkup "$phydevice"
            ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
            ifup "$vlanname"
        fi
    done
    exit 0
fi

# Check, if interface is VLAN interface
if ! [ -e /tmp/vlan.${netif}.phy ]; then
    for i in /tmp/vlan.${netif}.*; do
        [ -e "$i" ] || continue
        export DO_VLAN=yes
        break
    done
fi


# bridge this interface?
if [ -z "$NO_BRIDGE_MASTER" ]; then
    for i in /tmp/bridge.*.info; do
        [ -e "$i" ] || continue
        unset bridgeslaves
        unset bridgename
        . "$i"
        for ethname in $bridgeslaves ; do
            [ "$netif" != "$ethname" ] && continue

            NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
            linkup $ethname
            if [ ! -e /tmp/bridge.$bridgename.up ]; then
                ip link add name $bridgename type bridge
                echo 0 > /sys/devices/virtual/net/$bridgename/bridge/forward_delay
                > /tmp/bridge.$bridgename.up
            fi
            ip link set dev $ethname master $bridgename
            ifup $bridgename
            exit 0
        done
    done
fi

# enslave this interface to bond?
if [ -z "$NO_BOND_MASTER" ]; then
    for i in /tmp/bond.*.info; do
        [ -e "$i" ] || continue
        unset bondslaves
        unset bondname
        . "$i"
        for slave in $bondslaves ; do
            [ "$netif" != "$slave" ] && continue

            # already setup
            [ -e /tmp/bond.$bondname.up ] && exit 0

            # wait for all slaves to show up
            for slave in $bondslaves ; do
                # try to create the slave (maybe vlan or bridge)
                NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave

                if ! ip link show dev $slave >/dev/null 2>&1; then
                    # wait for the last slave to show up
                    exit 0
                fi
            done

            modprobe -q -b bonding
            echo "+$bondname" >  /sys/class/net/bonding_masters 2>/dev/null
            ip link set $bondname down

            # Stolen from ifup-eth
            # add the bits to setup driver parameters here
            for arg in $bondoptions ; do
                key=${arg%%=*};
                value=${arg##*=};
                # %{value:0:1} is replaced with non-bash specific construct
                if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
                    OLDIFS=$IFS;
                    IFS=',';
                    for arp_ip in $value; do
                        echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
                    done
                    IFS=$OLDIFS;
                else
                    echo $value > /sys/class/net/${bondname}/bonding/$key
                fi
            done

            linkup $bondname

            for slave in $bondslaves ; do
                cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
                ip link set $slave down
                echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
                linkup $slave
            done

            # Set mtu on bond master
            [ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $bondname

            # add the bits to setup the needed post enslavement parameters
            for arg in $bondoptions ; do
                key=${arg%%=*};
                value=${arg##*=};
                if [ "${key}" = "primary" ]; then
                    echo $value > /sys/class/net/${bondname}/bonding/$key
                fi
            done

            > /tmp/bond.$bondname.up

            NO_BOND_MASTER=yes ifup $bondname
            exit $?
        done
    done
fi

if [ -z "$NO_TEAM_MASTER" ]; then
    for i in /tmp/team.*.info; do
        [ -e "$i" ] || continue
        unset teammaster
        unset teamslaves
        . "$i"
        for slave in $teamslaves ; do
            [ "$netif" != "$slave" ] && continue

            [ -e /tmp/team.$teammaster.up ] && exit 0

            # wait for all slaves to show up
            for slave in $teamslaves ; do
                # try to create the slave (maybe vlan or bridge)
                NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup $slave

                if ! ip link show dev $slave >/dev/null 2>&1; then
                    # wait for the last slave to show up
                    exit 0
                fi
            done

            if [ ! -e /tmp/team.$teammaster.up ] ; then
                # We shall only bring up those _can_ come up
                # in case of some slave is gone in active-backup mode
                working_slaves=""
                for slave in $teamslaves ; do
                    teamdctl ${teammaster} port present ${slave} 2>/dev/null \
                        && continue
                    ip link set dev $slave up 2>/dev/null
                    if wait_for_if_up $slave; then
                        working_slaves="$working_slaves$slave "
                    fi
                done
                # Do not add slaves now
                teamd -d -U -n -N -t $teammaster -f /etc/teamd/${teammaster}.conf
                for slave in $working_slaves; do
                    # team requires the slaves to be down before joining team
                    ip link set dev $slave down
                    (
                        unset TEAM_PORT_CONFIG
                        _hwaddr=$(cat /sys/class/net/$slave/address)
                        _subchannels=$(iface_get_subchannels "$slave")
                        if [ -n "$_hwaddr" ] && [ -e "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf" ]; then
                            . "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf"
                        elif [ -n "$_subchannels" ] && [ -e "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf" ]; then
                            . "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf"
                        elif [ -e "/etc/sysconfig/network-scripts/ifcfg-${slave}" ]; then
                            . "/etc/sysconfig/network-scripts/ifcfg-${slave}"
                        fi

                        if [ -n "${TEAM_PORT_CONFIG}" ]; then
                            /usr/bin/teamdctl ${teammaster} port config update ${slave} "${TEAM_PORT_CONFIG}"
                        fi
                    )
                    teamdctl $teammaster port add $slave
                done

                ip link set dev $teammaster up

                > /tmp/team.$teammaster.up
                NO_TEAM_MASTER=yes ifup $teammaster
                exit $?
            fi
        done
    done
fi

# all synthetic interfaces done.. now check if the interface is available
if ! ip link show dev $netif >/dev/null 2>&1; then
    exit 1
fi

# disable manual ifup while netroot is set for simplifying our logic
# in netroot case we prefer netroot to bringup $netif automaticlly
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"

if [ -n "$manualup" ]; then
    >/tmp/net.$netif.manualup
    rm -f /tmp/net.${netif}.did-setup
else
    [ -e /tmp/net.${netif}.did-setup ] && exit 0
    [ -z "$DO_VLAN" ] && \
    [ -e /sys/class/net/$netif/address ] && \
        [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
fi


# No ip lines default to dhcp
ip=$(getarg ip)

if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
    if [ "$netroot" = "dhcp6" ]; then
        do_dhcp -6
    else
        do_dhcp -4
    fi

    for s in $(getargs nameserver); do
        [ -n "$s" ] || continue
        echo nameserver $s >> /tmp/net.$netif.resolv.conf
    done
fi


# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
    ip_to_var $p
    # skip ibft
    [ "$autoconf" = "ibft" ] && continue

    case "$dev" in
        ??:??:??:??:??:??)  # MAC address
            _dev=$(iface_for_mac $dev)
            [ -n "$_dev" ] && dev="$_dev"
            ;;
        ??-??-??-??-??-??)  # MAC address in BOOTIF form
            _dev=$(iface_for_mac $(fix_bootif $dev))
            [ -n "$_dev" ] && dev="$_dev"
            ;;
    esac

    # If this option isn't directed at our interface, skip it
    if [ -n "$dev" ]; then
        if [ "$dev" != "$netif" ]; then
            [ ! -e "/sys/class/net/$dev" ] \
                && warn "Network interface '$dev' does not exist!"
            continue
        fi
    else
        iface_is_enslaved "$netif" && continue
    fi

    # Store config for later use
    for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
        eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
    done > /tmp/net.$netif.override

    for autoopt in $(str_replace "$autoconf" "," " "); do
        case $autoopt in
            dhcp|on|any)
                do_dhcp -4 ;;
            dhcp6)
                load_ipv6
                do_dhcp -6 ;;
            auto6)
                do_ipv6auto ;;
            either6)
                do_ipv6auto || do_dhcp -6 ;;
            *)
                do_static ;;
        esac
    done
    ret=$?

    # setup nameserver
    for s in "$dns1" "$dns2" $(getargs nameserver); do
        [ -n "$s" ] || continue
        echo nameserver $s >> /tmp/net.$netif.resolv.conf
    done

    if [ $ret -eq 0 ]; then
        > /tmp/net.${netif}.up

        if  [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
            > /tmp/net.$(cat /sys/class/net/${netif}/address).up
        fi

        # and finally, finish interface set up if there isn't already a script
        # to do so (which is the case in the dhcp path)
        if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then
                setup_net $netif
                source_hook initqueue/online $netif
                if [ -z "$manualup" ]; then
                    /sbin/netroot $netif
                fi
        fi

        exit $ret
    fi
done

# no ip option directed at our interface?
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
    if [ -e /tmp/net.bootdev ]; then
        BOOTDEV=$(cat /tmp/net.bootdev)
        if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
            load_ipv6
            do_dhcp
        fi
    else
        if getargs 'ip=dhcp6'; then
            load_ipv6
            do_dhcp -6
        fi
        if getargs 'ip=dhcp'; then
            do_dhcp -4
        fi
    fi
fi

exit 0
#!/bin/sh
#
# Format:
#       bridge=<bridgename>:<bridgeslaves>
#
#       <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
#       bridge without parameters assumes bridge=br0:eth0
#

parsebridge() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done
    case $# in
        0)  bridgename=br0; bridgeslaves=$iface ;;
        1)  die "bridge= requires two parameters" ;;
        2)  bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
        *)  die "bridge= requires two parameters" ;;
    esac
}

# Parse bridge for bridgename and bridgeslaves
for bridge in $(getargs bridge=); do
    unset bridgename
    unset bridgeslaves
    iface=eth0
    # Read bridge= parameters if they exist
    if [ "$bridge" != "bridge" ]; then
        parsebridge $bridge
    fi
    # Simple default bridge
    if [ -z "$bridgename" ]; then
        bridgename=br0
        bridgeslaves=$iface
    fi
    echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info
    echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info
done
#!/bin/sh
#
# Format:
#       ip=[dhcp|on|any]
#
#       ip=<interface>:[dhcp|on|any][:[<mtu>][:<macaddr>]]
#
#       ip=<client-IP-number>:<server-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{dhcp|on|any|none|off}[:[<mtu>][:<macaddr>]]
#
# When supplying more than only ip= line, <interface> is mandatory and
# bootdev= must contain the name of the primary interface to use for
# routing,dns,dhcp-options,etc.
#

command -v getarg >/dev/null          || . /lib/dracut-lib.sh

if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
    # No ip= argument(s) for netroot provided, defaulting to DHCP
    return;
fi

# Count ip= lines to decide whether we need bootdev= or not
if [ -z "$NEEDBOOTDEV" ] ; then
    count=0
    for p in $(getargs ip=); do
        case "$p" in
            ibft)
                continue;;
        esac
        count=$(( $count + 1 ))
    done
    [ $count -gt 1 ] && NEEDBOOTDEV=1
fi
unset count

# If needed, check if bootdev= contains anything usable
BOOTDEV=$(getarg bootdev=)

if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then
    #[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
    echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf
    info "Multiple ip= arguments: assuming rd.neednet=1"
else
    unset NEEDBOOTDEV
fi

# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
for p in $(getargs ip=); do
    ip_to_var $p

    # make first device specified the BOOTDEV
    if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then
        BOOTDEV="$dev"
        info "Setting bootdev to '$BOOTDEV'"
    fi

    # skip ibft since we did it above
    [ "$autoconf" = "ibft" ] && continue

    # Empty autoconf defaults to 'dhcp'
    if [ -z "$autoconf" ] ; then
        warn "Empty autoconf values default to dhcp"
        autoconf="dhcp"
    fi

    # Error checking for autoconf in combination with other values
    for autoopt in $(str_replace "$autoconf" "," " "); do
        case $autoopt in
            error) die "Error parsing option 'ip=$p'";;
            bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
            none|off)
                [ -z "$ip" ] && \
                    die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
                [ -z "$mask" ] && \
                    die "Sorry, automatic calculation of netmask is not yet supported"
                ;;
            auto6);;
            either6);;
            dhcp|dhcp6|on|any) \
                [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
                    die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
                [ -n "$ip" ] && \
                    die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
                ;;
            *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
        esac
    done

    if [ -n "$dev" ] ; then
        # We don't like duplicate device configs
        if [ -n "$IFACES" ] ; then
            for i in $IFACES ; do
                [ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
            done
        fi
        # IFACES list for later use
        IFACES="$IFACES $dev"

        # Interface should exist
        if [ ! -e "/sys/class/net/$dev" ]; then
            warn "Network interface '$dev' does not exist"
        fi
    fi

    # Do we need to check for specific options?
    if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
        # Correct device? (Empty is ok as well)
        [ "$dev" = "$BOOTDEV" ] || continue
        # Server-ip is there?
        [ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
        # dhcp? (It's simpler to check for a set ip. Checks above ensure that if
        # ip is there, we're static
        [ -z "$ip" ] && continue
        # Not good!
        die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
    fi

    if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
        printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
               "$dev" \
               "${dev:3:2}" \
               "${dev:5:2}" \
               "${dev:7:2}" \
               "${dev:9:2}" \
               "${dev:11:2}" \
               "${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
    fi
done

# put BOOTIF in IFACES to make sure it comes up
if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
    BOOTDEV=$(fix_bootif $BOOTIF)
    IFACES="$BOOTDEV $IFACES"
fi

# This ensures that BOOTDEV is always first in IFACES
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
    IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
    IFACES="$BOOTDEV $IFACES"
fi

# Store BOOTDEV and IFACES for later use
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
[ -n "$IFACES" ]  && echo $IFACES > /tmp/net.ifaces
#!/bin/sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh

# We already need a set netif here
netif=$interface

setup_interface() {
    ip=$new_ip_address
    mtu=$new_interface_mtu
    mask=$new_subnet_mask
    bcast=$new_broadcast_address
    gw=${new_routers%%,*}
    domain=$new_domain_name
    search=$(printf -- "$new_domain_search")
    namesrv=$new_domain_name_servers
    hostname=$new_host_name
    [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
    [ -n "$new_max_life" ] && lease_time=$new_max_life
    preferred_lft=$lease_time
    [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life

    [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override

    # Taken from debian dhclient-script:
    # The 576 MTU is only used for X.25 and dialup connections
    # where the admin wants low latency.  Such a low MTU can cause
    # problems with UDP traffic, among other things.  As such,
    # disallow MTUs from 576 and below by default, so that broken
    # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
    if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
        if ! ip link set $netif mtu $mtu ; then
            ip link set $netif down
            ip link set $netif mtu $mtu
            linkup $netif
        fi
    fi

    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
        ${lease_time:+valid_lft $lease_time} \
        ${preferred_lft:+preferred_lft ${preferred_lft}}

    if [ -n "$gw" ] ; then
        if [ "$mask" = "255.255.255.255" ] ; then
            # point-to-point connection => set explicit route to gateway
            echo ip route add $gw dev $netif > /tmp/net.$netif.gw
        fi

        echo "$gw" | {
            IFS=' ' read -r main_gw other_gw
            echo ip route replace default via $main_gw dev $netif >> /tmp/net.$netif.gw
            if [ -n "$other_gw" ] ; then
                for g in $other_gw; do
                    echo ip route add default via $g dev $netif >> /tmp/net.$netif.gw
                done
            fi
        }
    fi

    if getargbool 1 rd.peerdns; then
        [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
        if  [ -n "$namesrv" ] ; then
            for s in $namesrv; do
                echo nameserver $s
            done
        fi >> /tmp/net.$netif.resolv.conf
    fi
    # Note: hostname can be fqdn OR short hostname, so chop off any
    # trailing domain name and explicity add any domain if set.
    [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}

setup_interface6() {
    domain=$new_domain_name
    search=$(printf -- "$new_dhcp6_domain_search")
    namesrv=$new_dhcp6_name_servers
    hostname=$new_host_name
    [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
    [ -n "$new_max_life" ] && lease_time=$new_max_life
    preferred_lft=$lease_time
    [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life

    [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override

    ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
        dev ${netif} scope global \
        ${lease_time:+valid_lft $lease_time} \
        ${preferred_lft:+preferred_lft ${preferred_lft}}

    if getargbool 1 rd.peerdns; then
        [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
        if  [ -n "$namesrv" ] ; then
            for s in $namesrv; do
                echo nameserver $s
            done
        fi >> /tmp/net.$netif.resolv.conf
    fi

    # Note: hostname can be fqdn OR short hostname, so chop off any
    # trailing domain name and explicity add any domain if set.
    [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}

parse_option_121() {
    while [ $# -ne 0 ]; do
        mask="$1"
        shift

        # Is the destination a multicast group?
        if [ $1 -ge 224 -a $1 -lt 240 ]; then
            multicast=1
        else
            multicast=0
        fi

        # Parse the arguments into a CIDR net/mask string
        if [ $mask -gt 24 ]; then
            destination="$1.$2.$3.$4/$mask"
            shift; shift; shift; shift
        elif [ $mask -gt 16 ]; then
            destination="$1.$2.$3.0/$mask"
            shift; shift; shift
        elif [ $mask -gt 8 ]; then
            destination="$1.$2.0.0/$mask"
            shift; shift
        elif [ $mask -gt 0 ]; then
            destination="$1.0.0.0/$mask"
            shift
        else
            destination="0.0.0.0/$mask"
        fi

        # Read the gateway
        gateway="$1.$2.$3.$4"
        shift; shift; shift; shift

        # Multicast routing on Linux
        #  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
        #  - If you simply leave it link-local and attach it to an interface, it works fine.
        if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
            temp_result="$destination dev $interface"
        else
            temp_result="$destination via $gateway dev $interface"
        fi

        echo "/sbin/ip route add $temp_result"
    done
}


case $reason in
    PREINIT)
        echo "dhcp: PREINIT $netif up"
        linkup $netif
        ;;

    PREINIT6)
        echo "dhcp: PREINIT6 $netif up"
        linkup $netif
        wait_for_ipv6_dad_link $netif
        ;;

    BOUND)
        echo "dhcp: BOND setting $netif"
        unset layer2
        if [ -f /sys/class/net/$netif/device/layer2 ]; then
            read layer2 < /sys/class/net/$netif/device/layer2
        fi
        if [ "$layer2" != "0" ]; then
            if command -v arping2 >/dev/null; then
                if arping2 -q -C 1 -c 2 -I $netif -0 $new_ip_address ; then
                    warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                    exit 1
                fi
            else
                if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
                    warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                    exit 1
                fi
            fi
        fi
        unset layer2
        setup_interface
        set | while read line || [ -n "$line" ]; do
            [ "${line#new_}" = "$line" ] && continue
            echo "$line"
        done >/tmp/dhclient.$netif.dhcpopts

        {
            echo '. /lib/net-lib.sh'
            echo "setup_net $netif"
            if [ -n "$new_classless_static_routes" ]; then
                OLDIFS="$IFS"
                IFS=".$IFS"
                parse_option_121 $new_classless_static_routes
                IFS="$OLDIFS"
            fi
            echo "source_hook initqueue/online $netif"
            [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
            echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
        } > $hookdir/initqueue/setup_net_$netif.sh

        echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
        >/tmp/net.$netif.up
        if [ -e /sys/class/net/${netif}/address ]; then
            > /tmp/net.$(cat /sys/class/net/${netif}/address).up
        fi

        ;;

    RENEW|REBIND)
        unset lease_time
        [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
        [ -n "$new_max_life" ] && lease_time=$new_max_life
        preferred_lft=$lease_time
        [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
        ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \
           ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
           >/dev/null 2>&1
        ;;

    BOUND6)
        echo "dhcp: BOND6 setting $netif"
        setup_interface6

        set | while read line || [ -n "$line" ]; do
            [ "${line#new_}" = "$line" ] && continue
            echo "$line"
        done >/tmp/dhclient.$netif.dhcpopts

        {
            echo '. /lib/net-lib.sh'
            echo "setup_net $netif"
            echo "source_hook initqueue/online $netif"
            [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
            echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
        } > $hookdir/initqueue/setup_net_$netif.sh

        echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
        >/tmp/net.$netif.up
        if [ -e /sys/class/net/${netif}/address ]; then
            > /tmp/net.$(cat /sys/class/net/${netif}/address).up
        fi
        ;;

    RENEW6|REBIND6)
        unset lease_time
        [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
        [ -n "$new_max_life" ] && lease_time=$new_max_life
        preferred_lft=$lease_time
        [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
        ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
           ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
           >/dev/null 2>&1
        ;;

    *) echo "dhcp: $reason";;
esac

exit 0
#!/bin/sh

for f in /tmp/dhclient.*.pid; do
    [ -e $f ] || continue
    read PID < $f;
    kill $PID >/dev/null 2>&1
done

sleep 0.1

for f in /tmp/dhclient.*.pid; do
    [ -e $f ] || continue
    read PID < $f;
    kill -9 $PID >/dev/null 2>&1
done
#!/bin/sh
#
# Format:
#       team=<teammaster>:<teamslaves>[:<teamrunner>]
#
#       teamslaves is a comma-separated list of physical (ethernet) interfaces
#       teamrunner is the runner type to be used (see teamd.conf(5)); defaults to activebackup
#
#       team without parameters assumes team=team0:eth0,eth1:activebackup
#

parseteam() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    case $# in
    0)  teammaster=team0; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
    1)  teammaster=$1; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
    2)  teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner="activebackup" ;;
    3)  teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner=$3 ;;
    *)  die "team= requires zero to three parameters" ;;
    esac
    return 0
}

for team in $(getargs team); do
    [ "$team" = "team" ] && continue

    unset teammaster
    unset teamslaves
    unset teamrunner

    parseteam "$team" || continue

    echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
    echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
    echo "teamrunner=\"$teamrunner\"" >> /tmp/team.${teammaster}.info

    if ! [ -e /etc/teamd/${teammaster}.conf ]; then
        warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using $teamrunner."
        mkdir -p /etc/teamd
        printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf"
    fi
done

#!/bin/sh

command -v getarg >/dev/null          || . /lib/dracut-lib.sh
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh

if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
    modprobe -b -q iscsi_boot_sysfs 2>/dev/null
    modprobe -b -q iscsi_ibft
    ibft_to_cmdline
fi
#!/bin/sh
#
# Format:
#	vlan=<vlanname>:<phydevice>
#

parsevlan() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    unset vlanname phydevice
    case $# in
    2)  vlanname=$1; phydevice=$2 ;;
    *)  die "vlan= requires two parameters" ;;
    esac
}

for vlan in $(getargs vlan=); do
    unset vlanname
    unset phydevice
    if [ ! "$vlan" = "vlan" ]; then
        parsevlan "$vlan"
    fi

    echo "phydevice=\"$phydevice\"" > /tmp/vlan.${phydevice}.phy
    {
        echo "vlanname=\"$vlanname\""
        echo "phydevice=\"$phydevice\""
    } > /tmp/vlan.${vlanname}.${phydevice}
done
#!/bin/sh

getargbool 0 rd.neednet && NEEDNET=1

# Don't continue if we don't need network
if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; then
    return
fi

command -v fix_bootif >/dev/null || . /lib/net-lib.sh

# Write udev rules
{
    # bridge: attempt only the defined interface
    for i in /tmp/bridge.*.info; do
        [ -e "$i" ] || continue
        unset bridgeslaves
        unset bridgename
        . "$i"
        RAW_IFACES="$RAW_IFACES $bridgeslaves"
        MASTER_IFACES="$MASTER_IFACES $bridgename"
    done

    # bond: attempt only the defined interface (override bridge defines)
    for i in /tmp/bond.*.info; do
        [ -e "$i" ] || continue
        unset bondslaves
        unset bondname
        . "$i"
        # It is enough to fire up only one
        RAW_IFACES="$RAW_IFACES $bondslaves"
        MASTER_IFACES="$MASTER_IFACES ${bondname}"
    done

    for i in /tmp/team.*.info; do
        [ -e "$i" ] || continue
        unset teamslaves
        unset teammaster
        . "$i"
        RAW_IFACES="$RAW_IFACES ${teamslaves}"
        MASTER_IFACES="$MASTER_IFACES ${teammaster}"
    done

    for i in /tmp/vlan.*.phy; do
        [ -e "$i" ] || continue
        unset phydevice
        . "$i"
        RAW_IFACES="$RAW_IFACES $phydevice"
        for j in /tmp/vlan.*.${phydevice}; do
            [ -e "$j" ] || continue
            unset vlanname
            . "$j"
            MASTER_IFACES="$MASTER_IFACES ${vlanname}"
        done
    done

    MASTER_IFACES="$(trim "$MASTER_IFACES")"
    RAW_IFACES="$(trim "$RAW_IFACES")"

    if [ -z "$IFACES" ]; then
        [ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
    fi

    if [ -e /tmp/net.bootdev ]; then
        bootdev=$(cat /tmp/net.bootdev)
    fi

    ifup='/sbin/ifup $env{INTERFACE}'

    runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""

    # We have some specific interfaces to handle
    if [ -n "${RAW_IFACES}${IFACES}" ]; then
        echo 'SUBSYSTEM!="net", GOTO="net_end"'
        echo 'ACTION!="add|change|move", GOTO="net_end"'
        for iface in $IFACES $RAW_IFACES; do
            case "$iface" in
                ??:??:??:??:??:??)  # MAC address
                    cond="ATTR{address}==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
                ??-??-??-??-??-??)  # MAC address in BOOTIF form
                    cond="ATTR{address}==\"$(fix_bootif $iface)\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
                *)                  # an interface name
                    cond="ENV{INTERFACE}==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    cond="NAME==\"$iface\""
                    echo "$cond, $runcmd, GOTO=\"net_end\""
                    ;;
            esac
            # The GOTO prevents us from trying to ifup the same device twice
        done
        echo 'LABEL="net_end"'

        for iface in $IFACES; do
            if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
		if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
                    echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
		else
                    echo "[ -f /tmp/net.${iface}.did-setup ]"
		fi >$hookdir/initqueue/finished/wait-$iface.sh
            fi
        done
    # Default: We don't know the interface to use, handle all
    # Fixme: waiting for the interface as well.
    else
        cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
        # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
        echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
        if [ "$NEEDNET" = "1" ]; then
            echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ]  && exit 0; done; exit 1' >$hookdir/initqueue/finished/wait-network.sh
        fi
    fi

# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
} > /etc/udev/rules.d/90-net.rules
#!/bin/sh
#
# Format:
#       bond=<bondname>[:<bondslaves>[:<options>[:<mtu>]]]
#
#       bondslaves is a comma-separated list of physical (ethernet) interfaces
#       options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
#       if options include multi-valued arp_ip_target option, then its values should be separated by semicolon.
#
#       bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
#
#       if the mtu is specified, it will be set on the bond master
#

# We translate list of slaves to space-separated here to make it easier to loop over them in ifup
# Ditto for bonding options
parsebond() {
    local v=${1}:
    set --
    while [ -n "$v" ]; do
        set -- "$@" "${v%%:*}"
        v=${v#*:}
    done

    case $# in
    0)  bondname=bond0; bondslaves="eth0 eth1" ;;
    1)  bondname=$1; bondslaves="eth0 eth1" ;;
    2)  bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
    3)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
    4)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
    *)  die "bond= requires zero to four parameters" ;;
    esac
}

# Parse bond for bondname, bondslaves, bondmode, bondoptions and bondmtu
for bond in $(getargs bond=); do
    unset bondname
    unset bondslaves
    unset bondoptions
    unset bondmtu
    if [ "$bond" != "bond" ]; then
        parsebond "$bond"
    fi
    # Simple default bond
    if [ -z "$bondname" ]; then
        bondname=bond0
        bondslaves="eth0 eth1"
    fi
    # Make it suitable for initscripts export
    bondoptions=$(str_replace "$bondoptions" ";" ",")
    echo "bondname=$bondname" > /tmp/bond.${bondname}.info
    echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
    echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
    echo "bondmtu=\"$bondmtu\"" >> /tmp/bond.${bondname}.info
done

option classless-static-routes code 121 = array of unsigned integer 8;

send dhcp-client-identifier = hardware;

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        root-path, interface-mtu, classless-static-routes;
#!/bin/bash

# called by dracut
check() {
    local _program

    require_binaries ip dhclient sed awk grep || return 1
    require_any_binary arping arping2 || return 1

    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    return 0
}

# called by dracut
install() {
    local _arch _i _dir
    inst_multiple ip dhclient sed awk grep

    inst_multiple -o arping arping2
    strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"

    inst_multiple -o ping ping6
    inst_multiple -o teamd teamdctl teamnl
    inst_simple /etc/libnl/classid
    inst_script "$moddir/ifup.sh" "/sbin/ifup"
    inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
    inst_simple -H "/etc/dhclient.conf"
    cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
    inst_hook pre-udev 60 "$moddir/net-genrules.sh"
    inst_hook cmdline 92 "$moddir/parse-ibft.sh"
    inst_hook cmdline 95 "$moddir/parse-vlan.sh"
    inst_hook cmdline 96 "$moddir/parse-bond.sh"
    inst_hook cmdline 96 "$moddir/parse-team.sh"
    inst_hook cmdline 97 "$moddir/parse-bridge.sh"
    inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
    inst_hook cmdline 99 "$moddir/parse-ifname.sh"
    inst_hook cleanup 10 "$moddir/kill-dhclient.sh"

    # install all config files for teaming
    unset TEAM_MASTER
    unset TEAM_CONFIG
    unset TEAM_PORT_CONFIG
    unset HWADDR
    unset SUBCHANNELS
    for i in /etc/sysconfig/network-scripts/ifcfg-*; do
        [ -e "$i" ] || continue
        case "$i" in
            *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
                continue
                ;;
        esac
        (
            . "$i"
            if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
                    && [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
                if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
                    mkdir -p $initdir/etc/teamd
                    printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
                elif [ -n "$TEAM_PORT_CONFIG" ]; then
                    inst_simple "$i"

                    HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
                    if [ -n "$HWADDR" ]; then
                        ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
                    fi

                    SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
                    if [ -n "$SUBCHANNELS" ]; then
                        ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
                    fi
                fi
            fi
        )
    done

    _arch=$(uname -m)

    inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
        {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"

    dracut_need_initqueue
}

#!/bin/sh
#
# Format:
#       ifname=<interface>:<mac>
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# ifname=eth0:4a:3f:4c:04:f8:d7
#
# Note when using ifname= to get persistent interface names, you must specify
# an ifname= argument for each interface used in an ip= or fcoe= argument

# check if there are any ifname parameters
if ! getarg ifname= >/dev/null ; then
    return
fi

command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh

# Check ifname= lines
for p in $(getargs ifname=); do
    parse_ifname_opts $p
done
#!/bin/bash

for i in $(multipath -l -v1); do
    if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then
        dmsetup message $i 0 fail_if_no_path
    fi
done
#!/bin/sh

if [ -e /etc/multipath.conf ]; then
    HARD=""
    while pidof multipathd >/dev/null 2>&1; do
        for pid in $(pidof multipathd); do
            kill $HARD $pid >/dev/null 2>&1
        done
        HARD="-9"
    done
fi

[Unit]
Description=Device-Mapper Multipath Default Configuration
Before=iscsi.service iscsid.service lvm2-activation-early.service
Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target
After=systemd-udev-trigger.service systemd-udev-settle.service
Before=local-fs-pre.target multipathd.service
DefaultDependencies=no
Conflicts=shutdown.target

ConditionKernelCommandLine=rd.multipath=default
ConditionPathExists=!/etc/multipath.conf

[Service]
Type=oneshot
ExecStartPre=-/usr/bin/mkdir -p /etc/multipath/multipath.conf.d
ExecStart=/usr/sbin/mpathconf --enable

[Install]
WantedBy=sysinit.target
[Unit]
Description=Device-Mapper Multipath Device Controller
Before=iscsi.service iscsid.service lvm2-activation-early.service
Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target
After=systemd-udev-trigger.service systemd-udev-settle.service
Before=local-fs-pre.target
Before=initrd-cleanup.service
DefaultDependencies=no
Conflicts=shutdown.target
Conflicts=initrd-cleanup.service
ConditionKernelCommandLine=!nompath
ConditionKernelCommandLine=!rd.multipath=0
ConditionKernelCommandLine=!rd_NO_MULTIPATH
ConditionKernelCommandLine=!multipath=off

[Service]
Type=simple
ExecStartPre=-/sbin/modprobe dm-multipath
ExecStart=/sbin/multipathd -s -d
ExecReload=/sbin/multipathd reconfigure
ExecStop=/sbin/multipathd shutdown

[Install]
WantedBy=sysinit.target
#!/bin/sh

for i in $(multipath -l -v1); do
    if $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
        need_shutdown
        break
    fi
done
#!/bin/bash

is_mpath() {
    local _dev=$1
    [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
    [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
    return 1
}

majmin_to_mpath_dev() {
    local _dev
    for i in /dev/mapper/*; do
        [[ $i == /dev/mapper/control ]] && continue
        _dev=$(get_maj_min $i)
        if [ "$_dev" = "$1" ]; then
            echo $i
            return
        fi
    done
}

# called by dracut
check() {
    local _rootdev

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for_each_host_dev_and_slaves is_mpath || return 255
    }

    # if there's no multipath binary, no go.
    require_binaries multipath || return 1
    require_binaries kpartx || return 1

    return 0
}

# called by dracut
depends() {
    echo rootfs-block
    echo dm
    return 0
}

# called by dracut
cmdline() {
    for m in scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm_multipath; do
        if grep -m 1 -q "$m" /proc/modules ; then
            printf 'rd.driver.pre=%s ' "$m"
        fi
    done
}

# called by dracut
installkernel() {
    local _ret
    local _arch=$(uname -m)
    local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
    local _s390

    if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
        _s390drivers="=drivers/s390/scsi"
    fi

    hostonly='' dracut_instmods -o -s "$_funcs" "=drivers/scsi" "=drivers/md" ${_s390drivers:+"$_s390drivers"}
}

# called by dracut
install() {
    local _f _allow

    add_hostonly_mpath_conf() {
        is_mpath $1 && {
            local _dev

            _dev=$(majmin_to_mpath_dev $1)
            [ -z "$_dev" ] && return
            strstr "$_allow" "$_dev" && return
            _allow="$_allow --allow $_dev"
        }
    }

    inst_multiple -o  \
        dmsetup \
        kpartx \
        mpath_wait \
        mpathconf \
        mpathpersist \
        multipath  \
        multipathd \
        xdrgetprio \
        xdrgetuid \
        /etc/xdrdevices.conf \
        /etc/multipath.conf \
        /etc/multipath/* \
        /etc/multipath/conf.d/*

    [[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
    }

    inst $(command -v partx) /sbin/partx

    inst_libdir_file "libmultipath*" "multipath/*"
    inst_libdir_file 'libgcc_s.so*'

    if [[ $hostonly_cmdline ]] ; then
        local _conf=$(cmdline)
        [[ $_conf ]] && echo "$_conf" >> "${initdir}/etc/cmdline.d/90multipath.conf"
    fi

    if dracut_module_included "systemd"; then
        inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service"
        inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
        systemctl -q --root "$initdir" enable multipathd-configure.service
        systemctl -q --root "$initdir" enable multipathd.service
    else
        inst_hook pre-trigger 02 "$moddir/multipathd.sh"
        inst_hook cleanup   02 "$moddir/multipathd-stop.sh"
    fi

    inst_hook cleanup   80 "$moddir/multipathd-needshutdown.sh"
    inst_hook shutdown  20 "$moddir/multipath-shutdown.sh"

    inst_rules 40-multipath.rules 56-multipath.rules \
	62-multipath.rules 65-multipath.rules \
	66-kpartx.rules 67-kpartx-compat.rules \
	11-dm-mpath.rules 11-dm-parts.rules
}

#!/bin/sh

if [ "$(getarg rd.multipath)" = "default" ] && [ ! -e /etc/multipath.conf ]; then
    mkdir -p /etc/multipath/multipath.conf.d
    mpathconf --enable
fi

if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]; then
    modprobe dm-multipath
    multipathd -B || multipathd
    need_shutdown
else
    rm -- /etc/udev/rules.d/??-multipath.rules 2>/dev/null
fi

#!/bin/bash

# called by dracut
install() {
    local _terminfodir
    # terminfo bits make things work better if you fall into interactive mode
    for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
        [ -f ${_terminfodir}/l/linux ] && break
    done

    if [ -d ${_terminfodir} ]; then
        for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
            inst_dir "$_terminfodir/${i%/*}"
            $DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$_terminfodir/$i"
        done
    fi
}
#!/bin/bash

# called by dracut
check() {
    return 255
}

# called by dracut
depends() {
    return 0
}

# called by dracut
installkernel() {
    local _modname
    # Include KMS capable drm drivers

    if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
        # arm/aarch64 specific modules needed by drm
        instmods \
            "=drivers/gpu/drm/i2c" \
            "=drivers/gpu/drm/panel" \
            "=drivers/gpu/drm/bridge" \
            "=drivers/video/backlight" \
            ${NULL}
    fi

    instmods amdkfd hyperv_fb "=drivers/pwm"

    # if the hardware is present, include module even if it is not currently loaded,
    # as we could e.g. be in the installer; nokmsboot boot parameter will disable
    # loading of the driver if needed
    if [[ $hostonly ]]; then
        for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
            [[ -e $i ]] || continue
            if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register" -S "iw_handler_get_spy" $(<$i); then
                if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then
                    hostonly='' instmods amdkfd
                fi
            fi
        done
    else
        dracut_instmods -o -s "drm_crtc_init|drm_dev_register" "=drivers/gpu/drm" "=drivers/staging"
    fi
}
# This file causes block devices with RAID (dmraid) signatures to
# automatically cause dmraid_scan to be run.
# See udev(8) for syntax

SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"

ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"

ENV{ID_FS_TYPE}!="*_raid_member", GOTO="dm_end"

ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", ENV{rd_NO_MDDDF}!="?*", GOTO="dm_end"

ENV{rd_NO_DM}=="?*", GOTO="dm_end"

OPTIONS:="nowatch"

ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"

PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="dm_end"

RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}"

LABEL="dm_end"
#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

dev="$1"
devenc=$(str_replace "$1" '/' '\2f')

[ -e /tmp/dmraid.$devenc ] && exit 0

>/tmp/dmraid.$devenc

DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)

if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then

    DM_CLEANUP="no"

    # run dmraid if udev has settled
    info "Scanning for dmraid devices $DM_RAIDS"
    SETS=$(dmraid -c -s)

    if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
        return
    fi

    info "Found dmraid sets:"
    echo $SETS|vinfo

    if [ -n "$DM_RAIDS" ]; then
    # only activate specified DM RAIDS
        for r in $DM_RAIDS; do
            for s in $SETS; do
                if [ "${s##$r}" != "$s" ]; then
                    info "Activating $s"
                    dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
                fi
            done
        done
    else
    # scan and activate all DM RAIDS
        for s in $SETS; do
            info "Activating $s"
            dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
            [ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
            udevsettle
        done
    fi

    need_shutdown

fi
#!/bin/sh

# nodmraid for anaconda / rc.sysinit compatibility
if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
    info "rd.dm=0: removing DM RAID activation"
    udevproperty rd_NO_DM=1
fi

if  ! command -v mdadm >/dev/null \
    || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
    || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
    udevproperty rd_NO_MDIMSM=1
fi

if  ! command -v mdadm >/dev/null \
    || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
    || ! getargbool 1 rd.md -d -n rd_NO_MD; then
    info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
    udevproperty rd_NO_MDDDF=1
fi

DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)

if [ -z "$DM_RAIDS" ] && ! getargbool 0 rd.auto; then
    udevproperty rd_NO_DM=1
fi
#!/bin/bash

# called by dracut
check() {
    local _rootdev
    # if we don't have dmraid installed on the host system, no point
    # in trying to support it in the initramfs.
    require_binaries dmraid || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for dev in "${!host_fs_types[@]}"; do
            [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue

            DEVPATH=$(get_devpath_block "$dev")

            for holder in "$DEVPATH"/holders/*; do
                [[ -e "$holder" ]] || continue
                [[ -e "$holder/dm" ]] && return 0
                break
            done

        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo dm rootfs-block
    return 0
}

# called by dracut
cmdline() {
    local _activated
    declare -A _activated

    for dev in "${!host_fs_types[@]}"; do
        local holder DEVPATH DM_NAME majmin
        [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue

        DEVPATH=$(get_devpath_block "$dev")

        for holder in "$DEVPATH"/holders/*; do
            [[ -e "$holder" ]] || continue
            dev="/dev/${holder##*/}"
            DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
            [[ ${DM_NAME} ]] && break
        done

        [[ ${DM_NAME} ]] || continue

        if ! [[ ${_activated[${DM_NAME}]} ]]; then
            printf "%s" " rd.dm.uuid=${DM_NAME}"
            _activated["${DM_NAME}"]=1
        fi
    done
}

# called by dracut
install() {
    local _i

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _raidconf=$(cmdline)
        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf"
    fi

    inst_multiple dmraid
    inst_multiple -o kpartx
    inst $(command -v partx) /sbin/partx

    inst "$moddir/dmraid.sh" /sbin/dmraid_scan

    inst_rules 66-kpartx.rules 67-kpartx-compat.rules

    inst_libdir_file "libdmraid-events*.so*"

    inst_rules "$moddir/61-dmraid-imsm.rules"
    #inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
    inst_hook pre-trigger 30 "$moddir/parse-dm.sh"
}
# hacky rules to try to activate lvm when we get new block devs...
#
# Copyright 2008, Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>


SUBSYSTEM!="block", GOTO="lvm_end"
ACTION!="add|change", GOTO="lvm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"

PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
    GOTO="lvm_end"

RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial"
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"

LABEL="lvm_end"
#!/bin/sh

if [ -e /etc/lvm/lvm.conf ] && ! getargbool 1 rd.lvm.conf -d -n rd_NO_LVMCONF; then
    rm -f -- /etc/lvm/lvm.conf
fi

LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"

if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
    || ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); then
    info "rd.lvm=0: removing LVM activation"
    rm -f -- /etc/udev/rules.d/64-lvm*.rules
else
    for dev in $LV_DEVS; do
        wait_for_dev -n "/dev/$dev"
    done
fi

#!/bin/sh

# run lvm scan if udev has settled

extraargs="$@"
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=)
LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=)
SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=)
SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)

[ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
# build a list of devices to scan
lvmdevs=$(
    for f in /tmp/.lvm_scan-*; do
        [ -e "$f" ] || continue
        printf '%s' "${f##/tmp/.lvm_scan-} "
    done
)

if [ ! -e /etc/lvm/lvm.conf ]; then
    {
        echo 'devices {';
        printf '    filter = [ '
        for dev in $lvmdevs; do
            printf '"a|^/dev/%s$|", ' $dev;
        done;
        echo '"r/.*/" ]';
        echo '}';

        # establish LVM locking
        if [ -n $SNAPSHOT ]; then
            echo 'global {';
            echo '    locking_type = 1';
            echo '    use_lvmetad = 0';
            echo '}';
        else
            echo 'global {';
            echo '    locking_type = 4';
            echo '    use_lvmetad = 0';
            echo '}';
        fi
    } > /etc/lvm/lvm.conf
    lvmwritten=1
fi

check_lvm_ver() {
    maj=$1
    min=$2
    ver=$3
    # --poll is supported since 2.2.57
    [ $4 -lt $maj ] && return 1
    [ $4 -gt $maj ] && return 0
    [ $5 -lt $min ] && return 1
    [ $5 -gt $min ] && return 0
    [ $6 -ge $ver ] && return 0
    return 1
}

# hopefully this output format will never change, e.g.:
#   LVM version:     2.02.53(1) (2009-09-25)
OLDIFS=$IFS
IFS=.
set $(lvm version 2>/dev/null)
IFS=$OLDIFS
maj=${1##*:}
min=$2
sub=${3%% *}
sub=${sub%%\(*};

lvm_ignorelockingfailure="--ignorelockingfailure"
lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"

check_lvm_ver 2 2 57 $maj $min $sub && \
    lvm_quirk_args="$lvm_quirk_args --poll n"

if check_lvm_ver 2 2 65 $maj $min $sub; then
    lvm_quirk_args=" --sysinit $extraargs"
fi

if check_lvm_ver 2 2 221 $maj $min $sub; then
    lvm_quirk_args=" $extraargs"
    unset lvm_ignorelockingfailure
fi

unset extraargs

export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1

if [ -n "$SNAPSHOT" ] ; then
    # HACK - this should probably be done elsewhere or turned into a function
    # Enable read-write LVM locking
    sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type =  1/' ${initdir}/etc/lvm/lvm.conf

    # Expected SNAPSHOT format "<orig lv name>:<snap lv name>"
    ORIG_LV=${SNAPSHOT%%:*}
    SNAP_LV=${SNAPSHOT##*:}

    info "Removing existing LVM snapshot $SNAP_LV"
    lvm lvremove --force $SNAP_LV 2>&1| vinfo

    # Determine snapshot size
    if [ -z "$SNAPSIZE" ] ; then
        SNAPSIZE=$(lvm lvs --noheadings  --units m --options lv_size $ORIG_LV)
        info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)"
    fi

    info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)"
    lvm lvcreate -s -n $SNAP_LV -L $SNAPSIZE $ORIG_LV 2>&1| vinfo
fi

if [ -n "$LVS" ] ; then
    info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
    lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
    for LV in $LVS; do
        lvm lvchange --yes -K -ay $lvm_quirk_args $LV 2>&1 | vinfo
    done
fi

if [ -z "$LVS" -o -n "$VGS" ]; then
    info "Scanning devices $lvmdevs for LVM volume groups $VGS"
    lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo
    lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo
fi

if [ "$lvmwritten" ]; then
    rm -f -- /etc/lvm/lvm.conf
fi
unset lvmwritten

udevadm settle

need_shutdown
#!/bin/bash

# called by dracut
check() {
    # No point trying to support lvm if the binaries are missing
    require_binaries lvm || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs = LVM*_member ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    # We depend on dm_mod being loaded
    echo rootfs-block dm
    return 0
}

# called by dracut
cmdline() {
    local _activated
    declare -A _activated

    for dev in "${!host_fs_types[@]}"; do
        [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
        [ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
        uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
        [[ "${uuid#LVM-}" == "$uuid" ]] && continue
        dev=$(</sys/block/${dev#/dev/}/dm/name)
        eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
        [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
        if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
            printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
            _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
        fi
    done
}

installkernel() {
    hostonly='' instmods dm-snapshot
}

# called by dracut
install() {
    local _i

    inst lvm

    if [[ $hostonly_cmdline == "yes" ]]; then
        local _lvmconf=$(cmdline)
        [[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
    fi

    inst_rules "$moddir/64-lvm.rules"

    if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
        if [ -f /etc/lvm/lvm.conf ]; then
            inst_simple -H /etc/lvm/lvm.conf
            # FIXME: near-term hack to establish read-only locking;
            # use command-line lvm.conf editor once it is available
            sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
            sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
        fi

        export LVM_SUPPRESS_FD_WARNINGS=1
        # Also install any files needed for LVM system id support.
        if [ -f /etc/lvm/lvmlocal.conf ]; then
            inst_simple -H /etc/lvm/lvmlocal.conf
        fi
        eval $(lvm dumpconfig global/system_id_source &>/dev/null)
        if [ "$system_id_source" == "file" ]; then
            eval $(lvm dumpconfig global/system_id_file)
            if [ -f "$system_id_file" ]; then
                inst_simple -H $system_id_file
            fi
        fi
        unset LVM_SUPPRESS_FD_WARNINGS
    fi

    if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
        mkdir -p "${initdir}/etc/lvm"
        {
            echo 'global {'
            echo 'locking_type = 4'
            echo 'use_lvmetad = 0'
            echo '}'
        } > "${initdir}/etc/lvm/lvm.conf"
    fi

    inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules

    # Do not run lvmetad update via pvscan in udev rule  - lvmetad is not running yet in dracut!
    if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then
        if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
            sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
                ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
            sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
            sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
        else
            sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
                ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
        fi
    fi

    # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
    # files, but provides the one below:
    inst_rules 64-device-mapper.rules
    # debian udev rules
    inst_rules 56-lvm.rules 60-persistent-storage-lvm.rules

    inst_script "$moddir/lvm_scan.sh" /sbin/lvm_scan
    inst_hook cmdline 30 "$moddir/parse-lvm.sh"

    inst_libdir_file "libdevmapper-event-lvm*.so"

    if [[ $hostonly ]] && find_binary lvs &>/dev/null; then
        for dev in "${!host_fs_types[@]}"; do
            [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
            dev=$(</sys/block/${dev#/dev/}/dm/name)
            eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
            [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
            case "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" in
                *thin*|*cache*|*era*)
                    inst_multiple -o thin_dump thin_restore thin_check thin_repair \
                                  cache_dump cache_restore cache_check cache_repair \
                                  era_check era_dump era_invalidate era_restore
                    break;;
            esac
        done
    fi

    if ! [[ $hostonly ]]; then
        inst_multiple -o thin_dump thin_restore thin_check thin_repair \
                      cache_dump cache_restore cache_check cache_repair \
                      era_check era_dump era_invalidate era_restore
    fi

    dracut_need_initqueue
}
SUBSYSTEM!="block", GOTO="btrfs_end"
ACTION!="add|change", GOTO="btrfs_end"
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
RUN+="/sbin/btrfs device scan $env{DEVNAME}"

RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"

LABEL="btrfs_end"
#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

btrfs_check_complete() {
    local _rootinfo _dev
    _dev="${1:-/dev/root}"
    [ -e "$_dev" ] || return 0
    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
    if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
        info "Checking, if btrfs device complete"
        unset __btrfs_mount
        mount -o ro "$_dev" /tmp >/dev/null 2>&1
        __btrfs_mount=$?
        [ $__btrfs_mount -eq 0 ] && umount "$_dev" >/dev/null 2>&1
        return $__btrfs_mount
    fi
    return 0
}

btrfs_check_complete $1
exit $?
#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

info "Scanning for all btrfs devices"
/sbin/btrfs device scan >/dev/null 2>&1
#!/bin/sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

btrfs_check_complete() {
    local _rootinfo _dev
    _dev="${1:-/dev/root}"
    [ -e "$_dev" ] || return 0
    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
    if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
        info "Checking, if btrfs device complete"
        btrfs device ready "$_dev" >/dev/null 2>&1
        return $?
    fi
    return 0
}

btrfs_check_complete $1
exit $?
#!/bin/bash

# called by dracut
check() {
    local _rootdev
    # if we don't have btrfs installed on the host system,
    # no point in trying to support it in the initramfs.
    require_binaries btrfs || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ "$fs" == "btrfs" ]] && return 0
        done
        return 255
    }

    return 0
}

# called by dracut
depends() {
    echo udev-rules
    return 0
}

# called by dracut
installkernel() {
    instmods btrfs
    # Make sure btfs can use fast crc32c implementations where available (bsc#1011554)
    instmods crc32c-intel
}

# called by dracut
install() {
    if ! inst_rules 64-btrfs.rules; then
        inst_rules "$moddir/80-btrfs.rules"
        case "$(btrfs --help)" in
            *device\ ready*)
                inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
            *)
                inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
        esac
    fi

    if ! dracut_module_included "systemd"; then
        inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
    fi

    inst_multiple -o btrfsck btrfs-zero-log
    inst $(command -v btrfs) /sbin/btrfs
}

#!/bin/sh

root=$(getarg root=)

rflags="$(getarg rootflags=)"
getargbool 0 ro && rflags="${rflags},ro"
getargbool 0 rw && rflags="${rflags},rw"
rflags="${rflags#,}"

fstype="$(getarg rootfstype=)"
if [ -z "$fstype" ]; then
    fstype="auto"
fi