From ecff0797b7ad8571bbe292eaebfd18bc67df2c54 Mon Sep 17 00:00:00 2001 From: --global Date: Sat, 22 Jun 2024 20:57:14 +0200 Subject: [PATCH] Add archinstall to software section --- README.md | 5 ++-- build.sh | 6 ++++ source/start_archinstall.sh | 56 +++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100755 source/start_archinstall.sh diff --git a/README.md b/README.md index 62cf9ce..06a2fcb 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ At the end, you only need to dd the iso to your favorit usb drive, use [venotoy] This iso comes with some batteries included. -* Git -* Vim +* [archinstall](https://github.com/archlinux/archinstall) in `/root/software/archinstall` including a `start_archinstall.sh` * [arch-linux-configuration](https://github.com/stevleibelt/arch-linux-configuration) in `/root/software/arch-linux-configuration` * This repository has a [recover](https://github.com/stevleibelt/arch-linux-configuration/tree/master/scripts/zfs/recover) section to ease up fixing broken installations * [downgrade](https://github.com/pbrisbin/downgrade) to the image in the path `/root/software/downgrade` @@ -29,6 +28,8 @@ This iso comes with some batteries included. * This repository has a [unix](https://github.com/stevleibelt/General_Howtos/tree/master/operation_system/unix) knowledge section inside * This repository has a [zfs](https://github.com/stevleibelt/General_Howtos/tree/master/filesystem/zfs) knowledge section inside * And much more knowledge +* Git +* Vim ## Howto diff --git a/build.sh b/build.sh index 28b1e98..c11069e 100755 --- a/build.sh +++ b/build.sh @@ -72,6 +72,12 @@ function add_files () cp "${PATH_TO_THIS_SCRIPT}/source/replace_zfsbootmenu.sh" "${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/zfsbootmenu/" exit_if_last_exit_code_is_not_zero ${?} "Copy of >>${PATH_TO_THIS_SCRIPT}/source/replace_zfsbootmenu.sh<< to >>${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/zfsbootmenu/<< failed." + _echo_if_be_verbose " Adding repository >>archinstall<< " + git clone https://github.com/archlinux/archinstall "${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/archinstall" + exit_if_last_exit_code_is_not_zero ${?} "Checkout and creation of directory >>${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/archinstall<< failed." + cp "${PATH_TO_THIS_SCRIPT}/source/start_archinstall.sh" "${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/archinstall/" + exit_if_last_exit_code_is_not_zero ${?} "Copy of >>${PATH_TO_THIS_SCRIPT}/source/start_archinstall.sh<< to >>${PATH_TO_THE_ARCHLIVE_ROOT_USER}/software/archinstall/<< failed." + _echo_if_be_verbose " Adding repository >>general_howtos<< " git clone https://github.com/stevleibelt/general_howtos "${PATH_TO_THE_ARCHLIVE_ROOT_USER}/document/general_howtos" exit_if_last_exit_code_is_not_zero ${?} "Checkout and creation of directory >>${PATH_TO_THE_ARCHLIVE_ROOT_USER}/document/general_howtos<< failed." diff --git a/source/start_archinstall.sh b/source/start_archinstall.sh new file mode 100755 index 0000000..46d24cb --- /dev/null +++ b/source/start_archinstall.sh @@ -0,0 +1,56 @@ +#!/bin/bash +##### +# Tries to find existing zfsbootmenu.EFI file and replace this with another one +# Creates a backup of the existing file +#### +# @since: 2023-11-10 +# @author: stev leibelt +#### + +function _echo_if_be_verbose () +{ + if [[ ${BE_VERBOSE} -eq 1 ]]; + then + echo "${@}" + fi +} + +function _exit_if_last_exit_code_is_not_zero () +{ + local ERROR_MESSAGE + local LAST_COMMAND + local LAST_EXIT_CODE + + ERROR_MESSAGE="${2:-'Something went wrong'}" + LAST_COMMAND="${@:2}" + LAST_EXIT_CODE="${1:-1}" + + if [[ ${LAST_EXIT_CODE} -ne 0 ]]; + then + echo ":: Error" + echo " Last exit code >>${LAST_EXIT_CODE}<<" + echo " Last command >>${LAST_COMMAND}<<" + echo " >>${ERROR_MESSAGE}<<." + + exit "${LAST_EXIT_CODE}" + fi +} + +function _main () +{ + local BASEPATH_OF_THIS_SCRIPT + + BASEPATH_OF_THIS_SCRIPT=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd) + + if [[ ${UID} != 0 ]]; + then + echo ":: Script needs to be executed as root" + + exit 10 + fi + + # ref: https://github.com/archlinux/archinstall?tab=readme-ov-file#running-the-guided-installer-using-git + python -m archinstall +} + +_main "${@}"