차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
| linuxfromscratch:auto-lfs [2024/04/30 20:33] – baecy | linuxfromscratch:auto-lfs [2024/06/07 20:14] (현재) – [파일 다운로드 링크 처리] baecy | ||
|---|---|---|---|
| 줄 12: | 줄 12: | ||
| <code lang=bash> | <code lang=bash> | ||
| #!/bin/bash | #!/bin/bash | ||
| - | # Begin auto-lfs | + | # LFS 12.1-systemd에 맞춤 |
| - | # | + | # < |
| - | # For LFS 12.1-systemd | + | # 커널 가상 파일 마운트/ |
| - | # you can use it after proceeding with < | + | # Begin ~/ |
| - | # Mount and unmount kernel virtual file system and entering to chroot environment | + | |
| + | VERSION=0.1.7 | ||
| LFS=/ | LFS=/ | ||
| - | LFS_PART=/ | + | LFS_PART=/ |
| - | VERSION=0.1.5 | + | LFS_BOOT=/dev/nvme0n1p6 |
| - | # Dedicated partition mount | + | LFS_EFI=/dev/nvme0n1p2 |
| - | if mountpoint -q $LFS; then true; else mount $LFS_PART $LFS; fi | + | LFS_HOME=/dev/nvme0n1p7 |
| - | if mountpoint -q $LFS/boot; then true; else mount /dev/nvme0n1p3 $LFS/boot; fi | + | |
| - | if mountpoint -q $LFS/ | + | |
| - | if mountpoint -q $LFS/home; then true; else mount /dev/nvme0n1p4 $LFS/home; fi | + | |
| - | # Mount point dirctory check | + | # 필요한 별도의 파티션 마운트 |
| + | if ! mountpoint -q $LFS; then mount $LFS_PART $LFS; fi | ||
| + | if ! mountpoint -q $LFS/ | ||
| + | if ! mountpoint -q $LFS/ | ||
| + | if ! mountpoint -q $LFS/ | ||
| + | if ! mountpoint -q $LFS/ | ||
| + | |||
| + | # /dev 존재 확인 후 필요한 조치 진행 | ||
| if [ ! -d $LFS/dev ]; then | if [ ! -d $LFS/dev ]; then | ||
| echo "Make necessary directories" | echo "Make necessary directories" | ||
| 줄 35: | 줄 39: | ||
| fi | fi | ||
| - | # To prepare for run 'chroot', run ' | + | # 입력에 따라 |
| case $1 in | case $1 in | ||
| clean|c|-c) | clean|c|-c) | ||
| 줄 42: | 줄 46: | ||
| echo "LFS is now set to '" | echo "LFS is now set to '" | ||
| echo "Now proceed with the unmount of <Kernel Virtual File System> for chroot" | echo "Now proceed with the unmount of <Kernel Virtual File System> for chroot" | ||
| - | for kvfs in dev/shm dev/pts sys proc run dev sources; do | + | for kvfs in dev/shm dev/pts sys proc run dev ; do |
| - | umount -q $LFS/$kvfs | + | |
| done | done | ||
| - | findmnt -o FSTYPE, | + | findmnt -D -R $LFS |
| echo "Ok unmount unnecessary devices" | echo "Ok unmount unnecessary devices" | ||
| echo "Good bye" | echo "Good bye" | ||
| 줄 51: | 줄 55: | ||
| else | else | ||
| echo " | echo " | ||
| - | findmnt -o FSTYPE, | + | findmnt -D -R $LFS |
| exit 0 | exit 0 | ||
| fi | fi | ||
| 줄 59: | 줄 63: | ||
| echo "Now proceed with the mount of <Kernel Virtual File System> for chroot" | echo "Now proceed with the mount of <Kernel Virtual File System> for chroot" | ||
| echo "LFS is now set to '" | echo "LFS is now set to '" | ||
| - | if mountpoint -q $LFS/dev; then true; else mount --bind /dev $LFS/dev; fi | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/ | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/proc; then true; else mount -t proc proc $LFS/proc; fi | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/sys; then true; else mount -t sysfs sysfs $LFS/sys; fi | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/run; then true; else mount -t tmpfs tmpfs $LFS/run; fi | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/ | + | if ! mountpoint -q $LFS/ |
| - | if mountpoint -q $LFS/ | + | if ! mountpoint -q $LFS/ |
| - | findmnt -o FSTYPE, | + | findmnt -D -R $LFS |
| # Run ' | # Run ' | ||
| chroot " | chroot " | ||
| 줄 94: | 줄 98: | ||
| *) | *) | ||
| #Guidance on the factors needed to execute script | #Guidance on the factors needed to execute script | ||
| - | echo "sh ./Auto_LFS.sh | + | echo "sh ./lfs-env-config |
| exit 0 | exit 0 | ||
| ;; | ;; | ||
| esac | esac | ||
| + | ## End ~/ | ||
| </ | </ | ||
| + | ===== 파일 다운로드 링크 처리 ===== | ||
| + | |||
| + | 다음과 같이 등록하고 사용해야 '' | ||
| + | |||
| + | <code lang=bash> | ||
| + | alias < | ||
| + | </ | ||
| + | |||
| + | 다운로드 링크 입력: 다운로드 -> 압축 해제 -> 디렉토리 이동 | ||
| + | |||
| + | 추가한 사항 | ||
| + | - 입력받은 URL이 Git인 경우 처리 추가 | ||
| + | - 확장자가 .zip인 경우 처리 추가 | ||
| + | - 이미 다운로드 완료한 파일의 경우 처리 추가 | ||
| + | - 작업 디렉토리의 소유권 확인 추가 | ||
| + | - 출력 색상 변수 설정 | ||
| + | |||
| + | 추가할 사항 | ||
| + | - alias 등록 확인 | ||
| + | - wget, git, gawk 설치 여부 확인 | ||
| + | |||
| + | 수정할 사항 | ||
| + | - git clone 사용 할 때 작업 디렉터리에 먼저 받고 source 디렉터리에 복사하는 방식으로 변경 필요. | ||
| + | |||
| + | |||
| + | <code user=user host=host lang=bash> | ||
| + | user@host:[ ~ ] $ pre-stage | ||
| + | xcb-proto-1.17.0.tar 100% [====================================================> | ||
| + | [Files: 1 Bytes: 148.19K [153.40KB/ | ||
| + | user@host:[ / | ||
| <code lang=bash> | <code lang=bash> | ||
| #!/bin/bash | #!/bin/bash | ||
| - | # Packages Build prepare | + | |
| - | # 아래 두개의 변수를 상황에 맞게 변경해서 사용. | + | Green=' |
| - | BuildBase=/ | + | BIGreen=' |
| - | SourceDir=/sources | + | Red=' |
| - | wget -P $SourceDir | + | Yellow=' |
| - | TargetFile=$(basename $1) | + | Color_Off=' |
| + | |||
| + | if [ "$(type -t p4c)" != ' | ||
| + | echo -e "p4c is not ${Yellow}alias registered${Color_Off}, so the functionality is not available." | ||
| + | source ${HOME}/.bash_aliases | ||
| + | | ||
| + | fi | ||
| + | |||
| + | if [ -z " | ||
| + | InputStringType=$(echo " | ||
| + | BuildBase=" | ||
| + | SourceBase=" | ||
| + | TargetFile=$(basename "$1") | ||
| + | GitDirCheck=$(basename | ||
| + | GitCheck=${TargetFile: | ||
| + | ZipCheck=${TargetFile: | ||
| TargetDir=$(echo " | TargetDir=$(echo " | ||
| + | NotFoundMsg1=" | ||
| + | However, it does not exist, so it will move to the ${Yellow}most recent directory created${Color_Off}.\n\ | ||
| + | Please check if it is correct." | ||
| + | |||
| + | if [ $(stat -c %u $BuildBase) -ne $(id -u) ] ; then echo -e "Check ${Red}$BuildBase${Color_Off} Ownership"; | ||
| function chg_dir() { | function chg_dir() { | ||
| - | | + | if [ -d " |
| + | | ||
| + | else | ||
| + | cd $(ls -tcA -w1 | head -n1) | ||
| + | echo -e " | ||
| + | fi | ||
| } | } | ||
| - | # Move to /workbench | + | # Change directory " |
| if [ " | if [ " | ||
| chg_dir " | chg_dir " | ||
| fi | fi | ||
| + | |||
| + | ## Handling Git | ||
| + | if [ " | ||
| + | if [ -d " | ||
| + | chg_dir " | ||
| + | return | ||
| + | else | ||
| + | pushd $SourceBase | ||
| + | if [ -d $GitDirCheck ] ; then | ||
| + | rm -rf $GitDirCheck | ||
| + | fi | ||
| + | git clone " | ||
| + | cp -R $GitDirCheck $BuildBase | ||
| + | popd | ||
| + | # echo "Git #1" | ||
| + | chg_dir " | ||
| + | return | ||
| + | fi | ||
| + | fi | ||
| + | |||
| + | case " | ||
| + | https|http|ftp) | ||
| + | wget --no-verbose -nc --directory-prefix=" | ||
| + | ;; | ||
| + | *) | ||
| + | ;; | ||
| + | esac | ||
| # Prepare Package Build | # Prepare Package Build | ||
| - | if file "$TargetFile" | + | if [ "$ZipCheck" |
| mkdir -p " | mkdir -p " | ||
| chg_dir " | chg_dir " | ||
| - | unzip -q "SourceDir"/" | + | unzip -q "$SourceBase"/" |
| + | return | ||
| else | else | ||
| - | tar -xf "$SourceDir"/" | + | |
| + | | ||
| + | fi | ||
| chg_dir " | chg_dir " | ||
| + | |||
| fi | fi | ||
| - | </ | + | |
| + | unset InputStringType BuildBase SourceBase TargetFile GitDirCheck GitCheck ZipCheck TargetDir NotFoundMsg1 | ||
| + | </ | ||