Commit 366f21d7 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Add recipe for disks automounting

parent c42f6208
...@@ -41,6 +41,7 @@ IMAGE_INSTALL_append += " python-core \ ...@@ -41,6 +41,7 @@ IMAGE_INSTALL_append += " python-core \
init-elphel393 \ init-elphel393 \
init-tempmon \ init-tempmon \
ahci-blacklist \ ahci-blacklist \
udev-rules \
" "
#kernel-modules #kernel-modules
......
KERNEL!="sd[a-z][0-9]", GOTO="quit_automount"
# Import file system parameters; these parameters can be obtained with 'udevadm monitor --environment' command
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Device has a label
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
# Device has no file system, do not mount it
ENV{ID_FS_LABEL}=="", ENV{ID_FS_USAGE}=="", GOTO="quit_automount"
# Device has no label, but has a file system
ENV{ID_FS_LABEL}=="", ENV{ID_FS_USAGE}=="filesystem", ENV{dir_name}="%k"
# Mount device to /media if it is not SSD
ACTION=="add", ENV{ID_ATA_SATA}!="1", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount /dev/%k /media/%E{dir_name}"
# Mound device to /mnt if it is SSD
ACTION=="add", ENV{ID_ATA_SATA}=="1", RUN+="/bin/mkdir -p /mnt/%E{dir_name}", RUN+="/bin/mount /dev/%k /mnt/%E{dir_name}"
# Delete directory after removal
ACTION=="remove", ENV{ID_ATA_SATA}!="1", ENV{dir_name}!="", RUN+="/bin/rmdir /media/%E{dir_name}"
ACTION=="remove", ENV{ID_ATA_SATA}=="1", ENV{dir_name}!="", RUN+="/bin/rmdir /mnt/%E{dir_name}"
# Exit point
LABEL="quit_automount"
SUMMARY = "Extra initscripts for the Elphel 10393 board"
DESCRIPTION = "udev rules for automounting disk drives to /mnt or /media directories"
AUTHOR = "Elphel Inc."
HOMEPAGE = "http://www3.elphel.com/"
PRIORITY = "optional"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891"
PV = "${SRCDATE}"
PR = "r0"
SRC_URI = "file://90-elphel-automount.rules \
"
RDEPENDS_${PN} = "udev"
PACKAGES = "udev-rules"
UDEV_RULES_DIR = "${sysconfdir}/udev/rules.d"
FILES_${PN} += "${UDEV_RULES_DIR}/90-elphel-automount.rules"
do_install() {
install -d ${D}${UDEV_RULES_DIR}
install -m 644 ${WORKDIR}/90-elphel-automount.rules ${D}${UDEV_RULES_DIR}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment