Results 1 to 10 of 18

Thread: Run a script upon entering runlevel 2

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    20
    Hi Capricorny!

    Interesting points. Is what you call the main filesystem the large KNOPPIX file? This appears to be the first thing that the init script mounts, hence Bash ought to be available prior to knoppix.sh execution, if what you think is correct.

    I retrieved one of my original attempts, upon which I made the claim that some code worked in Bash but not at boot, and tested it again; it works correctly in a Bash terminal, likewise in root console post-boot (that is to say, after INIT enters runlevel 2), but is improperly implemented at boottime execution of knoppix.sh. Quite peculiar. If you are interested let me know and I'll post it.

    Running /bin/busybox will list the functions defined in the BusyBox version installed on that workstation. As you say, these functions might not be shared by all versions of that program, and this is especially the case given the openness of GNU/Linux and associated software. Best practice entails specifying versions!

    Now, a related question has emerged, and I'll post it next.
    Last edited by lapidu; 07-19-2012 at 12:59 PM.

  2. #2
    Senior Member registered user
    Join Date
    Sep 2006
    Posts
    802
    Quote Originally Posted by lapidu View Post
    Is what you call the main filesystem the large KNOPPIX file? This appears to be the first thing that the init script mounts, hence Bash ought to be available prior to knoppix.sh execution, if what you think is correct.
    You may unzip and look at the minirt.gz init script to see what is going on at the initial stages of booting.

    The KNOPPIX image is cloop-mounted (or squashfs-mounted if it has been compressed that way, other schemes are also possible), and there may be several overlays mounted the same way, to be unionfs-mounted with persistent store(s). If you have updated any system programs, the new versions will reside in the persistent store (or overlays, if you compress stuff iteratively).

    The knoppix-autoconfig script uses several system programs, so I would think they are all accessible, and the invocation of knoppix.sh is at the end of this script. Maybe there is some kind of "call frame"
    here, making that run under busybox if the calling script does? I don't know much about this, you see .

    As for busybox components, you may roll your own. For example, you may need more commands during minirt init, or you come across some incompatibility. Important uses of busybox are in phones and embedded devices, where there may never be full version core utilities available.

    PS:
    Code:
     grep -s -w -i "no_script" /proc/cmdline && exit
    might be an even shorter way to implement that cheatcode? (Haven't tried, may also be busybox limitations for grep.)
    Last edited by Capricorny; 07-19-2012 at 01:22 PM.

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    20
    Quote Originally Posted by Capricorny View Post
    ...might be an even shorter way to implement that cheatcode? (Haven't tried, may also be busybox limitations for grep.)...
    That works, and the grep -w switch is especially recommended to anyone using a non-distinct assigned keyword that could be unintentionally matched by parts of other boot option words/phrases.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Dell 6P85J 4TB ST4000NM0063 7.2k 6Gb/s 3.5” SAS SED Hard Drive with Tray picture

Dell 6P85J 4TB ST4000NM0063 7.2k 6Gb/s 3.5” SAS SED Hard Drive with Tray

$39.99



Dell Constellation ES.3 3TB Enterprise-class Hard Drive (Wiped & Tested) picture

Dell Constellation ES.3 3TB Enterprise-class Hard Drive (Wiped & Tested)

$39.00



Western Digital HUS726T4TAL5204 4TB 7.2K SAS 12Gb/s 3.5

Western Digital HUS726T4TAL5204 4TB 7.2K SAS 12Gb/s 3.5" 512e HDD NetApp X375A

$64.00



(ST8000NM0045) SEAGATE ENTERPRISE 8TB 7200RPM 4Kn SATA 6Gb/s 3.5

(ST8000NM0045) SEAGATE ENTERPRISE 8TB 7200RPM 4Kn SATA 6Gb/s 3.5" HARD DRIVE

$199.99



Seagate ST500DM009 BarraCuda 500 GB 3.5

Seagate ST500DM009 BarraCuda 500 GB 3.5" SATA III Desktop Hard Drive

$14.99



Seagate ST4000NM0034 Enterprise 4TB 7200RPM SAS 12Gb/s HDD v4 picture

Seagate ST4000NM0034 Enterprise 4TB 7200RPM SAS 12Gb/s HDD v4

$39.00



Dell ST6000NM0034 1HT27Z-150 NWCCG 6TB SAS 3.5 7.2K ENTERPRISE SERVER DRIVE picture

Dell ST6000NM0034 1HT27Z-150 NWCCG 6TB SAS 3.5 7.2K ENTERPRISE SERVER DRIVE

$68.99



HGST HUS724040ALA640 HDD 4TB SATA 6Gb/s 7.5K 3.5

HGST HUS724040ALA640 HDD 4TB SATA 6Gb/s 7.5K 3.5" 0F19459 512 b/s

$78.00



DELL 2TB Enterprise HDD (7200RPM, 3.5

DELL 2TB Enterprise HDD (7200RPM, 3.5", SATA III, 128MB Cache) HUS722T2TALA600

$49.95



Seagate ST8000NM0075 Enterprise Capacity 3.5 HDD 8TB SAS Hard Drive 8TB EXOS picture

Seagate ST8000NM0075 Enterprise Capacity 3.5 HDD 8TB SAS Hard Drive 8TB EXOS

$184.99