Skip to content

Debian Package Management

ckuethe edited this page Mar 21, 2015 · 3 revisions

You can skip this page if you're already familiar with debian package management.

Building a kernel

Who knew that the linux kernel had a debian package target? Neat!

mkdir o_usbarmory
wget https://raw.githubusercontent.com/inversepath/usbarmory/master/software/kernel_conf/usbarmory_linux-3.19.0.config -O o_usbarmory/.config
make O=o_usbarmory ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make O=o_usbarmory ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 deb-pkg

Package extraction

Copying in a kernel, for example.

dpkg-deb -x random-package-0.1.deb /mnt/usbarmory

Adding sources to Debian

chroot /mnt # not necessary if you're doing this on the Armory itself
cat >> /etc/apt/sources.list << EOF
deb http://http.debian.net/debian wheezy main contrib non-free
deb http://http.debian.net/debian wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
EOF

Preventing daemons from starting immediately after being installed

cat > /usr/sbin/policy-rc.d << EOF
#!/bin/sh
#https://major.io/2014/06/26/install-debian-packages-without-starting-daemons/
echo "All runlevel operations denied by policy" >&2
exit 101
EOF
chmod 0555 /usr/sbin/policy-rc.d

Updating and installing packages

apt-get update
apt-cache search openssh
apt-get install tor openvpn openssh-server  # see, this is why you don't autostart daemons
apt-get clean

Managing service startup

$ service --status-all
$ service openvpn start
$ service openvpn status
$ service openvpn stop

# http://www.debuntu.org/how-to-managing-services-with-update-rc-d/
$ update-rc.d -f tor remove
$ update-rc.d tor defaults
$ update-rc.d tor defaults 91
$ update-rc.d tor defaults 20 80
$ update-rc.d tor stop 80 0 1 2 3 4 5 6 .
$ update-rc.d tor start 20 2 3 4 5 . stop 80 0 1 6 .
$ update-rc.d tor start 20 2 3 4 . start 30 5 . stop 80 0 1 6 .

http://www.tecmint.com/dpkg-command-examples/