vigil deb 包制作
前边有写过简单rpm 包的制作,现在制作一个简单的deb 包。
deb 包的制作是通过源码编译+ fpm
环境准备
- rust
curl https://sh.rustup.rs -sSf | sh
- 配置nightly 版本
rustup install nightly-2019-05-14
rustup default nightly-2019-05-14
- debian 系统配置
可能需要的一些依赖比如git pkg_config
apt-get update
apt-get install git pkg_config
clone 代码
- github 代码
git clone https://github.com/rongfengliang/myvigil-multiemail.git
编译vigil
cd myvigil-multiemail && cargo build --release
安装fpm
sudo apt-get update
sudo apt-get install ruby-dev build-essential
sudo gem install fpm
构建deb 包
- 命令
fpm -s dir -t deb -n vigil --config-files /etc/vigil.cfg -v 2.0 ./vigil=/usr/bin/ ./vigil.cfg=/etc/ ./res=/etc/vigil/ ./vigil.service=/lib/systemd/system/vigil.service
- deb 包项目结构
├── res
├── vigil
├── vigil.cfg
├── vigil.service
- 构建效果
fpm -s dir -t deb -n vigil --config-files /etc/vigil.cfg -v 2.0 ./vigil=/usr/bin/ ./vigil.cfg=/etc/ ./res=/etc/vigil/ ./vigil.service=/lib/systemd/system/vigil.service
Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag {:level=>:warn}
Created package {:path=>"vigil_2.0_amd64.deb"}
- 安装试用
dpkg -i vigil_2.0_amd64.deb
效果
dpkg -i vigil_2.0_amd64.deb
(Reading database
Preparing to unpack vigil_2.0_amd64.deb
Unpacking vigil (2.0) over (2.0)
Setting up vigil (2.0)
Installing new version of config file /etc/vigil.cfg
- 启动
systemctl start vigil
几个问题
- libssl.so.10 && libcrypto.so.10
查看依赖方法:
使用ldd
如下:
ldd /usr/bin/vigil
linux-vdso.so.1 (0x00007fff72106000)
libssl.so.10 => not found
libcrypto.so.10 => not found
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff86c28c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff86c084000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff86be67000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff86bc50000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff86b8b1000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff86b5ad000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff86cc68000)
说明:
这个是操作系统版本的依赖包的问题,解决方法可以通过重新下载openssl-1.0.1e
参考如下:
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1e.tar.gz
./config shared zlib-dynamic
make
参考资料
https://github.com/rongfengliang/myvigil-multiemail
https://fpm.readthedocs.io/en/latest/intro.html
https://github.com/rongfengliang/vigil-rpm/releases/tag/v2.0