version 3, including all changes.
.
| Rev |
Author |
# |
Line |
| 1 |
LeslieViljoen |
1 |
!!! Debian Packaging and System Administration in Ruby |
| |
|
2 |
|
| 2 |
LeslieViljoen |
3 |
This presentation was on March 7, 2011 at the [OSS building in Grafton Road|http://www.oss.co.nz/contacts]. First, we built packages. These packages were built on Ubuntu (Maverick) but the Debian process is probably similar. |
| |
|
4 |
|
| 3 |
LeslieViljoen |
5 |
The steps below for building a package from scratch is heavily based on Daniel Holbach's excellent tutorial videos. He has quite a few videos on ~YouTube that illustrate many aspects of packaging for Ubuntu. The first of these is here: http://www.youtube.com/watch?v=zKLabbXTqMc |
| 2 |
LeslieViljoen |
6 |
|
| |
|
7 |
__Checkinstall__ |
| |
|
8 |
|
| |
|
9 |
Here are the steps for wrapping up a source package into a Deb using Checkinstall. |
| |
|
10 |
|
| |
|
11 |
<verbatim> |
| |
|
12 |
|
| |
|
13 |
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p3.tar.gz |
| |
|
14 |
tar zxvf ntp-4.2.6p3.tar.gz |
| |
|
15 |
cd ntp-4.2.6p3 |
| |
|
16 |
./configure |
| |
|
17 |
make |
| |
|
18 |
|
| |
|
19 |
# stop! |
| |
|
20 |
# checkinstall will "make install" |
| |
|
21 |
|
| |
|
22 |
# copy files you want distributed with the package |
| |
|
23 |
mkdir doc-pak |
| |
|
24 |
cp README INSTALL COPYING ChangeLog TODO doc-pak |
| |
|
25 |
|
| |
|
26 |
# you can now add scripts to be run during install: |
| |
|
27 |
# |
| 3 |
LeslieViljoen |
28 |
# preinstall-pak Run BEFORE the package is INSTALLED |
| 2 |
LeslieViljoen |
29 |
# postinstall-pak Run AFTER the package is INSTALLED |
| |
|
30 |
# preremove-pak Run BEFORE the package is REMOVED |
| |
|
31 |
# postremove-pak Run AFTER the package is REMOVED |
| |
|
32 |
|
| |
|
33 |
sudo su |
| |
|
34 |
checkinstall |
| |
|
35 |
|
| |
|
36 |
# Checkinstall will ask for a package description |
| |
|
37 |
# Change maintainer if you so desire |
| |
|
38 |
|
| |
|
39 |
less ntp_4.2.6p3-1_i386.deb |
| |
|
40 |
dpkg -L ntp |
| |
|
41 |
|
| |
|
42 |
# to remove: apt-get remove ntp |
| |
|
43 |
</verbatim> |
| |
|
44 |
|
| |
|
45 |
__The Full Package__ |
| |
|
46 |
|
| |
|
47 |
These are the steps we followed to produce a complete Ubuntu package. |
| |
|
48 |
|
| |
|
49 |
<verbatim> |
| |
|
50 |
Set up environment |
| |
|
51 |
------------------ |
| |
|
52 |
apt-get install devscripts build-essential fakeroot debhelper gnupg pbuilder dh-make lzip |
| |
|
53 |
|
| |
|
54 |
vi ~/.bashrc |
| |
|
55 |
# export DEBEMAIL="leslie.viljoen@gmail.com" |
| |
|
56 |
# export DEBFULLNAME="Leslie Viljoen" |
| |
|
57 |
|
| |
|
58 |
source ~/.bashrc |
| |
|
59 |
export | grep DEB |
| |
|
60 |
|
| |
|
61 |
gpg --gen-key #use defaults, enter name, email, password |
| |
|
62 |
gpg --list-keys |
| |
|
63 |
|
| |
|
64 |
# you can now upload your key on launchpad.net |
| |
|
65 |
# good idea: backup your key (Ubuntu One?) and remember password |
| |
|
66 |
|
| |
|
67 |
vi ~/.pbuilderrc |
| |
|
68 |
# COMPONENTS="main restricted universe multiverse" |
| |
|
69 |
|
| |
|
70 |
sudo pbuilder create #169 MB in /var/cache/pbuilder |
| |
|
71 |
|
| |
|
72 |
|
| |
|
73 |
Create package |
| |
|
74 |
-------------- |
| |
|
75 |
# almost same process: watch Daniel's vids |
| |
|
76 |
# vids are slightly out of date |
| |
|
77 |
|
| |
|
78 |
wget ftp://ftp.gnu.org/pub/gnu/ed/ed-1.5.tar.lz |
| |
|
79 |
tar xvf ed-1.5.tar.lz |
| |
|
80 |
|
| |
|
81 |
# this archive name is very important... |
| |
|
82 |
# you must use underscore and .orig |
| |
|
83 |
# you must make a gzipped tar |
| |
|
84 |
tar czf ed_1.5.orig.tar.gz ed-1.5 |
| |
|
85 |
|
| |
|
86 |
cd ed-1.5 |
| |
|
87 |
head COPYING |
| |
|
88 |
dh_make -s -c gpl3 #single package, gpl license |
| |
|
89 |
cd debian |
| |
|
90 |
rm *.ex *.EX docs info README.Debian README.source |
| |
|
91 |
|
| |
|
92 |
vi changelog |
| |
|
93 |
# version -> 1.5.1-0ubuntu1 |
| |
|
94 |
# maverick |
| |
|
95 |
# Initial release (no bugs closed) |
| |
|
96 |
# Repacked .tar.lz to .tar.gz, no other changes |
| |
|
97 |
|
| |
|
98 |
vi control |
| |
|
99 |
# section: editors |
| |
|
100 |
# remove stuff |
| |
|
101 |
# copy in Description from README |
| |
|
102 |
|
| |
|
103 |
vi copyright #critical! |
| |
|
104 |
# downloaded: ftp://ftp.gnu.org |
| |
|
105 |
# less authors |
| |
|
106 |
# find . -name '*.c'|xargs grep Copyright |
| |
|
107 |
|
| |
|
108 |
cd .. #package directory (ed-1.5) |
| |
|
109 |
debuild -S -sa #source only package, include orig src |
| |
|
110 |
|
| |
|
111 |
# may change things and run debuild again |
| |
|
112 |
# man pages all over, millions of options |
| |
|
113 |
# produces: |
| |
|
114 |
# new source .tar.gz |
| |
|
115 |
# .dsc file, tying .orig to new source .tar.gz |
| |
|
116 |
# debuild used to make .diff, now see: |
| |
|
117 |
# http://wiki.debian.org/Projects/DebSrc3.0 |
| |
|
118 |
# |
| |
|
119 |
|
| |
|
120 |
cd .. #to where new .dsc file is |
| |
|
121 |
sudo pbuilder build ed_1.5-0ubuntu1.dsc |
| |
|
122 |
less /var/cache/pbuilder/result/ed_1.5-0ubuntu1_i386.deb |
| |
|
123 |
|
| |
|
124 |
# depends has been created for us |
| |
|
125 |
# this is very simple, you have to add a lot more |
| |
|
126 |
# stuff to make a real package: mostly documentation |
| |
|
127 |
# you'll be communicating with upstream and ubuntu |
| |
|
128 |
# irc: #ubuntu-motu on freenode |
| |
|
129 |
|
| |
|
130 |
</verbatim> |
| |
|
131 |
|
| |
|
132 |
__Modifying a Package__ |
| |
|
133 |
|
| |
|
134 |
We did not show these steps in the presentation, but they can be followed to introduce a small change into an existing package. |
| |
|
135 |
|
| |
|
136 |
<verbatim> |
| |
|
137 |
|
| |
|
138 |
# make sure you have a source repos in /etc/apt/sources.list |
| |
|
139 |
grep deb-src /etc/apt/sources.list |
| |
|
140 |
|
| |
|
141 |
apt-get source tango-icon-theme-extras |
| |
|
142 |
# the source has been extracted and ubuntu diff applied |
| |
|
143 |
# according to the dsc file |
| |
|
144 |
|
| |
|
145 |
cd tango-icon-theme-extras-0.1.0 |
| |
|
146 |
vi debian/control |
| |
|
147 |
# update standards to 3.7.3 |
| |
|
148 |
# add Homepage field |
| |
|
149 |
|
| |
|
150 |
# now document changes |
| |
|
151 |
dch -i |
| |
|
152 |
|
| |
|
153 |
# to upload to Ubuntu, build source package |
| |
|
154 |
# because its a patch, do not force including of original source (-sa) |
| |
|
155 |
debuild -S |
| |
|
156 |
|
| |
|
157 |
# to build binary for yourself |
| |
|
158 |
apt-get build-dep tango-icon-theme-extras |
| |
|
159 |
debuild |
| |
|
160 |
|
| |
|
161 |
# to install |
| |
|
162 |
cd .. |
| |
|
163 |
sudo dpkg -i tango-icon-theme-extras_0.1.0-0ubuntu5_all.deb |
| |
|
164 |
|
| |
|
165 |
# if dependencies were missing, apt can pull them in |
| |
|
166 |
# automatically and complete the installation: |
| |
|
167 |
sudo apt-get -f install |
| |
|
168 |
|
| |
|
169 |
</verbatim> |