/usr/share/gfxboot/bin/adddir is in gfxboot-dev 4.5.2-1.1-5build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #! /bin/bash
#
# Symlink all files in a tree that are missing.
#
function read_dir {
local i
for i in `( cd "$1" && echo * )` ; do
[ -e "$1/$i" -o -L "$1/$i" ] && echo "$i"
done
}
function add_dir {
local src dst tmp i
src="$1"
dst="$2"
# echo "adddir $src $dst"
for i in `read_dir $src` ; do
if [ -d "$src/$i" -a ! -L "$src/$i" ]; then
# add directory
# echo " add dir $src/$i as $dst/$i"
if [ ! -d "$dst/$i" ] ; then
rm -f "$dst/$i"
mkdir "$dst/$i"
fi
if [ -L "$dst/$i" ] ; then
tmp=`mktemp -d "$dst/adddir.XXXXXX"` || exit 2
chown --dereference --reference "$dst/$i" "$tmp" 2>/dev/null
chmod --reference "$dst/$i" "$tmp"
add_dir "`readlink $dst/$i`" "$tmp"
rm -f "$dst/$i"
mv "$tmp" "$dst/$i"
fi
add_dir "$src/$i" "$dst/$i"
else
if [ ! -e "$dst/$i" ] ; then
# add non-directory
# echo " add file $src/$i as $dst/$i"
if [ -d "$dst/$i" -a ! -L "$dst/$i" ] ; then
rm -rf "$dst/$i"
else
rm -f "$dst/$i"
fi
if [ -f "$src/$i" -a ! -L "$src/$i" ] ; then
ln -s "`( cd $src ; pwd )`/$i" "$dst/$i"
else
cp -a "$src/$i" "$dst/$i"
fi
fi
fi
done
}
src="$1"
dst="$2"
if [ ! \( -d "$src" -a -d "$dst" \) ] ; then
echo "Usage: adddir src_dir dst_dir"
echo "Adds (symlinks) everything that is in src_dir to dst_dir."
echo "Note: spaces in filenames are evil."
exit 1
fi
add_dir "$src" "$dst"
|