05-disable_swapon 432 Bytes
Newer Older
1
2
#!/bin/sh

3
4
5
6
7
# Disable swapon to avoid initscripts to setup swap space.
# Rationale: security-in-depth model.

set -e

amnesia's avatar
amnesia committed
8
SWAPON=/sbin/swapon
9

10
11
12
13
14
# Move any /sbin/swapon installed by any package out of the way,
# now (--rename) as well for any future one (hint: apt-get upgrade...).
dpkg-divert --rename --add /sbin/swapon

# Install a custom noop swapon executable instead.
15
16
17
18
19
cat > $SWAPON << 'EOF'
#!/bin/sh
/bin/true
EOF
chmod 755 $SWAPON