Linux制作deb
1、新建一个我们临时的工作目录mkdir deb
2、新建我们程序的目录
mkdir hello
3、编写我们的程序
我们以我们最熟悉的helloworld程序做起,
hello.c代码如下
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}
Makefile文件如下:
OBJS=hello.o
CC=gcc -g
all:$(OBJS)
$(CC) -o hello $(OBJS)
clean:
rm -f *.o hello
.PHONY:all clean
4、我们sudo make一下,测试程序编译是否有问题,然后在./hello检查程序是否正确执行
5、如果没问题进行下一步,如果有问题我们看提示检查程序代码
6、我们清理下刚才编译程序的垃圾,sudo make clean一下
7、输入命令,切回上级目录
cd ..
8、进行一次压缩打包(为什么做这一步,我也不太明白,查资料说,这一步是为了给生成的deb文件进行对比,确保我们deb文件没有错误)
改名:因为文件名必须包含文件名还有版本号
mv hello hello-1.0
//说明:文件名后必须用-,不能用_
tar zcvf hello_1.0.orig.tar.gz hello-1.0
说明:压缩包的名字必须是包含文件名及版本号
9、进入我们的hello-1.0目录
cd hello-1.0
10、我们需要dh_make工具进行打包前的配置,如果是第一使用请先安装dh-make
dh-make安装方法:
sudo apt-get install dh-make
安装好后,我们就可以使用该命令了
dh_make -e linuxidc@www.linuxidc.com 修改参数,也可以不修改,执行这一步,我们将会看到,邮箱是我们刚才输入的
如果不想改为自己的邮箱,可以执行下面命令
dh_make
上面任一命令后都会出现,一下内容:
www.linuxidc.com@linuxidc:~/deb/hello-1.0$ dh_make -e linuxidc@www.linuxidc.com
Type of package: single binary, indep binary, multiple binary, library, kernel module, kernel patch or cdbs?
[s/i/m/l/k/n/b]
11、我们输入s
Maintainer name : zsx
Email-Address : linuxidc@www.linuxidc.com
Date : Sat, 18 Dec 2010 23:06:25 +0800
Package Name : hello
Version : 1.0
License : blank
Using dpatch : no
Type of Package : Single
Hit <enter> to confirm:
12、输入回车,确认
Skipping creating ../hello_1.0.orig.tar.gz because it already exists
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the hello Makefiles install into $DESTDIR and not in / .
13、准备工作完成
14、开始打包
dpkg-buildpackage
15、打包成功,切回上级目录就可看到我们的helloworld的deb包
cd ..
ls后就会看到 hello_1.0-1_armhf.deb
-------------------------------------------------------------------------------------
这里有一个问题,执行hello报错,我自己捣鼓出了解决方法「可能只对我的机器适用---树梅派3b linux arm」
1.把deb下面的文件全删除,我们在来一次
mkdir hello
cd hello
nano hello.c
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}
nano Makefile
all:
gcc hello.c -o hello
clean:.PHONY:all clean
//这里执行的效果和上面是一样的咯
sudo make
sudo make clean
cd ..
mv hello hello-1.0
cd hello-1.0
dh_make --createorig
输入s
mkdir bin/
cp hello bin/
cd debian/
nano install
#!/bin/bash
./bin/hello 这里还是有个问题hello虽然被包含到bin里去了但是可能会后台执行这个hello,install里面写mkdir我写过,执行不了的,linux其他机器应该是可以
cd ..
cd..
tar zcvf hello_1.0.orig.tar.gz hello-1.0
cd hello-1.0
sudo dpkg-buildpackage
Finish:]
sudo dpkg -i *.deb
-------------------------------------------------------------------------------------------------------------
下面我介绍一下debain里面脚本(没有的可以自己创建,就和上面install一样)
Linux制作deb的更多相关文章
- 【linux】制作deb包方法 **
目录 前言 概念 ** 创建自己的deb包 文件源码 前言 制作deb的方式很多 使用 dpkg-deb 方式 使用 checkinstall 方式 使用 dh_make 方式 修改原有的 deb 包 ...
- ubuntu 制作deb 包
ubuntu下打包制作deb安装包 http://www.th7.cn/system/lin/201406/61012.shtml 2014-06-22 20:16:45CSDN-yangbing ...
- 从源代码制作deb包的两种方法以及修改已有deb包(转载)
From:http://yysfire.github.io/linux/%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%B6%E4%BD%9Cdeb%E5%8C% ...
- Ubuntu下制作deb包的方法详解
1 认识deb包 1.1 认识deb包 deb是Unix系统(其实主要是Linux)下的安装包,基于 tar 包,因此本身会记录文件的权限(读/写/可执行)以及所有者/用户组. 由于 Unix ...
- python在linux制作图形界面(snack)
snack是一个用于在linux制作图形界面(GUI)的模块,该模块由c编写,而且redhat的系统都自带这个模块. 1.获取模块 虽然redhat系统会自带这个模块,但是直接去import snac ...
- 利用checkinstall制作deb或rpm工具包
1. 概述 有时候我们向用户提供软件时,并不希望提供源码(虽然这挺狗的...),而是只希望提供一些可执行文件.小程序还好说,可以轻易地提取有用的信息出来. 但对于一些比较庞大的程序,尤其是需要配置文件 ...
- [deb]制作deb包
转自:http://www.cnblogs.com/Genesis-007/p/5219960.html 查看系统安装了哪些deb包: dpkg -l 打包: dpkg -b dir result.d ...
- win10 + linux 制作双系统教程(我本身是win10系统)
1.制作启动U盘 准备工作: .linux镜像 .硬盘空余空间>8G,越大越好 .制作启动U盘的软件 .最好3.0U盘一个>4G 下载启动软件的工具(UItraIOS制作的U盘启动盘无法安 ...
- dpkg制作deb包
deb包的文件结构: deb包里面的结构:DEBIAN目录 和 软件具体安装目录(模拟安装目录)(如etc, usr, opt, tmp等). 在DEBIAN目录中至少有control文件,还可能有p ...
随机推荐
- IIS服务器环境下某路径下所有PHP接口无法运行报500.19错误
IIS服务器环境下某路径(文件夹)下所有PHP接口无法运行报500.19错误 环境:IIS8.5 + php7.2.1 错误描述:某目录下(如 d:\web\A)所有php接口文档运行错误,接口测试工 ...
- simulate UE activity
can: 1,connect, disconnect 2,configure serial,nic,com,model,version,IMEI,IMSI,IP 3,various AT comman ...
- hdu4496-D-city--逆序并查集
D-City Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Subm ...
- Emma姐
- Android的崩溃类型总结
看了篇腾讯的沙龙分享,觉得很不错,在这里分享给大家 crash的大致划分:
- python学习14-模块
引入模块的方式: 1. import 模块 2. from xxx import 模块 一.collections 模块 1.Counter() counter是一个计数器,主要用来计数,计算一个字符 ...
- 云计算、大数据和 AI
我今天要讲这三个话题,一个是云计算,一个大数据,一个人工智能,我为什么要讲这三个东西呢?因为这三个东西现在非常非常的火,它们之间好像互相有关系,一般谈云计算的时候也会提到大数据,谈人工智能的时候也会提 ...
- sqoop导数
#!/bin/bash source ExitCodeCheck.shopts=$@getparam(){ echo $opts|xargs -n1|cut -b 2-|awk -v arg=$1 - ...
- Go语言包管理工具Glide
Go语言包管理工具用于管理Go项目的库和库的依赖引用. 包管理工具普遍会在Go项目根目录生成Vendor文件夹并自动下载该Go项目需要的库. Go语言有很多开源的包管理工具,这里主要介绍Glide ...
- CentOS6.4 安装sftp
1.打开命令终端窗口,按以下步骤操作.使用ssh -V 命令来查看openssh的版本,版本必须大于4.8p1,低于的这个版本需要升级. [root@ecs-3c46 ~]# ssh -v OpenS ...