so what actually is this destroot thing? 11. Feb 2011

When installing software via MacPorts there is an installation state called “destroot”.

--->  Staging ruby into destroot

Since MacPorts is rather close-lipped by default I’ve always wondered what’s happening behind the scenes. It turns out some rather meaningful stuff is being done:

Understanding the destroot phase is critical to understanding MacPorts, because, unlike some port systems, MacPorts “stages” an installation into an intermediate location — not the final file destination. MacPorts uses the destroot phase to provide: a) Port uninstalls - a port’s files may be cleanly uninstalled because all files and directories are recorded during install. b) Multiple port versions may be installed on the same host, since a port’s files are not directly inserted into ${prefix} but rather hard-linked into ${prefix} from an intermediate location during a later activation phase. (Source: MacPorts)

Interestingly if you would delete one of the hard links, the data wouldn’t be gone:

If one of the hard links is removed with the POSIX unlink function (for example, with the UNIX ‘rm’ command), then the data are still accessible through any other hard link that remains. If all of the hard links are removed and no process has the file open, then the space occupied by the data is freed, allowing it to be reused in the future. (Source: Wikipedia)

I must admit I didn’t know this. In fact I’m often suprised how much I manage to acomplish on Unix systems even though my knowledge is quite shallow and fragmented.

 

Kommentare (5)

  1. gnaskefar 150 days later

    Awesome, thanks for explaining. Wondered myself, but was to lazy to discover really, but you came in top, at google :D

Kommentar schreiben

Markdown Syntax