Page 1 of 1

Is it possible to auto boot Frugals by random number?

Posted: Sat Feb 17, 2024 7:31 pm
by theroar84

Updating this as I am struggling with getting the date info to match... Since date is not working I am willing to try random numbers.

I am running Fossa 64 installed to a EXT4 hard drive with 3 frugal installs. At boot I pick the one I need for either Monday, Wed, or Friday.

Is there a way I could have those entries autoboot based on the day of the week?

I get that it is not many clicks... but anytime I can automate something it feels like a win. Thanks for your time!


Re: Auto Boot Frugals based on day of the week?

Posted: Sat Feb 17, 2024 8:23 pm
by rockedge

@theroar84 Interesting assignment! Never had to do it quite this way but you made a good point.

Possibility might lay with Grub2 or Grub4Dos script writing capabilities and if it is complex enough to determine the day of the week and use the result to trigger the start of the desired frugal installation.


Re: Auto Boot Frugals based on day of the week?

Posted: Sat Feb 17, 2024 10:22 pm
by wizard

Grub2's scripting language has the ability to do it provided your installs are completely separate and not just one frugal install with multiple save file/folders.

wizard


Re: Auto Boot Frugals based on day of the week?

Posted: Sat Feb 17, 2024 10:53 pm
by Trapster

It seems grub.cfg is where this can happen.
It was solved here for booting an os per time of day.

https://www.linuxquestions.org/question ... ost4667231

grub manual


Re: Auto Boot Frugals based on day of the week?

Posted: Sun Feb 18, 2024 1:54 am
by theroar84

Thanks tons for all the input. I almost did not post it as I figured it was just not possible before the sys booted.

Thanks again. Will share if I get it all working as expected. 👍


Re: Auto Boot Frugals based on day of the week?

Posted: Fri Jun 28, 2024 1:40 pm
by theroar84

I am stuck it seems. The user in the post below does not seem to be using Puppy, so I could not find the files in the locations they have shared. (Edit /etc/default/grub and add the following line:)

I would still love to have the Frugals picked by day of the week... but I am now flexible and willing to try a random number. The pc already defaults to Fossa64. After that step I can pick 0-3 of my Frugal installs. Of course 0 is blank, so I really want 1-3.

Anyone have an idea of how I would add a random number and have it entered for the frugals to boot?

If I can get that working I can do some more legwork on how to get the Datehook part running. Thanks again for all the support!

Trapster wrote: Sat Feb 17, 2024 10:53 pm

It seems grub.cfg is where this can happen.
It was solved here for booting an os per time of day.

https://www.linuxquestions.org/question ... ost4667231

grub manual


Re: Is it possible to auto boot Frugals by random number?

Posted: Fri Jun 28, 2024 7:45 pm
by williwaw
theroar84 wrote: Fri Jun 28, 2024 1:40 pm

I am stuck it seems. The user in the post below does not seem to be using Puppy, so I could not find the files in the locations they have shared. (Edit /etc/default/grub and add the following line:)

making the edits for grub2 to boot puppy is the easy part. lots of posts here at the forum about that. you do not have to use update-grub to develop the script stanza. you can manually write a scripted grub2 stanza to test.
when you get your custom stanza working, and if you are in the need of using grub2s update abilities, (if for instance you have a distro on your machine that automatically updates grub when that OS is updated), then you can place your custom script in that OS /etc/grub??/custom?? and it will be retained when the other OS rewrites the grub2 menu.
you will have to do make the /etc/grub2 /??/custom?? edit anyway if you have the entry working with puppy, with or without your day of the week edits.


Re: Is it possible to auto boot Frugals by random number?

Posted: Sun Jun 30, 2024 11:57 pm
by theroar84

This is my grub.cfg. Nothing fancy. It auto boots Fossa... but how would I code it to pick one of the 3 frugal installs automatically? I can create code for a random number, but I do not understand how to send the 1, 2, or 3 to the system.

Any tips? Thanks for your time.

#
set default=0
set timeout=5

set menu_color_normal='yellow/blue'
set menu_color_highlight='black/cyan'

if [ $grub_platform = 'efi' ]; then
loadfont /boot/grub/fonts/DejaVuSansMono18.pf2
set gfxmode=auto
terminal_output gfxterm
fi

menuentry "Puppy fossapup64 9.5" {
insmod ext2
search --no-floppy --fs-uuid --set 58c7bf7f-233e-4e72-b9d0-436d926a3032
echo "Loading vmlinuz"
linux /fos/vmlinuz pmedia=atahd pdrv=58c7bf7f-233e-4e72-b9d0-436d926a3032 psubdir=/fos pfix=fsck,fsckp TZ=EST5EDT,M3.2.0,M11.1.0
echo "Loading initrd.gz"
initrd /fos/initrd.gz
}
if [ $grub_platform = 'efi' ]; then
menuentry 'System BIOS setup' {
fwsetup
}
fi
menuentry "Shutdown computer" {
halt
}
menuentry "Reboot computer" {
reboot
}


Re: Is it possible to auto boot Frugals by random number?

Posted: Wed Jul 03, 2024 12:12 am
by wizard

@theroar84

Take a look here: https://www.linuxquestions.org/question ... ay-940004/

wizard