Добавлены шаблоны sys-fs

* eudev
* fuse
* mtools
* udev
* udev-init-scripts
* udisks
master
parent 496b56194f
commit 613380c489

@ -0,0 +1 @@
{% calculate append = 'skip' %}

@ -0,0 +1 @@
{% calculate path='/etc', name='modprobe.d', package='sys-fs/eudev' %}

@ -0,0 +1,3 @@
{% calculate path='/etc/udev/rules.d' %}
SUBSYSTEM=="firmware", ACTION=="add", ATTR{loading}="-1"

@ -0,0 +1,2 @@
{% calculate append='remove', name='50-firmware.rules' %}
{# возможно удаление ошибочного размещения шаблона #}

@ -0,0 +1,7 @@
{% calculate format='regex', path='/lib/udev/rules.d' %}
<reg>(# probe filesystem metadata of disks)
(KERNEL!="sr\*", IMPORT\{builtin\}="blkid")</reg>
<text>\1
KERNEL!="sr*", ATTRS{size}=="0", ATTRS{removable}=="1", GOTO="skip_blkid"
\2
LABEL="skip_blkid"</text>

@ -0,0 +1,3 @@
{% calculate format='regex', path='/lib/udev/rules.d' %}
<reg>(KERNEL!=")(eth\*)</reg>
<text>\1en*|wl*|sl*|ww*|\2</text>

@ -0,0 +1 @@
{% calculate append='remove', path='/lib/udev/rules.d' %}

@ -0,0 +1 @@
{% calculate append='remove', path='/lib/udev/rules.d' %}

@ -0,0 +1,23 @@
{% calculate comment='#', path='/lib/udev/rules.d', install.os.container.type == 'host' %}
# VirtualBox
ACTION=="add|remove", DEVPATH=="/devices/virtual/misc/vbox*", ENV{ID_LXC}="all"
# PS/2 keyboard and mouse
ACTION=="add|remove", DEVPATH=="/devices/platform/i8042/*", ENV{ID_LXC}="all"
# USB devices
ACTION=="add|remove", ENV{ID_BUS}=="usb", ENV{ID_LXC}="all"
# Audio devices
ACTION=="add|remove", SUBSYSTEM=="sound", ENV{ID_LXC}="all"
# tty0 for chvt and lightdm
ACTION=="add|remove", KERNEL=="tty0", ENV{ID_LXC}="all"
# tty7-10 for xorg-server
ACTION=="add|remove", KERNEL=="tty7", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty8", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty9", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty10", ENV{ID_LXC}="all"
# Video devices
ACTION=="add|remove", SUBSYSTEM=="drm", ENV{ID_LXC}="all"

@ -0,0 +1,8 @@
{% calculate comment='#', path='/lib/udev/rules.d', install.os.container.type == 'host' %}
ENV{ID_LXC}=="", GOTO="lxc_end"
ACTION=="add", PROGRAM="/bin/bash /usr/libexec/lxc-udev-trigger add '$env{DEVNAME}' '$env{MAJOR}' '$env{MINOR}' '$env{SUBSYSTEM}' '$env{ID_LXC}'"
ACTION=="remove", PROGRAM="/bin/bash /usr/libexec/lxc-udev-trigger remove $env{DEVNAME} $env{MAJOR} $env{MINOR} $env{SUBSYSTEM} $env{ID_LXC}"
LABEL="lxc_end"

@ -0,0 +1,7 @@
{% calculate comment='#' %}
# hplip and cups 1.4+ use raw USB devices, so it requires usblp not be loaded
blacklist usblp
# You probably want this to not get the console beep loud on every tab :)
blacklist pcspkr

@ -0,0 +1,61 @@
{% calculate comment='#', path='/usr/libexec', chmod='755', install.os.container.type == 'host' %}
#!/bin/bash
ACTION="$1"
DEVNAME="$2"
MAJOR="$3"
MINOR="$4"
SUBSYSTEM="$5"
if [[ -z $MINOR ]] || [[ -z $DEVNAME ]]
then
exit 0
fi
shift 5
COMPS="$*"
process_device() {
local comp=$1
if [[ "$ACTION" == "add" ]]
then
lxc-device -n ${comp} -- add $DEVNAME
lxc-attach -n ${comp} $(stat -L -c "chmod %a %n" $DEVNAME)
lxc-attach -n ${comp} $(stat -L -c "chown %u:%g %n" $DEVNAME)
udevadm trigger --action=change --name-match=$DEVNAME
fi
if [[ "$ACTION" == "remove" ]]
then
lxc-attach -n ${comp} -- rm $DEVNAME
if [[ -n $MAJOR ]] && [[ -n $MINOR ]]
then
if [[ $SUBSYSTEM == "block" ]]
then
lxc-cgroup -n ${comp} devices.deny "b $MAJOR:$MINOR rwm"
else
lxc-cgroup -n ${comp} devices.deny "c $MAJOR:$MINOR rwm"
fi
fi
udevadm trigger --action=remove --name-match=$DEVNAME
fi
}
if [[ $COMPS == "all" ]]
then
for COMP in $(lxc-ls -1q 2>/dev/null)
do
if lxc-info -n $COMP -c lxc.environment | grep LXC_DESKTOP=1 &>/dev/null
then
process_device $COMP
fi
done
else
for COMP in $COMPS
do
if [[ -n $(lxc-info -pH -n $COMP) ]]
then
process_device $COMP
fi
done
fi

@ -0,0 +1,5 @@
{% calculate format='regex', multiline, path='/lib/udev' %}
<reg>^match="\$match, KERNEL==.*$\n</reg>
<text></text>
<reg>^#write_rule </reg>
<text>write_rule </text>

@ -0,0 +1 @@
{% calculate append='skip', package='sys-fs/fuse' %}

@ -0,0 +1,2 @@
{% calculate append="link", source="/etc/init.d/fuse", install.os.linux.system == 'desktop' and custom.runlevels.fuse != 'on' or grep('var/lib/calculate/-runlevels-fuse','/fuse') %}
{% save.system custom.runlevels.fuse = "on" %}

@ -0,0 +1 @@
{% calculate path='/etc', package='sys-fs/mtools' %}

@ -0,0 +1,64 @@
# Example mtools.conf files. Uncomment the lines which correspond to
# your architecture and comment out the "SAMPLE FILE" line below
#SAMPLE FILE
# # Linux floppy drives
# drive a: file="/dev/fd0" exclusive
# drive b: file="/dev/fd1" exclusive
# # First SCSI hard disk partition
# drive c: file="/dev/sda1"
# # First IDE hard disk partition
# drive c: file="/dev/hda1"
# # dosemu floppy image
# drive m: file="/var/lib/dosemu/diskimage"
# # dosemu hdimage
# drive n: file="/var/lib/dosemu/diskimage" offset=3840
# # Atari ramdisk image
# drive o: file="/tmp/atari_rd" offset=136
# # ZIP disk for Solaris:
# Drive X is ZIP-100 at target 5
# drive X: file="/dev/rdsk/c0t5d0s2" partition=4 scsi=1 nodelay
# # ZIP disk for SunOS:
# # Zip drive is at target 5, which default kernel calls tape st1 !!
# drive Y: file="/dev/rsd5c" partition=4 scsi=1 nodelay
# # autoselect zip drive/floppy on HP-UX 9/10
# drive a: file="/dev/rdsk/c201d5" exclusive partition=4
# drive a: file="/dev/rdsk/c201d5s0" exclusive partition=4
# drive a: file="/dev/rfloppy/c201d0s0" exclusive
# A/UX target 5 on 1st scsi bus jaz or zip
# drive X: file="/dev/rdsk/c105d0s31" partition=4
# Some examples for BeOS.
# floppy drive. hardcoded in devices.c, so no real need to define it here
#drive a: file="/dev/floppy_disk" exclusive
# ZIP drive on SCSI ID 6
#drive z: file="/dev/scsi_disk_060" offset=16384 fat_bits=16
# SCO Unix 3.2v4
# # Floppy disk drives
#
# drive a: file="/dev/install" exclusive
# drive b: file="/dev/install1" exclusive
#
# # SCSI hard disk partitions
#
# drive c: file="/dev/dsk/0sC"
# drive d: file="/dev/dsk/0sD"
# drive e: file="/dev/dsk/0sE"
# drive f: file="/dev/dsk/0sF"
# drive g: file="/dev/dsk/0sG"
# drive h: file="/dev/dsk/0sH"
# # uncomment the following line to display all file names in lower
# # case by default
# mtools_lower_case=1

@ -0,0 +1 @@
{% calculate path='/etc', name='conf.d', package='sys-fs/udev-init-scripts' %}

@ -0,0 +1,3 @@
{% calculate format='openrc', name='udev' %}
rc_want="hostname"

@ -0,0 +1 @@
{% calculate path='/etc', install.os.container.type == 'desktop' %}

@ -0,0 +1,11 @@
{% calculate format='regex', dotall %}
<reg>(start_pre\(\)
\{).*?\n\}</reg>
<text>start_pre()
{
get_udevd_binary || return 1
return 0
}
</text>
<reg> -lxc</reg>
<text></text>

@ -0,0 +1,3 @@
{% calculate format='regex', dotall %}
<reg> -lxc</reg>
<text></text>

@ -0,0 +1 @@
{% calculate path='/etc/runlevels' %}

@ -0,0 +1,2 @@
{% calculate append="link", source="/etc/init.d/udev", custom.runlevels.udev_init_scripts != 'on' or grep('var/lib/calculate/-runlevels-udev-init-scripts','/udev') %}
{% save.system custom.runlevels.udev_init_scripts = "on" %}

@ -0,0 +1 @@
{% calculate package='', path='/etc', name='modprobe.d' %}

@ -0,0 +1,11 @@
{% calculate format='regex', path='/lib/udev/rules.d' %}
<reg>(ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb\|ieee1394", ENV\{ID_CDROM\}=="\?\*", ENV\{GENERATED\}!="\?\*", \\
PROGRAM="write_cd_rules by-id", SYMLINK\+="%c", GOTO="persistent_cd_end")
(ACTION=="add", SUBSYSTEM=="block", ENV\{ID_CDROM\}=="\?\*")</reg>
<text>\1
ACTION=="add", SUBSYSTEM=="block", ENV{ID_ATA}=="1", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \
PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end"
\2</text>
<reg>ID_ATA=="1"</reg>
<text>ENV{ID_ATA}=="1"</text>

@ -0,0 +1 @@
{% calculate path='/etc/udev/rules.d', source='/lib/udev/rules.d/80-net-name-slot.rules', pkg() >= '197', force %}

@ -0,0 +1 @@
# Calculate path=/etc/udev/rules.d link=/lib/udev/rules.d/80-net-setup-link.rules pkg(sys-fs/udev)>=209 force

@ -0,0 +1,23 @@
{% calculate comment='#', path='/lib/udev/rules.d', install.os.container.type == 'host' %}
# VirtualBox
ACTION=="add|remove", DEVPATH=="/devices/virtual/misc/vbox*", ENV{ID_LXC}="all"
# PS/2 keyboard and mouse
ACTION=="add|remove", DEVPATH=="/devices/platform/i8042/*", ENV{ID_LXC}="all"
# USB devices
ACTION=="add|remove", ENV{ID_BUS}=="usb", ENV{ID_LXC}="all"
# Audio devices
ACTION=="add|remove", SUBSYSTEM=="sound", ENV{ID_LXC}="all"
# tty0 for chvt and lightdm
ACTION=="add|remove", KERNEL=="tty0", ENV{ID_LXC}="all"
# tty7-10 for xorg-server
ACTION=="add|remove", KERNEL=="tty7", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty8", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty9", ENV{ID_LXC}="all"
ACTION=="add|remove", KERNEL=="tty10", ENV{ID_LXC}="all"
# Video devices
ACTION=="add|remove", SUBSYSTEM=="drm", ENV{ID_LXC}="all"

@ -0,0 +1,8 @@
{% calculate comment='#', path='/lib/udev/rules.d', install.os.container.type == 'host' %}
ENV{ID_LXC}=="", GOTO="lxc_end"
ACTION=="add", PROGRAM="/bin/bash /usr/libexec/lxc-udev-trigger add '$env{DEVNAME}' '$env{MAJOR}' '$env{MINOR}' '$env{SUBSYSTEM}' '$env{ID_LXC}'"
ACTION=="remove", PROGRAM="/bin/bash /usr/libexec/lxc-udev-trigger remove $env{DEVNAME} $env{MAJOR} $env{MINOR} $env{SUBSYSTEM} $env{ID_LXC}"
LABEL="lxc_end"

@ -0,0 +1,7 @@
{% calcultae pkg() >= '197' %}
# hplip and cups 1.4+ use raw USB devices, so it requires usblp not be loaded
blacklist usblp
# You probably want this to not get the console beep loud on every tab :)
blacklist pcspkr

@ -0,0 +1,61 @@
{% calculate comment='#', path='/usr/libexec', chmod='755', install.os.container.type == 'host' %}
#!/bin/bash
ACTION="$1"
DEVNAME="$2"
MAJOR="$3"
MINOR="$4"
SUBSYSTEM="$5"
if [[ -z $MINOR ]] || [[ -z $DEVNAME ]]
then
exit 0
fi
shift 5
COMPS="$*"
process_device() {
local comp=$1
if [[ "$ACTION" == "add" ]]
then
lxc-device -n ${comp} -- add $DEVNAME
lxc-attach -n ${comp} $(stat -L -c "chmod %a %n" $DEVNAME)
lxc-attach -n ${comp} $(stat -L -c "chown %u:%g %n" $DEVNAME)
udevadm trigger --action=change --name-match=$DEVNAME
fi
if [[ "$ACTION" == "remove" ]]
then
lxc-attach -n ${comp} -- rm $DEVNAME
if [[ -n $MAJOR ]] && [[ -n $MINOR ]]
then
if [[ $SUBSYSTEM == "block" ]]
then
lxc-cgroup -n ${comp} devices.deny "b $MAJOR:$MINOR rwm"
else
lxc-cgroup -n ${comp} devices.deny "c $MAJOR:$MINOR rwm"
fi
fi
udevadm trigger --action=remove --name-match=$DEVNAME
fi
}
if [[ $COMPS == "all" ]]
then
for COMP in $(lxc-ls -1q 2>/dev/null)
do
if lxc-info -n $COMP -c lxc.environment | grep LXC_DESKTOP=1 &>/dev/null
then
process_device $COMP
fi
done
else
for COMP in $COMPS
do
if [[ -n $(lxc-info -pH -n $COMP) ]]
then
process_device $COMP
fi
done
fi

@ -0,0 +1 @@
{% calculate path='/var/lib/polkit-1/localauthority', name='50-local.d', package='udisks' %}

@ -0,0 +1,13 @@
{% calculate append='replace', comment='//', path='/etc/polkit-1/rules.d' %}
/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */
// Mount disk by plugdev group rules for polkit
//
polkit.addRule(function(action, subject) {
if ((action.id.indexOf("org.freedesktop.udisks.") == 0 ||
action.id.indexOf("org.freedesktop.udisks2.") == 0 ) &&
subject.isInGroup("plugdev")) {
return polkit.Result.YES;
}
});

@ -0,0 +1 @@
{% calculate path='/usr/share/polkit-1' %}

@ -0,0 +1,221 @@
{% calculate pkg('sys-fs/udisks:0') %}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>The udisks Project</vendor>
<vendor_url>http://udisks.freedesktop.org/</vendor_url>
<icon_name>drive-removable-media</icon_name>
<action id="org.freedesktop.udisks.filesystem-mount">
<description>Mount a device</description>
<message>Authentication is required to mount the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-mount-system-internal">
<description>Mount a system-internal device</description>
<message>Authentication is required to mount the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-check">
<description>Check file system on a device</description>
<message>Authentication is required to check the file system on the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-check-system-internal">
<description>Check file system of a system-internal device</description>
<message>Authentication is required to check the file system on the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-unmount-others">
<description>Unmount a device mounted by another user</description>
<message>Authentication is required to unmount devices mounted by another user</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-lsof">
<description>List open files</description>
<message>Authentication is required to list open files on a mounted file system</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.filesystem-lsof-system-internal">
<description>List open files on a system-internal device</description>
<message>Authentication is required to list open files on a mounted file system</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-eject">
<description>Eject media from a device</description>
<message>Authentication is required to eject media from the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-detach">
<description>Detach a drive</description>
<message>Authentication is required to detach the drive</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.change">
<description>Modify a device</description>
<message>Authentication is required to modify the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.change-system-internal">
<description>Modify a system-internal device</description>
<message>Authentication is required to modify the device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-ata-smart-refresh">
<description>Refresh ATA SMART data</description>
<message>Authentication is required to refresh ATA SMART data</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-ata-smart-selftest">
<description>Run ATA SMART Self Tests</description>
<message>Authentication is required to run ATA SMART self tests</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-ata-smart-retrieve-historical-data">
<description>Retrieve historical ATA SMART data</description>
<message>Authentication is required to retrieve historical ATA SMART data</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.luks-unlock">
<description>Unlock an encrypted device</description>
<message>Authentication is required to unlock an encrypted device</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.luks-lock-others">
<description>Lock an encrypted device unlocked by another user</description>
<message>Authentication is required to lock an encrypted device unlocked by another user</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.linux-md">
<description>Configure Linux Software RAID</description>
<message>Authentication is required to configure Linux Software RAID devices</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.linux-lvm2">
<description>Configure Linux LVM2</description>
<message>Authentication is required to configure Linux LVM2</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.cancel-job-others">
<description>Cancel a job initiated by another user</description>
<message>Authentication is required to cancel a job initiated by another user</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.inhibit-polling">
<description>Inhibit media detection</description>
<message>Authentication is required to inhibit media detection</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="org.freedesktop.udisks.drive-set-spindown">
<description>Set drive spindown timeout</description>
<message>Authentication is required to configure drive spindown timeout</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
</policyconfig>

@ -0,0 +1,4 @@
[Mounting, checking, etc. of external drives]
Identity=unix-group:plugdev
Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.filesystem-mount-system-internal;org.freedesktop.udisks.filesystem-check;org.freedesktop.udisks.filesystem-check-system-internal;org.freedesktop.udisks.filesystem-unmount-others;org.freedesktop.udisks.filesystem-lsof;org.freedesktop.udisks.filesystem-lsof-system-internal;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.change;org.freedesktop.udisks.change-system-internal;org.freedesktop.udisks.drive-ata-smart-refresh;org.freedesktop.udisks.drive-ata-smart-selftest;org.freedesktop.udisks.drive-ata-smart-retrieve-historical-data;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.luks-lock-others;org.freedesktop.udisks.linux-md;org.freedesktop.udisks.linux-lvm2;org.freedesktop.udisks.cancel-job-others;org.freedesktop.udisks.inhibit-polling;org.freedesktop.udisks.drive-set-spindown
ResultActive=yes
Loading…
Cancel
Save