From 05f0cd63d0823b036d98cacdb6d69e342fc2851d Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 14 Dec 2024 14:39:48 +0100 Subject: [PATCH 1/4] Add `.timer` & various other systemd extensions (fixes #7161) --- lib/linguist/languages.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index b5eebfe28..f201b0697 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8468,10 +8468,38 @@ crontab: language_id: 705203557 desktop: type: data + # https://en.wikipedia.org/wiki/INI_file + filenames: + - "systemd-system.conf" + - "systemd-user.conf" + - "logind.conf" + - "journald.conf" + - "journal-remote.conf" + - "journal-upload.conf" + - "systemd-sleep.conf" + - "timesyncd.conf" extensions: - ".desktop" - ".desktop.in" + # systemd unit-file types; extensions from + # https://www.freedesktop.org/software/systemd/man/latest/systemd.syntax.html + - ".automount" + - ".device" + - ".link" + - ".mount" + - ".netdev" + - ".network" + - ".nspawn" + - ".path" + - ".scope" - ".service" + - ".slice" + - ".snapshot" + - ".socket" + - ".swap" + - ".target" + - ".timer" + - ".unit" tm_scope: source.desktop ace_mode: text language_id: 412 From 1a61b82c42754ff84f1a3e108150a2a7461c10bc Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 14 Dec 2024 15:01:49 +0100 Subject: [PATCH 2/4] Remove a number of extensions used by systemd INI files which are too common (see #7161) --- lib/linguist/languages.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index f201b0697..f90d5da0f 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8484,22 +8484,12 @@ desktop: # systemd unit-file types; extensions from # https://www.freedesktop.org/software/systemd/man/latest/systemd.syntax.html - ".automount" - - ".device" - - ".link" - ".mount" - ".netdev" - - ".network" - ".nspawn" - - ".path" - - ".scope" - ".service" - - ".slice" - - ".snapshot" - ".socket" - - ".swap" - - ".target" - ".timer" - - ".unit" tm_scope: source.desktop ace_mode: text language_id: 412 From 225d9ee27dc668387f4663efe223b5d84799bb12 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 30 Dec 2024 19:16:59 +0100 Subject: [PATCH 3/4] Remove inline comments, as requested in PR review feedback --- lib/linguist/languages.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index f90d5da0f..ede582698 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -8468,7 +8468,6 @@ crontab: language_id: 705203557 desktop: type: data - # https://en.wikipedia.org/wiki/INI_file filenames: - "systemd-system.conf" - "systemd-user.conf" @@ -8481,8 +8480,6 @@ desktop: extensions: - ".desktop" - ".desktop.in" - # systemd unit-file types; extensions from - # https://www.freedesktop.org/software/systemd/man/latest/systemd.syntax.html - ".automount" - ".mount" - ".netdev" From 7df44bc377c9f64ae4b5dac14d29b2742e371be8 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 30 Dec 2024 19:24:41 +0100 Subject: [PATCH 4/4] Add missing systemd samples --- samples/desktop/btrfs-trim.timer | 7 ++++++ samples/desktop/nyancat.socket | 9 ++++++++ samples/desktop/run-dwarffs.automount | 8 +++++++ samples/desktop/signal-cli-socket.socket | 7 ++++++ samples/desktop/tmp.mount | 29 ++++++++++++++++++++++++ samples/desktop/tor-browser.nspawn | 7 ++++++ samples/desktop/wireguard.netdev | 7 ++++++ 7 files changed, 74 insertions(+) create mode 100644 samples/desktop/btrfs-trim.timer create mode 100644 samples/desktop/nyancat.socket create mode 100644 samples/desktop/run-dwarffs.automount create mode 100644 samples/desktop/signal-cli-socket.socket create mode 100644 samples/desktop/tmp.mount create mode 100644 samples/desktop/tor-browser.nspawn create mode 100644 samples/desktop/wireguard.netdev diff --git a/samples/desktop/btrfs-trim.timer b/samples/desktop/btrfs-trim.timer new file mode 100644 index 000000000..2320c3d66 --- /dev/null +++ b/samples/desktop/btrfs-trim.timer @@ -0,0 +1,7 @@ +[Unit] +Description=Discard unused blocks on a mounted filesystem +Documentation=man:fstrim + +[Timer] +OnCalendar=monthly +AccuracySec=1h diff --git a/samples/desktop/nyancat.socket b/samples/desktop/nyancat.socket new file mode 100644 index 000000000..dca7fa55f --- /dev/null +++ b/samples/desktop/nyancat.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Nyan.cat socket + +[Socket] +ListenStream=23 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/samples/desktop/run-dwarffs.automount b/samples/desktop/run-dwarffs.automount new file mode 100644 index 000000000..5f21a857c --- /dev/null +++ b/samples/desktop/run-dwarffs.automount @@ -0,0 +1,8 @@ +[Unit] +Description=Debug Symbols File System +Documentation=https://github.com/edolstra/dwarffs +Before=sysinit.target + +[Automount] +Where=/run/dwarffs +TimeoutIdleSec=30 diff --git a/samples/desktop/signal-cli-socket.socket b/samples/desktop/signal-cli-socket.socket new file mode 100644 index 000000000..7cedc4ee5 --- /dev/null +++ b/samples/desktop/signal-cli-socket.socket @@ -0,0 +1,7 @@ +[Unit] +Description=Send secure messages to Signal clients + +[Socket] +ListenStream=%t/signal-cli/socket +SocketUser=root +# Add yourself to the signal-cli group to talk with the service diff --git a/samples/desktop/tmp.mount b/samples/desktop/tmp.mount new file mode 100644 index 000000000..98f23d644 --- /dev/null +++ b/samples/desktop/tmp.mount @@ -0,0 +1,29 @@ +# /etc/systemd/system/tmp.mount +# SPDX-License-Identifier: LGPL-2.1+ +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Temporary Directory (/tmp) +Documentation=https://systemd.io/TEMPORARY_DIRECTORIES +Documentation=man:file-hierarchy(7) +Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems +ConditionPathIsSymbolicLink=!/tmp +DefaultDependencies=no +Conflicts=umount.target +Before=local-fs.target umount.target middlewared.service +After=swap.target + +[Mount] +What=tmpfs +Where=/tmp +Type=tmpfs +Options=mode=1777,strictatime,nosuid,noexec,nodev + +[Install] +WantedBy=local-fs.target diff --git a/samples/desktop/tor-browser.nspawn b/samples/desktop/tor-browser.nspawn new file mode 100644 index 000000000..034ac4f2f --- /dev/null +++ b/samples/desktop/tor-browser.nspawn @@ -0,0 +1,7 @@ +[Exec] +DropCapability=all +Environment=DISPLAY=:0 +Hostname=kilgore-trout +NoNewPrivileges=true +Parameters=./start-tor-browser --log /dev/stdout +PrivateUsers=true diff --git a/samples/desktop/wireguard.netdev b/samples/desktop/wireguard.netdev new file mode 100644 index 000000000..f24299c63 --- /dev/null +++ b/samples/desktop/wireguard.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=wg0 +Kind=wireguard +Description=WireGuard tunnel + +[WireGuard] +ListenPort=51820