Visit Our UNIX and Linux User Community


Running Script after Preseed Install


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Running Script after Preseed Install
# 1  
Old 09-16-2008
Running Script after Preseed Install

Hello there,

If you don't want to here the long version, but still want to answer my question, please skip down to THE BOTTOM!

You can probably tell what I want to do already from the title, so I'll sum up what I have already done real quick:

First off, for those that don't know, a preseed file is a script which auto answers all the questions in the install process for you, so you can start it, walk away, and come back with a full system without having to babysit the install and answer all the questions. Here is a handy page if you are interested yourself:
https://help.ubuntu.com/7.04/install...eed-using.html

1) Tried installing from CD and specifying to look on a thumb drive for the preseed file through a boot parameter. Could not get it to find the file, not sure where it would look or how it would mount the dive.
2) Made a boot thumb drive, and placed preseed file on there. Worked fine, but didn't find file until it looked for it while looking for iso on the thumb drive.
3) Improved number of questions I had to answer by placing file right in the initrd file. This is tricky, if you are curious about it, you can ask. This should, in theory, also work if you edited the initrd on an iso and burned it.

Now, at the end of the install, I want to run a script that does some further set up aside from the installation. Here is a section of the default provided preseed file:
Code:
Code:
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.

# This first command is run as early as possible, just after
# preseeding is read.
#d-i preseed/early_command string anna-install some-udeb

# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

Now, using this new information, I want to run a script. Trouble is, that when I do this, using
d-i preseed/late_command string sh testscript.sh
I get an error that the file cannot be found. My theory is that during the final stages of the install, it is running from the hard drive and not the installation device. If this is wrong, or you have a different solution than the answer to the question at the bottom, please feel free to voice it.

// THE BOTTOM \\

Therefore, during installation, I want to try to place a file from the boot device onto the hard drive. How would I go about doing this, what/where on the .iso do I edit?

// Temporary solution \\

Copy the file from an in house mirror:

d-i preseed/late_command string \
in-target chsh -s /bin/bash ; \
in-target wget http://[some_IP]/testscript.sh ; \
in-target sh testscript.sh ;
in-target rm testscript.sh ;

Last edited by Curtor; 09-18-2008 at 11:30 AM.. Reason: Fixed link and added a solution
# 2  
Old 09-18-2008
My speculation would be that the device is okay but you need an explicit path to the script.

As a workaround, make it install a dummy package with a preinst script which does what you want.

Previous Thread | Next Thread
Test Your Knowledge in Computers #611
Difficulty: Easy
You can enter the Python interpreter by simply typing python on the command line (assume Python is installed).
True or False?

10 More Discussions You Might Find Interesting

1. Debian

Debian installer or how to preseed

Good afternoon! Could you please clarify me how to use correct Debian's preseed file? I have a kernel version 4.15.0-20-generic (Ubuntu 18.04) and default initrd (both downloaded from official repo) Also I have a little kickstart file and main preseed cfg file Installation start by iPXE... (4 Replies)
Discussion started by: nodorgrom
4 Replies

2. Solaris

Install LDoms in T2000 running Solaris 11.2

Hi, im trying a lab with Solaris 11.2 in SunFire T2000 I read about know problem with ldomsmanager version. Solaris 11 comes with ldomsmanager 2.2 and T2000 needs 1.2. I need to install ldomsmanager version 1.2 but i donīt know why... i canīt find it at oracle site. I found oracle VM for SPARC... (0 Replies)
Discussion started by: MuziKizuM
0 Replies

3. Red Hat

FATAL: Error running install command for binfmt_0000

Hi, Firstly, I want to say hello to all of you guys. My first post here... I have issue with CentOS and I hope that there is someone who can help or even explain what could cause this kind of situation. I have installed CentOS 5.7 x86_64 into Hyper-V (Windows Server 2012 R2) environment. After... (0 Replies)
Discussion started by: gigolos
0 Replies

4. UNIX for Dummies Questions & Answers

Running program from local install?

Dear forum, This is my first post here, nice to meet you all. My question might be a beginner one, also it might have been answered before (I searched but found nothing). I am a new Unix user. I am using a terminal to connect to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-48-generic x86_64);... (10 Replies)
Discussion started by: athina
10 Replies

5. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

6. UNIX for Dummies Questions & Answers

Preseed command to copy a file to /root directory

I was hoping to edit the command below to copy a file "start.bin" from the install cd to /root on the installation machine. d-i preseed/late_command string \ wget -O /target/root/start.bin 'http://abc.start.bin' \ && in-target chmod 755 /root/start.bin \ My best guess is it would... (0 Replies)
Discussion started by: dmunoz
0 Replies

7. AIX

Can I install AIX operating system on a PC that is running windows 7?

Hi All, I was wondering if I can install AIX 6.1 on my D harddrive and have Windows 7 on my C harddrive. If so, can anybody help me with the installation of AIX? I am totally new to AIX and don't know how to install it. Tried getting info from google on how to install AIX but couldn't... (2 Replies)
Discussion started by: AIX_Beginner
2 Replies

8. Linux

install macbook pro fedora10 ???((<<if can install, how to install? >> ))

If may install can Tells everybody ??? (0 Replies)
Discussion started by: kzBSD
0 Replies

9. Shell Programming and Scripting

Ubuntu Preseed not found

Hello there! I am not certain that this is the proper place to post this, but I will try anyway. I am trying to install Ubuntu using a preseed on a USB thumb drive, and I am having problems. Hopefully someone here is able to help me. I have a file named 'preseed.cfg' in the root directory... (4 Replies)
Discussion started by: Curtor
4 Replies

10. Solaris

Running from Shell Vs running from RC script

Hi, i have a script which need to do behave differently when run as a startup process from init.d/ rc2.d script and when run manually from shell. How do i distinguish whether my script is run by init process or by shell?? Will the command /proc/$$/psinfo | grep "myscript" work well???... (2 Replies)
Discussion started by: vickylife
2 Replies

Featured Tech Videos