Prima di tutto, systemdnon è un unix tradizionale init. Systemd è molto di più, quindi è un po 'ingiusto confrontare i due.
Per rispondere alla domanda, ciò che sembra necessario sono alcuni file binari e i seguenti file di configurazione:
/usr/lib/systemd/system/default.target
/usr/lib/systemd/system/basic.target
/usr/lib/systemd/system/sysinit.target
/usr/lib/systemd/system/getty.target
/usr/lib/systemd/system/getty@.service
/usr/lib/systemd/system/console-getty.service
l'emissione systemctl enable console-getty.service getty@tty2.servicequindi crea questi collegamenti simbolici:
/etc/systemd/system/default.target.wants/getty@tty2.service -> / lib / systemd / system / getty @ service
/etc/systemd/system/getty.target.wants/console-getty.service -> /lib/systemd/system/console-getty.service
NOTA : per utilizzare systemdle funzioni speciali per l'avvio agettydinamico, su richiesta quando si preme Alt+ F3e così via, sembra che sia necessario disporre almeno di questi due file:
/etc/systemd/logind.conf
/lib/systemd/system/autovt@.service
dove autovt@.serviceè un link simbolico a getty@.service.
Contenuto dei file di configurazione:
Il default.target, getty.target, sysinit.targeti file possono essere vuoto tranne che per il [Unit]tag e (probabilmente) Description=xxx.
basic.target contiene anche informazioni sulla dipendenza:
[Unità]
Descrizione = Sistema di base
Richiede = sysinit.target
Wants = sockets.target timers.target paths.target slices.target
After = sysinit.target sockets.target timers.target paths.target slices.target
Non sono sicuro se i riferimenti a target che non esistono come file sono necessari o meno. Sono descritti nella systemd.special(7)pagina man.
console-getty.service: (Caso speciale per agetty sulla console)
[Unità]
Descrizione = Console Getty
After = systemd-user-sessioni.service plymouth-quit-wait.service
Prima = getty.target
[Servizio]
ExecStart = - / sbin / agetty --noclear --keep-baud console 115200,38400,9600 $ TERM
Tipo = inattiva
Restart = sempre
RestartSec = 0
UtmpIdentifier = cons
TTYPath = / dev / console
TTYReset = yes
TTYVHangup = yes
KillMode = processo
IgnoreSIGPIPE = no
SendSIGHUP = yes
[Installare]
WantedBy = getty.target
getty@.service: (configurazione generica per tutti i servizi getty tranne la console)
[Unità]
Descrizione = Getty su% I
After = systemd-user-sessioni.service plymouth-quit-wait.service
Prima = getty.target
IgnoreOnIsolate = yes
ConditionPathExists = / dev / tty0
[Servizio]
ExecStart = - / sbin / agetty --noclear% I $ TERM
Tipo = inattiva
Restart = sempre
RestartSec = 0
UtmpIdentifier =% I
TTYPath = / dev /% I
TTYReset = yes
TTYVHangup = yes
TTYVTDisallocate = no
KillMode = processo
IgnoreSIGPIPE = no
SendSIGHUP = yes
[Installare]
WantedBy = getty.target
DefaultInstance = tty1
Finalmente probabilmente avrai bisogno di alcuni di questi binari speciali (non ho provato quali sono cruciali):
/ lib / systemd / systemd (/ sbin / init di solito punta a questo)
/ Lib / systemd / systemd-logind
/ Lib / systemd / systemd-cgroups-agent
/ lib / systemd / systemd-user-sessioni
/ Lib / systemd / systemd-vconsole-setup
/ Lib / systemd / systemd-update-utmp
/ Lib / systemd / systemd-sonno
/ Lib / systemd / systemd-sysctl
/ Lib / systemd / systemd-initctl
/ Lib / systemd / systemd-reply-Password
/ Lib / systemd / systemd-ac-power
/ Lib / systemd / systemd-activate
/ Lib / systemd / systemd-retroilluminazione
/ Lib / systemd / systemd-binfmt
/ Lib / systemd / systemd-bootchart
/ Lib / systemd / systemd-bus-proxyd
/ Lib / systemd / systemd-coredump
/ Lib / systemd / systemd-cryptsetup
/ Lib / systemd / systemd-fsck
/ Lib / systemd / systemd-hostnamed
/ Lib / systemd / systemd-journald
/ Lib / systemd / systemd-journal-gatewayd
/ Lib / systemd / systemd-journal-remote
/ Lib / systemd / systemd-localed
/ Lib / systemd / systemd-lavorati
/ Lib / systemd / systemd-moduli carico
/ Lib / systemd / systemd-multi-sedile-x
/ Lib / systemd / systemd-networkd
/ Lib / systemd / systemd-networkd-wait-online
/ Lib / systemd / systemd-quotacheck
/ Lib / systemd / systemd-random-seed
/ Lib / systemd / systemd-readahead
/ lib / systemd / systemd-rimontare-FS
/ Lib / systemd / systemd-risolto
/ Lib / systemd / systemd-rfkill
/ Lib / systemd / systemd-spegnimento
/ Lib / systemd / systemd-shutdownd
/ Lib / systemd / systemd-presa-proxyd
/ Lib / systemd / systemd-timedated
/ Lib / systemd / systemd-timesyncd
/ Lib / systemd / systemd-udevd
/ Lib / systemd / systemd-update-fatto
Per riassumere il processo di avvio di systemd, penso che funzioni in questo modo:
- systemd individua
basic.target(o tutti i *.targetfile?)
- le dipendenze sono risolte basano su
WantedBy=, Wants=, Before=, After=... direttive nel [Install]settore delle *.servicee *.targetdei file di configurazione.
*.serviceche dovrebbero iniziare (che non sono servizi "speciali"), avere una [Service]sezione con una ExecStart=direttiva, che indica l'avvio dell'eseguibile.