metro
the build system for Funtoo Linux and Gentoo Linux stages.
About me
名前 => 小島 和範
会社 => Plus One Digital Co,. Ltd.
活動 => GentooJP のサーバ管理など
その他 => ThinkPad User, Dovrak User
What is Funtoo Linux?
Daniel Robbins が2008年に始めた
Gentoo Linux ベースのDistribution
What is Funtoo Linux?
● Portage tree
○ Git
○ 定期的に Gentoo の Portage tree を取り込んでいる
○ Funtoo 独自の ebuild や mask
● Core networking
○ Gentoo とは異なるネットワーク設定
● boot-update
○ grub.cfg/grub.conf を自動生成してくれる
What is Funtoo Linux?
● Kernel
○ gentoo-sources の他に debian-sources や ubuntu-
sources などもある
■ Kernel compile までやってくれる ebuild
● metro
○ 今回のテーマ
metro
● Funtoo Linux のためのビルドシステム
○ Gentoo もサポートしてる
● stage[123] を自動生成してくれます
● 自分好みの stage ファイルが作り放題
● 似たツールに Catalyst が存在する
metro - 何ができる?
例えば app-editors/vim が入っている
stage ファイルを作れる
metro - 何ができる?
例えば pam_ldap と nss_ldap をいれて
設定を突っ込んでおけば
インストール直後から LDAP 認証なマシンが作れ
る
metro - 何ができる?
CPU別の stage ファイルが作ることができる
metro - How to install.
# emerge dev-python/boto dev-vcs/git
# git clone https://github.com/funtoo/metro.git
# ln -s /root/git/metro /usr/lib/metro
# ln -s /root/git/metro/metro /usr/bin/metro
# export METRO_MIRROR=/home/mirror/funtoo
# cd “${METRO_MIRROR}
# install -d "funtoo-stable/x86-64bit/generic_64"
metro - How to use <1>
# cd "funtoo-stable/x86-64bit/generic_64"
# install -d 2014-06-07
# wget http://mirror/funtoo-stable/x86-64bit/generic_64/stage3-latest.tar.xz 
-O 2014-06-07/stage3-generic_64-funtoo-stable-2014-06-07.tar.xz
# install -d .control/version
# echo 2014-06-07 > .control/version/stage3
# install -d .control/strategy
# echo local > .control/strategy/build
# echo stage3 > .control/strategy/seed
# cd /root/git/metro
metro - How to use <2>
# ./scripts/ezbuild.sh funtoo-stable generic_64
以降は毎日このコマンドを実行するだけで、毎日 stage ファイ
ルが生成されていきます。
metro - Customize
# cd /root/git/metro
# cp -a etc/builds/funtoo-stable etc/builds/my-stable
# cd "${METRO_MIRROR}"
# cp -a funtoo-stable my-stable
# cd my-stable/x86-64bit/generic_64/2014-06-07
# mv stage3-generic_64-funtoo-stable-2014-06-07.tar.xz 
stage3-generic_64-my-stable-2014-06-07.tar.xz
自分用の設定を作る
metro - Customize <build.conf>
[section portage]
stable:
MAKEOPTS: -j2
FEATURES:
SYNC: $[snapshot/source/remote]
USE:
● section portage
make.conf に設定するような内
容。
stable に ~ と書くと unstable
になる。
metro - Customize <build.conf>
[section release]
author: Daniel Robbins <drobbins@funtoo.org>
● section release
author とか。
metro - Customize <build.conf>
[section profile]
format: new
path: gentoo:funtoo/1.0/linux-gnu
arch: $[:path]/arch/$[target/arch_desc]
build: $[:path]/build/stable
flavor: $[:path]/flavor/core
mix-ins:
● section profile
“eselect profile” で設定する内容。
Funtooには4項目のProfileが存在する。
● arch
● build
● flavor
● mix-ins
metro - Customize <build.conf>
[section emerge]
options: --jobs=4 --load-average=3 --keep-going=n
packages: [
dev-vcs/git
net-misc/dhcpcd
sys-fs/xfsprogs
sys-apps/gptfdisk
net-misc/bridge-utils
net-misc/ifenslave
sys-devel/bc
sys-apps/pciutils
app-portage/gentoolkit
sys-fs/udev
app-editors/vim
]
● section emerge
emerge コマンドのオプションやインストー
ルするパッケージの指定
metro - Customize <build.conf>
[section snapshot/source]
type: git
branch: funtoo.org
# branch to have checked out for tarball:
branch/tar: origin/master
name: ports-2012
remote: git://github.com/funtoo/ports-2012.git
options: pull
● section snapshot/source
portage ツリーの選択。
type は現状 git のみっぽい?
(targets/gentoo/snapshot/source/{git,rsync})
metro - Customize <build.conf>
[section baselayout]
services: sshd
● section baselayout
自動起動するサービス
複数記述する場合は
services: [
sshd
iptables
]
などとする。
metro - Customize <3>
# cd /root/git/metro
# ./scripts/ezbuild.sh my-stable generic_64
metro - Customize <build.conf>
[section files]
motd/trailer: [
>>> Send suggestions, improvements, bug reports
relating to...
>>> This release: $[release/author]
>>> Funtoo Linux (general): Funtoo Linux (http:
//www.funtoo.org)
>>> Gentoo Linux (general): Gentoo Linux (http:
//www.gentoo.org)
]
● section files
右の例の場合だと /etc/motd にこの内容
が追記される。
実際には、
targets/gentoo/target/files.spec や
targets/gentoo/steps/stage.spec の中に
書かれている Shell script で書込処理が
行われている。
metro - Create LiveCD
# emerge sys-fs/squashfs-tools sys-boot/syslinux app-cdr/cdrtools
# wget https://gist.githubusercontent.
com/kjmkznr/93379267c1f6cb2e59b5/raw/65ff4ecf8a2a4fe734e5182ee9621a3
11c7176f5/livecd.spec -O target/gentoo/livecd.spec
# vim etc/builds/my-stable/build.conf
+ [section livecd]
+
+ isolinux/binfile: /usr/share/syslinux/isolinux.bin
+ memtest:
+ kernel/package: sys-kernel/gentoo-sources
metro - tips
● Multi-Core 環境では pbzip2/pxz を入れておく
○ アーカイブの作成・展開のときに複数コアを使ってくれるのでよい。
●
References
● Metro Quick Start Tutorial
● Metro Data Model
● funtoo/metro - github
● Funtoo Linux - Wikipedia

Metro

  • 1.
    metro the build systemfor Funtoo Linux and Gentoo Linux stages.
  • 2.
    About me 名前 =>小島 和範 会社 => Plus One Digital Co,. Ltd. 活動 => GentooJP のサーバ管理など その他 => ThinkPad User, Dovrak User
  • 3.
    What is FuntooLinux? Daniel Robbins が2008年に始めた Gentoo Linux ベースのDistribution
  • 4.
    What is FuntooLinux? ● Portage tree ○ Git ○ 定期的に Gentoo の Portage tree を取り込んでいる ○ Funtoo 独自の ebuild や mask ● Core networking ○ Gentoo とは異なるネットワーク設定 ● boot-update ○ grub.cfg/grub.conf を自動生成してくれる
  • 5.
    What is FuntooLinux? ● Kernel ○ gentoo-sources の他に debian-sources や ubuntu- sources などもある ■ Kernel compile までやってくれる ebuild ● metro ○ 今回のテーマ
  • 6.
    metro ● Funtoo Linuxのためのビルドシステム ○ Gentoo もサポートしてる ● stage[123] を自動生成してくれます ● 自分好みの stage ファイルが作り放題 ● 似たツールに Catalyst が存在する
  • 7.
    metro - 何ができる? 例えばapp-editors/vim が入っている stage ファイルを作れる
  • 8.
    metro - 何ができる? 例えばpam_ldap と nss_ldap をいれて 設定を突っ込んでおけば インストール直後から LDAP 認証なマシンが作れ る
  • 9.
    metro - 何ができる? CPU別のstage ファイルが作ることができる
  • 10.
    metro - Howto install. # emerge dev-python/boto dev-vcs/git # git clone https://github.com/funtoo/metro.git # ln -s /root/git/metro /usr/lib/metro # ln -s /root/git/metro/metro /usr/bin/metro # export METRO_MIRROR=/home/mirror/funtoo # cd “${METRO_MIRROR} # install -d "funtoo-stable/x86-64bit/generic_64"
  • 11.
    metro - Howto use <1> # cd "funtoo-stable/x86-64bit/generic_64" # install -d 2014-06-07 # wget http://mirror/funtoo-stable/x86-64bit/generic_64/stage3-latest.tar.xz -O 2014-06-07/stage3-generic_64-funtoo-stable-2014-06-07.tar.xz # install -d .control/version # echo 2014-06-07 > .control/version/stage3 # install -d .control/strategy # echo local > .control/strategy/build # echo stage3 > .control/strategy/seed # cd /root/git/metro
  • 12.
    metro - Howto use <2> # ./scripts/ezbuild.sh funtoo-stable generic_64 以降は毎日このコマンドを実行するだけで、毎日 stage ファイ ルが生成されていきます。
  • 13.
    metro - Customize #cd /root/git/metro # cp -a etc/builds/funtoo-stable etc/builds/my-stable # cd "${METRO_MIRROR}" # cp -a funtoo-stable my-stable # cd my-stable/x86-64bit/generic_64/2014-06-07 # mv stage3-generic_64-funtoo-stable-2014-06-07.tar.xz stage3-generic_64-my-stable-2014-06-07.tar.xz 自分用の設定を作る
  • 14.
    metro - Customize<build.conf> [section portage] stable: MAKEOPTS: -j2 FEATURES: SYNC: $[snapshot/source/remote] USE: ● section portage make.conf に設定するような内 容。 stable に ~ と書くと unstable になる。
  • 15.
    metro - Customize<build.conf> [section release] author: Daniel Robbins <drobbins@funtoo.org> ● section release author とか。
  • 16.
    metro - Customize<build.conf> [section profile] format: new path: gentoo:funtoo/1.0/linux-gnu arch: $[:path]/arch/$[target/arch_desc] build: $[:path]/build/stable flavor: $[:path]/flavor/core mix-ins: ● section profile “eselect profile” で設定する内容。 Funtooには4項目のProfileが存在する。 ● arch ● build ● flavor ● mix-ins
  • 17.
    metro - Customize<build.conf> [section emerge] options: --jobs=4 --load-average=3 --keep-going=n packages: [ dev-vcs/git net-misc/dhcpcd sys-fs/xfsprogs sys-apps/gptfdisk net-misc/bridge-utils net-misc/ifenslave sys-devel/bc sys-apps/pciutils app-portage/gentoolkit sys-fs/udev app-editors/vim ] ● section emerge emerge コマンドのオプションやインストー ルするパッケージの指定
  • 18.
    metro - Customize<build.conf> [section snapshot/source] type: git branch: funtoo.org # branch to have checked out for tarball: branch/tar: origin/master name: ports-2012 remote: git://github.com/funtoo/ports-2012.git options: pull ● section snapshot/source portage ツリーの選択。 type は現状 git のみっぽい? (targets/gentoo/snapshot/source/{git,rsync})
  • 19.
    metro - Customize<build.conf> [section baselayout] services: sshd ● section baselayout 自動起動するサービス 複数記述する場合は services: [ sshd iptables ] などとする。
  • 20.
    metro - Customize<3> # cd /root/git/metro # ./scripts/ezbuild.sh my-stable generic_64
  • 21.
    metro - Customize<build.conf> [section files] motd/trailer: [ >>> Send suggestions, improvements, bug reports relating to... >>> This release: $[release/author] >>> Funtoo Linux (general): Funtoo Linux (http: //www.funtoo.org) >>> Gentoo Linux (general): Gentoo Linux (http: //www.gentoo.org) ] ● section files 右の例の場合だと /etc/motd にこの内容 が追記される。 実際には、 targets/gentoo/target/files.spec や targets/gentoo/steps/stage.spec の中に 書かれている Shell script で書込処理が 行われている。
  • 22.
    metro - CreateLiveCD # emerge sys-fs/squashfs-tools sys-boot/syslinux app-cdr/cdrtools # wget https://gist.githubusercontent. com/kjmkznr/93379267c1f6cb2e59b5/raw/65ff4ecf8a2a4fe734e5182ee9621a3 11c7176f5/livecd.spec -O target/gentoo/livecd.spec # vim etc/builds/my-stable/build.conf + [section livecd] + + isolinux/binfile: /usr/share/syslinux/isolinux.bin + memtest: + kernel/package: sys-kernel/gentoo-sources
  • 23.
    metro - tips ●Multi-Core 環境では pbzip2/pxz を入れておく ○ アーカイブの作成・展開のときに複数コアを使ってくれるのでよい。 ●
  • 24.
    References ● Metro QuickStart Tutorial ● Metro Data Model ● funtoo/metro - github ● Funtoo Linux - Wikipedia