1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/bin/bash
if [ -z "$1" ] ; then
echo "usage: $0 <directory>"
exit 1
fi
if [ -e "$1" ] ; then
echo "$1 already exists, remove it or use another directory name"
exit 1
fi
if ! dar -V > /dev/null ; then
echo "need dar to copy unix socket to the test tree"
exit 1
fi
mkdir "$1"
cd "$1"
# creating
mkdir "SUB"
dd if=/dev/zero of=plain_zeroed bs=1024 count=1024
dd if=/dev/urandom of=random bs=1024 count=1024
dd if=/dev/zero of=sparse_file bs=1 count=1 seek=10239999
ln -s random SUB/symlink-broken
ln -s ../random SUB/symlink-valid
mkfifo pipe
mknod null c 3 1
mknod fd1 b 2 1
dar -c - -R / -g dev/log -N -Q -q | dar -x - --sequential-read -N -q -Q
ln sparse_file SUB/hard_linked_sparse_file
ln dev/log SUB/hard_linked_socket
ln pipe SUB/hard_linked_pipe
# modifying dates and permissions
sleep 2
chown nobody random
chown -h bin SUB/symlink-valid
chgrp -h daemon SUB/symlink-valid
sleep 2
echo hello >> random
sleep 2
cat < random > /dev/null
# adding Extend Attributes, assuming the filesystem as user_xattr and acl option set
setfacl -m u:nobody:rwx plain_zeroed && setfattr -n "user.hello" -v "hello world!!!" plain_zeroed || (echo "FAILED TO CREATE EXTENDED ATTRIBUTES" && exit 1)
# adding filesystem specific attributes
chattr +dis plain_zeroed
|