User avatar
kaksi
Posts: 135
Joined: Tue Mar 10, 2015 6:19 am

Can I replace the start-up dialogue?

Thu May 21, 2020 8:49 am

For various reasons, from time to time, I perform a clean reinstall. When I started with RPI2, I could not imagine my life without raspi-config. Now, when I go thru the starting menu over and over again, I dream about a bash that would replace this dialogue using a kind of answerfile:

camera=on
country=sk
keyboard=sf
language=en
network=skip
password=xxx
ssh=on
update=skip
run=/boot/1strun/10.SH

To get the correct keyboard/language/timezone configuration, I have to perform these operations:

#RASPBERRY PI 1st boot:
# Welcome to Raspberry Pi
# Set Country: Country: Switzerland Next
# Change Password: Next
# Setup Screen: Next
# Select WiFi Network: Skip
# Update Software: Skip
# Setup Complete: Restart
#
#RASPBERRY PI 2nd boot:
# Preferenze - Raspberry Pi Configuration
# System
# Hostname: RPIx_x
# Interfaces
# SSH: Enable
# Camera: Enable
# Localisation - Set locale
# Language: English
# Country: DK
# sudo reboot

Is there a way to replace the initial script? Without editing the ISO (I fear I would not manage it), just modifying /boot?

At least: can I skip the 1st restart?

User avatar
rpdom
Posts: 17454
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 11:19 am

kaksi wrote:
Thu May 21, 2020 8:49 am
Is there a way to replace the initial script? Without editing the ISO (I fear I would not manage it), just modifying /boot?
Not without editing the IMG (not iso) file.
Unreadable squiggle

GlowInTheDark
Posts: 884
Joined: Sat Nov 09, 2019 12:14 pm

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 11:33 am

Well, the obvious answer is Expect and the "autoexpect" utility.

Install "expect", then use autoexpect to generate a script that does all your raspbi-configging for you.

The way it works is that you do:

$ autoexpect raspbi-config
{ do everything manually, and then exit the config utility }
$ LESS=aCeMw less script.exp
$

Then you end up with a script called script.exp that, when run in future, will do all the things that you just did manually. So, the net is you have to do it once manually, but then (hopefully) never again.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
HawaiianPi
Posts: 5959
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 11:34 am

Editing the image is not that hard.

STICKY: Making your own custom burn-n-boot Raspbian image

Writing the script to process your answer file is the tricky part. Adding it to the image is simple.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

bls
Posts: 735
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 2:46 pm

Here's a tool that really simplifies creating and managing Raspbian IMG files in a ready-to-go manner. With it you can start with a standard Raspbian IMG file (Lite or Full), install apps and files that you want on every Pi, and keep it up to date (via apt update/apt upgrade).

You can also configure locale, keymap, timezone, WiFi country, and password for the Pi account. Of course, ssh will be enabled, and you can easily copy your custom wpa_supplicant.conf into the IMG.

Then, when you need a new SD card, use the script to burn an SD card. During that process, the SD card is set to start up and set the hostname.

Using this, I can build a new custom IMG from the Raspbian distro IMG in a few minutes on a Pi4, and easily crank out perfectly identical SD cards, each with a different host name, for my Pi fleet, or singly for a new Pi.

@HawaiianPi's note on custom burn-n-boot images provided the inspiration for this tool.

Read about it here: https://github.com/gitbls/sdm
Pi tools:
Free your network from your router's DHCP/DNS and run it on a Pi:https://github.com/gitbls/ndm
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
kaksi
Posts: 135
Joined: Tue Mar 10, 2015 6:19 am

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 3:32 pm

HawaiianPi wrote:
Thu May 21, 2020 11:34 am
Editing the image is not that hard.
Everything is relative, depends for whom.

I achieved a great improvement with sudo cp keyboard /etc/default. RPI does not mind remaining in GB, ssh is enabled, so I get thru the config quickly and only once.

User avatar
Botspot
Posts: 1368
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Can I replace the start-up dialogue?

Thu May 21, 2020 3:51 pm

I programmed a tool that helps you edit your Raspbian img. It's called Pi-Power-Tools, and probably the most user-friendly tool out there.

PPT is a set of bash-scripts with a simple GUI added on top. If you prefer, the CLI version is here.
In your case, you'd want to 'boot' that img in a virtual machine, configure it how you like, and then hang onto that golden img for future re-writes.
kaksi wrote:
HawaiianPi wrote:
Thu May 21, 2020 11:34 am
Editing the image is not that hard.
Everything is relative, depends for whom.
With PPT, it couldn't be easier.
Simply provide the path to the img, then click Boot.
boot-button.png
boot-button.png (21.55 KiB) Viewed 222 times
PPT takes care of everything else for you, and boots that img using systemd-nspawn. Unlike any other tool, this is the only one that shows you the desktop.
I use a method similar to Sakaki's raspbian-nspawn-64 to display the graphics.
container-desktop-min.png
container-desktop-min.png (109.64 KiB) Viewed 222 times
Any changes made inside will be retained in the img.
PPT github link here: https://github.com/Botspot/Pi-Power-Tools
Ever wished you could "open" a RaspiOS .img file? Well now you can! I've developed Pi-Power-Tools, the only RaspiOS img editor on the planet.
https://github.com/Botspot/Pi-Power-Tools
Want to try it out?

Code: Select all

wget -O - https://raw.githubusercontent.com/Botspot/Pi-Power-Tools/master/update | bash

Return to “Beginners”