[AIX] テスト用のモジュールをifix形式にする方法

### 事前準備：
オリジナルのスクリプトをコピーし、デバッグ用に下記を追加。
(C言語などで作成するモジュールの場合は、コンパイルしておく)
例)
```
# cp -p /usr/sbin/shutdown .
# vi shutdown

#############################################################################
## MAIN  ROUTINE
#############################################################################

#This line is added to unset the previously set LIBPATH so that it
#will point to the default LIBPATH. Done to solve the defect 325302

set -x
for i in $(typeset +f); do
    typeset -ft $i
done
```
aparrefファイルとprereqファイルを作成。
```
# cat aparref
none
```
製品サポートが作成するifixではなく、APARの指定は存在しないためaparrefにはnoneと記述。

```
# cat prereq
bos.rte.control 7.2.5.201 7.2.5.201
```
置き換え対象のファイルセット名、下限レベル、上限レベルの順に指定。

### ifix形式のファイル作成：
epkgコマンドを使用。
```
# export LANG=C
# epkg TESTLABEL
Creating efix directory /epkgwork/TESTLABEL.
** For help, enter "h!" at any question prompt. **

Enter efix abstract [38 bytes maximum]:
-> test for epkg command  <== ifixの概要を入力

Does this efix deliver one or more files ? (yes/no):
-> yes  <== yesを入力

Enter the ship file location for efix file number 1:
-> ./shutdown  <== 事前準備で作成したスクリプトを指定

Enter target file location or archive for efix file number 1:
-> /usr/sbin/shutdown  <== 置き換えるファイルを指定

Select file type for efix file number 1:
1) Standard (file or executable)
2) Archive/Library Member
-> 1  <== 1を指定

Select the installer which tracks the file that is being fixed by efix
file number 1:
1) Currently tracked by installp.
2) Currently tracked by RPM.
3) Currently tracked by ISMP.
4) Currently NOT tracked -OR- tracked by another installer.
5) NEW file that will be tracked by installp.
6) NEW file that will be tracked by RPM.
7) NEW file that will be tracked by ISMP.
8) NEW file that will be tracked by another installer.
9) NEW file that will NOT be tracked.
-> 1  <== AIXのファイルセットで配られているファイルは1を指定

Are there more efix files ? (yes/no):
-> no  <== 追加で置き換えるファイルが無ければnoを指定

Enter the location for the pre-install script or "." to skip.
-> .  <== pre install scriptを指定するか.を指定

Enter the location for the post-install script or "." to skip.
-> .  <== 上記と同様

Enter the location for the pre-remove script or "." to skip.
-> .  <== 上記と同様

Enter the location for the post-remove script or "." to skip.
-> .  <== 上記と同様

Select reboot policy for this efix package:
1) Reboot is NOT required.
2) Reboot is required. The boot image will be rebuilt.
3) Reboot is required. The boot image will NOT be rebuilt.
4) Reboot is NOT required. The boot image will be rebuilt.
-> 1  <== リブート、bosbootの要否に合わせて設定(スクリプトなら通常は1)
===============================================================================
Please Note:
All efixes should be marked Live Update capable.  This is needed for installing
efixes as a group.  If there is a reason an efix is not suitable for a live
update operation, then answer "no" but most efixes should be marked "yes".
===============================================================================

Is this efix suitable for a live update operation ? (yes/no):
-> no  <== 一般的にはnoを指定

Enter the location for the APAR reference file.
-> ./aparref  <== 事前準備で作成したaparrefを指定

Enter the location for the installp prerequisite file or "." to skip.
-> ./prereq  <== 事前準備で作成したprereqを指定、ユーザー作成ファイルの場合は.で問題なし

Enter the location for the efix description file or "." to compose it in an editor:
-> .  <== . を入力

viが起動し下記画面が表示されるためifixの詳細を記述
========================== EFIX DESCRIPTION =============================
Enter the EFIX description. Please include the symptoms that are fixed by
this EFIX, all additional install details, and any other information that
would be useful to the USER. Save and exit the editor to return to epkg.
=========================================================================
↓
例)
test description for epkg command

Verifying efix control file ...
Verifying prerequisite file ...
Populating efix directory ...
Packing efix package file ...
Package file is: /epkgwork/TESTLABEL/TESTLABEL.240329.epkg.Z
```
下記ファイルが作成されたため、内容を確認。
/epkgwork/TESTLABEL/TESTLABEL.YYMMDD.epkg.Z
```
# uncompress -c /epkgwork/TESTLABEL/TESTLABEL.YYMMDD.epkg.Z | tar -xvf -
x ./ecfile, 697 bytes, 2 tape blocks
x ./description, 34 bytes, 1 tape blocks
x ./prereq, 36 bytes, 1 tape blocks
x ./aparref, 5 bytes, 1 tape blocks
x ./EFILE1, 46088 bytes, 91 tape blocks
x ./secfile.sec, 170 bytes, 1 tape blocks
x ./secfile.lib.sec, 0 bytes, 0 tape blocks
x ./.alist, 92 bytes, 1 tape blocks

# cat ecfile
*DATE=ddd MMM DD hh:mm:ss JST YYYY
*EFIX_LABEL=TESTLABEL
ABSTRACT=test for epkg command  <== 指定した概要
PRE_INSTALL=.
POST_INSTALL=.
PRE_REMOVE=.
POST_REMOVE=.
REBOOT=no  <== リブート不要
PREREQ=/HIDDEN/
DESCRIPTION=/HIDDEN/
*INSTWORK=92
*VUID=XXXXX
EFIX_FILES=1
BUILD_BOOT_IMAGE=no  <== bosboot不要
*VERSION=7
PKGLOCKS=.
SUPERSEDE=.
E2E_PREREQ=.
FIXTESTED=no
CU_VR=
APARREF=/HIDDEN/
LKU_CAPABLE=no
CKSUM_SEC=25983

EFIX_FILE:
        EFIX_FILE_NUM=1
        SHIP_FILE=/HIDDEN/
        TARGET_FILE=/usr/sbin/shutdown  <== 置き換え対象ファイル
        TYPE=1
        INSTALLER=1
        *CKSUM=51597
        *SIZE=96
        ACL=DEFAULT
        AR_MEM=.


# Internal navigation variables
*QNEXT=QEND
*QORDER=ABSTRACT QFILES ESHIP ETARGET ETYPE EINST EMORE PREI POSTI PRER POSTR EREBOOT LKU_CAPABLE APARREF PREREQ EDESC

# cat description
test description for epkg command  <== 指定した詳細

# cat prereq
bos.rte.control 7.2.5.201 7.2.5.201  <== 指定したprereq

# cat aparref
none  <== none

# diff EFILE1 /usr/sbin/shutdown  <== EFILEnが置き換え用のファイルになるため、デバッグ用に追加した記述があることを確認
798,803d797
< set -x
< for i in $(typeset +f); do
<     typeset -ft $i
< done
```
emgrコマンドでプレビューを実行
```
# emgr -pXe /epkgwork/TESTLABEL/TESTLABEL.YYMMDD.epkg.Z

(略)

EPKG NUMBER       LABEL               OPERATION              RESULT
===========       ==============      =================      ==============
1                 TESTLABEL           INSTALL PREVIEW        SUCCESS
```
プレビューが成功したら適用
```
# emgr -Xe /epkgwork/TESTLABEL/TESTLABEL.YYMMDD.epkg.Z
(略)
EPKG NUMBER       LABEL               OPERATION              RESULT
===========       ==============      =================      ==============
1                 TESTLABEL           INSTALL                SUCCESS
```
適用状態の確認
```
# emgr -l

ID  STATE LABEL      INSTALL TIME      UPDATED BY ABSTRACT
=== ===== ========== ================= ========== ======================================
1    S    TESTLABEL  MM/DD/YY hh:mm:ss            test for epkg command
```
除去
```
# emgr -rL TESTLABEL
(略)
EFIX NUMBER       LABEL               OPERATION              RESULT
===========       ==============      =================      ==============
1                 TESTLABEL           REMOVE                 SUCCESS
```