Show Table of Contents
32.6. 설치전 스크립트
ks.cfg 파일이 구문 분석된 후 즉시 시스템에서 실행될 명령을 추가하실 수 있습니다. 이 부분은 32.4절. “킥스타트 옵션”에서 설명하고 있듯이 반드시 킥스타트 파일의 (명령어 부분 다음) 마지막 부분에 위치해야 하며, %pre 명령으로 시작해야 합니다. 킥스타트 파일에 %post 섹션이 포함되어 있는 경우 %pre 및 %post 섹션 순서는 중요하지 않습니다.
%pre 섹션에 있는 네트워크를 액세스할 수 있지만 이 시점에서 네임 서비스는 설정되어 있지 않기 때문에 IP 주소만 작동합니다.
참고
설치전 스크립트는 chroot (change root) 환경에서 실행되지 않습니다.
--interpreter /usr/bin/python- 파이썬과 같은 다른 스크립팅 언어를 사용할 수 있도록 합니다. /usr/bin/python 을 원하는 스크립팅 언어로 변경하십시오.
32.6.1. 예시
다음은
%pre 섹션의 예입니다:
%pre #!/bin/sh hds="" mymedia="" for file in /proc/ide/h* do mymedia=`cat $file/media` if [ $mymedia == "disk" ] ; then hds="$hds `basename $file`" fi done set $hds numhd=`echo $#` drive1=`echo $hds | cut -d' ' -f1` drive2=`echo $hds | cut -d' ' -f2` #Write out partition scheme based on whether there are 1 or 2 hard drives if [ $numhd == "2" ] ; then #2 drives echo "#partitioning scheme generated in %pre for 2 drives" > /tmp/part-include echo "clearpart --all" >> /tmp/part-include echo "part /boot --fstype ext3 --size 75 --ondisk hda" >> /tmp/part-include echo "part / --fstype ext3 --size 1 --grow --ondisk hda" >> /tmp/part-include echo "part swap --recommended --ondisk $drive1" >> /tmp/part-include echo "part /home --fstype ext3 --size 1 --grow --ondisk hdb" >> /tmp/part-include else #1 drive echo "#partitioning scheme generated in %pre for 1 drive" > /tmp/part-include echo "clearpart --all" >> /tmp/part-include echo "part /boot --fstype ext3 --size 75" >> /tmp/part-include echo "part swap --recommended" >> /tmp/part-include echo "part / --fstype ext3 --size 2048" >> /tmp/part-include echo "part /home --fstype ext3 --size 2048 --grow" >> /tmp/part-include fi
이 스크립트는 시스템에 속한 하드 드라이브의 숫자를 알아낸 후 드라이브가 한 개인지 두 개인지 여부에 따라서 다른 파티션 분할 스키마를 사용하여 텍스트 파일을 기록합니다. 킥스타트 파일에 파티션 명령을 함께 입력하는 대신, 다음과 같은 줄을 포함하시기 바랍니다:
%include /tmp/part-include
스크립트에서 선택된 파티션 명령이 사용될 것입니다.
참고
킥스타트의 설치전 스크립트 부분은 다중 설치 트리나 소스 미디어를 관리할 수 없습니다. 설치 과정의 두번째 단계가 진행되는 동안 설치전 스크립트가 나타나므로, 이러한 정보는 생성된 각각의 ks.cfg 파일에 포함되어야 합니다.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.