0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

BastilleBSDで開発環境を作ってみた

Last updated at Posted at 2021-06-02

ホストでビルドしていると、いろいろパッケージを入れてしまって、妙な依存などが発生してしまう可能性もあり、できるだけクリーンなシステムでビルドすることで再現性を高めたい。そのためjail下にビルド環境を作ってみる。

以前勤めていた会社にもjailを使った開発環境がありました。

昨今は何はなくてもgitなので、gitのpkgをjailにインストールします。

% sudo bastille pkg testjail install git 

BastilleBSDにはtemplateという機能があって、定型の処理を記述する事ができます。この機能でアカウントを作ってみます。

/usr/local/bastille/templatesの下にdevelop/setupというディレクトリを作ります。

この中にアカウント作成のためにCMDというファイル名で以下の内容を書きます。

pw useradd -n hiroki -g wheel -s tcsh
mkdir /home/hiroki
chown hiroki /home/hiroki

jailに反映します。

% sudo bastille template testjail develop/setup

templateは一つのファイルにまとめて書くこともできるようです。

アカウントが作られたので、そのアカウントでjailに入ります。

% sudo bastille console testjail hiroki

FreeBSDの使い方のメッセージを出さないようにするのは以下でできました。

> touch .hushlogin

FreeBSDのソースツリーとZRouterを拾ってきてビルドしてみました。

> git clone -b releng/12.3 --depth 1 https://git.freebsd.org/src.git src
> mkdir obj
> git clone -b yamori813_modify https://github.com/ZRouter/ZRouter.git
> cd ZRouter
> ./menu.sh

便利です。

後から気が付いたのですがgitはtemplateのPKGファイルに書いておけば勝手にインストールされます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?