PDA

View Full Version : Is there a way to bash script a reboot with a cheatcode?



utu
09-14-2012, 10:13 PM
Is there a bash command that I can use in a script to shut down a LiveUSB
Knoppix session which is using persistence and automatically rebooting
that Knoppix with the cheatcode 'noimage', for example?

Werner P. Schulz
09-15-2012, 04:56 PM
Of course, you can write such a script which manipulates '/mnt-system/boot/syslinux/syslinux.cfg'.

myreboot noimagelook with "grep" if 'syslinux.cfg' contains the word "noimage"; if not, insert it with "sed", else do nothing.
And you need the other way

myreboot !noimagelook with "grep" if 'syslinux.cfg' contains the word "noimage"; if so, delete it with "sed", else do nothing.

But why expend so much time to develop such a script; it's easier to work on 'syslinux.cfg' with mcedit or leafpad if you really need it some time.

Capricorny
09-26-2012, 12:36 AM
An alternative, and for me simpler, approach is to use a bootloader. I use old legacy GRUB, and there you can easily use a noimage boot alternative as the default. Which of course lets you override that manually. If you want a flip mechanism, you may set and manipulate the default alternative, principally the same way as Werner describes with syslinux boot.

utu
09-26-2012, 02:04 AM
Greetings, Werner & Capricorny.

Thank you both for your suggestions.

I have implemented a workable manipulation of the DEFAULT line in
syslinux.cfg adequate to my purposes.
I now have a working bash script to facilitate stacking compressed
images ala Klaus K's CeBIT scheme.
I also found Werner's menu management scheme of organization and use
of 'dialogs' very useful to build upon.

After I use this a while to catch some of my errors, I'll post it
for your comments.