Dear members,
The script knoppix.sh should be put in the folder KNOPPIX (when the DOK is mounted under windows)
Thanks,
Zvika.
Hello,
I'm booting Knoppix 6.7.1 from DOK.
The image on this media was created using a live CD.
Then I changed syslinux.cfg in 6.7.1 and now knoppix enters runlevel 2 (text mode) by default.
Upon entering this level I want to run my script.
So I added:
echo "My script"
in /etc/rc.local
But "My script" is not displayed.
According to another thread in this forum I tried putting my script in :
/opt/knx/knoppix/KNOPPIX/knoppix.sh
But this does not work also.
Can you help ?
Thanks,
Zvika.
Dear members,
The script knoppix.sh should be put in the folder KNOPPIX (when the DOK is mounted under windows)
Thanks,
Zvika.
Hi, Anyone know a way to inhibit execution of knoppix.sh with a boot command/cheatcode? This is useful when working on devices where you might not want your regular script to run.
You cannot inhibit the script knoppix.sh, but you can decide within this script what to do.
Append any cheatcode, for exampleIn your script "knoppix.sh" test for existence of your cheatcode byCode:knoppix no_myscriptIf the cheatcode is found, do nothing else; otherwise execute remaining of the script.Code:cat /proc/cmdline
Good idea Werner, thanks for the suggestion!
Here is my detailed explanation for novices, and a working code sample (tested on v6.7.1dvd), for those who wish to use this method:
knoppix.sh is executed during startup by a block of code that can be seen at the end of /etc/init.d/knoppix-autoconfig. If one wishes to undertake a deep remastering, it is possible to modify this code to build a script-inhibiting cheatcode into the system.
Alternatively, a conditional code block can be inserted at the start of knoppix.sh to parse /proc/cmdline, the kernel boot instructions, for a specified keyword, for example no_myscript. Use this keyword as you would a cheatcode, by typing knoppix no_myscript at the boot prompt, and the code shown below will suspend script execution; if the keyword is not entered, the script will execute as per normal.
Note that knoppix.sh is not executed in Bash, but in a Bourne shell, so some more common Bash commands that check whether a variable contains certain text will not work properly; for instance, grep will not work, nor will [[ "$string" == *no_myscript* ]]. Hence my use of the clever method published by one ephemient on a thread at stackoverflow, and described by him as follows:Code:string=$(cat /proc/cmdline); # Assign output of 'cat' to variable 'string'. if [ "$string" != "${string/no_myscript}" ]; then # Check for presence of keyword. echo "Stopping Script" exit else echo "Running Script" fi
${var/search/replace} is $var with the first instance of search replaced by replace, if it's found (it doesn't change $var). If you try to replace [no_myscript] by nothing, and the string has changed, then obviously [no_myscript] was found.
If you use within Knoppix the shebang-lineNote that knoppix.sh is not executed in Bash, but in a Bourne shellyou'll get the Bash. '/bin/sh' is only a symlink to '/bin/bash'Code:#!/bin/sh
I see, and appreciate your input; as a novice myself I welcome and encourage criticism and instruction from others who know their stuff.
My comment was an inference based on the fact that certain alternative methods of checking for the presence of text in a string var worked in LXTerminal, but not in the lower runlevel root terminal at startup. Why is this the case?
I noticed that the shebang-line in /etc/init.d/knoppix-autoconfig invokes #!/bin/busybox sh. Does knoppix.sh therefore run in Busybox/Almquist shell, rather than Bash or sh?
While booting Knoppix only busybox is available (here '#!/bin/sh' is a symlink to busybox). After completion of bootprocess you can use Bash.
Within the init-script of minirt.gz you can see, how KK solved the problem using the function "checkbootparam()"
In the script knoppix.sh you can use a line like this:
Code:cat /proc/cmdline | grep -q "no_myscript" && exit
Yes, your code above works at boot, and is more elegant.
My initial attempt with grep used a different syntax which worked in Bash but returned an error at boot, hence my incorrect statement that "grep will not work" in a post above; grep function is included in BusyBox and will indeed work at boottime.
Sure it is elegant! As regards busybox, I'm not so sure: As soon as main file system is mounted, I would think bash is available. So, Klaus K's reason for explicitly using /bin/busybox may, for example, be to have the same semantics during the whole init process. During minirt init, he has made only busybox available (other booting procedures stuff lots of core utilities into that image), and busybox does its things somewhat differently from standard gnu coreutils.
Also, what commands busybox contains and not depends on the compilation. You may find that other versions can have more or fewer commands than this one, which I think may be the standard Debian version.
Vintage DEC Digital Equipment Corp. Digital PC752 DEC PC LPv 433SX 486 Computer
$250.00
*NEW UNOPENED* Vintage DEC LB-5923 Keyboard
$40.00
Vintage DEC Digital Equipment Corp PDP 11/40 G114 16K SENSE/INHIBIT (B10)
$269.99
Vintage DEC/The Redac mini cabinet front panel Digital Equipment Corp. 19"
$269.99
Vintage Digital Equipment Co RP04p hard drive DEC VAX mini computer 11 14” disks
$250.00
Vintage DEC Starion 960 (FR-904AA-A8) Desktop Computer Intel Pentium 166MHz
$88.96
Vintage DEC DIgital MicroVAX 2000 Hardware Information ST533B11
$35.00
DEC PDP 8/M PDP 8M / 4 avail / Vintage Digital Equipment Corp /Also DEC PDP 12
$5775.00
Vintage Digital Equipment DEC Medical Systems Front Control Panel Bezel
$449.10
Vintage DEC Digital Equipment Corp PDP 11 G116 32K SENSE/INHIBIT 5011654C (B10)
$269.99