Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
255 lines (187 sloc) 5.77 KB

Packaging related informations

Script meta

Colon at column :16

# One line description for this script.
# VERSION       :semver
# DATE          :2019-12-31
# URL           :
# AUTHOR        :Viktor Szépe <>
# LICENSE       :The MIT License (MIT)
# REFS          :url
# DOCS          :url
# SOURCE        :url
# UPSTREAM      :url
# DEPENDS       :apt-get install package
# LOCATION      :/usr/local/sbin/
# OWNER         :root:staff
# PERMISSION    :0755
# SYMLINK       :/usr/local/sbin/
# CRON-HOURLY   :/usr/local/sbin/
# CRON-DAILY    :/usr/local/sbin/
# CRON-WEEKLY   :/usr/local/sbin/
# CRON-MONTHLY  :/usr/local/sbin/ | mail -E -s "subject" root
# CRON.D        :02 2  * * *  root	/usr/local/sbin/
# CONFIG        :~/.config/script/configuration

# Usage/Remarks
# How to use, examples, remarks.

Backporting guide

dgit - git interoperability with the Debian archive

debconf - Configuration management

APT repository concept

Find actual values in debian/dists/stable/Release

  • a,archive,suite (e.g. "stable", "stretch")
  • c,component (e.g. "main", "crontrib" or "non-free")
  • v,version (e.g. "1.0.2-1" )
  • o,origin (e.g. "Debian", "Unofficial Multimedia Packages")
  • l,label (e.g. "Debian", "Debian-Security")
  • n,codename (e.g. "jessie", "jessie-updates")
  • site (e.g. "")

See apt_preferences(5) Determination of Package Version and Distribution Properties

APT pinning

Package: <package name>
Pin: <man 5 apt_preferences>
Pin-Priority: <integer>
  • Package: *
  • Package: *systemd*
  • Pin: version 5.20*
  • Pin: release a=testing see previous section and the Release file
  • Pin: origin pin by host name in sources.list
  • Pin-Priority: -1 never install
  • Pin-Priority: 1000 always install

Inspect signing keys

wget -qO- KEY-URL | gpg -v --with-fingerprint

Import signing keys

apt-key adv --keyserver --recv-keys KEY
wget -qO- KEY-URL | apt-key add -
Import all signing keys for Debian contributed packages
grep -h -A5 "^deb " /etc/apt/sources.list.d/*.list|grep "^#K: "|cut -d" " -f2-|/bin/bash

Check APT configuration

apt-config dump | pager

Disable APT language


Acquire::Languages "none";

Search package contents


Query runlevel information for system services (init scripts)

chkconfig --list

Display files sizes in a package

dpkg -L PACKAGE|while read -r F;do test -d "$F"||du -sk "$F";done|sort -n

Display list of packages in order of package size

dpkg-query -f '${Installed-size}\t${Package}\n' --show|sort -k 1 -n

Extract and rebuild packages

dpkg-deb -x PACKAGE-1.deb PACKAGE-NAME
editor PACKAGE-NAME/DEBIAN/control
dpkg-deb -b PACKAGE-NAME PACKAGE-2.deb

Update package MD5 sums

debsums --generate=keep PACKAGE-NAME

Install pip (Python package manager)

wget -O- | python2
wget -O- | python3

Creating Python virtual environments

apt-get install python3-venv
python3 -m venv env-dir
cd env-dir; source bin/activate

Python package locations

  • Python packages installed from Debian packages /usr/lib/python3/dist-packages - a Debian-specific convention
  • Python packages installed by pip /usr/local/lib/python3.4/dist-packages
  • Python packages installed by "from-source Python builds" /usr/local/lib/python3.4/site-packages
# find /usr -type d -name dist-packages -o -name site-packages

Convert a Python package to Debian package

apt-get install -y python-stdeb
pypi-install $PYPI_PKG

Convert a PEAR package to Debian package

apt-get install -y debpear
debpear $PEAR_PKG

List globally installed node packages

npm -g ls --depth=0

Colorizing Debian package build output

apt-get install -y colorgcc #colormake
ln -svf /usr/bin/colorgcc /usr/local/bin/g++
ln -svf /usr/bin/colorgcc /usr/local/bin/gcc
ln -svf /usr/bin/colorgcc /usr/local/bin/cc
#ln -svf /usr/bin/colormake /usr/local/bin/make

Makeself - A self-extracting archiving tool

Unattended cpan install

PERL_MM_USE_DEFAULT=1 cpan -i Alien::RRDtool

Switch to LLVM/clang compiler

# Debian jessie
echo "gcc-$VERSION hold" | dpkg --set-selections
echo "cpp-$VERSION hold" | dpkg --set-selections
echo "g++-$VERSION hold" | dpkg --set-selections
cd /usr/bin/
rm -v g++-$VERSION gcc-$VERSION cpp-$VERSION
ln -vs clang++ g++-$VERSION
ln -vs clang gcc-$VERSION
ln -vs clang cpp-$VERSION
cd -
gcc --version | grep "clang"

List binary files

find -type f -executable -exec file --mime "{}" ";" | grep -F 'charset=binary'

Writing a man page

You can’t perform that action at this time.