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 5 years have passed since last update.

perl-Fuseのrpm作成方法

Posted at

Fuseモジュールのサンプルプログラムはdocker環境のせいなのか、動かなかったのでrpm作成方法まで。

fuseとは

眠くなってきたので省略。

Filesystem in Userspace - Wikipedia
https://ja.wikipedia.org/wiki/Filesystem_in_Userspace

dpavlin/perl-fuse: write filesystems in Perl using FUSE
https://github.com/dpavlin/perl-fuse

Fuse - write filesystems in Perl using FUSE - metacpan.org
https://metacpan.org/pod/Fuse

準備、ビルド、実行

長いので覚悟致せ。

$ docker run --rm -i -t --cap-add SYS_ADMIN --device /dev/fuse centos:centos7 /bin/bash

捨てdockerコンテナを起動する。
--cap-add SYS_ADMIN --device /dev/fuseはおまじない。

# yum install -y sudo
# visudo
- #%wheel  ALL=(ALL)       NOPASSWD: ALL
+%wheel  ALL=(ALL)       NOPASSWD: ALL
# useradd -g users -G wheel test
# su - test

いちいち一般ユーザーとrootを切り替えるのが面倒なのでsudoを使えるようにしておく。パスワードもいらない。

$ sudo yum install -y fuse-devel perl-ExtUtils-MakeMaker make perl-Test-Simple gcc rpm-build rpmdevtools fuse

これら一通りが必要。

$ curl -L https://git.io/cpanm -o cpanm
$ chmod +x cpanm
$ ./cpanm Fuse
Building and testing Fuse-0.16 ... FAIL
! Installing Fuse failed. See /home/test/.cpanm/work/1463153252.157/build.log for details. Retry with --force to force install it.
20 distributions installed

cpanmでモジュールを一般ユーザーのローカルにインストールする。
testが通らないのでFuseのエラーが出て止まる。

$ curl -O https://cpan.metacpan.org/authors/id/D/DP/DPATES/Fuse-0.16.tar.gz
$ curl -O http://apt.sw.be/source/perl-Fuse-0.09-1.rf.src.rpm
$ rpmdev-setuptree
$ rpm -ivh perl-Fuse-0.09-1.rf.src.rpm
$ mv Fuse-0.16.tar.gz rpmbuild/SOURCES/
$ vi rpmbuild/SPECS/perl-Fuse.spec
-Version: 0.09
+Version: 0.16
$ rpmbuild -ba rpmbuild/SPECS/perl-Fuse.spec
Wrote: /home/test/rpmbuild/SRPMS/perl-Fuse-0.16-1.el7.centos.src.rpm
Wrote: /home/test/rpmbuild/RPMS/x86_64/perl-Fuse-0.16-1.el7.centos.x86_64.rpm

rpmを作成する。SPECファイルはRepoforgeレポジトリものを使わせて頂く。
ここでFuseモジュールのエラーが出ないのはSPECファイルの中でmake testをしていないから。

sudo rpm -ivh /home/test/rpmbuild/RPMS/x86_64/perl-Fuse-0.16-1.el7.centos.x86_64.rpm

rpmをインストール。

mkdir tmp
perl /usr/share/doc/perl-Fuse-0.16/examples/example.pl tmp/
Ctrl+C
$ ll
ls: cannot access tmp: Transport endpoint is not connected
-rwxr-xr-x 1 test users 304737 May 13 15:27 cpanm
-rw-r--r-- 1 test users  24588 May 13 15:31 perl-Fuse-0.09-1.rf.src.rpm
drwxr-xr-x 5 test users   4096 May 13 15:27 perl5
drwxr-xr-x 8 test users   4096 May 13 15:32 rpmbuild
d????????? ? ?    ?          ?            ? tmp
$ fusermount -u tmp

perl-Fuseでインストールされるsampleを実行するが、
止まってしまって動かない。Ctrl+Cで抜けるとおかしな状態が残るので
fusermount -uで解除する。

参考

dpavlin/perl-fuse: write filesystems in Perl using FUSE
https://github.com/dpavlin/perl-fuse

おまえら rpmdev-setuptree を使えという話 : 革命の日々 その2
http://blog.gachapin-sensei.com/archives/618872.html

.rpmmacrosに並列処理設定を追加してくれる。

【質問エントリ】s3fsってdocker内でマウントできないの? - Qiita
http://qiita.com/kochizufan/items/e0253eeda0cd470c6dc8

docker run の時に --cap-add SYS_ADMIN と --device /dev/fuse をつけるとうまく動きました。
実際の打ったコマンド
docker run -d -p 80:80 -p 443:443 -p 8080:8080 -p 1122:22 --cap-add SYS_ADMIN --device /dev/fuse centos6.6:origin01

【AWS】 s3fsマウント時に起こる問題と、その回避方法 | サボり屋の技術メモ
https://angelndxp.wordpress.com/2014/03/06/%E3%80%90aws%E3%80%91-s3fs%E3%83%9E%E3%82%A6%E3%83%B3%E3%83%88%E6%99%82%E3%81%AB%E8%B5%B7%E3%81%93%E3%82%8B%E5%95%8F%E9%A1%8C%E3%81%A8%E3%80%81%E3%81%9D%E3%81%AE%E5%9B%9E%E9%81%BF%E6%96%B9%E6%B3%95/

fusermount -u /mnt/s3-bucket

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?