summaryrefslogtreecommitdiffstats
path: root/projectroot
diff options
context:
space:
mode:
Diffstat (limited to 'projectroot')
-rw-r--r--projectroot/etc/fstab20
-rw-r--r--projectroot/lib/systemd/system/systemd-autoformat@.service15
-rw-r--r--projectroot/lib/udev/rules.d/91-mkfs-ext4.rules5
3 files changed, 40 insertions, 0 deletions
diff --git a/projectroot/etc/fstab b/projectroot/etc/fstab
new file mode 100644
index 0000000..09b1d18
--- /dev/null
+++ b/projectroot/etc/fstab
@@ -0,0 +1,20 @@
+#
+# /etc/fstab
+#
+
+# special filesystems
+proc /proc proc nosuid,nodev,noexec 0 0
+devpts /dev/pts devpts nosuid,noexec,mode=620,gid=112 0 0
+sysfs /sys sysfs nosuid,nodev,noexec 0 0
+debugfs /sys/kernel/debug debugfs noauto 0 0
+
+# ramdisks
+tmpfs /tmp tmpfs nosuid,nodev,mode=1777,size=20% 0 0
+tmpfs /run tmpfs nosuid,nodev,strictatime,mode=0755 0 0
+/run /var/run bind bind 0 0
+tmpfs /var/log tmpfs nosuid,nodev,noexec,mode=0755,size=10% 0 0
+tmpfs /var/lock tmpfs nosuid,nodev,noexec,mode=0755,size=1M 0 0
+tmpfs /var/tmp tmpfs nosuid,nodev,mode=1777,size=20% 0 0
+
+# data partition
+/dev/mmcblk0p3 /mnt/data ext4 defaults,x-systemd.automount 0 2
diff --git a/projectroot/lib/systemd/system/systemd-autoformat@.service b/projectroot/lib/systemd/system/systemd-autoformat@.service
new file mode 100644
index 0000000..7522140
--- /dev/null
+++ b/projectroot/lib/systemd/system/systemd-autoformat@.service
@@ -0,0 +1,15 @@
+[Unit]
+Before=mnt-data.mount systemd-fsck@%i.service
+Description=Create ext4 Data Partition
+ConditionPathExists=/dev/%i
+
+[Service]
+Environment=DATAPARTITION=3
+Type=oneshot
+# resize partition to maximum
+ExecStart=/bin/sh -c 'echo ",+" | sfdisk --force -N$DATAPARTITION /dev/mmcblk0'
+# force kernel to reload the partition size of partition 3
+ExecStart=/usr/sbin/partx -d -n $DATAPARTITION /dev/mmcblk0
+ExecStart=/usr/sbin/partx -a -n $DATAPARTITION /dev/mmcblk0
+# create filesystem (this service is only started if we have none)
+ExecStart=/sbin/mkfs.ext4 /dev/%i
diff --git a/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules b/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules
new file mode 100644
index 0000000..1c1a396
--- /dev/null
+++ b/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules
@@ -0,0 +1,5 @@
+ACTION!="add", GOTO="systemd-autoformat-ext4-devices_end"
+SUBSYSTEM!="block", GOTO="systemd-autoformat-ext4-devices_end"
+ENV{ID_FS_USAGE}!="filesystem", SUBSYSTEMS=="mmc", KERNEL=="mmcblk0p3", ENV{ID_FS_TYPE}!="ext4", ENV{SYSTEMD_WANTS}+="systemd-autoformat@$name.service"
+
+LABEL="systemd-autoformat-ext4-devices_end"