4

I have created a Debian Live DVD following the excellent guide https://willhaley.com/blog/custom-debian-live-environment/.

I would like to be able to great two grub menu enteries when selected auto login and run a script.

    menuentry "Run Script 1" {
        linux /vmlinuz boot=live quiet nomodeset
        initrd /initrd
    }

    menuentry "Run Script 2" {
        linux /vmlinuz boot=live quiet nomodeset
        initrd /initrd
    }

How can I pass from grub menu entry the absolute path of a script to run when I auto login as root?

/lib/live/mount/medium/scripts/script1.bash

To auto login I have modified /lib/systemd/system/getty@.service to auto login as root using the above menu items.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
densha
  • 157
  • 3
  • 12

1 Answers1

4

Boot with a custom parameter:

linux /vmlinuz .... my_dummy_param=/lib/live/mount/medium/scripts/script1.bash

Then later read /proc/cmdline and parse it in your login shell startup files, ex. in .bashrc for bash shells or .profile:

#!/bin/bash
. /proc/cmdline
echo "Running $my_dummy_param"
"$my_dummy_param"
KamilCuk
  • 120,984
  • 8
  • 59
  • 111