You are not logged in.

#1 2021-11-27 20:24:58

Dante777
Member
From: Greece
Registered: 2016-07-12
Posts: 29

[SOLVED] Can i use my own installation script to chroot and.. beyond

Hi everyone.
Please forgive my English, (not my native language) and also forgive my scripting ignorance. (i have no coding experience or knowledge whatsoever)
That being said, i'd greatly appreciate some help on the following:
I created my own Arch install bash scripts.
The way i'm doing this, is like so :

1. Boot from the Arch iso

2. Connect to the internet and install "git" (on the live media)

3. Clone my gitlab repo and cd into it

4. Run my script_1, which takes care of all steps up to chrooting into my system :
(format drive, create partitions, format partitions, mount partitions, pacstrap and install "base, git, linux" packages, generate fstab and lastly chroot into my installation)

5. Then, i clone my gitlab repo once again (while in chroot) to run my script_2, which takes care of the rest of the installation.

The (childish) script format is like this:

script_1.sh :

#!/bin/zsh
command 1 &&
command 2 &&
command 'n' &&
arch-chroot /mnt &&
umount -R /mnt &&
poweroff 

script_2.sh

#!/bin/bash
command 1 &&
command 2 &&
command 'n' &&
last command 

As soon as i'm done with the 2nd script, and exit, script_1 completes, auto-exits and i'm done.

I'm wondering if there's a way to combine the 2 scripts, so i don't have to clone my repo twice, or is this far too advanced for my (zero) knowledge level?

Thank you for your time, in advance !

Last edited by Dante777 (2021-11-29 20:59:52)

Offline

#2 2021-11-27 20:35:54

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

Offline

#3 2021-11-27 20:51:24

Dante777
Member
From: Greece
Registered: 2016-07-12
Posts: 29

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

Thank you @Head_on_a_Stick !
Greatly appreciated.

Offline

#4 2021-11-28 10:12:33

Dante777
Member
From: Greece
Registered: 2016-07-12
Posts: 29

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

I'm facing a new issue now.
My bash script fails when i run it from the arch live iso, chroots into my installation and tries to execute a command that needs human interaction. (e.g. pacman -S base-devel)

Example script:

#!/bin/zsh

command 1 &&
command 2 &&
arch-chroot /mnt /bin/bash <<END
command 1 &&
command 2 &&
pacman -S base-devel
END
command "n"  &&
last command 

How could i get around this issue?
Already tried

yes | pacman -S base-devel 

to no avail.
Any ideas?

EDIT: correction

Last edited by Dante777 (2021-11-28 10:15:31)

Offline

#5 2021-11-28 10:28:41

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,739

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

pacman has a --noconfirm option that will automatically pick the normally highlighted option

Online

#6 2021-11-28 10:58:05

Dante777
Member
From: Greece
Registered: 2016-07-12
Posts: 29

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

V1del wrote:

pacman has a --noconfirm option that will automatically pick the normally highlighted option

Thank you! Will give it a try asap.

Offline

#7 2021-11-28 16:23:03

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

Alternitavely just add base-devel to the list of packages initially installed when running pacstrap.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#8 2021-11-29 21:19:51

Dante777
Member
From: Greece
Registered: 2016-07-12
Posts: 29

Re: [SOLVED] Can i use my own installation script to chroot and.. beyond

Slithery wrote:

Alternitavely just add base-devel to the list of packages initially installed when running pacstrap.

Both ways (pacman --noconfirm option while in chroot, or just pacstrapping the desired packages), work equally good.
I prefer the pacstrap -i option, since it provides interaction, and lets me refine my choices.
Plus, it's already (a step) in my script, so i see no reason why should i duplicate it in the first place.
Thank you all !

Offline

Board footer

Powered by FluxBB