Little helper in case you want to evaluate one of the following programs:
- Symfony Framework (standard edition) - latest
- Zend Framework (skeleton application) - latest
- Mapbender3 GIS software (example application) - chooseable
- Ilias e-learning software (base install) - latest
dtinstaller
- checks the install requirements prior installation
- creates virtual hosts
- links http://{projectname}.dev to your virtual host
dnsmasqhelper
Link the toplevel domain "dev" to your local machine
http://{project}.dev
service check
checks if mysqld and apache2 services are running
First checkout the source
$ git clone [email protected]:debugteam/dtinstaller.git /home/jochen/debpackage
actually this is a structure of a symfony project without composer.{json, lock}, CONTRIBUTING.md, README.md,...
composer.lock should be shipped though (inside of °5)
debpackage - °1 │ ├──── debsource - °2 │ │ │ │ │ ├───── DEBIAN - °3 │ │ │ │ │ └───── control - °4 │ │ │ ├──── usr │ │ │ │ │ ├───── share │ │ │ │ │ │ │ ├───── {packagename} - °5 │ │ │ │ │ │ │ │ │ ├───── app - °6 │ │ │ │ │ │ │ │ │ ├───── bin - °7 │ │ │ │ │ │ │ │ │ ├───── src - °8 │ │ │ │ │ │ │ │ │ ├───── vendor - °9 │ │ │ │ │ │ │ │ │ └───── web - °10 │ │ │ │ │ │ │ ├───── man - °11 │ │ │ │ │ │ │ │ │ └───── man8 - °12 │ │ │ │ │ │ │ │ │ └───── {packagename}.8.gz - °13 │ │ │ │ │ │ │ └───── doc │ │ │ │ │ │ │ └───── {packagename} │ │ │ │ │ │ │ ├───── changelog.gz - °14 │ │ │ │ │ │ │ └───── copyright - °15 │ │ │ │ │ └───── bin - °16 │ │ │ │ │ └───── {packagename} - °17 │ │ │ ├──── var │ │ │ │ │ ├──── cache │ │ │ │ │ │ │ └───── {packagename} - °18 │ │ │ │ │ └──── log │ │ │ │ │ └───── {packagename} - °19 │ │ │ └──── etc │ │ │ └──── {packagename} - °20 │ │ │ └───── apache.conf │ └───── debs - °21 │ │ ├───── keyfile - °22 │ └───── dists - °23 │ └───── stable │ └───── {packagename}.deb - °24
the neccessary files to generate the deb package
https://www.debian.org/doc/manuals/maint-guide/dreq.de.html
The minimum configuration for a deb package consists of config + md5sums
file: config - chmod 644
Package: mapbender3
Section: web
Version: 0.3.6.4
Maintainer: Jochen Schultz <[email protected]>
Priority: extra
Architecture: all
Depends: apache2, php5
Description: project description
extended project description multiline
or for a bashscript it may look like this
Package: dtinstaller
Version: 1.0
Architecture: all
Installed-Size: 39301
Maintainer: Jochen Schultz <[email protected]>
Provides: dtinstaller
Depends: php
Recommends: apache2, git
Section: devel
Priority: extra
Homepage: http://www.debugteam.com/
Description: Install script
helps to create a development environment to evaluate
supported programs like symfony or zend framework, mapbender3 or ilias
file: md5sums - chmod 644
this contains the files belonging to the package in a list with their md5hash
of course this is generated
$ cd debsource
$ find {etc,usr,var} -type f -exec md5sum "{}" + > DEBIAN/md5sums
https://www.debian.org/doc/manuals/maint-guide/dother.de.html
file: conffiles - chmod 644 dh_installdeb marks all files inside folder /etc automatically as »conffiles«. If the program doesn't need another location to store configuration, you don't need this file - which is the suggested method
file: rules - chmod 644
https://www.commandlinux.com/man-page/man1/dh.1.html
#!/usr/bin/make -f
%:
dh $@
file: preinst - chmod 644
This script is run prior extraction of the deb package - it may stop services if neccessary which may be restarted by the "postinst" script after the files have been deployed
file: postinst - chmod 644
A script that configures the system after the files are transfered to their locations. Often it asks the user for additional config parameters like usernames. it may as well (re)start services or executes a reboot if neccessary.
file: prerm - chmod 644
This script stops all services that are linked with the packet
- executed prior deletion of packet files
file:postrm
Typically this script removes changes made by the installation process including changes in files and deletion of files
compat This file defines the debhelper compatibility level. Currently you should use version v9 echo 9 > DEBIAN/compat
The project files are stored and therefor will be deployed in /usr/share/{projectname}
...stores logs, cache and config here
this must be changed.
- cache belongs into °18 and can be symlinked from there into °6
- logs belongs into °19 and can be symlinked from there into °6
- config belongs into °19 and can be symlinked from there into °6
- config belongs into °19 and can be symlinked from there into °6
- sources of symfony packages may be put here
this is a package, and we may ship the vendors as well... BUT! sometimes package owners tend to put different binaries into their packages
we actually don't want to have .exe and .x86 binaries mixed in our deb package
yep the doc root - in case we got a web application
A pure webapplication without a binary doesn't need a manpage
If we have a binary package we need a manpage that fits the section
If you want to make changes to the manpage of the dtinstaller:
https://www.debian.org/doc/manuals/maint-guide/dother.de.html#manpage
$ gunzip /home/jochen/debpackage/debsource/usr/share/man/man8/dtinstaller.8.gz
$ vi /home/jochen/debpackage/debsource/usr/share/man/man8/dtinstaller.8
$ gzip -n -9 /home/jochen/debpackage/debsource/usr/share/man/man8/dtinstaller.8
https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.de.html
$ dch -i --create --changelog=changelog
- After it is generated or extened it must be gziped
$ gzip -n -9 changelog
- and owner/group and mode must be set like this:
$ chown jochen:jochen changelog.gz
$ chmod 644 changelog.gz
- to extend it you can run "gunzip changelog.gz" to create changelog
- and edit changelog in a texteditor
NEEDS DOCUMENTATION
according to Filesystem Hierarchie Standard wie must put our binaries in here - symlinks do help alot
if you create a shell/bash script do not use a file extension (e.g. ".sh")
according to Filesystem Hierarchie Standard wie must put our cache in here - symlinks do help alot
according to Filesystem Hierarchie Standard wie must put our logs in here - symlinks do help alot
OPTIONAL - in case we have a webapplication
- define the documentroot/alias in apache2.config file in here
- put parameters.yml here
repository for the debfiles
https://help.ubuntu.com/community/CreateAuthenticatedRepository
{packagename}{version}-{revision}{architecture}.deb
e.g. dtinstaller_0.6-4_amd64.deb
$ fakeroot dpkg -b debsource debs/dists/stable/dtinstaller.deb
$ lintian -i debs/dists/stable/dtinstaller.deb
- create a key
$ gpg --gen-key
# choose 4096 bit
# never let it become invalid
# choose a good password
- list your keys
$ gpg --list-keys
/home/jochen/.gnupg/pubring.gpg ------------------------------- pub 4096R/A28A3C35 2017-08-18 uid Jochen Schultz
- use a key hash to sign the deb package
$ sudo dpkg-sig --sign -k A28A3C35 dtinstaller.deb
File: Packages
$ apt-ftparchive packages . > Packages
File: Packages.gz
$ gzip -c Packages > Packages.gz
File: InRelease
$ apt-ftparchive release . > Release
File: Release
$ gpg --clearsign --default-key A28A3C35 -o InRelease Release
File: Release.gpg
$ gpg --default-key A28A3C35 -abs -o Release.gpg Release
$ ifconfig
$ sudo su
$ wget -O - http://172.16.2.167/keyfile | apt-key add -
$ echo "deb http://172.16.2.167/dists/stable /" >> /etc/apt/sources.list
$ apt update
$ apt install dtinstaller
$ exit