shim in support for nspawn settings files
This commit is contained in:
parent
b561c6bce9
commit
bd94a2cb97
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
SRC = systemd.el
|
SRC = systemd.el
|
||||||
DATA = unit-directives.txt network-directives.txt
|
DATA = unit-directives.txt network-directives.txt nspawn-directives.txt
|
||||||
DISTFILES := Makefile $(SRC) $(DATA) LICENSE README systemd-pkg.el tests
|
DISTFILES := Makefile $(SRC) $(DATA) LICENSE README systemd-pkg.el tests
|
||||||
|
|
||||||
VERSION := $(shell awk '/^;; Version:/ {print $$3}' $(SRC))
|
VERSION := $(shell awk '/^;; Version:/ {print $$3}' $(SRC))
|
||||||
|
|||||||
28
nspawn-directives.txt
Normal file
28
nspawn-directives.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Boot
|
||||||
|
ProcessTwo
|
||||||
|
Parameters
|
||||||
|
Environment
|
||||||
|
User
|
||||||
|
WorkingDirectory
|
||||||
|
Capability
|
||||||
|
DropCapability
|
||||||
|
KillSignal
|
||||||
|
Personality
|
||||||
|
MachineID
|
||||||
|
PrivateUsers
|
||||||
|
NotifyReady
|
||||||
|
ReadOnly
|
||||||
|
Volatile
|
||||||
|
Bind
|
||||||
|
BindReadOnly
|
||||||
|
TemporaryFileSystem
|
||||||
|
PrivateUsersChown
|
||||||
|
Private
|
||||||
|
VirtualEthernet
|
||||||
|
VirtualEthernetExtra
|
||||||
|
Interface
|
||||||
|
MACVLAN
|
||||||
|
IPVLAN
|
||||||
|
Bridge
|
||||||
|
Zone
|
||||||
|
Port
|
||||||
37
systemd.el
37
systemd.el
@ -106,6 +106,20 @@
|
|||||||
(split-string (buffer-string))))
|
(split-string (buffer-string))))
|
||||||
"Network configuration directives for systemd.")
|
"Network configuration directives for systemd.")
|
||||||
|
|
||||||
|
(defconst systemd-nspawn-sections
|
||||||
|
'("Exec" "Files" "Network")
|
||||||
|
"Namespace container configuration sections for systemd 232.")
|
||||||
|
|
||||||
|
(defconst systemd-nspawn-directives
|
||||||
|
(eval-when-compile
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert-file-contents
|
||||||
|
(let ((f "nspawn-directives.txt"))
|
||||||
|
(if (null load-file-name) f
|
||||||
|
(expand-file-name f (file-name-directory load-file-name)))))
|
||||||
|
(split-string (buffer-string))))
|
||||||
|
"Namespace container configuration directives for systemd.")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defconst systemd-autoload-regexp
|
(defconst systemd-autoload-regexp
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
@ -196,18 +210,26 @@ file, defaulting to the link under point, if any."
|
|||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(= (following-char) ?\[)))
|
(= (following-char) ?\[)))
|
||||||
|
|
||||||
(defun systemd-buffer-network-p ()
|
(defun systemd-file-network-p (filename)
|
||||||
"Return non-nil if `buffer-name' has a network-type extension, otherwise nil."
|
"Return non-nil if FILENAME has a network-type extension, otherwise nil."
|
||||||
(string-match-p (eval-when-compile
|
(string-match-p (eval-when-compile
|
||||||
(rx "." (or "link" "netdev" "network") string-end))
|
(rx "." (or "link" "netdev" "network") string-end))
|
||||||
(buffer-name)))
|
filename))
|
||||||
|
|
||||||
|
(defun systemd-file-nspawn-p (filename)
|
||||||
|
"Return non-nil if FILENAME has an nspawn extension, otherwise nil."
|
||||||
|
(string-match-p (eval-when-compile (rx ".nspawn" string-end)) filename))
|
||||||
|
|
||||||
(defun systemd-completion-table (&rest _ignore)
|
(defun systemd-completion-table (&rest _ignore)
|
||||||
"Return a list of completion candidates."
|
"Return a list of completion candidates."
|
||||||
(let ((sectionp (systemd-buffer-section-p)))
|
(let ((sectionp (systemd-buffer-section-p))
|
||||||
(if (systemd-buffer-network-p)
|
(name (buffer-name)))
|
||||||
(if sectionp systemd-network-sections systemd-network-directives)
|
(cond
|
||||||
(if sectionp systemd-unit-sections systemd-unit-directives))))
|
((systemd-file-nspawn-p name)
|
||||||
|
(if sectionp systemd-nspawn-sections systemd-nspawn-directives))
|
||||||
|
((systemd-file-network-p name)
|
||||||
|
(if sectionp systemd-network-sections systemd-network-directives))
|
||||||
|
(t (if sectionp systemd-unit-sections systemd-unit-directives)))))
|
||||||
|
|
||||||
(defun systemd-complete-at-point ()
|
(defun systemd-complete-at-point ()
|
||||||
"Complete the symbol at point."
|
"Complete the symbol at point."
|
||||||
@ -269,6 +291,7 @@ See systemd.unit(5) for details on unit file syntax.")
|
|||||||
["Open systemd.directives(7)" systemd-doc-directives
|
["Open systemd.directives(7)" systemd-doc-directives
|
||||||
:help "Index of configuration directives"]))
|
:help "Index of configuration directives"]))
|
||||||
|
|
||||||
|
;;;###autoload (add-to-list 'auto-mode-alist '("\\.nspawn\\'" . systemd-mode))
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-autoload-regexp . systemd-mode))
|
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-autoload-regexp . systemd-mode))
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-tempfn-autoload-regexp . systemd-mode))
|
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-tempfn-autoload-regexp . systemd-mode))
|
||||||
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-dropin-autoload-regexp . systemd-mode))
|
;;;###autoload (add-to-list 'auto-mode-alist `(,systemd-dropin-autoload-regexp . systemd-mode))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user