#!/usr/bin/env zsh
## configuration file for devuan-desktop-live blend

vars+=(username userpass default_shell mkefi grubversion hookscripts)
arrs+=(disk_name efi_partitions swap_partitions custom_deb_packages)

blend_name="devuan-desktop-metal_"

# release="jessie"
# version="1.0.0"

# release="ascii" 
# version="2.0.0"

# release="beowulf" 
# version="3.0.0"

# release="chimaera" 
# version="4.0.0"

release="daedalus"
version="5.0.0"

# release="excalibur"
# version="6.0.0"

# release="freia"
# version="7.0.0"


hostname="devuan"
username="devuan"
userpass="devuan"
user_skel="/etc/skel"
user_groups="sudo,docker"
user_shell="/usr/bin/zsh"
default_shell="/usr/bin/zsh"

# comment to disable:
#hookscripts="yes"

# debootstrap options
# From lib/libdevuansdk/zlib/bootstrap we need to add the options variable.
# debootstrap --keyring="$LIBPATH/extra/devuan-keyring/keyrings/devuan-archive-keyring.gpg" \
#		--include=devuan-keyring,wget,ca-certificates \
#		--foreign \
#    	    >>> ${bootstrap_options} \ <<<
#		--arch
# Currently we have put a wrapper in blend_helpers-docker to add these optiions using an alias.
debootstrap_options=("--force-check-gpg --no-merged-usr --variant=minbase")
debootstrap_purge_packages=()
debootstrap_cache="/tmp/debootstrap_cache"

# debootstrap mirror
#mirror="tor+http://devuanauxrkggcowgm2vcs6go3c5pgxdidd5wqjpg7zpfaxkmgspr6id.onion/merged"
#mirror="http://pkgmaster.devuan.org/merged"              # 
#mirror="http://deb.devuan.org" 			  #
#mirror="http://localhost:3142/deb.devuan.org/merged/"    # apt-cacher-ng
#mirror="http://192.168.1.49:3142/deb.devuan.org/merged/" # apt-cacher-ng
mirror="http://192.168.1.49:3142" # apt-cacher-ng

# the mirror to use in /etc/apt/apt.conf.d/02proxy 
apt_proxy="http://192.168.1.49:3142"

arch="amd64"
#arch="arm64"
#arch="i386"

case "$arch" in
	# for minimal-live
	#i386)  extra_packages+=(linux-image-686) ;;

	# for desktop-live
	#i386)  extra_packages+=(linux-image-686-pae) ;;

	amd64) extra_packages+=(linux-image-amd64) ;;

	arm64) extra_packages+=(linux-image-arm64) ;;
esac

kernel_version="6.1.0-10"

# ZFS install parameters
rootfs="zfs"

disk_path="/dev/disk/by-id"
disk_name="ata-CT1000MX500SSD1_2321E6DBE216"
disk2_name="ata-CT1000MX500SSD1_2321E6DBE1D2"
# disk_name="ata-HGST_HTS541010A9E680_JA1000102T3RVP"
# disk2_name="ata-HGST_HTS541010A9E680_JB10001329MG7R"

#raid=unset  		# raid0: striped 1 or more
raid=mirror  		# raid1: mirror  2
#raid=raidz  		# raid1: mirror  3
#raid=raidz2  		# raid2: mirror  4
#raid=raidz3  		# raid3: mirror  5
#raid=stripedmirror  	# raid10: mirror  4 and paired

available_disks=("${disk_name}")
if [[ -v $raid ]]; then
	available_disks+="${disk2_name}"
fi

root_name="devuan-1"
rpool_name="rpool"
bpool_name="bpool"
#encrypt=yes

# polite to use somewhere other than /etc/zfs rather than squash it.
#zpool_cache_dir="/etc/zfs"
zpool_cache_dir="/var/tmp"

## underlying physical block size for zpool create.
# ashift=9 means 512B sectors (used by all ancient drives), 
# ashift=12 means 4K sectors (used by most modern hard drives), and 
# ashift=13 means 8K sectors (used by some modern SSDs).
ashift=12

bios_part_number="1"
efi_part_number="2"
swap_part_number="3"
boot_part_number="4"
root_part_number="5"

efi_start="2048"

bios_part_size="1MB"
efi_part_size="512MB"
swap_part_size="8GB"
boot_part_size="2GB"

# zvol requires resume to be disabled
#swap_type="zvol"
swap_type="physical"

tmp_exec_state="off"
var_tmp_exec_state="on"

# uncomment to create uefi-bootable iso causes iso_make_efi and iso_write_grub_cfg
# to be called in blend_postinst
#MKEFI=1
efi_work="$BLENDPATH/${release}/efi-files"


zero_uefi="no"
#efi=1

if [[ -n $efi ]];then
	grub_mount="/boot/efi"
	grubversion="grub-efi-${arch}"

        case "arch" in
                amd64) grub_efi_target="x86_64-efi" ;;
                arm64) grub_efi_target="arm64-efi" ;;
                i386) grub_efi_target="i386-efi" ;;
        esac

else
	grub_mount="/boot/grub"
	grubversion="grub-pc"
fi

efi_partitions+=("/dev/disk/by-id/${disk_name}-part${efi_part_number}")
if [[ -v ${raid} ]]; then
	efi_partitions+="/dev/disk/by-id/${disk2_name}-part${efi_part_number}"
fi

swap_partitions+=("/dev/disk/by-id/${disk_name}-part${swap_part_number}")
if [[ -v ${raid} ]]; then
        swap_partitions+="/dev/disk/by-id/${disk2_name}-part${swap_part_number}"
fi


# Uncomment for amd64
base_packages+=(grub-efi-amd64-bin grub-efi-ia32-bin)

# devuan grub themes: cinnabar-grub  darkpurpy-grub  deepsea-grub
# grub themes must be placed on filesystems visable to grub ie not zfs.
grub_theme="deepsea-grub"
grub_gfxmode="1920x1200x32,1920x1200x8"

mirror="http://deb.devuan.org/merged"
section="main contrib non-free non-free-firmware"

# need to add to the debootstrap command in lib/libdevuansdk/zlibs/bootstrap
#debootstrap_options="--extra-suites=ascii-proposed-updates --include=libupower-glib3,dbus-x11,xfce4"

base_packages_option=(--no-install-recommends)
extra_packages_option=(--no-install-recommends)


release_conf="$BLENDPATH/${release}/config"


### package sets are defined in the corresponding $release/config file

source $release_conf

## image_name depends on release and version

image_name="${os}_${release}_${version}_${arch}_desktop"
