Issue
I am using preseed to auto install debian.
I want to be able to run a script called "run.sh" at the end of the Debian installation:
#!/bin/bash
touch /root/example.txt
echo $(hostname -I | cut -d"." -f 4) > /root/example.txt
I have tried several models that I have found by google (I add these commands to preseed.cfg):
d-i late_command string cp -a /cdrom/preseed/run.sh /target/root; chmod 777 /root/run.sh; /root/run.sh;
d-i preseed/late_command string \
in-target cp run.sh /root/ && in-target chmod 755 /root/run.sh \
cd /target; \
chmod +x ./run.sh; \
chroot ./ ./run.sh;
I have tried everything I have seen and it has occurred to me, on none of the occasions have I been successful. The most I have achieved is a red screen with an error that the file "run.sh" is corrupt
I just saw a similar question from 2015
UPDATE:
These commands work
d-i preseed/late_command string mkdir -p /target/root/one
d-i preseed/late_command string cp /cdrom/files/jitsi/run.sh /target/root/; chmod +x /target/root/run.sh;
Solution
Surely the reason that it does not work when trying to execute is because the route has not been declared. You can use this failing that:
d-i preseed/late_command string cp /cdrom/files/jitsi/run.sh /target/root/; chmod +x /target/root/run.sh; in-target /bin/bash /root/run.sh
Answered By - JuDy94