summaryrefslogtreecommitdiff
path: root/package/base-files/files/init.d/fs
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-20 17:42:34 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2016-11-25 01:49:36 +0100
commitb0f23d1e562e753cb78a473fdade956a25cc337b (patch)
treefe4a5908d1e39e24ec6df66052e866ed72421a79 /package/base-files/files/init.d/fs
parent49a817b44be5695a87f6b4c8eadef3bb0f9419f9 (diff)
finalize systemd as alternative init system
Most important is the fix in patch-src_journal_journald-server_c, which breaks startup of systemd-journald when code is compiled with -DNDEBUG. A lot of base-files reorganizing to only install required files on sysv systems.
Diffstat (limited to 'package/base-files/files/init.d/fs')
-rwxr-xr-xpackage/base-files/files/init.d/fs50
1 files changed, 50 insertions, 0 deletions
diff --git a/package/base-files/files/init.d/fs b/package/base-files/files/init.d/fs
new file mode 100755
index 000000000..55e2c3449
--- /dev/null
+++ b/package/base-files/files/init.d/fs
@@ -0,0 +1,50 @@
+#!/bin/sh
+#INIT 10
+[[ $1 = autostart ]] || exit 0
+
+# activate swap
+[ -x /sbin/swapon ] && {
+ grep swap /etc/fstab >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ logger -t 'SWAP' "Activating swap"
+ swapon -a
+ fi
+}
+
+# activate any logical volumes
+[ -x /usr/sbin/lvm ] && {
+ logger -t 'LVM' "Activating LVM volumes"
+ lvm vgscan
+ lvm vgchange -ay
+}
+
+# mount local filesystems
+fstypes="ext2 ext3 ext4 xfs vfat ntfs ntfs-3g"
+for fs in $fstypes; do
+ procfs=$fs
+ if [ $fs = "ntfs-3g" ];then
+ procfs=fuse
+ fi
+ disks=$(grep -v "^#" /etc/fstab|grep "${fs}[[:blank:]]"|awk '{ print $1 }')
+ for disk in $disks; do
+ logger -t 'Filesystem' "Found $disk with filesystem $fs"
+ mnt=$(grep -v "^#" /etc/fstab|grep "${disk}[[:blank:]]"|awk '{ print $2 }')
+ grep $procfs /proc/filesystems >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ [ -x /usr/sbin/fsck.$fs ] && {
+ logger -t 'Filesystem' "checking $fs filesystem on $disk"
+ fsck -p $disk >/dev/null 2>&1
+ }
+ mkdir -p $mnt > /dev/null 2>&1
+ if [ -b $disk ]; then
+ logger -t 'Filesystem' "Mounting $disk to $mnt"
+ mount $disk
+ else
+ logger -t 'Filesystem' "Skipping mounting $disk, device file missing"
+ fi
+ else
+ logger -t 'Filesystem' "No $procfs filesystem in kernel"
+ fi
+ done
+done
+exit 0