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

3 4
set -e

5 6
echo "Disabling swapon"

7 8 9
# Disable swapon to avoid initscripts to setup swap space.
# Rationale: security-in-depth model.

amnesia's avatar
amnesia committed
10
SWAPON=/sbin/swapon
11

12 13 14 15 16
# 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.
17 18 19 20 21
cat > $SWAPON << 'EOF'
#!/bin/sh
/bin/true
EOF
chmod 755 $SWAPON