#!/bin/sh
CWD=$(pwd)
owner=$(stat -c %U "$CWD")
# shellcheck disable=SC1091
. ./slint_functions.sh
un() {
	[ "$(id -u)" -eq 0 ] && echo "Please use this function as regular user." && exit
	[ -d "$ISODIR" ] && echo "Please remove $ISODIR first" && exit
	echo "Did you download the most recent translations? If not, bail out."
	echo "Did you then update the package slint-docs? Else, bail out."
	read -r
	initsources
#	update_main_scripts
	extract_doc_installer_from_HandBook
	build_installer_translations
	sh update_repos.sh
	sh meta_repo.sh
#	sh build_lists_of_packages.sh
	echo "check the ISO tree then run as root $0 deux"
}
# See ../installer-tree/README_and_ChangeLog
deux() {
	[ "$(id -u)" -ne 0 ] && echo "Please use this function as root." && exit
	origuser=$(stat -c %U "$CWD")
	export origuser
	sh unpack_slackware_initrd.sh
	sh populate_iso_dir.sh
#	add_packages
#	localize_the_installer
#	customize
	create_initrd_Slint
	add_booting_equipment
	echo "Terminé. Now run as regular user $0 trois"
}
trois() {
[ "$(id -u)" -eq 0 ] && echo "Please use this function as regular user." && exit
make_iso
}
case "$1" in
 un|deux|trois) $1;;
 *) echo "usage: $0 un|deux|trois"
esac
