从脚本或二进制文件创建.deb包

我搜索了一个简单的方法来创建.deb包没有可编译的源代码(configs,shellscripts,专有软件)。 这是一个非常严重的问题,因为大多数软件包教程都假设您有一个要编译的源tarball。 然后我找到了这个简短的教程(德语)。

之后,我创建了一个小脚本来创建一个简单的存储库。 像这样:

rm /export/my-repository/repository/* cd /home/tdeutsch/deb-pkg for i in $(ls | grep my); do dpkg -b ./$i /export/my-repository/repository/$i.deb; done cd /export/avanon-repository/repository gpg --armor --export "My Package Signing Key" > PublicKey apt-ftparchive packages ./ | gzip > Packages.gz apt-ftparchive packages ./ > Packages apt-ftparchive release ./ > /tmp/Release.tmp; mv /tmp/Release.tmp Release gpg --output Release.gpg -ba Release 

我将密钥添加到apt密钥环并包含这样的源代码:

 deb http://my.default.com/my-repository/ ./ 

它看起来像repo本身运行良好(我遇到了一些问题,修复它们我需要添加两次Packages并为Release文件制作临时文件解决方法)。 我还把一些下载的.deb放到了repo中,看起来它们也没有问题。 但我自己创建的软件包没有… Wenn我做了sudo apt-get update ,它们导致了这样的错误:

 E: Problem parsing dependency Depends E: Error occurred while processing my-printerconf (NewVersion2) E: Problem with MergeList /var/lib/apt/lists/my.default.com_my-repository_._Packages E: The package lists or status file could not be parsed or opened. 

有谁知道我做错了什么?

更新2012-03-06:只是提示另一个正在寻找创建DEB的简单方法的人:看看FPM 。

您链接的教程使用低级方法来构建包。 通常不推荐这种方法,如果不仔细,可能会导致各种问题。

一旦了解了打包基础知识,就可以非常简单地为脚本创建.deb。 简而言之:

 # Configure your paths and filenames SOURCEBINPATH=~ SOURCEBIN=myscript.sh DEBFOLDER=~/somescripts DEBVERSION=0.1 DEBFOLDERNAME=$DEBFOLDER-$DEBVERSION # Create your scripts source dir mkdir $DEBFOLDERNAME # Copy your script to the source dir cp $SOURCEBINPATH/$SOURCEBIN $DEBFOLDERNAME cd $DEBFOLDERNAME # Create the packaging skeleton (debian/*) dh_make -s --indep --createorig # Remove make calls grep -v makefile debian/rules > debian/rules.new mv debian/rules.new debian/rules # debian/install must contain the list of scripts to install # as well as the target directory echo $SOURCEBIN usr/bin > debian/install # Remove the example files rm debian/*.ex # Build the package. # You will get a lot of warnings and ../somescripts_0.1-1_i386.deb debuild 

添加更多脚本需要将它们复制到目录并添加到debian / install文件中 – 然后重新运行debuild。 您还应该根据需要检查并更新debian / *文件。

您应该阅读: dh_makedh_installdebuild的手册页