如何创建一个 deb 包来安装文件?

如何创建一个 deb 包来安装文件?

下面是使用创建 Debian 软件包时的工作控制文件关联。我保留了一个依赖项并且它正在创建 deb 文件。

Package: my-program
Version: 1.0
Architecture: all
Essential: no
Priority: optional
Depends: default-jdk
Maintainer: Your Name
Description: A short desc

创建的文件夹结构;在测试中我保留了几个文件。

├── my-program_version_architecture
│   └── DEBIAN
│       ├── control
│       └── usr
│           └── local
│               └── share
│                   └── testing
│                       ├── remaining files

我运行了以下命令:

dpkg-deb --build my-program_version_architecture/

deb 文件已创建,但是当我运行以下命令来安装 deb 文件时,出现了错误。

sudo apt install ./my-program_version_architecture.deb

我收到的错误:

> Reading package lists... Done Building dependency tree Reading state
> information... Done Note, selecting 'my-program' instead of
> './my-program_version_architecture.deb' The following NEW packages
> will be installed:   my-program 0 upgraded, 1 newly installed, 0 to
> remove and 14 not upgraded. Need to get 0 B/107 MB of archives. After
> this operation, 0 B of additional disk space will be used. Get:1
> /home/azureuser/debpkgs/my-program_version_architecture.deb my-program
> all 1.0 [107 MB] dpkg: error processing archive
> /home/azureuser/debpkgs/my-program_version_architecture.deb
> (--unpack):  unable to open file '/var/lib/dpkg/tmp.ci//usr': Is a
> directory Errors were encountered while processing: 
> /home/azureuser/debpkgs/my-program_version_architecture.deb E:
> Sub-process /usr/bin/dpkg returned an error code (1)

答案1

看起来包结构与其他视频或论坛中显示的不同。

要安装的文件夹应该位于 DEBIAN 文件夹外面,而不是里面。

参考关联

相关内容