#!/bin/bash
# put the clonezilla live script in rc2.d
mv -f /S[0-9][0-9]* /etc/rc2.d/; chown root.root /etc/rc2.d/S[0-9][0-9]*

# clean unnecessary backup file to save space
rm -f /boot/initrd*.bak

# it's useless to  create a template file to avoid warning when debian live boots. Since make-live will purge that file. Therefore comment this line
# echo "search localdomain" > /etc/resolv.conf

# since ssh services is on, and casper is known for the whole world, we have to block it.
echo 'ALL: ALL EXCEPT localhost' >> /etc/hosts.deny

# force to load fuse in live CD to avoid if sshfs is used, no /dev/fuse.
echo "fuse" >> /etc/modules

# create non-purge file
cat <<-NON_PURGE_END >/etc/locale.nopurge
MANDELETE
DONTBOTHERNEWLOCALE
SHOWFREEDSPACE
C.UTF-8
en_US.UTF-8
zh_TW.UTF-8
NON_PURGE_END
# run localepurge
localepurge

### THE END ###
# DO NOT PUT SCRIPT AFTHER THIS!!!
# kill this program before create squashfs fs.
rm $0
