|
|
08abde |
#!/bin/bash
|
|
|
08abde |
#
|
|
|
08abde |
# verify_doLinkCheck.sh -- This function receives a list of required
|
|
|
08abde |
# symbolic links and verifies them. This function enforces relation
|
|
|
08abde |
# between link names and their targets (previously defined in
|
|
|
08abde |
# verify_doLinks.sh function).
|
|
|
08abde |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
08abde |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
|
|
|
7cd8e9 |
|
|
|
7cd8e9 |
|
|
|
08abde |
#
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
# General Public License for more details.
|
|
|
08abde |
#
|
|
|
08abde |
|
|
|
08abde |
# along with this program; if not, write to the Free Software
|
|
|
08abde |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
08abde |
# USA.
|
|
|
08abde |
#
|
|
|
08abde |
# ----------------------------------------------------------------------
|
|
|
08abde |
# $Id$
|
|
|
08abde |
# ----------------------------------------------------------------------
|
|
|
08abde |
|
|
|
08abde |
function verify_doLinkCheck {
|
|
|
08abde |
|
|
|
08abde |
local -a LINKS_TARGET
|
|
|
08abde |
local LINKS_COUNT=0
|
|
|
08abde |
|
|
|
08abde |
until [[ $LINKS_COUNT -eq ${#LINKS[*]} ]];do
|
|
|
08abde |
|
|
|
08abde |
if [[ -h ${LINKS[$LINKS_COUNT]} ]]; then
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
LINKS_TARGET[$LINKS_COUNT]=$(stat --format='%N' ${LINKS[$LINKS_COUNT]} \
|
|
|
08abde |
| tr '`' ' ' | tr "'" ' ' | tr -s ' ' | cut -d' ' -f4)
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
if [[ ${LINKS_TARGET[$LINKS_COUNT]} != ${TARGETS[$LINKS_COUNT]} ]] ;then
|
|
|
08abde |
LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]}
|
|
|
08abde |
LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT"
|
|
|
08abde |
fi
|
|
|
08abde |
|
|
|
08abde |
else
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
LINKS_MISSING[$LINKS_COUNT]=${LINKS[$LINKS_COUNT]}
|
|
|
08abde |
LINKS_MISSING_ID="$LINKS_MISSING_ID $LINKS_COUNT"
|
|
|
08abde |
|
|
|
08abde |
fi
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
LINKS_COUNT=$(($LINKS_COUNT + 1))
|
|
|
08abde |
|
|
|
08abde |
done
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
LINKS_MISSING_ID=$(echo $LINKS_MISSING_ID | sed 's!^ +!!')
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
|
|
|
08abde |
if [[ ${#LINKS_MISSING[*]} -eq 0 ]];then
|
|
|
08abde |
cli_printMessage "`gettext "The required links are already installed."`"
|
|
|
08abde |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
08abde |
fi
|
|
|
08abde |
|
|
|
08abde |
}
|