05-disable_swapon 457 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. set -e
  3. echo "Disabling swapon"
  4. # Disable swapon to avoid initscripts to setup swap space.
  5. # Rationale: security-in-depth model.
  6. SWAPON=/sbin/swapon
  7. # Move any /sbin/swapon installed by any package out of the way,
  8. # now (--rename) as well for any future one (hint: apt-get upgrade...).
  9. dpkg-divert --rename --add /sbin/swapon
  10. # Install a custom noop swapon executable instead.
  11. cat > $SWAPON << 'EOF'
  12. #!/bin/sh
  13. /bin/true
  14. EOF
  15. chmod 755 $SWAPON