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.

Gigabyte 4U AI Server 10x Nvidia GPU 2x Xeon Gold 6150 36 Core 2.7GHz DDR4 RAM
$1499.00
Dell EMC PowerEdge R440 Xeon silver 4215 2.5GHz 16 GB ram 2x 550W PSU No HDD
$275.00
867959-B21 HPE ProLiant DL360 G10 CTO Server W/ 2x 865414-B21 1x 840140-001
$245.00
Microsoft Windows Server 2022 Standard 64Bit 16 Core-50 CALs DVD With Key&
$69.90
128GB (4x32GB) SK hynix DDR4 PC4-2666V RDIMM ECC Server Ram HMA84GR7CJR4N-VK
$799.00
Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2680 v3 | 32gb Ram | 2x 1600W
$409.99
Dell PowerEdge C4130 1U AI GPU Server | 2x E5-2690 v3 | 64gb Ram | 2x 1600W
$524.99
Dell Poweredge R730xd 12LFF 2*2660v4 4*1Gbe h730 2x 750W Server CTO
$248.00
Dell PowerEdge R530 2x E5-2630v4 H330 iDRAC8 Port Card Riser No PSU/RAM/HDD
$99.99
Dell PowerEdge FX2s + 8x FC430 Blades 16x E5-2630v4 160 Cores Rails No PSU/RAM
$699.00