WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [solved] or not needed --suggestion new bootcode=bootlocal2.sh  (Read 2336 times)

aus9

  • Guest
[solved] or not needed --suggestion new bootcode=bootlocal2.sh
« on: October 09, 2012, 05:16:23 PM »
Hi
EDIT used the wrong term.

I am aware we have bootcode for lst so we can have lst=none or lst=something.lst.

What I would like, completely selfish I know, is to have a new bootcode to use as an alternative to bootlocal.sh.
--I will call it bootlocal2.sh
-----to do different things to save doing these things on a manual basis.

eg At the moment, user has 2 soundware devices. For the preferred device, bootlocal.sh suffices----mixer levels are set by automatic restore script.
For their second device, the infrequently used one, things started by bootlocal may need to be undone.
If they have automatic restore function in bootlocal, the second device will need a manually performed command or manually issued script to fix up the error.

Currently user could use a blacklist bootcode that might disable the detection and enabling of one of the devices but they can't really use an auto restore bootlocal command.

I hope that makes sense.

a work-a-round is to suggest to multiple needed sound device users, is to recommend that do not use bootlocal.sh to restore sound levels, but a script for each device that has the following formula plus blacklist bootcode for  both sound modules

Code: [Select]
#!/bin/sh
# script 1

/sbin/modprobe wanted_sound_module index=0
/usr/local/sbin/alsactl -f /home/tc/device1.state restore

Code: [Select]
#!/bin/sh
# script 2

/sbin/modprobe other_sound_module index=0
/usr/local/sbin/alsactl -f /home/tc/device2.state restore

but if a second bootlocal.sh was available I am hoping this could then automate the process, and most likely we keep the blacklist bootcode for both modules.

if not, thanks for reading

gordon

PS index=0 is not really needed, but included to focus my mind on what I am trying to achieve.
« Last Edit: October 10, 2012, 06:21:20 AM by aus9 »

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 7792
Re: suggestion new bootcode=onboot2.sh
« Reply #1 on: October 09, 2012, 06:25:13 PM »
Hi aus9
You can create your own boot code, just pick something that won't collide with an existing boot code. For example,
mysoundsettings=script1.sh  or  mysoundsettings=script2.sh. You can parse the result of  showbootcodes  in your
bootlocal.sh and call the script listed after  mysoundsettings=.

aus9

  • Guest
Re: suggestion new bootcode=bootlocal2.sh
« Reply #2 on: October 09, 2012, 07:59:39 PM »

Rich

I have just cleaned up by bad term, I meant bootlocal.

I will test out a local bootcode later thanks

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 7792
Re: suggestion new bootcode=bootlocal2.sh
« Reply #3 on: October 09, 2012, 09:37:49 PM »
Hi aus9
This should do what you are looking for (lifted from /etc/inid.d/tc-config):
Code: [Select]
#!/bin/sh

RUNME=""

for i in `showbootcodes`
do
case $i in
mysoundsettings*) RUNME=${i#*=} ;;
esac
done
[ -n "$RUNME" ] && $RUNME

aus9

  • Guest
Re: suggestion new bootcode=bootlocal2.sh
« Reply #4 on: October 10, 2012, 03:06:58 AM »
Rich

You have lost me on this one, I am not a coder

firstly I can just run the command and get the following
Code: [Select]
showbootcodes
BOOT_IMAGE=/vmlinuz tce=sda2 opt=sda2 home=sda2 blacklist=snd_hda_intel snd=/opt/1.sh
tc@box:~$

BTW the blacklist was tested before, its working fine but my script isn't
Code: [Select]
ls -al /opt/1.sh
-rwxrwxr-x 1 tc staff 105 Oct 10 08:54 /opt/1.sh
tc@box:~$ cat /opt/1.sh
#!/bin/sh
/sbin/modprobe snd_hda_intel model=5stack
/usr/local/sbin/alsactl -f /home/tc/1.state restore


But then you appear to be asking me to put those show-codes directly into bootlocal?

But what if I want a second script to run, with a different action we can call 2.sh?
My brain is scrambled, I am thinking that I have gone in a circle and am thinking a second bootlocal.sh is a better answer?

Any links on how to do what you requested....or treat me as a dumbee and go slower please unless you agree that there would be an issue having.....some reference to 1.sh and 2.sh in bootlocal when only one script is to be loaded at each boot.

I hope you understand how my brain is not working

cheers

gordon

edit full pathway for 1.sh
« Last Edit: October 10, 2012, 06:14:51 AM by aus9 »

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 7792
Re: suggestion new bootcode=bootlocal2.sh
« Reply #5 on: October 10, 2012, 05:57:39 AM »
Hi aus9
No worries mate, I'll dial it down a bit. Place this in your bootlocal.sh where you want a script to run:
Code: [Select]
RUNME=""

for i in `showbootcodes`
do
case $i in
mysoundsettings*) RUNME=${i#*=} ;;
esac
done
[ -n "$RUNME" ] && $RUNME
Here is how it works
Code: [Select]
RUNME=""RUNME is a variable, we set it to an empty string, meaning it contains no text.
Code: [Select]
mysoundsettings*) RUNME=${i#*=} ;;mysoundsettings  is your custom boot code. If you use the boot code  mysoundsettings=/opt/script1.sh,  RUNME
will now contain the string  /opt/script1.sh , if you decide not to use the  mysoundsettings  boot code,  RUNME
will still contain an empty string.
Code: [Select]
[ -n "$RUNME" ] && $RUNME If  RUNME  contains an empty string, do nothing. Otherwise, execute the string contained in RUNME, which in
this example would have been  /opt/script1.sh.
Does that clear it up?

aus9

  • Guest
Re: suggestion new bootcode=bootlocal2.sh
« Reply #6 on: October 10, 2012, 06:20:26 AM »
woo hooo  and silly me, I did not have full pathway to script.

very cool stuff and thanks for you patience.

after more testing I want to have some stuff in the alsa wiki, this will allow an person at home, with junk onboard laptop sound have a boot menu that gives them USB.

---when they go to coffee shop, etc....they choose the second menu item for their bootloader, and will need to setup volumes the first time but less hassle the second time eh?

thanks heaps