dracut-aufs.paketlendi

This commit is contained in:
milisarge 2017-06-12 05:11:02 +03:00
parent f56bb2fa24
commit f34a0f646a
3 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,92 @@
#!/bin/sh
. /lib/dracut-lib.sh
data=$(getarg aufs_root)
if [ ! -z "$data" ] ; then
skip_dirs=$(getarg rfreeze_skip_dirs)
# we can have either "aufs_root=UUID=" or "aufs_root=DIR="
case $data in
*UUID=* )
echo "AAA"
UUID=${data#UUID=}
DIR=""
;;
*DIR=* )
UUID=""
DIR=${data#DIR=}
;;
esac
mount -t tmpfs tmpfs /sysroot/tmp
mkdir /sysroot/tmp/xinos
mkdir /sysroot/tmp/sysroot-rw
mkdir /sysroot/tmp/sysroot-ro
mount -o bind /sysroot /sysroot/tmp/sysroot-ro
RES=0
if [ ! -z "$UUID" ] ; then
/sbin/fsck.ext2 -y /dev/disk/by-uuid/$UUID
mount /dev/disk/by-uuid/$UUID /sysroot/tmp/sysroot-rw && RES=1
fi
if [ ! -z "$DIR" ] ; then
RES=1
fi
if [ "$RES" = 0 ] ; then
mount -n -t tmpfs tmpfs /sysroot/tmp/sysroot-rw
fi
if [ ! -z "$skip_dirs" ] ; then
SKIP_DIRS=${skip_dirs//:/ }
else
SKIP_DIRS="dev home lost+found media mnt proc run sys tmp"
fi
for d in `ls /sysroot `
do
skip_dir=0
if [ ! -d "/sysroot/$d" ] ; then
continue
fi
for sd in $SKIP_DIRS
do
if [ $d = $sd ] ; then
skip_dir=1
fi
done
if [ $skip_dir = 1 ] ; then
continue
fi
if [ ! -e "/sysroot/tmp/sysroot-rw/$d" ] ; then
if [ $d = "root" ] ; then
mkdir -m 750 "/sysroot/tmp/sysroot-rw/$d"
else
mkdir -m 755 "/sysroot/tmp/sysroot-rw/$d"
fi
fi
if [ ! -d "/sysroot/tmp/sysroot-rw/$d" ] ; then
continue
fi
if [ ! -z "$DIR" ] ; then
mount -o bind /sysroot/$DIR/$d /sysroot/tmp/sysroot-rw/$d
fi
mount -n -t aufs -o nowarn_perm,noatime,xino=/sysroot/tmp/xinos/$d.xino.aufs,dirs=/sysroot/tmp/sysroot-rw/$d=rw:/sysroot/$d=rr none /sysroot/$d
done
# cp -f /etc/halt /sysroot/etc/init.d/halt
# cp -f /etc/functions /sysroot/etc/init.d/functions
# mount -n -t aufs -o noatime,xino=/xinos/sysroot.xino.aufs,dirs=/sysroot-rw=rw:/sysroot=rr none /sysroot
fi # if [ ! -z "$data" ]

View File

@ -0,0 +1,23 @@
#!/bin/bash
# called by dracut
check() {
return 0
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
instmods aufs
}
# called by dracut
install() {
inst_multiple -o fsck.ext2 fsck.ext4 fsck.ext3
inst_hook pre-pivot 10 "$moddir/aufs-mount.sh"
}

View File

@ -0,0 +1,16 @@
# Description: Dracut için aufs modülünü kullanarak dizinlerin başlama esnasında bağlanmasını sağlar.
# URL: https://abf-doc.rosalinux.ru/din/dracut-aufs.git
# Packager: milisarge
# Depends on: dracut
name=dracut-aufs
version=1.0
release=1
source=(aufs-mount.sh
module-setup.sh)
build() {
install -d $PKG/usr/lib/dracut/modules.d/99aufs-mount
install -m 755 $SRC/aufs-mount.sh $PKG/usr/lib/dracut/modules.d/99aufs-mount/
install -m 755 $SRC/module-setup.sh $PKG/usr/lib/dracut/modules.d/99aufs-mount/
}