Is it possible to auto boot Frugals by random number?

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

Is it possible to auto boot Frugals by random number?

Post 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!

Last edited by theroar84 on Fri Jun 28, 2024 5:35 pm, edited 1 time in total.

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
rockedge
Site Admin
Posts: 6378
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2578 times
Been thanked: 2533 times
Contact:

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

Post 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.

User avatar
wizard
Posts: 1845
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2519 times
Been thanked: 600 times

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

Post 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

Big pile of OLD computers

User avatar
Trapster
Posts: 173
Joined: Sat Aug 01, 2020 7:44 pm
Has thanked: 1 time
Been thanked: 44 times

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

Post 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

User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

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

Post 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. 👍

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

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

Post 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

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

williwaw
Posts: 1869
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 167 times
Been thanked: 340 times

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

Post 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.

User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

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

Post 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
}

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
wizard
Posts: 1845
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2519 times
Been thanked: 600 times

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

Post by wizard »

@theroar84

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

wizard

Big pile of OLD computers

Post Reply

Return to “Beginners Help”