You are not logged in.

#1 2023-09-24 17:16:46

psykokura
Member
Registered: 2023-07-20
Posts: 7

Add custom configurations to new install with archinstall [SOLVED]

Is it possible to transfer files from the live medium to the new installation? Essentially I'm trying to clone the live environment I customized on archiso into the newly installed system with archinstall. I played around with "custom-commands" a little bit, but didn't have any success.  Adding something like

"custom-commands": ["echo 'this is a test' > $HOME/testfile.txt"]

to the .json config file doesn't populate anything on the new system. I'm trying to automate the process a little bit for someone else, so chroot into the newly installed system isn't really an option.

Last edited by psykokura (2023-09-25 13:59:40)

Offline

#2 2023-09-24 19:16:18

Torxed
Member
Registered: 2013-01-10
Posts: 200

Re: Add custom configurations to new install with archinstall [SOLVED]

Interesting idea for sure.
The custom commands runs in the context of the installed system, so their path and access is that of (simplified a tiny bit):

echo "<custom command>" >> /mnt/archinstall/tmp/script.sh
arch-chroot /mnt/archinstall /bin/bash /tmp/script.sh

We could add so that the command can have options. This is something we used to have, where commands would be not just a string, but could be a dict containing options. One option could be "not-in-chroot" for instance. Would that help?

Offline

#3 2023-09-24 20:42:16

psykokura
Member
Registered: 2023-07-20
Posts: 7

Re: Add custom configurations to new install with archinstall [SOLVED]

Thank you for your reply, I'm not quite sure I follow you though. Do you mean I should create a separate shell script to run all of the commands I need and call that from within archinstall via arch-chroot after the installation is complete? On GitHub there is an example file of an installer with custom commands appended within a .json formatted configuration file, it seems straightforward but the same syntax doesn't work as expected for me https://github.com/archlinux/archinstal … ample.json

Offline

#4 2023-09-25 06:37:29

Torxed
Member
Registered: 2013-01-10
Posts: 200

Re: Add custom configurations to new install with archinstall [SOLVED]

Apologies for my explanation, what I tried to convey is that in the example you linked (https://github.com/archlinux/archinstal … on#L27-L31) those commands are (by archinstall):

    "custom-commands": [
        "cd /home/devel; git clone https://aur.archlinux.org/paru.git",
        "chown -R devel:devel /home/devel/paru",
        "usermod -aG docker devel"
    ]

executed as:

# echo "cd /home/devel; git clone https://aur.archlinux.org/paru.git" > /mnt/archinstall/tmp/script.sh
# arch-chroot /mnt/archinstall bash /tmp/script.sh

# echo "chown -R devel:devel /home/devel/paru" > /mnt/archinstall/tmp/script.sh
# arch-chroot /mnt/archinstall bash /tmp/script.sh

# echo "usermod -aG docker devel" > /mnt/archinstall/tmp/script.sh
# arch-chroot /mnt/archinstall bash /tmp/script.sh

Meaning in your example, the issue will become that the commands are executed "in the new system", not from outside.
So accessing files to copy in will be hard, but we could fix it for a future release.

Offline

#5 2023-09-25 13:58:18

psykokura
Member
Registered: 2023-07-20
Posts: 7

Re: Add custom configurations to new install with archinstall [SOLVED]

Now I understand, thank you for clarifying.  If it were added to a future release, it would be very helpful for me, though I'm not sure how many other people are trying to do something like this. I actually just found archinstall, I was in the middle of writing my own installation script and realized I was reinventing the wheel.  Keep up the good work!

- Marking solved as I don't think there's anything further I can do specifically regarding archinstall in the near future.

Last edited by psykokura (2023-09-25 14:00:38)

Offline

Board footer

Powered by FluxBB