#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Program to create Clonezilla live.

# load config file
. /ocs-live.conf
# load functions
. /ocs-live-hook-functions 

# preset lo network setting
cat <<-NET_END > /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

NET_END

# set root passwd, I do not like root without passwd.
set_root_passwd

# We have to create account casper, otherwise there is a problem when we put command in casper's ~/.bash_profile. See ocs-live-hook-functions for more details.
create_account_casper

#
append_start_clonezilla_in_casper_bash_profile

# put the clonezilla live script in rc2.d
move_ocs_live_startup_to_rc2.d

# for better security
turn_off_ssh_service

# clean unnecessary backup file to save space
clean_unnecessary_backup_file_in_boot

# some required modules at startup
append_mod_in_etc_modules

# we need real /sbin/start-stop-daemon
remove_cdebootstrap-helper-diverts

# run localepurge
set_localepurge
localepurge

### THE END ###
# DO NOT PUT SCRIPT AFTHER THIS!!!
# kill this program before creating squashfs filesystem.
clean_ocs_hook_files_in_chroot
