Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to make something start up after the next reboot, but only once, and not after any other reboot. Just like your first boot of a Haiku image off a USB stick runs the Installer, and whether you use it or not (maybe you just want to always run it off the stick, for instance) it never runs on startup after that. How can I do something like that, like a one-time reminder for next bootup?

If I mount a freshly downloaded image and compare the following directories in it to my installed boot drive:

/image/home/config/boot
/image/system/boot
/image/common/boot

...the files are identical. So how does Haiku know whether the run-once installer has been run? Not from there, anyway...

Update: I did find the file /image/common/settings/fresh_install that did not exist on my install, containing the text "This file is only supposed to exist on fresh Haiku installations." However, copying it to my install and rebooting only resulted in the MIME type updater running again, not the installer.

share|improve this question
    
This is for my home computer use, I just want something to start next startup, but that's the only time. How is that off-topic? –  Kev Apr 11 '13 at 21:37
    
@Zoredache--Haiku is the name of the OS, hence "in Haiku" in the title, and the haiku tag. C.f. haiku-os.org or click the haiku tag and then "Learn More". –  Kev Apr 14 '13 at 13:03
    
My mistake. I wasn't familiar with Haiku, I thought it was the app you wanted started, not the OS. –  Zoredache Apr 15 '13 at 21:30

1 Answer 1

up vote 0 down vote accepted

Make sure /boot/common/settings/fresh_install exists and then create a shell script ending in .sh in /boot/common/settings/boot/post_install. It will run on the next startup, and then fresh_install will auto-delete itself, causing the shell script not to run on subsequent startups.

I guess that approach could have been taken from the start, but maybe this is better because it's "built in"? Basically you can steal the following code from /boot/system/boot/Bootscript to accomplish the same thing with a different file than fresh_install, non-.sh scripts, etc. if you want to tweak it:

# Check for fresh install and run post install scripts.
freshInstallIndicator=/boot/common/settings/fresh_install
postInstallDir=/boot/common/boot/post_install
if [ -e $freshInstallIndicator ]; then
    # wait a moment for things to calm down a bit
    sleep 3

    # execute scripts
    for f in $postInstallDir/*.sh; do
        if [ -f $f ]; then
            echo "Running post install script $f ..." > /dev/dprintf
            $f
        fi
    done

    sync
    rm $freshInstallIndicator
fi

...and put it in your UserBootScript, for example.

(Still not sure what makes the installer itself run--it must be an even more special case, because it launches before Deskbar or Tracker start up.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.