You are not logged in.

#1 2021-10-10 22:05:07

Cassus
Member
Registered: 2021-07-15
Posts: 18

[SOLVED] How to keep a file after the live media is removed?

Hello,

I am making my own install script and everything is fine except for one detail; I cannot figure out how to keep a file after the installation process is finished and the media is removed.
What I want to do is to keep a shell script in the root directory (the location doesn't really matter, I just need it immediately after I reboot) so that after I reboot I can just execute it straight away and automate the post-installation setup before even connecting to the wireless network.
However, the file just disappears after I reboot! I tried using chattr +i to make it immutable but that didn't work. I also tried placing it into other directories, but it got removed there as well.

Any help or alternative solutions would be greatly appreciated!

Last edited by Cassus (2021-10-11 18:01:32)

Offline

#2 2021-10-10 23:07:47

Ammako
Member
Registered: 2021-07-16
Posts: 267

Re: [SOLVED] How to keep a file after the live media is removed?

What exactly are you doing and where exactly are you putting that file?

Offline

#3 2021-10-11 00:38:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] How to keep a file after the live media is removed?

If you actually put it on the target disk, it wouldn't disappear.

But there should be no need to reboot anyways - just run the script chrooted into the target system.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2021-10-11 08:04:43

Cassus
Member
Registered: 2021-07-15
Posts: 18

Re: [SOLVED] How to keep a file after the live media is removed?

Ammako wrote:

What exactly are you doing and where exactly are you putting that file?

Install script. It should work in 3 phases, pre chroot, post chroot and post installation. Pre chroot and post chroot scripts are executed before the media is removed and the post installation script should be executed after the media is removed, which is why I want the file containing the script to stay after the install media is removed. The problem is that it doesn't stay.
The pre chroot script copies the file to /mnt (which should be the root directory of my fresh install, right?) and also makes it executable. I also tried /mnt/home

Last edited by Cassus (2021-10-11 08:15:54)

Offline

#5 2021-10-11 08:08:34

Cassus
Member
Registered: 2021-07-15
Posts: 18

Re: [SOLVED] How to keep a file after the live media is removed?

Trilby wrote:

If you actually put it on the target disk, it wouldn't disappear.

But there should be no need to reboot anyways - just run the script chrooted into the target system.

Well, I think I am putting it on the target disk. In my other reply I say that I copy the file to /mnt (which is /dev/sda1, the root directory). Thing is, the post chroot script is also copied there and after the chroot it gets executed fine, so idk why the other file disappears after the reboot.

Forgot to mention that I don't want to execute it in the chroot because I want to make the actual install process ASAP, and separate other configurations for after the media is removed.

Last edited by Cassus (2021-10-11 08:14:10)

Offline

#6 2021-10-11 09:06:02

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] How to keep a file after the live media is removed?

Say your target disk is mounted at /mnt/yourroot/

/mnt/yourroot from outside the chroot is / in the chroot. Maybe you're confusing paths. I always copy my post reboot stuff to the root user's home folder, aka /root within the chroot or /mnt/yourroot/root.

Offline

#7 2021-10-11 18:06:08

Cassus
Member
Registered: 2021-07-15
Posts: 18

Re: [SOLVED] How to keep a file after the live media is removed?

Ok guys, it's hard to admit but.. the issue all along was that I mistyped the filename in the script :'^)
Thanks for all of your help though. This is a valuable lesson.

Offline

Board footer

Powered by FluxBB