#
# This file will have to be sourced where needed

# To prevent sourcing this file twice when using scripts to build CD images,
# use the following code at the top of your script:
#    CF=CONF.sh
#    . $CF
#    export DEBIAN_CD_CONF_SOURCED=true

# Allow to prevent double sourcing of this file
if [ "$DEBIAN_CD_CONF_SOURCED" = true ]; then
	return 0
fi

# Unset all optional variables first to start from a clean state
unset NONFREE           || true
unset CONTRIB           || true
unset EXTRANONFREE      || true
unset LOCAL             || true
unset LOCALDEBS         || true
unset SECURITY          || true
unset PROPOSED_UPDATES  || true
unset BOOTDIR           || true
unset SYMLINK           || true
unset COPYLINK          || true
unset MKISOFS           || true
unset MKISOFS_OPTS      || true
unset ISOLINUX          || true
unset EXCLUDE           || true
unset NORECOMMENDS      || true
unset NOSUGGESTS        || true
unset IMAGESUMS         || true
unset JIGDOTEMPLATEURL  || true
unset JIGDOFALLBACKURLS || true
unset JIGDOINCLUDEURLS  || true
unset JIGDOSCRIPT       || true
unset JIGDO_OPTS        || true
unset PUBLISH_URL       || true
unset PUBLISH_PATH      || true
unset UDEB_INCLUDE      || true
unset UDEB_EXCLUDE      || true
unset BASE_INCLUDE      || true
unset BASE_EXCLUDE      || true
unset INSTALLER_CD      || true
unset MAXCDS            || true
unset MAXISOS           || true
unset MAXJIGDOS         || true
unset SPLASHPNG         || true
unset OMIT_MANUAL	 || true
unset OMIT_RELEASE_NOTES || true
unset OMIT_DOC_TOOLS     || true
unset MAX_PKG_SIZE       || true
unset DEBOOTSTRAP_OPTS   || true
unset ARCHIVE_KEYRING_PACKAGE || true
unset ARCHIVE_KEYRING_FILE    || true
unset TYPE               || true

# The debian-cd dir
#export BASEDIR=$(dirname $(dirname $(dirname $(readlink -f $BASH_SOURCE))))
export BASEDIR=`pwd`

export CDNAME=deepin-server
export CODENAME=kui

# 设置ISO构建类型支持, secure, general
export TYPE="general"

# By default use Debian installer packages from $CODENAME
if [ -z "$DI_CODENAME" ]; then
	export DI_CODENAME=kui
fi

export DEBVERSION="15"
export OFFICIAL="Official"

# ... for arch
if [ -z "$ARCHES" ]; then
	CPU=`dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null || true`
	if [ -z "$CPU" ]; then
		CPU=`dpkg-architecture -qDEB_HOST_ARCH`
	fi
	KERNEL=`dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null || true`
	if [ -z "$KERNEL" ]; then
		KERNEL=linux
	fi
	if [ $KERNEL = linux ] ; then
		ARCHES=$CPU
	else
		ARCHES="$KERNEL-$CPU"
	fi
	export ARCHES
fi

# IMPORTANT : The 4 following paths must be on the same partition/device.
#	      If they aren't then you must set COPYLINK below to 1. This
#	      takes a lot of extra room to create the sandbox for the ISO
#	      images, however. Also, if you are using an NFS partition for
#	      some part of this, you must use this option.
# Paths to the mirrors
export MIRROR=/data/${TYPE}/isobuilder/mirror
#export SECURITY=/home/deepin-cd/mirrors/dev
# Path of the temporary directory
export TDIR=$BASEDIR/build/$DEBVERSION
# Path where the images will be written
export OUT=$BASEDIR/output/$DEBVERSION
# Where we keep the temporary apt stuff.
# This cannot reside on an NFS mount.
export APTTMP=$TDIR/apt
# Use this to force copying the files instead of symlinking or hardlinking
# them. This is useful if your destination directories are on a different
# partition than your source files.
export COPYLINK=1

# Do I want to have NONFREE merged in the CD set
export NONFREE=1

# Do I want to have CONTRIB merged in the CD set
export CONTRIB=1

# Do I want to force (potentially non-free) firmware packages to be
# placed on disc 1? Will make installation much easier if systems
# contain hardware that depends on this firmware
export FORCE_FIRMWARE=1

# If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with 
# local packages that you want to put on the CD set then
# uncomment the following line 
# export LOCAL=1
#export LOCALDEBS=/srv/mirror/server

# Override for i386 and amd64 to use xorriso instead of
# mkisofs/genisoimage. Allows creation of isohybrid images: ISO images
# that will burn correctly onto a CD and also can be written raw to a
# USB stick. xorriso 0.6.5 and later has working support for this.
export i386_MKISOFS="xorriso"
export i386_MKISOFS_OPTS="-as mkisofs -r -checksum_algorithm_iso md5,sha1,sha256,sha512"
export amd64_MKISOFS="xorriso"
export amd64_MKISOFS_OPTS="-as mkisofs -r -checksum_algorithm_iso md5,sha1,sha256,sha512"

# Keyring (defaults):
#ARCHIVE_KEYRING_PACKAGE=debian-archive-keyring
# The path to the keyring file relative to $TDIR/archive-keyring/
#ARCHIVE_KEYRING_FILE=usr/share/keyrings/debian-archive-keyring.gpg

# By default we use debootstrap --no-check-gpg to find out the minimal set
# of packages because there's no reason to not trust the local mirror. But
# you can be paranoid and then you need to indicate the keyring to use to
# validate the mirror.
#export DEBOOTSTRAP_OPTS="--keyring $TDIR/archive-keyring/$ARCHIVE_KEYRING_FILE"

