1

I was wondering how you could make a script so that on first boot it changes files to a specific parameters? So it would be like if I just installed a fresh kernel. I want to run a script once and that script will change /etc/network/interfaces to have preset static IPs and to add a message of the day message. Other items such as creating new users could be added to this script to automate the process a little.

Is it possible to have this script be installed with the kernel so it runs on first boot and then all settings get set?

2
  • "kernel" probably does not mean what you think it means...
    – fkraiem
    Oct 8, 2014 at 18:14
  • @fkraiem Most likely not. I am installing a version of ubuntu and would like to make changes automatically versus doing the same process several times for different boards
    – Keith
    Oct 8, 2014 at 18:17

1 Answer 1

0

"@fkraiem Most likely not. I am installing a version of ubuntu and would like to make changes automatically versus doing the same process several times for different boards"

You could write a Bash script that, when run, makes the changes you want. Then you can put it on a USB stick and run it with every new install.

(this is all in a terminal, I use gnome-terminal) For instance, you could have a template interfaces file that is what you want all of them to look like, and then you could write a script file like so: gedit scriptfile

#!/bin/bash
sudo cp ./interfaces /etc/network/interfaces
sudo gedit /etc/network/interfaces

Then you could run chmod +x scriptfile to make it executable.

Then you put the scriptfile and the interfaces template file onto a flash drive and when you install Ubuntu on a new "board" you can open the flash drive and run the scriptfile and it will replace the current /etc/network/interfaces file with the template one and then open it in Gedit for you to customise the IP address.

3
  • Is this process called something specific? Something that I can begin my web search on. I am new to scripts and would like to have some good reads on this process.
    – Keith
    Oct 8, 2014 at 19:41
  • What I am recommending is called "Bash scripting" or "Shell scripting". Here is a guide that might come in handy.
    – ILoveGit
    Oct 8, 2014 at 20:29
  • Ok thank you! I think I found the exact term or process I was looking for. Install scripts which are pretty similar to what you are proposing. Either way the guide will be of much help to me.
    – Keith
    Oct 9, 2014 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .