왜 자꾸 까먹으니까~ 까먹지 않기위해 정리합니다.
최종 결과물은 linux의 커널 버전과 linux 버전을 확인하는 스크립트를 설치하는 패키지를 만드는 것입니다.
먼져 커널버전과 패키지버전을 확인 하는 스크립트는 아래와 같습니다.
파일명 : linuxversion
#$/bin/bash echo "------------------------" echo "Linux Version : " echo "------------------------" grep . /etc/*-release echo "Linux Version : " cat /etc/*-release | uniq grep . /etc/issue* uname -r echo "------------------------" echo "Kernel Version :" echo "------------------------" cat /proc/version
그럼 시작해보겠습니다.
최종 결과물의 디렉토리 구조는 아래와 같습니다.
.
|-- linuxversion
| |-- DEBIAN
| | `-- control
| `-- usr
| `-- bin
| `-- linuxversion
`-- linuxversion_1.3.4_all.deb
1. linuxversion 디랙토리 생성
mkdir -p linuxversion
2.Debian 디랙토리 생성
mkdir -p linuxversion/DEBIAN
3. 디랙토리 권한설정
find ./linuxversion -type d | xargs chmod 755 # this is necessary on Debian Woody, don't ask me why
4.usr/bin 디랙토리 생성
mkdir -p .usr/bin
5. 스크립트 파일생성
#$/bin/bash echo "------------------------" echo "Linux Version : " echo "------------------------" grep . /etc/*-release echo "Linux Version : " cat /etc/*-release | uniq grep . /etc/issue* uname -r echo "------------------------" echo "Kernel Version :" echo "------------------------" cat /proc/version
5-1 실행권한을 줍니다.
chmod +x linuxversion
6. control 파일생성
cd linuxversion/DEVIAN
vi control
---------------------------
Package: linuxversion
Version: 1.3.4
Section: devel
Priority: optional
Architecture: all
Depends: curl
Recommends:
Maintainer: Developers <kwangmyung.kim@gmail.com>
Homepage: http://xmlangel.blogspot.com
Description: linuxversion check install package
1.0.1 : bug fetch..#1
1.1.1 : bug fetch..#2
1.2.0 : bug fetch..#3
-------------------------------
7. 빌드
dpkg-deb --build linuxversion
8. 이름변경 (버전구분을 위해 이름을 변경해줍니다.)
mv linuxversion.deb inuxversion_1.3.4_all.deb
9. 설치
dpkg -i linuxversion_1.3.4_all.deb
10. 실행
linuxversion
------------------------
Linux Version :
------------------------
/etc/lsb-release:DISTRIB_ID=Ubuntu
/etc/lsb-release:DISTRIB_RELEASE=14.04
/etc/lsb-release:DISTRIB_CODENAME=trusty
/etc/lsb-release:DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION="14.04.5 LTS, Trusty Tahr"
/etc/os-release:ID=ubuntu
/etc/os-release:ID_LIKE=debian
/etc/os-release:PRETTY_NAME="Ubuntu 14.04.5 LTS"
/etc/os-release:VERSION_ID="14.04"
/etc/os-release:HOME_URL="http://www.ubuntu.com/"
/etc/os-release:SUPPORT_URL="http://help.ubuntu.com/"
/etc/os-release:BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Linux Version :
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
/etc/issue:Ubuntu 14.04.5 LTS \n \l
/etc/issue.net:Ubuntu 14.04.5 LTS
4.4.0-53-generic
------------------------
Kernel Version :
------------------------
Linux version 4.4.0-53-generic (buildd@lgw01-18) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) #74~14.04.1-Ubuntu SMP Fri Dec 2 03:43:31 UTC 2016
설치한 패키지는
usr/bin 에 liunxversion 에 설치가 됩니다.
ls -al /usr/bin | grep linuxversion
-rwxr-xr-x 1 root root 306 Dec 13 11:11 linuxversion
11 삭제
삭제는 dpkg 명령으로 삭제합니다.
dpkg -r linuxversion
댓글 없음:
댓글 쓰기