# ISOLinux support for multiboot on CD1 for i386
export ISOLINUX=1

# uncomment this to if you want to see more of what the Makefile is doing
export VERBOSE_MAKE=1

# Should build_all.sh try to build a simple CD image if the proper official
# CD run does not work?
ATTEMPT_FALLBACK=yes

# Set your disk type here. Known types are:
# BC (businesscard): 650 MiB max (should be limited elsewhere,
#                    should never fill a CD anyway)
# NETINST:           650 MiB max (ditto)
# CD:                standard 74-min CD (650 MiB)
# CD700:             (semi-)standard 80-min CD (700 MiB)
# DVD:               standard 4.7 GB DVD
# DLDVD:             standard 8.5 GB dual-layer DVD
# BD:                standard 25 GB blu-ray
# DLBD:              standard 50 GB dual-layer blu-ray
# STICK1GB:          1GB USB stick or similar
# STICK2GB:          2GB USB stick or similar
# STICK4GB:          4GB USB stick or similar
# STICK8GB:          8GB USB stick or similar
# CUSTOM:            up to you - specify a size to go with it (in 2K blocks)
#export DISKTYPE=CD
#export DISKTYPE=CUSTOM
#export CUSTOMSIZE=XXXX
# If you want to over-ride this choice (e.g. to make a larger version of a given disk),
# you can do the following:
# export FORCE_CD_SIZE=<type> to change all the sizes in a given run
export DISKTYPE=DVD
#export FORCE_CD_SIZE1=CUSTOM
#export CUSTOMSIZE=100000

# Set to 1 to generate MD5/SHA1/SHA256/SHA512 sums for generated images
export IMAGESUMS=1

# And define the set of checksum algorithms you want here. Default is
# all of: md5 sha1 sha512 sha256
# export CHECKSUMS="md5 sha1 sha512 sha256"

# Produce iso/jigdo files: specify how many iso/jigdo files should be
# produced in your set. If not set or when the value is "ALL" they will
# be created for all images. One of the variables can be set to zero if
# either iso or jigdo files are not wanted.
# Replaces the old "DOJIGDO" setting with something much more flexible.
export MAXISOS=1
export MAXJIGDOS=0

# Only put the installer onto the cd (set NORECOMMENDS,... as well,
# and if you're not using build.sh then also make sure you set TASK
# appropriately here)
#export INSTALLER_CD=2
#export TASK=debian-installer+kernel

# Default desktop (currently only used by win32-loader)
export DESKTOP=mate

# If set, limits the number of images to produce. The maximum
# value of MAXISOS and MAXJIGDOS are limited to this setting.
export MAXCDS=1

# If set, overrides the boot picture used.
export SPLASHPNG=$BASEDIR/deepin/2015/splash.png

# Set to 1 to save space by omitting the installation manual. 
# If so the README will link to the manual on the web site.
export OMIT_MANUAL=1

# Set to 1 to save space by omitting the release notes
# If so we will link to them on the web site.
export OMIT_RELEASE_NOTES=1

# Set to 1 to not include the doc/tools directories on CD1
# Useful to save space and avoids failures if you have a mirror
# without those directories.
export OMIT_DOC_TOOLS=1

case "$OFFICIAL" in
    "Official")
	export OFFICIAL_VAL=2
	;;
    "Official Beta")
	export OFFICIAL_VAL=1
	;;
    *)
	export OFFICIAL_VAL=0
	;;
esac

##################################
# LOCAL HOOK DEFINITIONS
##################################
#
# Set these to point to scripts/programs to be called at various 
# points in the debian-cd image-making process. This is the ideal place
# to customise what's on the CDs, for example to add extra files or
# modify existing ones. Each will be called with the arguments in order:
#
# $TDIR (the temporary dir containing the build tree)
# $MIRROR (the location of the mirror)
# $DISKNUM (the image number in the set)
# $CDDIR (the root of the temp disc tree)
# $ARCHES (the set of architectures chosen)
#
# BE CAREFUL about what you do at each point: in the first couple of 
# cases, files and directories you're looking to use may not exist yet,
# you may need to worry about adding entries into md5sum.txt yourself
# and (in the last couple of cases) if you add any extra files you may
# end up over-filling the disc. If you *do* need to add files at the end
# of the process, see RESERVED_BLOCKS_HOOK below. It's strongly
# recommended to do this kind of customisation up-front if you can, it's
# much simpler that way!

# The disc_start hook. This will be called near the beginning of the
# start_new_disc script, just after the directory tree has been created
# but before any files have been added
#export DISC_START_HOOK=/bin/true

# The disc_pkg hook. This will be called just after the
# start_new_disc script has finished, just before make_disc_trees.pl
# starts to add package files.
#export DISC_PKG_HOOK=/bin/true

# The reserved_blocks hook; if set, this script should print the
# number of 2K blocks that need to be reserved for data to be added
# *after* a disc tree is filled with packages.
#export RESERVED_BLOCKS_HOOK=/bin/true

# The disc_finish hook. This will be called once a disc image is full,
# just after the last package rollback but before the last bits of
# cleanup are done on the temp disc tree
#export DISC_FINISH_HOOK=/bin/true

# The disc_end hook. This will be called *right* at the end of the
# image-making process in make_disc_trees.pl.
#export DISC_END_HOOK=/bin/true

export DISKINFO_DISTRO="Deepin Server"
#export OUTFILE="deepin-server-15-cloudguest-amd64-DVD-20160720"
