Fix and improve make script

This commit is contained in:
Lionel 2023-06-14 12:20:40 +02:00
parent ff8e12d9ef
commit 54253b9916

87
make.sh
View File

@ -28,7 +28,7 @@ pack_name[vm]="Driver Virtualisation"
pack_forced=(live cli disk net firmware) pack_forced=(live cli disk net firmware)
pack_default=(dm-common xfce4 gui) pack_default=(dm-common gui xfce4 cinnamon libreoffice)
nb_hooks=0 nb_hooks=0
@ -42,6 +42,8 @@ do
hooks+="$basename " hooks+="$basename "
done done
#default DISABLE sid
sid=-1
_usage() _usage()
{ {
@ -174,78 +176,84 @@ _build()
printf "\e[96mBootstrap new root filesystem\e[0m\n" printf "\e[96mBootstrap new root filesystem\e[0m\n"
lb bootstrap lb bootstrap
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
#printf "\e[96mBuild live OS file system\e[0m\n" #printf "\e[96mBuild live OS file system\e[0m\n"
#lb chroot #lb chroot
#[[ $? -eq 0 ]] || exit #[[ $? -eq 0 ]] || _exit_error
printf "\e[96mBuild live OS file system\e[0m\n" printf "\e[96mBuild live OS file system\e[0m\n"
lb chroot_cache restore lb chroot_cache restore
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_prep install all mode-archives-chroot lb chroot_prep install all mode-archives-chroot
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_devpts install lb chroot_devpts install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_proc install lb chroot_proc install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_selinuxfs install lb chroot_selinuxfs install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_sysfs install lb chroot_sysfs install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_debianchroot install lb chroot_debianchroot install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_dpkg install lb chroot_dpkg install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_tmpfs install lb chroot_tmpfs install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_sysv-rc install lb chroot_sysv-rc install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_hosts install lb chroot_hosts install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_resolv install lb chroot_resolv install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_hostname install lb chroot_hostname install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_apt install lb chroot_apt install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_archives chroot install lb chroot_archives chroot install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_linux-image lb chroot_linux-image
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_firmware lb chroot_firmware
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_preseed lb chroot_preseed
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_includes_before_packages lb chroot_includes_before_packages
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
[[ $sid -eq 0 ]] && _sid [[ $sid -eq 0 ]] && _sid
lb chroot_package-lists install lb chroot_package-lists install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_install-packages install lb chroot_install-packages install
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_package-lists live lb chroot_package-lists live
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_install-packages live lb chroot_install-packages live
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_includes_after_packages lb chroot_includes_after_packages
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_hooks lb chroot_hooks
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_hacks lb chroot_hacks
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
lb chroot_interactive lb chroot_interactive
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || _exit_error
}
_build_remove()
{
lb chroot_prep remove all mode-archives-chroot lb chroot_prep remove all mode-archives-chroot
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || exit
lb chroot_archives chroot remove # lb chroot_archives chroot remove
[[ $? -eq 0 ]] || exit # [[ $? -eq 0 ]] || exit
lb chroot_apt remove # lb chroot_apt remove
[[ $? -eq 0 ]] || exit # [[ $? -eq 0 ]] || exit
lb chroot_hostname remove lb chroot_hostname remove
[[ $? -eq 0 ]] || exit [[ $? -eq 0 ]] || exit
lb chroot_resolv remove lb chroot_resolv remove
@ -380,6 +388,14 @@ _create_iso()
} }
_exit_error()
{
printf "\e[91mError\e[0m\n"
_build_remove
_delete
exit
}
_delete() _delete()
{ {
printf "\e[96mDelete $build\e[0m\n" printf "\e[96mDelete $build\e[0m\n"
@ -411,10 +427,11 @@ _check
[[ $default = true ]] && pack=("${pack_forced[@]} ${pack_default[@]}") || _choose [[ $default = true ]] && pack=("${pack_forced[@]} ${pack_default[@]}") || _choose
_config _config
_build _build
_build_remove
mkdir -p $build/chroot/etc/skel/.ssh mkdir -p $build/chroot/etc/skel/.ssh
cp -v $USER_HOME/.ssh/{config,key_rsa_majalis,key_rsa_majalis.pub} $build/chroot/etc/skel/.ssh cp -v $USER_HOME/.ssh/{config,key_rsa_majalis,key_rsa_majalis.pub} $build/chroot/etc/skel/.ssh
ssh-keygen -f $USER_HOME/.ssh/known_hosts -q -H -F netdldata.net > $build/chroot/etc/skel/.ssh/known_hosts ssh-keygen -f $USER_HOME/.ssh/known_hosts -q -H -F ssh.netdldata.net > $build/chroot/etc/skel/.ssh/known_hosts
_prep_mounts _prep_mounts
_create_squashfs _create_squashfs