如何打包一个简单的bash脚本

下面的bash脚本是在大约10秒钟内编写的,但打包它将花费我数小时浏览大段文字,所以我想知道是否有一种我不知道的简便方法。
#!/usr/bin/env bash

echo "Hello World"
2个回答


终于有了一个快速而简单的方法来为一个简单的shell脚本创建deb包。谢谢! - Paradiesstaub

这个答案最初是从所在的问题中复制过来的。它被放在这里以保留问答的格式。
首先,我们需要安装这些软件包:sudo apt-get install dh-make devscripts 将脚本复制到编辑器中,并保存为hello
chmod u+x hello
mkdir hello-0.1
cp hello hello-0.1/

cd hello-0.1/
dh_make -s --indep --createorig
grep -v makefile debian/rules > debian/rules.new
mv debian/rules.new debian/rules
echo hello usr/bin > debian/install
echo "1.0" > debian/source/format
rm debian/*.ex
debuild -us -uc
cd ..
sudo dpkg -i hello_0.1-1_all.deb

现在在终端输入hello会打印出'Hello World'。

注意:dh_make 不允许同时使用 -s--indep。请只使用 --indep - NullDev