Skip to content

Commit

Permalink
Merge remote-tracking branch 'tobi-github/beesh-crosscheck'
Browse files Browse the repository at this point in the history
* tobi-github/beesh-crosscheck:
  beesh: added function bee_crosscheck()
  • Loading branch information
mariux committed Mar 21, 2012
2 parents ec2346e + 0819525 commit 6c40ac5
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions src/beesh.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,68 @@ function bee_install() {
print_info "action 'install' not defined: skipping.."
}

#### bee_crosscheck() #########################################################

function bee_crosscheck() {

directories=( $(find ${D} -type d -printf "/%P\n") )
for d in ${directories[@]} ; do
if [ ! -e "${d}" -o -d "${d}" -a ! -L "${d}" ] ; then
# its ok
continue
fi
print_warning "WARNING: system and image files named '${d}' differ"
print_warning " image : $(file -b ${D}${d})"
print_warning " system: $(file -b ${d})"
done

links=( $(find ${D} -type l -printf "%p\n") )
for imagefilename in ${links[@]} ; do
target="$(readlink ${imagefilename})"

if [ "${target#${D}}" != "${target}" ] ; then
print_warning "WARNING: image: target of ${imagefilename#${D}} contains path to image directory"
imagetarget="${target}"
elif [ "${target:0:1}" = "/" ] ; then
imagetarget="${D}${target}"
else
imagetarget="${imagefilename%/*}/${target}"
fi

if [ ! -d "${imagetarget}" ] ; then
# dont care
continue
fi

systemfilename="${imagefilename#${D}}"

if [ ! -e "${systemfilename}" ] ; then
# its ok
continue
fi

if [ -L "${systemfilename}" ] ; then
target="$(readlink ${systemfilename})"

if [ "${target:0:1}" = "/" ] ; then
systemtarget=${target}
else
systemtarget="${systemfilename%/*}/${target}"
fi

if [ -d "${systemtarget}" -a "${imagetarget#${D}}" = "${systemtarget}" ] ; then
#its ok
continue
fi
fi

print_warning "WARNING: system and image files named '${systemfilename}' differ"
print_warning " image : $(file -b ${imagefilename})"
print_warning " system: $(file -b ${systemfilename})"

done
}

#### bee_pkg_pack() ###########################################################

# $EXCLUDE is read from .bee file
Expand Down Expand Up @@ -712,6 +774,8 @@ bee_run install
print_info "changing to image directory: ${D}"
cd ${D}

bee_crosscheck

bee_pkg_pack

cd ${BEEWORKDIR}
Expand Down

0 comments on commit 6c40ac5

Please sign in to comment.