On 2017-09-17, at 10:27 AM, larkost <[email protected]> wrote:

>       As to #2, you are going to have to be a lot clearer about what you are 
> trying to do. Apple’s recommendation for handling startup dependencies is to 
> have each tool monitor its dependencies itself, and handle the cases where it 
> needs to wait for something. My general approach has been to write a Python 
> script in front of each one that has dependencies that waits for them then 
> uses something like `execv` to hand over the PID to the real process.

This is the sort of thing that a "all systems should ship secure and no user 
can make it insecure by accident" person will hate.

Basically, consider that everything started has hidden, unstated dependencies.

For example: /tmp will be ready for use. The system clock has been set and is 
accurate. Hostname is valid. Etc.

In deep history, the idea was that /etc/rc started by doing cleanup -- 
recovering the password file if it was edited, saving editor temp states, 
wiping /tmp back to clean AFTER both of those, etc.

Included here would be things like mounting drives that the system needed (good 
ol /etc/fstab, which is empty, and heck, I have attempted to use it and not 
been able to get partitions to mount properly), 

There was a point in /etc/rc where it started to run daemon programs (that did 
a fork/exec), or run other programs with an "&". That is the point where things 
start up for multiuser.

Everything after that point has hidden assumptions of basically, "Everything 
that /etc/rc would do to prepare the system has been done".

So, what I'm looking for is basically a way (putting it into writing like this 
actually makes it easy to state) to add a dependency tag to everything apple 
ships that says "A site-local startup script has run", and add in a program 
(bash, python, executable, whatever) that gets a chance to run before anything 
else gets going.

=====

Launchd used to be flexible at boot. Going from 10.7 to 10.9 gave me trouble. 
It turns out that Launchd as pid 0 will refuse to boot the system unless 
several paths exist on the root partition as directories with specific 
ownerships/permissions. You are not allowed to even have them as symbolic links 
to a second partition on the boot drive. Something I learned early on doing 
system admin on unix systems (hey, I learned these lessons in V7 and S3, I can 
use "unix") was that you wanted your root partition to be as little-write as 
possible. Neither tmp nor swap go on root. The idea of per-user temp and cache 
directories to prevent people from interfering with each other is great, but 
why does that have to be on a partition that doesn't have 20 GB of wasted temp 
space? Or why do I have to waste that much space?

Being able to say "Fine, here's a directory for launchd to be happy, now let me 
mount a fake that supplies a symbolic link before anything else runs and starts 
writing into the wrong place"? That's kinda my first goal.

/var, /var/vm, /var/tmp, /var/folders, and a few others are forced to be root 
partitions.

---
Entertaining minecraft videos
http://YouTube.com/keybounce

_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to