#!/bin/bash

. /mdk/bin/serverFunctions.inc

cleanOSForCompressing deleteSquidCache

#Remove m23debs (test sources)
grep -v "http://m23debs" /etc/apt/sources.list > /tmp/sources.list
cat /tmp/sources.list > /etc/apt/sources.list

grep -v "m23testing" /etc/apt/sources.list > /tmp/sources.list
cat /tmp/sources.list > /etc/apt/sources.list

rm /etc/apt/sources.list.d/m23debs.list 2> /dev/null

# Overwrite free space on / with zeros
dd if=/dev/zero of=/z.dd bs=1M; rm /z.dd

# Check, if / and /boot are stored on different devices
if [ $(LC_ALL=C df /boot/ | grep dev | awk '{print($1)}') != $(LC_ALL=C df / | grep dev | awk '{print($1)}') ]
then
	# Overwrite free space on /boot with zeros
	dd if=/dev/zero of=/boot/z.dd bs=1M; rm /boot/z.dd
fi